From 2f140cf2748e5acea10571031ac56409dce81f29 Mon Sep 17 00:00:00 2001 From: chanu Date: Mon, 7 Oct 2024 19:00:46 +0900 Subject: [PATCH 01/18] =?UTF-8?q?#91=20[mod]=20:=20compose=20=EB=B2=84?= =?UTF-8?q?=EC=A0=84=20=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle/libs.versions.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1b55ae81..22cf5ef1 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -60,15 +60,15 @@ processPhoenix = "3.0.0" ## Compose # https://developer.android.com/develop/ui/compose/bom/bom-mapping -androidxComposeBom = "2024.05.00" +androidxComposeBom = "2024.09.03" # https://developer.android.com/jetpack/androidx/releases/compose-kotlin androidxComposeCompiler = "1.5.14" # https://developer.android.com/jetpack/androidx/releases/navigation -androidxComposeNavigation = "2.8.0-alpha08" +androidxComposeNavigation = "2.8.2" # https://developer.android.com/jetpack/androidx/releases/compose-material3 -androidxComposeMaterial3 = "1.3.0-rc01" +androidxComposeMaterial3 = "1.3.0" # # https://developer.android.com/jetpack/androidx/releases/test -androidxTestExt = "1.1.5" +androidxTestExt = "1.2.1" hiltNavigationComposeVersion = "1.2.0" firebaseMessagingKtx = "24.0.1" From 3301e46e70052f78d54b4ac37ac03b487e7bdb2f Mon Sep 17 00:00:00 2001 From: chanu Date: Mon, 7 Oct 2024 19:02:22 +0900 Subject: [PATCH 02/18] #91 [add] : add compose navigation, model dependency in navigation module --- core/navigation/build.gradle.kts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/navigation/build.gradle.kts b/core/navigation/build.gradle.kts index 165a792b..61827d87 100644 --- a/core/navigation/build.gradle.kts +++ b/core/navigation/build.gradle.kts @@ -8,4 +8,6 @@ android { } dependencies { + implementation(project(":core:model")) + implementation(libs.androidx.compose.navigation) } From 5868d3b33fa7e306256f20d061949cd2d8b73583 Mon Sep 17 00:00:00 2001 From: chanu Date: Mon, 7 Oct 2024 19:02:36 +0900 Subject: [PATCH 03/18] #91 [add] : add serialization dependency in model module --- core/model/build.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/core/model/build.gradle.kts b/core/model/build.gradle.kts index 788e6ed6..8ea2cd59 100644 --- a/core/model/build.gradle.kts +++ b/core/model/build.gradle.kts @@ -2,6 +2,7 @@ plugins { id("com.android.library") id("com.teamwable.wable.kotlin") + id("com.teamwable.wable.serialization") } android { namespace = "com.teamwable.model" From c93e2b803f579ca8cfbb2f4b12d1515260702ebc Mon Sep 17 00:00:00 2001 From: chanu Date: Mon, 7 Oct 2024 19:13:40 +0900 Subject: [PATCH 04/18] #91 [feat]: Add CustomNavType to support generic types --- .../com/teamwable/navigation/CustomNavType.kt | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 core/navigation/src/main/java/com/teamwable/navigation/CustomNavType.kt diff --git a/core/navigation/src/main/java/com/teamwable/navigation/CustomNavType.kt b/core/navigation/src/main/java/com/teamwable/navigation/CustomNavType.kt new file mode 100644 index 00000000..4d75b9b6 --- /dev/null +++ b/core/navigation/src/main/java/com/teamwable/navigation/CustomNavType.kt @@ -0,0 +1,30 @@ +package com.teamwable.navigation + +import android.net.Uri +import android.os.Bundle +import androidx.navigation.NavType +import kotlinx.serialization.json.Json +import kotlinx.serialization.serializer + +object CustomNavType { + inline fun createNavType(): NavType = object : NavType( + isNullableAllowed = false, + ) { + override fun get(bundle: Bundle, key: String): T? { + val jsonString = bundle.getString(key) ?: return null + return Json.decodeFromString(serializer(), jsonString) + } + + override fun parseValue(value: String): T { + return Json.decodeFromString(serializer(), Uri.decode(value)) + } + + override fun serializeAsValue(value: T): String { + return Uri.encode(Json.encodeToString(serializer(), value)) + } + + override fun put(bundle: Bundle, key: String, value: T) { + bundle.putString(key, Json.encodeToString(serializer(), value)) + } + } +} From b1dd503ff9b4304926390a703f57124b3ba46ee0 Mon Sep 17 00:00:00 2001 From: chanu Date: Tue, 8 Oct 2024 00:13:10 +0900 Subject: [PATCH 05/18] #91 [delete]: delete unused enum type --- .../com/teamwable/designsystem/type/MemberInfoType.kt | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 core/designsystem/src/main/java/com/teamwable/designsystem/type/MemberInfoType.kt diff --git a/core/designsystem/src/main/java/com/teamwable/designsystem/type/MemberInfoType.kt b/core/designsystem/src/main/java/com/teamwable/designsystem/type/MemberInfoType.kt deleted file mode 100644 index 45be48ae..00000000 --- a/core/designsystem/src/main/java/com/teamwable/designsystem/type/MemberInfoType.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.teamwable.designsystem.type - -enum class MemberInfoType { - MEMBER_LCK_YEAR, - MEMBER_FAN_TEAM, - MEMBER_NICKNAME, - MEMBER_DEFAULT_PROFILE_IMAGE, - MEMBER_PROFILE_URL, - IS_ALARM_ALLOWED, -} From 57ee63078a0e042404e6abcde25337fdf122c796 Mon Sep 17 00:00:00 2001 From: chanu Date: Tue, 8 Oct 2024 00:22:54 +0900 Subject: [PATCH 06/18] #91 [mod]: change route parameter type list to custom data class --- .../src/main/java/com/teamwable/navigation/Route.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/navigation/src/main/java/com/teamwable/navigation/Route.kt b/core/navigation/src/main/java/com/teamwable/navigation/Route.kt index 03b400d4..4f9eb778 100644 --- a/core/navigation/src/main/java/com/teamwable/navigation/Route.kt +++ b/core/navigation/src/main/java/com/teamwable/navigation/Route.kt @@ -1,5 +1,6 @@ package com.teamwable.navigation +import com.teamwable.model.profile.MemberInfoEditModel import kotlinx.serialization.Serializable sealed interface Route { @@ -13,11 +14,11 @@ sealed interface Route { data object FirstLckWatch : Route @Serializable - data class SelectLckTeam(val userList: List) : Route + data class SelectLckTeam(val memberInfoEditModel: MemberInfoEditModel) : Route @Serializable - data class Profile(val userList: List) : Route + data class Profile(val memberInfoEditModel: MemberInfoEditModel) : Route @Serializable - data class AgreeTerms(val userList: List) : Route + data class AgreeTerms(val memberInfoEditModel: MemberInfoEditModel, val profileUri: String?) : Route } From 3ed71e343906126ff03f232788515fae3a7d0079 Mon Sep 17 00:00:00 2001 From: chanu Date: Tue, 8 Oct 2024 00:27:59 +0900 Subject: [PATCH 07/18] #91 [refactor] : Change lambda parameters List to data class --- .../com/teamwable/main_compose/MainNavigator.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/feature/main-compose/src/main/java/com/teamwable/main_compose/MainNavigator.kt b/feature/main-compose/src/main/java/com/teamwable/main_compose/MainNavigator.kt index c2f16c08..760b581d 100644 --- a/feature/main-compose/src/main/java/com/teamwable/main_compose/MainNavigator.kt +++ b/feature/main-compose/src/main/java/com/teamwable/main_compose/MainNavigator.kt @@ -10,6 +10,7 @@ import androidx.navigation.compose.currentBackStackEntryAsState import androidx.navigation.compose.rememberNavController import androidx.navigation.navOptions import com.teamwable.auth.naviagation.navigateLogin +import com.teamwable.model.profile.MemberInfoEditModel import com.teamwable.navigation.Route import com.teamwable.onboarding.agreeterms.naviagation.navigateToAgreeTerms import com.teamwable.onboarding.firstlckwatch.naviagation.navigateToFirstLckWatch @@ -33,16 +34,16 @@ class MainNavigator( navController.navigateToFirstLckWatch() } - fun navigateToSelectLckTeam(userList: List) { - navController.navigateToSelectLckTeam(userList) + fun navigateToSelectLckTeam(memberInfoEditModel: MemberInfoEditModel) { + navController.navigateToSelectLckTeam(memberInfoEditModel) } - fun navigateToProfile(userList: List) { - navController.navigateToProfile(userList) + fun navigateToProfile(memberInfoEditModel: MemberInfoEditModel) { + navController.navigateToProfile(memberInfoEditModel) } - fun navigateToAgreeTerms(userList: List) { - navController.navigateToAgreeTerms(userList) + fun navigateToAgreeTerms(memberInfoEditModel: MemberInfoEditModel, profileUri: String?) { + navController.navigateToAgreeTerms(memberInfoEditModel, profileUri) } private fun popBackStack() { From 9a03b9fbdec92f0aaa7c1f7409fb3bf548c3613c Mon Sep 17 00:00:00 2001 From: chanu Date: Tue, 8 Oct 2024 00:28:39 +0900 Subject: [PATCH 08/18] #91 [refactor] : Refactor navigation lambdas to method reference --- .../src/main/java/com/teamwable/main_compose/MainScreen.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/feature/main-compose/src/main/java/com/teamwable/main_compose/MainScreen.kt b/feature/main-compose/src/main/java/com/teamwable/main_compose/MainScreen.kt index 490a7a0e..0f6c568d 100644 --- a/feature/main-compose/src/main/java/com/teamwable/main_compose/MainScreen.kt +++ b/feature/main-compose/src/main/java/com/teamwable/main_compose/MainScreen.kt @@ -91,15 +91,15 @@ internal fun MainScreen( onShowErrorSnackBar = onShowErrorSnackBar, ) firstLckWatchNavGraph( - navigateToSelectLckTeam = { userList -> navigator.navigateToSelectLckTeam(userList) }, + navigateToSelectLckTeam = navigator::navigateToSelectLckTeam, onShowErrorSnackBar = onShowErrorSnackBar, ) selectLckTeamNavGraph( - navigateToProfile = { userList -> navigator.navigateToProfile(userList) }, + navigateToProfile = navigator::navigateToProfile, onShowErrorSnackBar = onShowErrorSnackBar, ) profileNavGraph( - navigateToAgreeTerms = { userList -> navigator.navigateToAgreeTerms(userList) }, + navigateToAgreeTerms = navigator::navigateToAgreeTerms, onShowErrorSnackBar = onShowErrorSnackBar, ) agreeTermsNavGraph( From 01b923bd4aee3d82cc3fa8998465ed99b0090b43 Mon Sep 17 00:00:00 2001 From: chanu Date: Tue, 8 Oct 2024 00:29:29 +0900 Subject: [PATCH 09/18] #91 [add] : Add @Serializable annotation in MemberInfoEditModel --- .../java/com/teamwable/model/profile/MemberInfoEditModel.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/model/src/main/java/com/teamwable/model/profile/MemberInfoEditModel.kt b/core/model/src/main/java/com/teamwable/model/profile/MemberInfoEditModel.kt index 3a299be3..c985febe 100644 --- a/core/model/src/main/java/com/teamwable/model/profile/MemberInfoEditModel.kt +++ b/core/model/src/main/java/com/teamwable/model/profile/MemberInfoEditModel.kt @@ -2,7 +2,9 @@ package com.teamwable.model.profile import android.os.Parcelable import kotlinx.parcelize.Parcelize +import kotlinx.serialization.Serializable +@Serializable @Parcelize data class MemberInfoEditModel( val nickname: String? = null, From 2bf8eff109646ac80d9182fc0f8976dfaeaf15e9 Mon Sep 17 00:00:00 2001 From: chanu Date: Tue, 8 Oct 2024 00:34:54 +0900 Subject: [PATCH 10/18] #91 [mod] : use custom nav type and change navcontroller parameter to custom data class --- .../naviagation/AgreeTermsNavigation.kt | 16 +++++++++++++--- .../naviagation/FirstLckWatchNavigation.kt | 3 ++- .../profile/naviagation/ProfileNavigation.kt | 15 +++++++++++---- .../naviagation/SelectLckTeamNavigation.kt | 15 +++++++++++---- 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/feature/onboarding/src/main/java/com/teamwable/onboarding/agreeterms/naviagation/AgreeTermsNavigation.kt b/feature/onboarding/src/main/java/com/teamwable/onboarding/agreeterms/naviagation/AgreeTermsNavigation.kt index 14a4d517..8bb88a41 100644 --- a/feature/onboarding/src/main/java/com/teamwable/onboarding/agreeterms/naviagation/AgreeTermsNavigation.kt +++ b/feature/onboarding/src/main/java/com/teamwable/onboarding/agreeterms/naviagation/AgreeTermsNavigation.kt @@ -4,18 +4,28 @@ import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable import androidx.navigation.toRoute +import com.teamwable.model.profile.MemberInfoEditModel +import com.teamwable.navigation.CustomNavType import com.teamwable.navigation.Route import com.teamwable.onboarding.agreeterms.AgreeTermsRoute +import kotlin.reflect.typeOf -fun NavController.navigateToAgreeTerms(userList: List) { - this.navigate(Route.AgreeTerms(userList)) +fun NavController.navigateToAgreeTerms( + memberInfoEditModel: MemberInfoEditModel, + profileUri: String?, +) { + this.navigate(Route.AgreeTerms(memberInfoEditModel, profileUri)) } fun NavGraphBuilder.agreeTermsNavGraph( navigateToHome: () -> Unit, onShowErrorSnackBar: (throwable: Throwable?) -> Unit, ) { - composable { backStackEntry -> + composable( + typeMap = mapOf( + typeOf() to CustomNavType.createNavType(), + ), + ) { backStackEntry -> val args = backStackEntry.toRoute() AgreeTermsRoute( navigateToHome = navigateToHome, diff --git a/feature/onboarding/src/main/java/com/teamwable/onboarding/firstlckwatch/naviagation/FirstLckWatchNavigation.kt b/feature/onboarding/src/main/java/com/teamwable/onboarding/firstlckwatch/naviagation/FirstLckWatchNavigation.kt index 68e754bf..42893717 100644 --- a/feature/onboarding/src/main/java/com/teamwable/onboarding/firstlckwatch/naviagation/FirstLckWatchNavigation.kt +++ b/feature/onboarding/src/main/java/com/teamwable/onboarding/firstlckwatch/naviagation/FirstLckWatchNavigation.kt @@ -3,6 +3,7 @@ package com.teamwable.onboarding.firstlckwatch.naviagation import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable +import com.teamwable.model.profile.MemberInfoEditModel import com.teamwable.navigation.Route import com.teamwable.onboarding.firstlckwatch.FirstLckWatchRoute @@ -11,7 +12,7 @@ fun NavController.navigateToFirstLckWatch() { } fun NavGraphBuilder.firstLckWatchNavGraph( - navigateToSelectLckTeam: (userList: List) -> Unit, + navigateToSelectLckTeam: (memberInfo: MemberInfoEditModel) -> Unit, onShowErrorSnackBar: (throwable: Throwable?) -> Unit, ) { composable { diff --git a/feature/onboarding/src/main/java/com/teamwable/onboarding/profile/naviagation/ProfileNavigation.kt b/feature/onboarding/src/main/java/com/teamwable/onboarding/profile/naviagation/ProfileNavigation.kt index d7ea5284..95c382b0 100644 --- a/feature/onboarding/src/main/java/com/teamwable/onboarding/profile/naviagation/ProfileNavigation.kt +++ b/feature/onboarding/src/main/java/com/teamwable/onboarding/profile/naviagation/ProfileNavigation.kt @@ -4,18 +4,25 @@ import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable import androidx.navigation.toRoute +import com.teamwable.model.profile.MemberInfoEditModel +import com.teamwable.navigation.CustomNavType import com.teamwable.navigation.Route import com.teamwable.onboarding.profile.ProfileRoute +import kotlin.reflect.typeOf -fun NavController.navigateToProfile(userList: List) { - this.navigate(Route.Profile(userList)) +fun NavController.navigateToProfile(memberInfoEditModel: MemberInfoEditModel) { + this.navigate(Route.Profile(memberInfoEditModel)) } fun NavGraphBuilder.profileNavGraph( - navigateToAgreeTerms: (List) -> Unit, + navigateToAgreeTerms: (MemberInfoEditModel, String?) -> Unit, onShowErrorSnackBar: (throwable: Throwable?) -> Unit, ) { - composable { backStackEntry -> + composable( + typeMap = mapOf( + typeOf() to CustomNavType.createNavType(), + ), + ) { backStackEntry -> val args = backStackEntry.toRoute() ProfileRoute( navigateToAgreeTerms = navigateToAgreeTerms, diff --git a/feature/onboarding/src/main/java/com/teamwable/onboarding/selectlckteam/naviagation/SelectLckTeamNavigation.kt b/feature/onboarding/src/main/java/com/teamwable/onboarding/selectlckteam/naviagation/SelectLckTeamNavigation.kt index 1d499452..e3838944 100644 --- a/feature/onboarding/src/main/java/com/teamwable/onboarding/selectlckteam/naviagation/SelectLckTeamNavigation.kt +++ b/feature/onboarding/src/main/java/com/teamwable/onboarding/selectlckteam/naviagation/SelectLckTeamNavigation.kt @@ -4,18 +4,25 @@ import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable import androidx.navigation.toRoute +import com.teamwable.model.profile.MemberInfoEditModel +import com.teamwable.navigation.CustomNavType import com.teamwable.navigation.Route import com.teamwable.onboarding.selectlckteam.SelectLckTeamRoute +import kotlin.reflect.typeOf -fun NavController.navigateToSelectLckTeam(userList: List) { - this.navigate(Route.SelectLckTeam(userList)) +fun NavController.navigateToSelectLckTeam(memberInfoEdit: MemberInfoEditModel) { + this.navigate(Route.SelectLckTeam(memberInfoEdit)) } fun NavGraphBuilder.selectLckTeamNavGraph( - navigateToProfile: (List) -> Unit, + navigateToProfile: (MemberInfoEditModel) -> Unit, onShowErrorSnackBar: (throwable: Throwable?) -> Unit, ) { - composable { backStackEntry -> + composable( + typeMap = mapOf( + typeOf() to CustomNavType.createNavType(), + ), + ) { backStackEntry -> val args = backStackEntry.toRoute() SelectLckTeamRoute( navigateToProfile = navigateToProfile, From de23cc2f71f5c5a29972db1b09521cb2a7ca0697 Mon Sep 17 00:00:00 2001 From: chanu Date: Tue, 8 Oct 2024 00:56:48 +0900 Subject: [PATCH 11/18] =?UTF-8?q?#91=20[mod]=20:=20nav=20args=20=EA=B0=92?= =?UTF-8?q?=20MemberInfoEditModel=20=EA=B0=9D=EC=B2=B4=EB=A1=9C=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=B2=98=EB=A6=AC=20=ED=86=B5?= =?UTF-8?q?=EC=9D=BC=20=EB=B0=8F=20=EC=83=81=ED=83=9C=20=EA=B4=80=EB=A6=AC?= =?UTF-8?q?=20=EA=B0=84=EC=86=8C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../onboarding/agreeterms/AgreeTermsScreen.kt | 16 +++++----------- .../firstlckwatch/FirstLckWatchScreen.kt | 19 +++++++------------ .../onboarding/profile/ProfileScreen.kt | 17 ++++++++--------- .../selectlckteam/SelectLckTeamScreen.kt | 12 +++++------- 4 files changed, 25 insertions(+), 39 deletions(-) diff --git a/feature/onboarding/src/main/java/com/teamwable/onboarding/agreeterms/AgreeTermsScreen.kt b/feature/onboarding/src/main/java/com/teamwable/onboarding/agreeterms/AgreeTermsScreen.kt index 9a53dc35..fbe1a76b 100644 --- a/feature/onboarding/src/main/java/com/teamwable/onboarding/agreeterms/AgreeTermsScreen.kt +++ b/feature/onboarding/src/main/java/com/teamwable/onboarding/agreeterms/AgreeTermsScreen.kt @@ -30,13 +30,10 @@ import com.teamwable.designsystem.component.checkbox.WableCheckBoxWithText import com.teamwable.designsystem.component.dialog.WableButtonDialog import com.teamwable.designsystem.theme.WableTheme import com.teamwable.designsystem.type.DialogType -import com.teamwable.designsystem.type.MemberInfoType -import com.teamwable.model.profile.MemberInfoEditModel import com.teamwable.navigation.Route import com.teamwable.onboarding.R import com.teamwable.onboarding.agreeterms.model.AgreeTerm import com.teamwable.onboarding.agreeterms.model.AgreeTermsSideEffect -import kotlinx.collections.immutable.toPersistentList @Composable fun AgreeTermsRoute( @@ -48,7 +45,7 @@ fun AgreeTermsRoute( val lifecycleOwner = LocalLifecycleOwner.current val showDialog by viewModel.showDialog.collectAsStateWithLifecycle() - val userInfo = args.userList.toPersistentList() + val memberInfoEditModel = args.memberInfoEditModel LaunchedEffect(lifecycleOwner) { viewModel.sideEffect.flowWithLifecycle(lifecycleOwner.lifecycle) @@ -64,14 +61,11 @@ fun AgreeTermsRoute( AgreeTermsScreen( onNextBtnClick = { marketingConsent -> viewModel.patchUserProfile( - memberInfoEditModel = MemberInfoEditModel( - nickname = userInfo[MemberInfoType.MEMBER_NICKNAME.ordinal], + memberInfoEditModel = memberInfoEditModel.copy( isAlarmAllowed = marketingConsent, - memberLckYears = userInfo[MemberInfoType.MEMBER_LCK_YEAR.ordinal].toInt(), - memberFanTeam = userInfo[MemberInfoType.MEMBER_FAN_TEAM.ordinal], - memberDefaultProfileImage = userInfo[MemberInfoType.MEMBER_DEFAULT_PROFILE_IMAGE.ordinal].takeIf { it.isNotEmpty() }, + memberDefaultProfileImage = memberInfoEditModel.memberDefaultProfileImage.takeIf { !it.isNullOrEmpty() }, ), - imgUrl = userInfo[MemberInfoType.MEMBER_PROFILE_URL.ordinal].takeIf { it.isNotEmpty() }, + imgUrl = args.profileUri.takeIf { !it.isNullOrEmpty() }, ) trackEvent(CLICK_COMPLETE_TNC_SIGNUP) }, @@ -79,7 +73,7 @@ fun AgreeTermsRoute( if (showDialog) { WableButtonDialog( - userName = userInfo[MemberInfoType.MEMBER_NICKNAME.ordinal], + userName = memberInfoEditModel.nickname.orEmpty(), dialogType = DialogType.WELLCOME, onClick = { viewModel.navigateToHome() diff --git a/feature/onboarding/src/main/java/com/teamwable/onboarding/firstlckwatch/FirstLckWatchScreen.kt b/feature/onboarding/src/main/java/com/teamwable/onboarding/firstlckwatch/FirstLckWatchScreen.kt index 249f5950..3e86368c 100644 --- a/feature/onboarding/src/main/java/com/teamwable/onboarding/firstlckwatch/FirstLckWatchScreen.kt +++ b/feature/onboarding/src/main/java/com/teamwable/onboarding/firstlckwatch/FirstLckWatchScreen.kt @@ -30,7 +30,7 @@ import com.teamwable.common.util.AmplitudeUtil.trackEvent import com.teamwable.designsystem.component.button.WableButton import com.teamwable.designsystem.extension.system.SetStatusBarColor import com.teamwable.designsystem.theme.WableTheme -import com.teamwable.designsystem.type.MemberInfoType +import com.teamwable.model.profile.MemberInfoEditModel import com.teamwable.onboarding.R import com.teamwable.onboarding.firstlckwatch.component.WableExposedDropdownBox import com.teamwable.onboarding.firstlckwatch.model.FirstLckWatchSideEffect @@ -39,20 +39,17 @@ import kotlinx.collections.immutable.toPersistentList @Composable fun FirstLckWatchRoute( viewModel: FirstLckWatchViewModel = hiltViewModel(), - navigateToSelectLckTeam: (List) -> Unit, + navigateToSelectLckTeam: (MemberInfoEditModel) -> Unit, onShowErrorSnackBar: (throwable: Throwable?) -> Unit, ) { val lifecycleOwner = LocalLifecycleOwner.current - - val userListSize = MemberInfoType.entries.size - val userList: List = List(userListSize) { "" } - var userMutableList by remember { mutableStateOf(userList) } + var memberInfoEditModel by remember { mutableStateOf(MemberInfoEditModel()) } LaunchedEffect(lifecycleOwner) { viewModel.firstLckWatchSideEffect.flowWithLifecycle(lifecycleOwner.lifecycle) .collect { sideEffect -> when (sideEffect) { - is FirstLckWatchSideEffect.NavigateToSelectLckTeam -> navigateToSelectLckTeam(userMutableList) + is FirstLckWatchSideEffect.NavigateToSelectLckTeam -> navigateToSelectLckTeam(memberInfoEditModel) else -> Unit } } @@ -60,9 +57,7 @@ fun FirstLckWatchRoute( FirstLckWatchScreen( onNextBtnClick = { - userMutableList = userMutableList.toMutableList().apply { - set(MemberInfoType.MEMBER_LCK_YEAR.ordinal, it) - } + memberInfoEditModel = memberInfoEditModel.copy(memberLckYears = it) viewModel.navigateToSelectTeam() trackEvent(CLICK_NEXT_YEAR_SIGNUP) }, @@ -71,7 +66,7 @@ fun FirstLckWatchRoute( @Composable fun FirstLckWatchScreen( - onNextBtnClick: (String) -> Unit, + onNextBtnClick: (Int) -> Unit, ) { SetStatusBarColor(color = WableTheme.colors.white) @@ -138,7 +133,7 @@ fun FirstLckWatchScreen( WableButton( text = stringResource(R.string.btn_next_text), - onClick = { onNextBtnClick(options[selectedIndex].toString()) }, + onClick = { onNextBtnClick(options[selectedIndex]) }, enabled = true, modifier = Modifier.padding(bottom = 24.dp), ) diff --git a/feature/onboarding/src/main/java/com/teamwable/onboarding/profile/ProfileScreen.kt b/feature/onboarding/src/main/java/com/teamwable/onboarding/profile/ProfileScreen.kt index 624f2653..621bc0a0 100644 --- a/feature/onboarding/src/main/java/com/teamwable/onboarding/profile/ProfileScreen.kt +++ b/feature/onboarding/src/main/java/com/teamwable/onboarding/profile/ProfileScreen.kt @@ -41,10 +41,10 @@ import com.teamwable.designsystem.component.dialog.PermissionAppSettingsDialog import com.teamwable.designsystem.component.textfield.WableBasicTextField import com.teamwable.designsystem.extension.system.navigateToAppSettings import com.teamwable.designsystem.theme.WableTheme -import com.teamwable.designsystem.type.MemberInfoType import com.teamwable.designsystem.type.NicknameType import com.teamwable.designsystem.type.ProfileEditType import com.teamwable.designsystem.type.ProfileImageType +import com.teamwable.model.profile.MemberInfoEditModel import com.teamwable.navigation.Route import com.teamwable.onboarding.R import com.teamwable.onboarding.profile.component.ProfileImagePicker @@ -59,14 +59,14 @@ import timber.log.Timber internal fun ProfileRoute( viewModel: ProfileViewModel = hiltViewModel(), args: Route.Profile, - navigateToAgreeTerms: (List) -> Unit, + navigateToAgreeTerms: (MemberInfoEditModel, String?) -> Unit, onShowErrorSnackBar: (throwable: Throwable?) -> Unit, ) { val lifecycleOwner = LocalLifecycleOwner.current val context = LocalContext.current val profileState by viewModel.profileState.collectAsStateWithLifecycle() - var userMutableList by remember { mutableStateOf(args.userList) } + var memberInfoEditModel by remember { mutableStateOf(args.memberInfoEditModel) } var openDialog by remember { mutableStateOf(false) } val permissionLauncher = rememberLauncherForActivityResult( @@ -102,7 +102,7 @@ internal fun ProfileRoute( viewModel.sideEffect.flowWithLifecycle(lifecycleOwner.lifecycle) .collect { sideEffect -> when (sideEffect) { - is ProfileSideEffect.NavigateToAgreeTerms -> navigateToAgreeTerms(userMutableList) + is ProfileSideEffect.NavigateToAgreeTerms -> navigateToAgreeTerms(memberInfoEditModel, profileState.selectedImageUri) is ProfileSideEffect.ShowPermissionDeniedDialog -> openDialog = true @@ -128,11 +128,10 @@ internal fun ProfileRoute( profileState = profileState, profileEditType = ProfileEditType.ONBOARDING, onNextBtnClick = { nickname, imageUri, defaultImage -> - userMutableList = userMutableList.toMutableList().apply { - set(MemberInfoType.MEMBER_NICKNAME.ordinal, nickname) - set(MemberInfoType.MEMBER_PROFILE_URL.ordinal, imageUri.orEmpty()) - set(MemberInfoType.MEMBER_DEFAULT_PROFILE_IMAGE.ordinal, defaultImage.orEmpty()) - } + memberInfoEditModel = memberInfoEditModel.copy( + nickname = nickname, + memberDefaultProfileImage = defaultImage.orEmpty(), + ) viewModel.navigateToAgreeTerms() trackEvent(CLICK_NEXT_PROFILE_SIGNUP) }, diff --git a/feature/onboarding/src/main/java/com/teamwable/onboarding/selectlckteam/SelectLckTeamScreen.kt b/feature/onboarding/src/main/java/com/teamwable/onboarding/selectlckteam/SelectLckTeamScreen.kt index 11e213fe..9ca6ae3e 100644 --- a/feature/onboarding/src/main/java/com/teamwable/onboarding/selectlckteam/SelectLckTeamScreen.kt +++ b/feature/onboarding/src/main/java/com/teamwable/onboarding/selectlckteam/SelectLckTeamScreen.kt @@ -34,7 +34,7 @@ import com.teamwable.designsystem.component.button.WableButton import com.teamwable.designsystem.extension.modifier.noRippleDebounceClickable import com.teamwable.designsystem.theme.WableTheme import com.teamwable.designsystem.type.LckTeamType -import com.teamwable.designsystem.type.MemberInfoType +import com.teamwable.model.profile.MemberInfoEditModel import com.teamwable.navigation.Route import com.teamwable.onboarding.R import com.teamwable.onboarding.selectlckteam.component.LckTeamItem @@ -44,17 +44,17 @@ import com.teamwable.onboarding.selectlckteam.model.SelectLckTeamSideEffect fun SelectLckTeamRoute( viewModel: SelectLckTeamViewModel = hiltViewModel(), args: Route.SelectLckTeam, - navigateToProfile: (List) -> Unit, + navigateToProfile: (MemberInfoEditModel) -> Unit, onShowErrorSnackBar: (throwable: Throwable?) -> Unit, ) { val lifecycleOwner = LocalLifecycleOwner.current - var userMutableList by remember { mutableStateOf(args.userList) } + var memberInfoEditModel by remember { mutableStateOf(args.memberInfoEditModel) } LaunchedEffect(lifecycleOwner) { viewModel.firstLckWatchSideEffect.flowWithLifecycle(lifecycleOwner.lifecycle) .collect { sideEffect -> when (sideEffect) { - is SelectLckTeamSideEffect.NavigateToProfile -> navigateToProfile(userMutableList) + is SelectLckTeamSideEffect.NavigateToProfile -> navigateToProfile(memberInfoEditModel) else -> Unit } } @@ -62,9 +62,7 @@ fun SelectLckTeamRoute( SelectLckTeamScreen( onNextBtnClick = { - userMutableList = userMutableList.toMutableList().apply { - set(MemberInfoType.MEMBER_FAN_TEAM.ordinal, it) - } + memberInfoEditModel = memberInfoEditModel.copy(memberFanTeam = it) viewModel.navigateToProfile() if (it.isNotEmpty()) trackEvent(CLICK_NEXT_TEAM_SIGNUP) else trackEvent(CLICK_DETOUR_TEAM_SIGNUP) From 3de7ef68e5dddf1c2a8d53ecb54878b9fedae0ac Mon Sep 17 00:00:00 2001 From: chanu Date: Tue, 8 Oct 2024 01:00:49 +0900 Subject: [PATCH 12/18] =?UTF-8?q?#91=20[fix]=20:=20=EC=84=9C=EB=B2=84=20db?= =?UTF-8?q?=EC=B4=88=EA=B8=B0=ED=99=94=20=EC=8B=9C,=20IsNewUser=EC=97=90?= =?UTF-8?q?=EC=84=9C=20nickname=EC=9C=BC=EB=A1=9C=20checkIsNewUser=20?= =?UTF-8?q?=ED=8C=90=EB=B3=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- feature/auth/src/main/java/com/teamwable/auth/LoginViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/auth/src/main/java/com/teamwable/auth/LoginViewModel.kt b/feature/auth/src/main/java/com/teamwable/auth/LoginViewModel.kt index 13bf901c..c3e40b63 100644 --- a/feature/auth/src/main/java/com/teamwable/auth/LoginViewModel.kt +++ b/feature/auth/src/main/java/com/teamwable/auth/LoginViewModel.kt @@ -87,7 +87,7 @@ class LoginViewModel @Inject constructor( saveAccessToken(response.accessToken) saveRefreshToken(response.refreshToken) saveMemberId(response.memberId) - checkIsNewUser(response.isNewUser) + checkIsNewUser(response.nickName.isBlank()) }.onFailure { _loginSideEffect.emit(LoginSideEffect.ShowSnackBar(it)) } From 46690f521f7031dfdbe87f3882c593f6f2125a61 Mon Sep 17 00:00:00 2001 From: chanu Date: Tue, 8 Oct 2024 01:01:24 +0900 Subject: [PATCH 13/18] =?UTF-8?q?#91=20[chore]=20:=20=EB=B6=88=ED=95=84?= =?UTF-8?q?=EC=9A=94=ED=95=9C=20=EC=BD=AC=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/com/teamwable/wable/WableApp.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/src/main/java/com/teamwable/wable/WableApp.kt b/app/src/main/java/com/teamwable/wable/WableApp.kt index 3dbff954..1f545c42 100644 --- a/app/src/main/java/com/teamwable/wable/WableApp.kt +++ b/app/src/main/java/com/teamwable/wable/WableApp.kt @@ -8,7 +8,6 @@ import android.content.Context import android.os.Build import androidx.appcompat.app.AppCompatDelegate import com.kakao.sdk.common.KakaoSdk -import com.kakao.sdk.common.util.Utility import com.teamwable.common.util.AmplitudeUtil.initAmplitude import com.teamwable.ui.util.FcmTag.CHANNEL_ID import com.teamwable.ui.util.FcmTag.CHANNEL_NAME @@ -44,8 +43,6 @@ class WableApp : Application() { private fun setKaKaoSdk() { KakaoSdk.init(this, KAKAO_APP_KEY) - var keyHash = Utility.getKeyHash(this) - Timber.tag("Kakao").d("KeyHash: $keyHash") } private fun createNotificationChannel() { From f7b7d97572773e62c7779833a9e5af99dc51305e Mon Sep 17 00:00:00 2001 From: chanu Date: Tue, 8 Oct 2024 02:10:30 +0900 Subject: [PATCH 14/18] #91 [refactor] : refactor CustomNavType using parcelable --- .../com/teamwable/navigation/CustomNavType.kt | 30 ----------------- .../teamwable/navigation/ParcelableNavType.kt | 32 +++++++++++++++++++ .../naviagation/AgreeTermsNavigation.kt | 4 +-- .../profile/naviagation/ProfileNavigation.kt | 4 +-- .../naviagation/SelectLckTeamNavigation.kt | 4 +-- 5 files changed, 38 insertions(+), 36 deletions(-) delete mode 100644 core/navigation/src/main/java/com/teamwable/navigation/CustomNavType.kt create mode 100644 core/navigation/src/main/java/com/teamwable/navigation/ParcelableNavType.kt diff --git a/core/navigation/src/main/java/com/teamwable/navigation/CustomNavType.kt b/core/navigation/src/main/java/com/teamwable/navigation/CustomNavType.kt deleted file mode 100644 index 4d75b9b6..00000000 --- a/core/navigation/src/main/java/com/teamwable/navigation/CustomNavType.kt +++ /dev/null @@ -1,30 +0,0 @@ -package com.teamwable.navigation - -import android.net.Uri -import android.os.Bundle -import androidx.navigation.NavType -import kotlinx.serialization.json.Json -import kotlinx.serialization.serializer - -object CustomNavType { - inline fun createNavType(): NavType = object : NavType( - isNullableAllowed = false, - ) { - override fun get(bundle: Bundle, key: String): T? { - val jsonString = bundle.getString(key) ?: return null - return Json.decodeFromString(serializer(), jsonString) - } - - override fun parseValue(value: String): T { - return Json.decodeFromString(serializer(), Uri.decode(value)) - } - - override fun serializeAsValue(value: T): String { - return Uri.encode(Json.encodeToString(serializer(), value)) - } - - override fun put(bundle: Bundle, key: String, value: T) { - bundle.putString(key, Json.encodeToString(serializer(), value)) - } - } -} diff --git a/core/navigation/src/main/java/com/teamwable/navigation/ParcelableNavType.kt b/core/navigation/src/main/java/com/teamwable/navigation/ParcelableNavType.kt new file mode 100644 index 00000000..627ca06f --- /dev/null +++ b/core/navigation/src/main/java/com/teamwable/navigation/ParcelableNavType.kt @@ -0,0 +1,32 @@ +package com.teamwable.navigation + +import android.net.Uri +import android.os.Build.VERSION.SDK_INT +import android.os.Bundle +import android.os.Parcelable +import androidx.navigation.NavType +import kotlinx.serialization.encodeToString +import kotlinx.serialization.json.Json + +inline fun parcelableNavType(): NavType = object : NavType( + isNullableAllowed = false, +) { + override fun get(bundle: Bundle, key: String): T? = + bundle.parcelable(key) + + override fun parseValue(value: String): T = + Json.decodeFromString(Uri.decode(value)) + + override fun serializeAsValue(value: T): String = + Uri.encode(Json.encodeToString(value)) + + override fun put(bundle: Bundle, key: String, value: T) { + bundle.putParcelable(key, value) + } +} + +inline fun Bundle.parcelable(key: String): T? = when { + SDK_INT >= 33 -> getParcelable(key, T::class.java) + else -> @Suppress("DEPRECATION") + getParcelable(key) as? T +} diff --git a/feature/onboarding/src/main/java/com/teamwable/onboarding/agreeterms/naviagation/AgreeTermsNavigation.kt b/feature/onboarding/src/main/java/com/teamwable/onboarding/agreeterms/naviagation/AgreeTermsNavigation.kt index 8bb88a41..ec7d8717 100644 --- a/feature/onboarding/src/main/java/com/teamwable/onboarding/agreeterms/naviagation/AgreeTermsNavigation.kt +++ b/feature/onboarding/src/main/java/com/teamwable/onboarding/agreeterms/naviagation/AgreeTermsNavigation.kt @@ -5,8 +5,8 @@ import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable import androidx.navigation.toRoute import com.teamwable.model.profile.MemberInfoEditModel -import com.teamwable.navigation.CustomNavType import com.teamwable.navigation.Route +import com.teamwable.navigation.parcelableNavType import com.teamwable.onboarding.agreeterms.AgreeTermsRoute import kotlin.reflect.typeOf @@ -23,7 +23,7 @@ fun NavGraphBuilder.agreeTermsNavGraph( ) { composable( typeMap = mapOf( - typeOf() to CustomNavType.createNavType(), + typeOf() to parcelableNavType(), ), ) { backStackEntry -> val args = backStackEntry.toRoute() diff --git a/feature/onboarding/src/main/java/com/teamwable/onboarding/profile/naviagation/ProfileNavigation.kt b/feature/onboarding/src/main/java/com/teamwable/onboarding/profile/naviagation/ProfileNavigation.kt index 95c382b0..20df37f9 100644 --- a/feature/onboarding/src/main/java/com/teamwable/onboarding/profile/naviagation/ProfileNavigation.kt +++ b/feature/onboarding/src/main/java/com/teamwable/onboarding/profile/naviagation/ProfileNavigation.kt @@ -5,8 +5,8 @@ import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable import androidx.navigation.toRoute import com.teamwable.model.profile.MemberInfoEditModel -import com.teamwable.navigation.CustomNavType import com.teamwable.navigation.Route +import com.teamwable.navigation.parcelableNavType import com.teamwable.onboarding.profile.ProfileRoute import kotlin.reflect.typeOf @@ -20,7 +20,7 @@ fun NavGraphBuilder.profileNavGraph( ) { composable( typeMap = mapOf( - typeOf() to CustomNavType.createNavType(), + typeOf() to parcelableNavType(), ), ) { backStackEntry -> val args = backStackEntry.toRoute() diff --git a/feature/onboarding/src/main/java/com/teamwable/onboarding/selectlckteam/naviagation/SelectLckTeamNavigation.kt b/feature/onboarding/src/main/java/com/teamwable/onboarding/selectlckteam/naviagation/SelectLckTeamNavigation.kt index e3838944..4f4331ce 100644 --- a/feature/onboarding/src/main/java/com/teamwable/onboarding/selectlckteam/naviagation/SelectLckTeamNavigation.kt +++ b/feature/onboarding/src/main/java/com/teamwable/onboarding/selectlckteam/naviagation/SelectLckTeamNavigation.kt @@ -5,8 +5,8 @@ import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable import androidx.navigation.toRoute import com.teamwable.model.profile.MemberInfoEditModel -import com.teamwable.navigation.CustomNavType import com.teamwable.navigation.Route +import com.teamwable.navigation.parcelableNavType import com.teamwable.onboarding.selectlckteam.SelectLckTeamRoute import kotlin.reflect.typeOf @@ -20,7 +20,7 @@ fun NavGraphBuilder.selectLckTeamNavGraph( ) { composable( typeMap = mapOf( - typeOf() to CustomNavType.createNavType(), + typeOf() to parcelableNavType(), ), ) { backStackEntry -> val args = backStackEntry.toRoute() From 3b504ff361e384f152e640a9e1102a3f63ffc624 Mon Sep 17 00:00:00 2001 From: chanu Date: Tue, 8 Oct 2024 02:10:45 +0900 Subject: [PATCH 15/18] #91 [chore] : delete unused code --- .../extension/bundle/getSafeParcelable.kt | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 core/designsystem/src/main/java/com/teamwable/designsystem/extension/bundle/getSafeParcelable.kt diff --git a/core/designsystem/src/main/java/com/teamwable/designsystem/extension/bundle/getSafeParcelable.kt b/core/designsystem/src/main/java/com/teamwable/designsystem/extension/bundle/getSafeParcelable.kt deleted file mode 100644 index 15fbec4e..00000000 --- a/core/designsystem/src/main/java/com/teamwable/designsystem/extension/bundle/getSafeParcelable.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.teamwable.designsystem.extension.bundle - -import android.os.Build -import android.os.Bundle -import android.os.Parcelable - -inline fun Bundle?.getSafeParcelable(key: String): T? { - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { - this?.getParcelable(key, T::class.java) - } else { - this?.getParcelable(key) as? T - } -} From 1edfadebf9f2a0c7e1296e1b147f6018166fd27a Mon Sep 17 00:00:00 2001 From: chanu Date: Wed, 9 Oct 2024 21:12:30 +0900 Subject: [PATCH 16/18] =?UTF-8?q?#95=20[hotfix]=20:=20=EB=88=84=EB=9D=BD?= =?UTF-8?q?=EB=90=9C=20dto=ED=95=84=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../network/dto/response/auth/ResponseReissueTokenDto.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/network/src/main/java/com/teamwable/network/dto/response/auth/ResponseReissueTokenDto.kt b/core/network/src/main/java/com/teamwable/network/dto/response/auth/ResponseReissueTokenDto.kt index 44053dde..e6d45f18 100644 --- a/core/network/src/main/java/com/teamwable/network/dto/response/auth/ResponseReissueTokenDto.kt +++ b/core/network/src/main/java/com/teamwable/network/dto/response/auth/ResponseReissueTokenDto.kt @@ -7,4 +7,6 @@ import kotlinx.serialization.Serializable data class ResponseReissueTokenDto( @SerialName("accessToken") val accessToken: String, + @SerialName("refreshToken") + val refreshToken: String, ) From 9cf6a630dabcb689dbddf923f46d35058c43e5f6 Mon Sep 17 00:00:00 2001 From: chanu Date: Wed, 9 Oct 2024 21:29:17 +0900 Subject: [PATCH 17/18] =?UTF-8?q?#95=20[hotfix]=20:=20=ED=86=A0=ED=81=B0?= =?UTF-8?q?=20=EB=A6=AC=EC=9D=B4=EC=8A=88=EC=8B=9C=20toast=20=EC=8A=A4?= =?UTF-8?q?=EB=A0=88=EB=93=9C=20=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/teamwable/network/TokenInterceptor.kt | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/core/network/src/main/java/com/teamwable/network/TokenInterceptor.kt b/core/network/src/main/java/com/teamwable/network/TokenInterceptor.kt index 3ce097c1..9b5decbb 100644 --- a/core/network/src/main/java/com/teamwable/network/TokenInterceptor.kt +++ b/core/network/src/main/java/com/teamwable/network/TokenInterceptor.kt @@ -1,12 +1,10 @@ package com.teamwable.network import android.app.Application +import android.content.Intent import android.widget.Toast -import com.jakewharton.processphoenix.ProcessPhoenix import com.teamwable.datastore.datasource.DefaultWablePreferenceDatasource import com.teamwable.network.datasource.AuthService -import com.teamwable.network.util.UNKNOWN_ERROR_MESSAGE -import com.teamwable.network.util.toCustomError import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.first @@ -14,7 +12,6 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock -import kotlinx.coroutines.withContext import okhttp3.Interceptor import okhttp3.Request import okhttp3.Response @@ -68,19 +65,22 @@ class TokenInterceptor @Inject constructor( false -> false } } catch (e: Exception) { - val errorMessage = e.toCustomError().message ?: UNKNOWN_ERROR_MESSAGE - Toast.makeText(context, errorMessage, Toast.LENGTH_SHORT).show() false } } } - private fun handleFailedTokenReissue() { + private fun handleFailedTokenReissue() = with(context) { CoroutineScope(Dispatchers.Main).launch { - withContext(Dispatchers.IO) { - defaultWablePreferenceDatasource.clear() - } - ProcessPhoenix.triggerRebirth(context) + defaultWablePreferenceDatasource.clear() + startActivity( + Intent.makeRestartActivityTask( + packageManager.getLaunchIntentForPackage(packageName)?.component, + ).apply { + addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK) + }, + ) + Toast.makeText(context, "재 로그인이 필요해요", Toast.LENGTH_SHORT).show() } } From c7d54a086f806ad95e0bf147fd36870006ba2266 Mon Sep 17 00:00:00 2001 From: chanu Date: Wed, 9 Oct 2024 21:45:12 +0900 Subject: [PATCH 18/18] =?UTF-8?q?#95=20[chore]=20:=20=EB=B6=88=ED=95=84?= =?UTF-8?q?=EC=9A=94=ED=95=9C=20=EB=9D=BC=EC=9D=B4=EB=B8=8C=EB=9F=AC?= =?UTF-8?q?=EB=A6=AC=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/network/build.gradle.kts | 1 - gradle/libs.versions.toml | 1 - 2 files changed, 2 deletions(-) diff --git a/core/network/build.gradle.kts b/core/network/build.gradle.kts index be1ca32a..e6cf361e 100644 --- a/core/network/build.gradle.kts +++ b/core/network/build.gradle.kts @@ -33,5 +33,4 @@ dependencies { implementation(project(":core:model")) implementation(project(":core:datastore")) implementation(libs.paging) - implementation(libs.process.phoenix) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 22cf5ef1..f9cd6520 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -147,7 +147,6 @@ lottie-compose = { group = "com.airbnb.android", name = "lottie-compose", versio amplitude = { module = "com.amplitude:analytics-android", version.ref = "amplitude" } amplitude-ads = { module = "com.google.android.gms:play-services-ads-identifier", version.ref = "amplitude-ads" } androidx-activity = { group = "androidx.activity", name = "activity", version.ref = "activity" } -process-phoenix = { group = "com.jakewharton", name = "process-phoenix", version.ref = "processPhoenix" } ## Compose androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidxComposeBom" }