- 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:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user