fix(android): complete Clawdbot → Moltbot class renaming
- Rename ClawdbotMessagingService → MoltbotMessagingService - Update AndroidManifest.xml service reference - Fix NodeCommandHandlers.kt: MoltbotLocationCommand, MoltbotScreenCommand, MoltbotSmsCommand - Fix NodeGatewaySync.kt: MoltbotCanvasA2UICommand - Fix NodeApp.kt import path - Update FCM channel ID and TAG constants Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
50c24afd39
commit
6b11f9da2f
@ -38,7 +38,7 @@
|
|||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:foregroundServiceType="dataSync|microphone|mediaProjection" />
|
android:foregroundServiceType="dataSync|microphone|mediaProjection" />
|
||||||
<service
|
<service
|
||||||
android:name=".push.ClawdbotMessagingService"
|
android:name=".push.MoltbotMessagingService"
|
||||||
android:exported="false">
|
android:exported="false">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package bot.molt.android
|
|||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.os.StrictMode
|
import android.os.StrictMode
|
||||||
import com.clawdbot.android.sync.SyncWorker
|
import bot.molt.android.sync.SyncWorker
|
||||||
|
|
||||||
class NodeApp : Application() {
|
class NodeApp : Application() {
|
||||||
val runtime: NodeRuntime by lazy { NodeRuntime(this) }
|
val runtime: NodeRuntime by lazy { NodeRuntime(this) }
|
||||||
|
|||||||
@ -7,12 +7,12 @@ import android.util.Log
|
|||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import bot.molt.android.gateway.GatewaySession
|
import bot.molt.android.gateway.GatewaySession
|
||||||
import bot.molt.android.node.CanvasController
|
import bot.molt.android.node.CanvasController
|
||||||
import bot.molt.android.protocol.ClawdbotCameraCommand
|
import bot.molt.android.protocol.MoltbotCameraCommand
|
||||||
import bot.molt.android.protocol.ClawdbotCanvasA2UICommand
|
import bot.molt.android.protocol.MoltbotCanvasA2UICommand
|
||||||
import bot.molt.android.protocol.ClawdbotCanvasCommand
|
import bot.molt.android.protocol.MoltbotCanvasCommand
|
||||||
import bot.molt.android.protocol.ClawdbotLocationCommand
|
import bot.molt.android.protocol.MoltbotLocationCommand
|
||||||
import bot.molt.android.protocol.ClawdbotScreenCommand
|
import bot.molt.android.protocol.MoltbotScreenCommand
|
||||||
import bot.molt.android.protocol.ClawdbotSmsCommand
|
import bot.molt.android.protocol.MoltbotSmsCommand
|
||||||
import kotlinx.coroutines.TimeoutCancellationException
|
import kotlinx.coroutines.TimeoutCancellationException
|
||||||
|
|
||||||
private const val TAG = "NodeCommandHandlers"
|
private const val TAG = "NodeCommandHandlers"
|
||||||
@ -28,10 +28,10 @@ internal suspend fun NodeRuntime.routeInvoke(
|
|||||||
paramsJson: String?
|
paramsJson: String?
|
||||||
): GatewaySession.InvokeResult {
|
): GatewaySession.InvokeResult {
|
||||||
// Background restrictions
|
// Background restrictions
|
||||||
if (command.startsWith(ClawdbotCanvasCommand.NamespacePrefix) ||
|
if (command.startsWith(MoltbotCanvasCommand.NamespacePrefix) ||
|
||||||
command.startsWith(ClawdbotCanvasA2UICommand.NamespacePrefix) ||
|
command.startsWith(MoltbotCanvasA2UICommand.NamespacePrefix) ||
|
||||||
command.startsWith(ClawdbotCameraCommand.NamespacePrefix) ||
|
command.startsWith(MoltbotCameraCommand.NamespacePrefix) ||
|
||||||
command.startsWith(ClawdbotScreenCommand.NamespacePrefix)
|
command.startsWith(MoltbotScreenCommand.NamespacePrefix)
|
||||||
) {
|
) {
|
||||||
if (!isForeground.value) {
|
if (!isForeground.value) {
|
||||||
return GatewaySession.InvokeResult.error(
|
return GatewaySession.InvokeResult.error(
|
||||||
@ -42,7 +42,7 @@ internal suspend fun NodeRuntime.routeInvoke(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Camera check
|
// Camera check
|
||||||
if (command.startsWith(ClawdbotCameraCommand.NamespacePrefix) && !cameraEnabled.value) {
|
if (command.startsWith(MoltbotCameraCommand.NamespacePrefix) && !cameraEnabled.value) {
|
||||||
return GatewaySession.InvokeResult.error(
|
return GatewaySession.InvokeResult.error(
|
||||||
code = "CAMERA_DISABLED",
|
code = "CAMERA_DISABLED",
|
||||||
message = "CAMERA_DISABLED: enable Camera in Settings",
|
message = "CAMERA_DISABLED: enable Camera in Settings",
|
||||||
@ -50,7 +50,7 @@ internal suspend fun NodeRuntime.routeInvoke(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Location check
|
// Location check
|
||||||
if (command.startsWith(ClawdbotLocationCommand.NamespacePrefix) &&
|
if (command.startsWith(MoltbotLocationCommand.NamespacePrefix) &&
|
||||||
locationMode.value == LocationMode.Off
|
locationMode.value == LocationMode.Off
|
||||||
) {
|
) {
|
||||||
return GatewaySession.InvokeResult.error(
|
return GatewaySession.InvokeResult.error(
|
||||||
@ -60,19 +60,19 @@ internal suspend fun NodeRuntime.routeInvoke(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return when (command) {
|
return when (command) {
|
||||||
ClawdbotCanvasCommand.Present.rawValue -> handleCanvasPresent(paramsJson)
|
MoltbotCanvasCommand.Present.rawValue -> handleCanvasPresent(paramsJson)
|
||||||
ClawdbotCanvasCommand.Hide.rawValue -> GatewaySession.InvokeResult.ok(null)
|
MoltbotCanvasCommand.Hide.rawValue -> GatewaySession.InvokeResult.ok(null)
|
||||||
ClawdbotCanvasCommand.Navigate.rawValue -> handleCanvasNavigate(paramsJson)
|
MoltbotCanvasCommand.Navigate.rawValue -> handleCanvasNavigate(paramsJson)
|
||||||
ClawdbotCanvasCommand.Eval.rawValue -> handleCanvasEval(paramsJson)
|
MoltbotCanvasCommand.Eval.rawValue -> handleCanvasEval(paramsJson)
|
||||||
ClawdbotCanvasCommand.Snapshot.rawValue -> handleCanvasSnapshot(paramsJson)
|
MoltbotCanvasCommand.Snapshot.rawValue -> handleCanvasSnapshot(paramsJson)
|
||||||
ClawdbotCanvasA2UICommand.Reset.rawValue -> handleA2UIReset()
|
MoltbotCanvasA2UICommand.Reset.rawValue -> handleA2UIReset()
|
||||||
ClawdbotCanvasA2UICommand.Push.rawValue,
|
MoltbotCanvasA2UICommand.Push.rawValue,
|
||||||
ClawdbotCanvasA2UICommand.PushJSONL.rawValue -> handleA2UIPush(command, paramsJson)
|
MoltbotCanvasA2UICommand.PushJSONL.rawValue -> handleA2UIPush(command, paramsJson)
|
||||||
ClawdbotCameraCommand.Snap.rawValue -> handleCameraSnap(paramsJson)
|
MoltbotCameraCommand.Snap.rawValue -> handleCameraSnap(paramsJson)
|
||||||
ClawdbotCameraCommand.Clip.rawValue -> handleCameraClip(paramsJson)
|
MoltbotCameraCommand.Clip.rawValue -> handleCameraClip(paramsJson)
|
||||||
ClawdbotLocationCommand.Get.rawValue -> handleLocationGet(paramsJson)
|
MoltbotLocationCommand.Get.rawValue -> handleLocationGet(paramsJson)
|
||||||
ClawdbotScreenCommand.Record.rawValue -> handleScreenRecord(paramsJson)
|
MoltbotScreenCommand.Record.rawValue -> handleScreenRecord(paramsJson)
|
||||||
ClawdbotSmsCommand.Send.rawValue -> handleSmsSend(paramsJson)
|
MoltbotSmsCommand.Send.rawValue -> handleSmsSend(paramsJson)
|
||||||
else -> GatewaySession.InvokeResult.error(
|
else -> GatewaySession.InvokeResult.error(
|
||||||
code = "INVALID_REQUEST",
|
code = "INVALID_REQUEST",
|
||||||
message = "INVALID_REQUEST: unknown command",
|
message = "INVALID_REQUEST: unknown command",
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package bot.molt.android
|
package bot.molt.android
|
||||||
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import bot.molt.android.protocol.ClawdbotCanvasA2UICommand
|
import bot.molt.android.protocol.MoltbotCanvasA2UICommand
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.serialization.json.JsonArray
|
import kotlinx.serialization.json.JsonArray
|
||||||
import kotlinx.serialization.json.JsonObject
|
import kotlinx.serialization.json.JsonObject
|
||||||
@ -141,7 +141,7 @@ internal fun NodeRuntime.decodeA2uiMessages(command: String, paramsJson: String?
|
|||||||
val jsonlField = (obj["jsonl"] as? JsonPrimitive)?.content?.trim().orEmpty()
|
val jsonlField = (obj["jsonl"] as? JsonPrimitive)?.content?.trim().orEmpty()
|
||||||
val hasMessagesArray = obj["messages"] is JsonArray
|
val hasMessagesArray = obj["messages"] is JsonArray
|
||||||
|
|
||||||
if (command == ClawdbotCanvasA2UICommand.PushJSONL.rawValue || (!hasMessagesArray && jsonlField.isNotBlank())) {
|
if (command == MoltbotCanvasA2UICommand.PushJSONL.rawValue || (!hasMessagesArray && jsonlField.isNotBlank())) {
|
||||||
val jsonl = jsonlField
|
val jsonl = jsonlField
|
||||||
if (jsonl.isBlank()) throw IllegalArgumentException("INVALID_REQUEST: jsonl required")
|
if (jsonl.isBlank()) throw IllegalArgumentException("INVALID_REQUEST: jsonl required")
|
||||||
val messages = jsonl
|
val messages = jsonl
|
||||||
|
|||||||
@ -17,7 +17,7 @@ import com.google.firebase.messaging.RemoteMessage
|
|||||||
* Handles both notification messages (shown automatically when app backgrounded)
|
* Handles both notification messages (shown automatically when app backgrounded)
|
||||||
* and data messages (always delivered to this handler).
|
* and data messages (always delivered to this handler).
|
||||||
*/
|
*/
|
||||||
class ClawdbotMessagingService : FirebaseMessagingService() {
|
class MoltbotMessagingService : FirebaseMessagingService() {
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
@ -127,8 +127,8 @@ class ClawdbotMessagingService : FirebaseMessagingService() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val TAG = "ClawdbotFCM"
|
private const val TAG = "MoltbotFCM"
|
||||||
private const val CHANNEL_ID = "clawdbot_chat"
|
private const val CHANNEL_ID = "moltbot_chat"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ class ClawdbotMessagingService : FirebaseMessagingService() {
|
|||||||
* Falls back to regular SharedPreferences only if encryption fails (rare edge cases).
|
* Falls back to regular SharedPreferences only if encryption fails (rare edge cases).
|
||||||
*/
|
*/
|
||||||
object PushTokenStore {
|
object PushTokenStore {
|
||||||
private const val PREFS_NAME = "clawdbot_push_secure"
|
private const val PREFS_NAME = "moltbot_push_secure"
|
||||||
private const val KEY_FCM_TOKEN = "fcm_token"
|
private const val KEY_FCM_TOKEN = "fcm_token"
|
||||||
private const val TAG = "PushTokenStore"
|
private const val TAG = "PushTokenStore"
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user