Skip to content

Commit

Permalink
Merge pull request #297 from team-haribo/develop
Browse files Browse the repository at this point in the history
🔀 :: (#297) - release 1.2.8
  • Loading branch information
diejdkll authored Jul 15, 2024
2 parents 960f45b + 533b9e1 commit 7d61c1c
Show file tree
Hide file tree
Showing 37 changed files with 249 additions and 108 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/com/goms/goms_android_v2/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class MainActivity : ComponentActivity() {
if (task.isSuccessful) {
val deviceTokenSF = getSharedPreferences(ResourceKeys.DEVICE_TOKEN, MODE_PRIVATE)
val deviceToken = task.result
if (deviceTokenSF.getString(ResourceKeys.DEVICE, "") == deviceToken) {
if (deviceTokenSF.getString(ResourceKeys.DEVICE, ResourceKeys.EMPTY) == deviceToken) {
viewModel.saveDeviceToken(deviceToken = deviceToken)
setNotification(deviceToken = deviceToken)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ class MainActivityViewModel @Inject constructor(
private val _saveDeviceTokenUiState = MutableStateFlow<Result<Unit>>(Result.Loading)
val saveDeviceTokenUiState = _saveDeviceTokenUiState.asStateFlow()

private val _themeState = MutableStateFlow("")
private val _themeState = MutableStateFlow(ResourceKeys.EMPTY)
val themeState = _themeState.asStateFlow()

private val _qrcodeState = MutableStateFlow("")
private val _qrcodeState = MutableStateFlow(ResourceKeys.EMPTY)
val qrcodeState = _qrcodeState.asStateFlow()

private val _alarmState = MutableStateFlow("")
private val _alarmState = MutableStateFlow(ResourceKeys.EMPTY)
val alarmState = _alarmState.asStateFlow()

fun saveDeviceToken(deviceToken: String) = viewModelScope.launch {
Expand All @@ -97,14 +97,14 @@ class MainActivityViewModel @Inject constructor(
}

fun getTheme() = viewModelScope.launch {
val themeValue = settingRepository.getThemeValue().first().replace("\"","")
val themeValue = settingRepository.getThemeValue().first()
_themeState.value = themeValue
}

fun getSettingInfo() = viewModelScope.launch {
val themeValue = settingRepository.getThemeValue().first().replace("\"","")
val qrcodeValue = settingRepository.getQrcodeValue().first().replace("\"","")
val alarmValue = settingRepository.getAlarmValue().first().replace("\"","")
val themeValue = settingRepository.getThemeValue().first()
val qrcodeValue = settingRepository.getQrcodeValue().first()
val alarmValue = settingRepository.getAlarmValue().first()
_themeState.value = themeValue
_qrcodeState.value = qrcodeValue
_alarmState.value = alarmValue
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.goms.goms_android_v2.navigation

import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.EnterTransition
import androidx.compose.animation.ExitTransition
import androidx.compose.animation.core.tween
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
Expand All @@ -26,6 +28,7 @@ import com.goms.login.navigation.loginScreen
import com.goms.login.navigation.navigateToInputLogin
import com.goms.main.navigation.adminMenuScreen
import com.goms.main.navigation.lateListScreen
import com.goms.main.navigation.mainRoute
import com.goms.main.navigation.mainScreen
import com.goms.main.navigation.navigateToAdminMenu
import com.goms.main.navigation.navigateToLateList
Expand All @@ -45,7 +48,6 @@ import com.goms.re_password.navigation.rePasswordScreen
import com.goms.setting.navigation.navigateToSettingScreen
import com.goms.setting.navigation.navigateToWithdrawalScreen
import com.goms.setting.navigation.settingScreen
import com.goms.setting.navigation.withdrawalRoute
import com.goms.setting.navigation.withdrawalScreen
import com.goms.sign_up.navigation.navigateToNumber
import com.goms.sign_up.navigation.navigateToPassword
Expand Down Expand Up @@ -87,10 +89,38 @@ fun GomsNavHost(
NavHost(
navController = navController,
startDestination = startDestination,
enterTransition = { EnterTransition.None },
exitTransition = { ExitTransition.None },
popEnterTransition = { EnterTransition.None },
popExitTransition = { ExitTransition.None },
enterTransition = {
if (targetState.destination.route != mainRoute) {
slideIntoContainer(
AnimatedContentTransitionScope.SlideDirection.Left,
animationSpec = tween(500)
)
} else {
EnterTransition.None
}
},
exitTransition = {
if (targetState.destination.route != mainRoute) {
slideOutOfContainer(
AnimatedContentTransitionScope.SlideDirection.Left,
animationSpec = tween(500)
)
} else {
ExitTransition.None
}
},
popEnterTransition = {
slideIntoContainer(
AnimatedContentTransitionScope.SlideDirection.Right,
animationSpec = tween(500)
)
},
popExitTransition = {
slideOutOfContainer(
AnimatedContentTransitionScope.SlideDirection.Right,
animationSpec = tween(500)
)
},
modifier = modifier
) {
loginScreen(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class AndroidApplicationConventionPlugin : Plugin<Project> {
applicationId = "com.goms.goms_android_v2"
minSdk = 26
targetSdk = 34
versionCode = 18
versionName = "1.2.7"
versionCode = 19
versionName = "1.2.8"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

vectorDrawables.useSupportLibrary = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.goms.datastore.datasource.auth

import androidx.datastore.core.DataStore
import com.goms.datastore.AuthToken
import com.goms.model.util.ResourceKeys
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import javax.inject.Inject
Expand All @@ -10,7 +11,7 @@ class AuthTokenDataSourceImpl @Inject constructor(
private val authToken: DataStore<AuthToken>
) : AuthTokenDataSource {
override fun getAccessToken(): Flow<String> = authToken.data.map {
it.accessToken ?: ""
it.accessToken ?: ResourceKeys.EMPTY
}

override suspend fun setAccessToken(accessToken: String) {
Expand All @@ -30,7 +31,7 @@ class AuthTokenDataSourceImpl @Inject constructor(
}

override fun getAccessTokenExp(): Flow<String> = authToken.data.map {
it.accessExp ?: ""
it.accessExp ?: ResourceKeys.EMPTY
}

override suspend fun setAccessTokenExp(accessTokenExp: String) {
Expand All @@ -50,7 +51,7 @@ class AuthTokenDataSourceImpl @Inject constructor(
}

override fun getRefreshToken(): Flow<String> = authToken.data.map {
it.refreshToken ?: ""
it.refreshToken ?: ResourceKeys.EMPTY
}

override suspend fun setRefreshToken(refreshToken: String) {
Expand All @@ -70,7 +71,7 @@ class AuthTokenDataSourceImpl @Inject constructor(
}

override fun getRefreshTokenExp(): Flow<String> = authToken.data.map {
it.refreshExp ?: ""
it.refreshExp ?: ResourceKeys.EMPTY
}

override suspend fun setRefreshTokenExp(refreshTokenExp: String) {
Expand All @@ -90,7 +91,7 @@ class AuthTokenDataSourceImpl @Inject constructor(
}

override fun getAuthority(): Flow<String> = authToken.data.map {
it.authority ?: ""
it.authority ?: ResourceKeys.EMPTY
}

override suspend fun setAuthority(authority: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ data class ListData(
val list: PersistentList<PersistentList<String>>
)

const val EMPTY = ""

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun MultipleSelectorBottomSheet(
Expand Down Expand Up @@ -117,7 +119,7 @@ fun MultipleSelectorBottomSheet(
modifier = Modifier.fillMaxWidth(),
text = stringResource(id = R.string.initialize_filter)
) {
bottomSheetSelectedItems.indices.forEach { bottomSheetSelectedItems[it] = "" }
bottomSheetSelectedItems.indices.forEach { bottomSheetSelectedItems[it] = EMPTY }
initClick()
}
}
Expand Down Expand Up @@ -155,7 +157,7 @@ fun MultipleSelectorBottomSheetItem(
selected = selectedItem == data
) {
if (selectedItem == data) {
itemChange("")
itemChange(EMPTY)
} else {
itemChange(data)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,24 @@ fun GomsSwitchButton(
onCheckedChanged: (checked: Boolean) -> Unit
) {
var clickListener by remember { mutableStateOf(false) }
var isActivation by remember { mutableStateOf(false) }

val swipeableState =
rememberSwipeableState(initialValue = initialValue, confirmStateChange = { true })

val sizePx = with(LocalDensity.current) { (width - height).toPx() }
val anchors = mapOf(0f to stateOff, sizePx to stateOn) // Maps anchor points (in px) to states
val anchors = mapOf(0f to stateOff, sizePx to stateOn)
val scope = rememberCoroutineScope()

LaunchedEffect("init") {
if(initialValue == stateOn) {
clickListener = true
isActivation = true
}
}

LaunchedEffect(clickListener) {
if (clickListener) onCheckedChanged(true) else onCheckedChanged(false)
LaunchedEffect(isActivation) {
if (isActivation) onCheckedChanged(true) else onCheckedChanged(false)
}

Box(
Expand All @@ -95,9 +97,11 @@ fun GomsSwitchButton(
.clip(RoundedCornerShape(height))
.background(
if (swipeableState.currentValue == stateOff) {
if (clickListener) switchOnBackground else switchOffBackground
isActivation = false
switchOffBackground
} else {
if (clickListener) switchOnBackground else switchOffBackground
isActivation = true
switchOnBackground
}
),
verticalAlignment = Alignment.CenterVertically,
Expand Down Expand Up @@ -146,4 +150,4 @@ private fun GomsSwitchButtonPreview() {
) {}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ import com.goms.design_system.theme.GomsTheme.typography
import com.goms.design_system.theme.ThemeType
import kotlinx.coroutines.delay

const val EMPTY = ""

@Composable
fun GomsTextField(
modifier: Modifier = Modifier,
isError: Boolean = false,
isEmail: Boolean = true,
placeHolder: String = "",
placeHolder: String = EMPTY,
readOnly: Boolean = false,
focusManager: FocusManager = LocalFocusManager.current,
focusRequester: FocusRequester = FocusRequester(),
Expand Down Expand Up @@ -143,11 +145,11 @@ fun GomsTextField(
fun NumberTextField(
modifier: Modifier = Modifier,
setText: String,
placeHolder: String = "",
placeHolder: String = EMPTY,
focusManager: FocusManager = LocalFocusManager.current,
focusRequester: FocusRequester = FocusRequester(),
isError: Boolean,
errorText: String = "",
errorText: String = EMPTY,
maxLength: Int = 4,
onValueChange: (String) -> Unit,
onResendClick: () -> Unit,
Expand Down Expand Up @@ -200,7 +202,7 @@ fun NumberTextField(
.onFocusChanged {
isFocused.value = it.isFocused
if (it.isFocused) {
onValueChange("")
onValueChange(EMPTY)
}
},
maxLines = 1,
Expand All @@ -226,7 +228,7 @@ fun NumberTextField(
},
onTimerReset = {
isErrorTextField.value = false
errorTextTextField.value = ""
errorTextTextField.value = EMPTY
onResendClick()
}
)
Expand All @@ -237,7 +239,7 @@ fun GomsPasswordTextField(
modifier: Modifier = Modifier,
isDescription: Boolean = false,
isError: Boolean = false,
placeHolder: String = "",
placeHolder: String = EMPTY,
readOnly: Boolean = false,
focusManager: FocusManager = LocalFocusManager.current,
focusRequester: FocusRequester = FocusRequester(),
Expand Down Expand Up @@ -327,7 +329,7 @@ fun GomsPasswordTextField(
fun GomsSearchTextField(
modifier: Modifier = Modifier,
debounceTime: Long = 300L,
placeHolder: String = "",
placeHolder: String = EMPTY,
readOnly: Boolean = false,
focusManager: FocusManager = LocalFocusManager.current,
focusRequester: FocusRequester = FocusRequester(),
Expand Down Expand Up @@ -410,43 +412,43 @@ private fun GomsTextFieldPreview() {
placeHolder = "GOMS",
isError = false,
onValueChange = {},
setText = ""
setText = EMPTY
)
GomsTextField(
modifier = Modifier.fillMaxWidth(),
placeHolder = "GOMS",
isError = true,
onValueChange = {},
setText = ""
setText = EMPTY
)
NumberTextField(
modifier = Modifier.fillMaxWidth(),
placeHolder = "GOMS",
isError = false,
onValueChange = {},
setText = ""
setText = EMPTY
) {}
NumberTextField(
modifier = Modifier.fillMaxWidth(),
placeHolder = "GOMS",
isError = true,
errorText = "Error",
onValueChange = {},
setText = ""
setText = EMPTY
) {}
GomsPasswordTextField(
modifier = Modifier.fillMaxWidth(),
isDescription = true,
placeHolder = "GOMS",
isError = false,
onValueChange = {},
setText = ""
setText = EMPTY
)
GomsSearchTextField(
modifier = Modifier.fillMaxWidth(),
placeHolder = "GOMS",
onValueChange = {},
setText = ""
setText = EMPTY
) {}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.goms.design_system.util

import kotlinx.datetime.LocalDate
import java.time.format.TextStyle
import java.util.Locale

fun LocalDate.formatDate(): String {
val year = this.year
val month = this.monthNumber
val day = this.dayOfMonth

val dayOfWeek = this.dayOfWeek.getDisplayName(TextStyle.SHORT, Locale.KOREAN)

return "${year}${month}${day}일 ($dayOfWeek)"
}
6 changes: 6 additions & 0 deletions core/model/src/main/java/com/goms/model/enum/EmailStatus.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.goms.model.enum

enum class EmailStatus {
BEFORE_SIGNUP,
AFTER_SIGNUP
}
Loading

0 comments on commit 7d61c1c

Please sign in to comment.