auth to server-V93

This commit is contained in:
Eric85710 2026-05-12 16:48:00 +08:00
parent 3bdddba40e
commit 47c4da93bd
3 changed files with 15 additions and 2 deletions

View file

@ -53,8 +53,18 @@ fun SharedTransitionScope.setting_detail_Screen(
settingIcon: String,
animatedVisibilityScope: AnimatedVisibilityScope,
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
DisposableEffect(Unit) {
bottomBarViewModel.setVisible(false)

View file

@ -399,7 +399,7 @@ fun Loaded_setting_profile_page(
onClick = onNavigateToAccountSwitch,
modifier = Modifier
.fillMaxWidth()
.padding(10.dp),
,
colors = ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.secondaryContainer,
contentColor = MaterialTheme.colorScheme.onSecondaryContainer

View file

@ -1,5 +1,6 @@
package com.example.login_v3.navigation
import android.util.Log
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
@ -69,7 +70,9 @@ class AppViewModel @Inject constructor(
}
fun goTo(screen: AppScreen) {
Log.d("NavTest", "Attempting to go to: $screen")
_currentScreen.value = screen
Log.d("NavTest", "Current state value: ${_currentScreen.value}")
}
// 修改:登出當前帳號