disable screen
This commit is contained in:
parent
48513f8da9
commit
80594be6f9
@ -5,9 +5,6 @@ plugins {
|
||||
id("com.google.dagger.hilt.android")
|
||||
}
|
||||
|
||||
// Set default build variant
|
||||
project.ext.set("android.defaultPublishConfig", "uatDebug")
|
||||
|
||||
android {
|
||||
namespace = "com.mob.utsmyanmar"
|
||||
compileSdk {
|
||||
@ -62,6 +59,14 @@ android {
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
debug {
|
||||
isMinifyEnabled = false
|
||||
isDebuggable = true
|
||||
// proguardFiles(
|
||||
// getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
// "proguard-rules.pro"
|
||||
// )
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
|
||||
@ -120,12 +120,25 @@ fun AppNavGraph(
|
||||
deviceInfoViewModel.loadDeviceInfo()
|
||||
}
|
||||
|
||||
val tmsSetupUiState by tmsSetupViewModel.uiState.collectAsStateWithLifecycle()
|
||||
|
||||
LaunchedEffect(tmsSetupViewModel) {
|
||||
tmsSetupViewModel.onSyncCompleted.collect {
|
||||
dashboardViewModel.refreshLastSyncTime()
|
||||
}
|
||||
}
|
||||
|
||||
LaunchedEffect(tmsSetupUiState.isTerminalDisabled) {
|
||||
if (tmsSetupUiState.isTerminalDisabled) {
|
||||
navController.navigate(Routes.TmsSetup.route) {
|
||||
popUpTo(Routes.Dashboard.route) {
|
||||
inclusive = true
|
||||
}
|
||||
launchSingleTop = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
transProcessViewModel.resetTransactionStatus()
|
||||
DashboardScreen2(
|
||||
dashboardUiState = dashboardUiState,
|
||||
|
||||
@ -2,6 +2,7 @@ package com.mob.utsmyanmar.ui.tms_setup
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import androidx.core.content.edit
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.mob.utsmyanmar.model.sirius.SiriusResponse
|
||||
@ -48,7 +49,7 @@ class TmsSetupViewModel @Inject constructor(
|
||||
private val emvParamOperation: EmvParamOperation,
|
||||
@ApplicationContext private val context: Context
|
||||
) : ViewModel() {
|
||||
|
||||
private val TAG = TmsSetupViewModel::class.simpleName;
|
||||
private val _uiState = MutableStateFlow(TmsSetupUiState())
|
||||
private val _dashboardUiState = MutableStateFlow(DashboardUiState())
|
||||
val uiState: StateFlow<TmsSetupUiState> = _uiState.asStateFlow()
|
||||
@ -144,19 +145,27 @@ class TmsSetupViewModel @Inject constructor(
|
||||
val ops = SystemParamsOperation.getInstance()
|
||||
|
||||
if (!ops.isActive) {
|
||||
LogUtil.d(TAG, "isActive ${ops.isActive}")
|
||||
val msg = ops.disabledMsg.takeIf { it.isNotEmpty() }
|
||||
?: "This terminal has been disabled. Please contact your administrator."
|
||||
_uiState.update { it.copy(isLoading = false) }
|
||||
viewModelScope.launch { _navigateToDisable.emit(msg) }
|
||||
_uiState.update {
|
||||
it.copy(
|
||||
isLoading = false,
|
||||
isError = true,
|
||||
isTerminalDisabled = true,
|
||||
statusText = "Terminal Disabled",
|
||||
errorMessage = msg
|
||||
)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
val validity = TMSUtil.getInstance().checkParams()
|
||||
if (validity.status == ValidityStatus.SUCCESS) {
|
||||
context.getSharedPreferences("mobpos_prefs", Context.MODE_PRIVATE)
|
||||
.edit()
|
||||
.putLong("last_sync_time", System.currentTimeMillis())
|
||||
.apply()
|
||||
.edit {
|
||||
putLong("last_sync_time", System.currentTimeMillis())
|
||||
}
|
||||
_uiState.update { it.copy(isLoading = false, statusText = "Ready.") }
|
||||
viewModelScope.launch {
|
||||
_onSyncCompleted.emit(Unit)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user