mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 19:44:59 +00:00
feat(android): add onboarding and gateway auth state plumbing
This commit is contained in:
@@ -53,6 +53,7 @@ class MainViewModel(app: Application) : AndroidViewModel(app) {
|
|||||||
val manualPort: StateFlow<Int> = runtime.manualPort
|
val manualPort: StateFlow<Int> = runtime.manualPort
|
||||||
val manualTls: StateFlow<Boolean> = runtime.manualTls
|
val manualTls: StateFlow<Boolean> = runtime.manualTls
|
||||||
val gatewayToken: StateFlow<String> = runtime.gatewayToken
|
val gatewayToken: StateFlow<String> = runtime.gatewayToken
|
||||||
|
val onboardingCompleted: StateFlow<Boolean> = runtime.onboardingCompleted
|
||||||
val canvasDebugStatusEnabled: StateFlow<Boolean> = runtime.canvasDebugStatusEnabled
|
val canvasDebugStatusEnabled: StateFlow<Boolean> = runtime.canvasDebugStatusEnabled
|
||||||
|
|
||||||
val chatSessionKey: StateFlow<String> = runtime.chatSessionKey
|
val chatSessionKey: StateFlow<String> = runtime.chatSessionKey
|
||||||
@@ -110,6 +111,14 @@ class MainViewModel(app: Application) : AndroidViewModel(app) {
|
|||||||
runtime.setGatewayToken(value)
|
runtime.setGatewayToken(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setGatewayPassword(value: String) {
|
||||||
|
runtime.setGatewayPassword(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setOnboardingCompleted(value: Boolean) {
|
||||||
|
runtime.setOnboardingCompleted(value)
|
||||||
|
}
|
||||||
|
|
||||||
fun setCanvasDebugStatusEnabled(value: Boolean) {
|
fun setCanvasDebugStatusEnabled(value: Boolean) {
|
||||||
runtime.setCanvasDebugStatusEnabled(value)
|
runtime.setCanvasDebugStatusEnabled(value)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -345,7 +345,10 @@ class NodeRuntime(context: Context) {
|
|||||||
val manualPort: StateFlow<Int> = prefs.manualPort
|
val manualPort: StateFlow<Int> = prefs.manualPort
|
||||||
val manualTls: StateFlow<Boolean> = prefs.manualTls
|
val manualTls: StateFlow<Boolean> = prefs.manualTls
|
||||||
val gatewayToken: StateFlow<String> = prefs.gatewayToken
|
val gatewayToken: StateFlow<String> = prefs.gatewayToken
|
||||||
|
val onboardingCompleted: StateFlow<Boolean> = prefs.onboardingCompleted
|
||||||
fun setGatewayToken(value: String) = prefs.setGatewayToken(value)
|
fun setGatewayToken(value: String) = prefs.setGatewayToken(value)
|
||||||
|
fun setGatewayPassword(value: String) = prefs.setGatewayPassword(value)
|
||||||
|
fun setOnboardingCompleted(value: Boolean) = prefs.setOnboardingCompleted(value)
|
||||||
val lastDiscoveredStableId: StateFlow<String> = prefs.lastDiscoveredStableId
|
val lastDiscoveredStableId: StateFlow<String> = prefs.lastDiscoveredStableId
|
||||||
val canvasDebugStatusEnabled: StateFlow<Boolean> = prefs.canvasDebugStatusEnabled
|
val canvasDebugStatusEnabled: StateFlow<Boolean> = prefs.canvasDebugStatusEnabled
|
||||||
|
|
||||||
|
|||||||
@@ -75,6 +75,10 @@ class SecurePrefs(context: Context) {
|
|||||||
MutableStateFlow(prefs.getString("gateway.manual.token", "") ?: "")
|
MutableStateFlow(prefs.getString("gateway.manual.token", "") ?: "")
|
||||||
val gatewayToken: StateFlow<String> = _gatewayToken
|
val gatewayToken: StateFlow<String> = _gatewayToken
|
||||||
|
|
||||||
|
private val _onboardingCompleted =
|
||||||
|
MutableStateFlow(prefs.getBoolean("onboarding.completed", false))
|
||||||
|
val onboardingCompleted: StateFlow<Boolean> = _onboardingCompleted
|
||||||
|
|
||||||
private val _lastDiscoveredStableId =
|
private val _lastDiscoveredStableId =
|
||||||
MutableStateFlow(
|
MutableStateFlow(
|
||||||
prefs.getString("gateway.lastDiscoveredStableID", "") ?: "",
|
prefs.getString("gateway.lastDiscoveredStableID", "") ?: "",
|
||||||
@@ -152,6 +156,15 @@ class SecurePrefs(context: Context) {
|
|||||||
_gatewayToken.value = value
|
_gatewayToken.value = value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setGatewayPassword(value: String) {
|
||||||
|
saveGatewayPassword(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setOnboardingCompleted(value: Boolean) {
|
||||||
|
prefs.edit { putBoolean("onboarding.completed", value) }
|
||||||
|
_onboardingCompleted.value = value
|
||||||
|
}
|
||||||
|
|
||||||
fun setCanvasDebugStatusEnabled(value: Boolean) {
|
fun setCanvasDebugStatusEnabled(value: Boolean) {
|
||||||
prefs.edit { putBoolean("canvas.debugStatusEnabled", value) }
|
prefs.edit { putBoolean("canvas.debugStatusEnabled", value) }
|
||||||
_canvasDebugStatusEnabled.value = value
|
_canvasDebugStatusEnabled.value = value
|
||||||
|
|||||||
Reference in New Issue
Block a user