Skip to content

Commit

Permalink
Merge pull request #110 from pknu-wap/feature/tgyuu/#106
Browse files Browse the repository at this point in the history
Feature/tgyuu/#106
  • Loading branch information
tgyuuAn authored Jan 21, 2024
2 parents 1ae9ef9 + 819859d commit 233a628
Show file tree
Hide file tree
Showing 78 changed files with 2,187 additions and 131 deletions.
3 changes: 1 addition & 2 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies {
implementation(project(":feature:survey"))
implementation(project(":feature:survey-check"))
implementation(project(":feature:profile"))
implementation(project(":feature:attendance"))
implementation(project(":feature:management"))
implementation(project(":feature:management-survey"))
implementation(project(":feature:management-event"))
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/wap/wapp/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import androidx.navigation.compose.rememberNavController
import com.wap.designsystem.WappTheme
import com.wap.wapp.component.WappBottomBar
import com.wap.wapp.core.domain.usecase.auth.SignInUseCase
import com.wap.wapp.feature.attendance.management.navigation.attendanceManagementNavigationRoute
import com.wap.wapp.feature.auth.signin.navigation.signInNavigationRoute
import com.wap.wapp.feature.auth.signup.navigation.signUpNavigationRoute
import com.wap.wapp.feature.management.event.navigation.eventRegistrationNavigationRoute
Expand Down Expand Up @@ -112,6 +113,7 @@ private fun handleBottomBarState(
signUpNavigationRoute -> setBottomBarState(false)
splashNavigationRoute -> setBottomBarState(false)
profileSettingNavigationRoute -> setBottomBarState(false)
attendanceManagementNavigationRoute -> setBottomBarState(false)
ManagementSurveyRoute.surveyFormRegistrationRoute -> setBottomBarState(false)
eventRegistrationNavigationRoute -> setBottomBarState(false)
else -> setBottomBarState(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import com.wap.wapp.R
import com.wap.wapp.core.designresource.R.string
import com.wap.wapp.feature.attendance.navigation.attendanceNavigationRoute
import com.wap.wapp.feature.management.navigation.managementNavigationRoute
import com.wap.wapp.feature.notice.navigation.noticeNavigationRoute
import com.wap.wapp.feature.profile.navigation.profileNavigationRoute
Expand All @@ -24,6 +25,11 @@ enum class TopLevelDestination(
iconDrawableId = R.drawable.ic_survey,
labelTextId = string.survey,
),
ATTENDANCE(
route = attendanceNavigationRoute,
iconDrawableId = com.wap.wapp.core.designresource.R.drawable.ic_check,
labelTextId = com.wap.wapp.feature.attendance.R.string.attendance,
),
PROFILE(
route = profileNavigationRoute,
iconDrawableId = R.drawable.ic_profile,
Expand Down
19 changes: 14 additions & 5 deletions app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import androidx.navigation.compose.NavHost
import androidx.navigation.navOptions
import com.wap.designsystem.WappTheme
import com.wap.wapp.core.domain.usecase.auth.SignInUseCase
import com.wap.wapp.feature.attendance.management.navigation.attendanceManagementScreen
import com.wap.wapp.feature.attendance.management.navigation.navigateToAttendanceManagement
import com.wap.wapp.feature.attendance.navigation.attendanceNavigationRoute
import com.wap.wapp.feature.attendance.navigation.attendanceScreen
import com.wap.wapp.feature.attendance.navigation.navigateToAttendance
import com.wap.wapp.feature.auth.signin.navigation.navigateToSignIn
import com.wap.wapp.feature.auth.signin.navigation.signInNavigationRoute
import com.wap.wapp.feature.auth.signin.navigation.signInScreen
Expand Down Expand Up @@ -94,14 +99,18 @@ fun WappNavHost(
)
profileScreen(
navigateToProfileSetting = navController::navigateToProfileSetting,
navigateToAttendance = navController::navigateToAttendance,
navigateToSignIn = {
navController.navigateToSignIn(
navOptions {
popUpTo(profileNavigationRoute)
},
)
navController.navigateToSignIn(navOptions { popUpTo(profileNavigationRoute) })
},
)
attendanceScreen(
navigateToSignIn = {
navController.navigateToSignIn(navOptions { popUpTo(attendanceNavigationRoute) })
},
navigateToAttendanceManagement = navController::navigateToAttendanceManagement,
)
attendanceManagementScreen(navigateToAttendance = navController::navigateToAttendance)
profileSettingScreen(
navigateToSignIn = {
navController.navigateToSignIn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ object DateUtil {
// 현재 날짜를 년-월-일 형식으로 반환해주는 포맷. ex 2023-11-20
val yyyyMMddFormatter = DateTimeFormatter.ofPattern("yyyy.MM.dd")

// 현재 날짜를 월-일 형식으로 반환해주는 포맷. ex 11월 20일
val MMddFormatter = DateTimeFormatter.ofPattern("MM월 dd일")

enum class DaysOfWeek(val displayName: String) {
SUNDAY(""),
MONDAY(""),
Expand Down
16 changes: 16 additions & 0 deletions core/data/src/main/java/com/wap/wapp/core/data/di/DataModule.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.wap.wapp.core.data.di

import com.wap.wapp.core.data.repository.attendance.AttendanceRepository
import com.wap.wapp.core.data.repository.attendance.AttendanceRepositoryImpl
import com.wap.wapp.core.data.repository.attendancestatus.AttendanceStatusRepository
import com.wap.wapp.core.data.repository.attendancestatus.AttendanceStatusRepositoryImpl
import com.wap.wapp.core.data.repository.auth.AuthRepository
import com.wap.wapp.core.data.repository.auth.AuthRepositoryImpl
import com.wap.wapp.core.data.repository.event.EventRepository
Expand Down Expand Up @@ -56,4 +60,16 @@ abstract class DataModule {
abstract fun bindsEventRepository(
eventRepositoryImpl: EventRepositoryImpl,
): EventRepository

@Binds
@Singleton
abstract fun bindsAttendanceRepository(
attendanceRepositoryImpl: AttendanceRepositoryImpl,
): AttendanceRepository

@Binds
@Singleton
abstract fun bindsAttendanceStatusRepository(
attendanceStatusRepositoryImpl: AttendanceStatusRepositoryImpl,
): AttendanceStatusRepository
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.wap.wapp.core.data.repository.attendance

import com.wap.wapp.core.model.attendance.Attendance
import java.time.LocalDateTime

interface AttendanceRepository {
suspend fun getAttendance(eventId: String): Result<Attendance>

suspend fun postAttendance(
eventId: String,
code: String,
deadline: LocalDateTime,
): Result<Unit>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.wap.wapp.core.data.repository.attendance

import com.wap.wapp.core.data.utils.toISOLocalDateTimeString
import com.wap.wapp.core.model.attendance.Attendance
import com.wap.wapp.core.network.source.attendance.AttendanceDataSource
import java.time.LocalDateTime
import javax.inject.Inject

class AttendanceRepositoryImpl @Inject constructor(
private val attendanceDataSource: AttendanceDataSource,
) : AttendanceRepository {
override suspend fun getAttendance(eventId: String): Result<Attendance> =
attendanceDataSource.getAttendance(eventId).mapCatching { attendanceResponse ->
attendanceResponse.toDomain()
}

override suspend fun postAttendance(
eventId: String,
code: String,
deadline: LocalDateTime,
): Result<Unit> =
attendanceDataSource.postAttendance(
eventId = eventId,
code = code,
deadline = deadline.toISOLocalDateTimeString(),
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.wap.wapp.core.data.repository.attendancestatus

import com.wap.wapp.core.model.attendancestatus.AttendanceStatus

interface AttendanceStatusRepository {
suspend fun getAttendanceStatus(eventId: String, userId: String): Result<AttendanceStatus>

suspend fun postAttendance(
eventId: String,
userId: String,
): Result<Unit>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.wap.wapp.core.data.repository.attendancestatus

import com.wap.wapp.core.model.attendancestatus.AttendanceStatus
import com.wap.wapp.core.network.source.attendancestatus.AttendanceStatusDataSource
import javax.inject.Inject

class AttendanceStatusRepositoryImpl @Inject constructor(
private val attendanceStatusDataSource: AttendanceStatusDataSource,
) : AttendanceStatusRepository {
override suspend fun getAttendanceStatus(
eventId: String,
userId: String,
): Result<AttendanceStatus> = attendanceStatusDataSource.getAttendanceStatus(
eventId = eventId,
userId = userId,
).mapCatching { it.toDomain() }

override suspend fun postAttendance(eventId: String, userId: String): Result<Unit> =
attendanceStatusDataSource.postAttendanceStatus(eventId = eventId, userId = userId)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="7dp"
android:height="14dp"
android:viewportWidth="10"
android:viewportHeight="20">
<path
android:pathData="M0,1.788L1.517,0L10,10L1.517,20L0,18.212L6.967,10L0,1.788Z"
android:fillColor="#FFFBCF34"/>
</vector>
5 changes: 5 additions & 0 deletions core/designsystem/src/main/java/com/wap/designsystem/Color.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ val YellowA4 = Color(0xFFFEEBA4)
val Yellow3C = Color(0xFFFFBD3C)
val Yellow34 = Color(0xFFFBCF34)

val GreenAB = Color(0xFF83F8AB)

val Red = Color(0xFFE7475D)

val Blue1FF = Color(0xFFEEF1FF)
Expand All @@ -47,6 +49,7 @@ class WappColor(
yellow34: Color = Color(0xFFFBCF34),
yellow3C: Color = Color(0xFFFFBD3C),
yellowA4: Color = Color(0xFFFEEBA4),
greenAB: Color = Color(0xFF83F8AB),
red: Color = Color(0xFFE7475D),
blueA3: Color = Color(0xFF2F3EA3),
blue2FF: Color = Color(0xFFB1B2FF),
Expand Down Expand Up @@ -85,6 +88,8 @@ class WappColor(
private set
var yellowA4 by mutableStateOf(yellowA4)
private set
var greenAB by mutableStateOf(greenAB)
private set
var red by mutableStateOf(red)
private set
var blueA3 by mutableStateOf(blueA3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import com.wap.designsystem.WappTheme
import com.wap.wapp.core.designsystem.R

@Composable
fun WappMainTopBar(
fun WappLeftMainTopBar(
@StringRes titleRes: Int,
@StringRes contentRes: Int,
showSettingButton: Boolean = false,
Expand Down Expand Up @@ -66,33 +66,108 @@ fun WappMainTopBar(
}
}

@Preview("without Button TopBar")
@Composable
fun WappMainTopBarWithoutButton() {
fun WappRightMainTopBar(
@StringRes titleRes: Int,
@StringRes contentRes: Int,
showBackButton: Boolean = false,
onClickBackButton: () -> Unit = {},
@StringRes settingButtonDescriptionRes: Int = R.string.back_button,
modifier: Modifier = Modifier,
) {
Column(
verticalArrangement = Arrangement.spacedBy(16.dp),
horizontalAlignment = Alignment.End,
modifier = modifier
.padding(top = 40.dp, start = 24.dp, end = 24.dp, bottom = 20.dp)
.fillMaxWidth()
.wrapContentHeight(),
) {
Box(modifier = Modifier.fillMaxWidth()) {
Text(
text = stringResource(id = titleRes),
color = WappTheme.colors.white,
style = WappTheme.typography.titleBold.copy(fontSize = 24.sp),
modifier = Modifier.align(Alignment.CenterEnd),
)

if (showBackButton) {
Image(
painter =
painterResource(id = R.drawable.ic_back),
contentDescription = stringResource(id = settingButtonDescriptionRes),
modifier = Modifier
.align(Alignment.CenterStart)
.clickable { onClickBackButton() },
)
}
}
Text(
text = stringResource(id = contentRes),
color = WappTheme.colors.white,
style = WappTheme.typography.contentRegular,
)
}
}

@Preview("without Button Left TopBar")
@Composable
fun WappLeftMainTopBarWithoutButton() {
WappTheme {
Surface(
color = WappTheme.colors.backgroundBlack,
) {
WappMainTopBar(
WappLeftMainTopBar(
titleRes = R.string.notice,
contentRes = R.string.notice,
)
}
}
}

@Preview("with Button TopBar")
@Preview("with Button Left TopBar")
@Composable
fun WappMainTopBarWithButton() {
fun WappLeftMainTopBarWithButton() {
WappTheme {
Surface(
color = WappTheme.colors.backgroundBlack,
) {
WappMainTopBar(
WappLeftMainTopBar(
titleRes = R.string.notice,
contentRes = R.string.notice,
showSettingButton = true,
)
}
}
}

@Preview("without Button Right TopBar")
@Composable
fun WappRightMainTopBarWithoutButton() {
WappTheme {
Surface(
color = WappTheme.colors.backgroundBlack,
) {
WappRightMainTopBar(
titleRes = R.string.notice,
contentRes = R.string.notice,
)
}
}
}

@Preview("with Button Right TopBar")
@Composable
fun WappRightMainTopBarWithButton() {
WappTheme {
Surface(
color = WappTheme.colors.backgroundBlack,
) {
WappRightMainTopBar(
titleRes = R.string.notice,
contentRes = R.string.notice,
showBackButton = true,
)
}
}
}
Loading

0 comments on commit 233a628

Please sign in to comment.