auth to server-V93
This commit is contained in:
parent
3bdddba40e
commit
47c4da93bd
3 changed files with 15 additions and 2 deletions
|
|
@ -53,8 +53,18 @@ fun SharedTransitionScope.setting_detail_Screen(
|
||||||
settingIcon: String,
|
settingIcon: String,
|
||||||
animatedVisibilityScope: AnimatedVisibilityScope,
|
animatedVisibilityScope: AnimatedVisibilityScope,
|
||||||
bottomBarViewModel: BottomBarViewModel = hiltViewModel(),
|
bottomBarViewModel: BottomBarViewModel = hiltViewModel(),
|
||||||
appViewModel: AppViewModel = hiltViewModel()
|
|
||||||
){
|
){
|
||||||
|
|
||||||
|
//UI state for manage account
|
||||||
|
val activity = LocalActivity.current as? ComponentActivity
|
||||||
|
|
||||||
|
// 2. 使用該 Activity 作為 ViewModelStoreOwner
|
||||||
|
// 這樣可以確保拿到的 appViewModel 是跟隨 Activity 生命週期的「唯一實例」
|
||||||
|
val appViewModel: AppViewModel = activity?.let {
|
||||||
|
hiltViewModel(viewModelStoreOwner = it)
|
||||||
|
} ?: hiltViewModel() // Fallback 方案
|
||||||
|
|
||||||
|
|
||||||
//control bottom bar behavior
|
//control bottom bar behavior
|
||||||
DisposableEffect(Unit) {
|
DisposableEffect(Unit) {
|
||||||
bottomBarViewModel.setVisible(false)
|
bottomBarViewModel.setVisible(false)
|
||||||
|
|
|
||||||
|
|
@ -399,7 +399,7 @@ fun Loaded_setting_profile_page(
|
||||||
onClick = onNavigateToAccountSwitch,
|
onClick = onNavigateToAccountSwitch,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(10.dp),
|
,
|
||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
containerColor = MaterialTheme.colorScheme.secondaryContainer,
|
containerColor = MaterialTheme.colorScheme.secondaryContainer,
|
||||||
contentColor = MaterialTheme.colorScheme.onSecondaryContainer
|
contentColor = MaterialTheme.colorScheme.onSecondaryContainer
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.example.login_v3.navigation
|
package com.example.login_v3.navigation
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
|
|
@ -69,7 +70,9 @@ class AppViewModel @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
fun goTo(screen: AppScreen) {
|
fun goTo(screen: AppScreen) {
|
||||||
|
Log.d("NavTest", "Attempting to go to: $screen")
|
||||||
_currentScreen.value = screen
|
_currentScreen.value = screen
|
||||||
|
Log.d("NavTest", "Current state value: ${_currentScreen.value}")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改:登出當前帳號
|
// 修改:登出當前帳號
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue