Add missing FCM support classes
ClippyAuto CI / build (push) Has been cancelled

- ClippyResponseBus: SharedFlow event bus for FCM + sync responses
- ResponseDedup: SHA-256 dedup with sliding window
- Updated ClippyFCMService and FCMTokenManager to use MatrixRestClient
- Added putAccountData() to MatrixRestClient for FCM token storage

Co-authored-by: Spirit <spirit@hobbs.farm>
This commit is contained in:
2026-03-08 23:17:33 -05:00
parent fc39098ff5
commit e8ca593164
5 changed files with 130 additions and 53 deletions
@@ -164,6 +164,27 @@ class MatrixRestClient(
}
}
/**
* Store account data in Matrix.
* Used for FCM token registration so n8n can read it.
*/
suspend fun putAccountData(userId: String, type: String, data: Map<String, String>): Boolean {
return try {
val response = client.put("$homeserverUrl/_matrix/client/v3/user/$userId/account_data/$type") {
header("Authorization", "Bearer $accessToken")
contentType(ContentType.Application.Json)
setBody(buildJsonObject {
data.forEach { (key, value) -> put(key, value) }
}.toString())
}
response.status.isSuccess()
} catch (e: Exception) {
Log.e("MatrixREST", "putAccountData failed", e)
false
}
}
fun shutdown() {
httpClient.close()
}