Add FirebasePushManager#unregister

This commit is contained in:
andrew
2023-06-09 09:52:11 +09:30
parent 95bb9ee441
commit ba6eca2443
5 changed files with 100 additions and 48 deletions

View File

@@ -36,6 +36,24 @@ data class SubscriptionRequest(
val enc_key: String
)
@Serializable
data class UnsubscriptionRequest(
/** the 33-byte account being subscribed to; typically a session ID */
val pubkey: String,
/** when the pubkey starts with 05 (i.e. a session ID) this is the ed25519 32-byte pubkey associated with the session ID */
val session_ed25519: String?,
/** 32-byte swarm authentication subkey; omitted (or null) when not using subkey auth (new closed groups) */
val subkey_tag: String? = null,
/** the signature unix timestamp in seconds, not ms */
val sig_ts: Long,
/** the 64-byte ed25519 signature */
val signature: String,
/** the string identifying the notification service, "firebase" for android (currently) */
val service: String,
/** dict of service-specific data, currently just "token" field with device-specific token but different services might have other requirements */
val service_info: Map<String, String>,
)
@Serializable
data class SubscriptionResponse(
val error: Int? = null,
@@ -60,6 +78,14 @@ data class SubscriptionResponse(
} else null to null
}
@Serializable
data class UnsubscribeResponse(
val error: Int? = null,
val message: String? = null,
val success: Boolean? = null,
val removed: Boolean? = null,
)
@Serializable
data class PushNotificationMetadata(
/** Account ID (such as Session ID or closed group ID) where the message arrived **/

View File

@@ -318,7 +318,7 @@ interface TextSecurePreferences {
}
@JvmStatic
fun setFCMToken(context: Context, value: String) {
fun setFCMToken(context: Context, value: String?) {
setStringPreference(context, FCM_TOKEN, value)
}