refactor(android): remove orphan runtime accessors · openclaw/openclaw@2e0dd66
vincentkoc
·
2026-06-23
·
via Recent Commits to openclaw:main
File tree
apps/android/app/src/main/java/ai/openclaw/app
| Original file line number | Diff line number | Diff line change |
|---|
@@ -393,12 +393,6 @@ class SecurePrefs(
|
393 | 393 | return stored?.takeIf { it.isNotEmpty() } |
394 | 394 | } |
395 | 395 | |
396 | | -/** Saves the paired gateway token under the current Android instance id. */ |
397 | | -fun saveGatewayToken(token: String) { |
398 | | -val key = "gateway.token.${_instanceId.value}" |
399 | | - securePrefs.edit { putString(key, token.trim()) } |
400 | | - } |
401 | | - |
402 | 396 | /** Loads the bootstrap token used during gateway setup and device-token handoff. */ |
403 | 397 | fun loadGatewayBootstrapToken(): String? { |
404 | 398 | val key = "gateway.bootstrapToken.${_instanceId.value}" |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -6,14 +6,6 @@ internal fun normalizeMainKey(raw: String?): String {
|
6 | 6 | return if (!trimmed.isNullOrEmpty()) trimmed else "main" |
7 | 7 | } |
8 | 8 | |
9 | | -/** Accepts only gateway session keys that can represent the main chat stream. */ |
10 | | -internal fun isCanonicalMainSessionKey(raw: String?): Boolean { |
11 | | -val trimmed = raw?.trim().orEmpty() |
12 | | -if (trimmed.isEmpty()) return false |
13 | | -if (trimmed == "global") return true |
14 | | -return trimmed.startsWith("agent:") |
15 | | -} |
16 | | - |
17 | 9 | /** Extracts the agent id from canonical agent-scoped main session keys. */ |
18 | 10 | internal fun resolveAgentIdFromMainSessionKey(raw: String?): String? { |
19 | 11 | val trimmed = raw?.trim().orEmpty() |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -260,24 +260,6 @@ class GatewaySession(
|
260 | 260 | currentConnection?.closeQuietly() |
261 | 261 | } |
262 | 262 | |
263 | | -fun currentCanvasHostUrl(): String? = pluginSurfaceUrls["canvas"] |
264 | | - |
265 | | -/** Refreshes the canvas plugin surface URL and caches the normalized Android-reachable URL. */ |
266 | | -suspend fun refreshCanvasHostUrl(timeoutMs: Long = 8_000): String? { |
267 | | -val refreshed = |
268 | | - refreshPluginSurfaceUrl( |
269 | | - method = "node.pluginSurface.refresh", |
270 | | - params = buildJsonObject { put("surface", JsonPrimitive("canvas")) }, |
271 | | - timeoutMs = timeoutMs, |
272 | | - ) |
273 | | -if (!refreshed.isNullOrBlank()) { |
274 | | - pluginSurfaceUrls = pluginSurfaceUrls + ("canvas" to refreshed) |
275 | | - } |
276 | | -return refreshed |
277 | | - } |
278 | | - |
279 | | -fun currentMainSessionKey(): String? = mainSessionKey |
280 | | - |
281 | 263 | /** Sends a best-effort node.event and returns false instead of throwing on failure. */ |
282 | 264 | suspend fun sendNodeEvent( |
283 | 265 | event: String, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -97,8 +97,6 @@ class CanvasController {
|
97 | 97 | |
98 | 98 | fun currentUrl(): String? = url |
99 | 99 | |
100 | | -fun isDefaultCanvas(): Boolean = url == null |
101 | | - |
102 | 100 | fun setDebugStatusEnabled(enabled: Boolean) { |
103 | 101 | debugStatusEnabled = enabled |
104 | 102 | applyDebugStatus() |
@@ -205,24 +203,6 @@ class CanvasController {
|
205 | 203 | } |
206 | 204 | } |
207 | 205 | |
208 | | -suspend fun snapshotPngBase64(maxWidth: Int?): String = |
209 | | - withContext(Dispatchers.Main) { |
210 | | -val wv = webView ?: throw IllegalStateException("no webview") |
211 | | -val bmp = wv.captureBitmap() |
212 | | -try { |
213 | | -val scaled = bmp.scaleForMaxWidth(maxWidth) |
214 | | -try { |
215 | | -val out = ByteArrayOutputStream() |
216 | | - scaled.compress(Bitmap.CompressFormat.PNG, 100, out) |
217 | | -Base64.encodeToString(out.toByteArray(), Base64.NO_WRAP) |
218 | | - } finally { |
219 | | -if (scaled !== bmp) scaled.recycle() |
220 | | - } |
221 | | - } finally { |
222 | | - bmp.recycle() |
223 | | - } |
224 | | - } |
225 | | - |
226 | 206 | /** Captures the WebView as PNG/JPEG base64 with optional width and quality bounds. */ |
227 | 207 | suspend fun snapshotBase64( |
228 | 208 | format: SnapshotFormat, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -67,9 +67,3 @@ fun overlayContainerColor(): Color {
|
67 | 67 | // Light mode keeps overlays away from pure-white glare on the app canvas. |
68 | 68 | return if (isDark) base else base.copy(alpha = 0.88f) |
69 | 69 | } |
70 | | - |
71 | | -/** |
72 | | - * Overlay icon token kept next to overlayContainerColor for callers outside the design package. |
73 | | - */ |
74 | | -@Composable |
75 | | -fun overlayIconColor(): Color = MaterialTheme.colorScheme.onSurfaceVariant |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1253,16 +1253,6 @@ private fun settingsPrimaryButtonColors() =
|
1253 | 1253 | disabledContentColor = Color.White.copy(alpha = 0.9f), |
1254 | 1254 | ) |
1255 | 1255 | |
1256 | | -/** Destructive button colors for permission and capability settings actions. */ |
1257 | | -@Composable |
1258 | | -private fun settingsDangerButtonColors() = |
1259 | | -ButtonDefaults.buttonColors( |
1260 | | - containerColor = mobileDanger, |
1261 | | - contentColor = Color.White, |
1262 | | - disabledContainerColor = mobileDanger.copy(alpha = 0.45f), |
1263 | | - disabledContentColor = Color.White.copy(alpha = 0.9f), |
1264 | | - ) |
1265 | | - |
1266 | 1256 | /** Opens this app's Android settings page for permissions that require system UI. */ |
1267 | 1257 | private fun openAppSettings(context: Context) { |
1268 | 1258 | val intent = |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。