mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-19 19:18:27 +00:00
cleanup
This commit is contained in:
parent
5c9dc36460
commit
0e0ab9151e
@ -36,7 +36,6 @@ import org.session.libsession.avatars.AvatarHelper;
|
||||
import org.session.libsession.database.MessageDataProvider;
|
||||
import org.session.libsession.messaging.MessagingModuleConfiguration;
|
||||
import org.session.libsession.messaging.sending_receiving.notifications.MessageNotifier;
|
||||
import org.session.libsession.messaging.sending_receiving.notifications.PushNotificationAPI;
|
||||
import org.session.libsession.messaging.sending_receiving.pollers.ClosedGroupPollerV2;
|
||||
import org.session.libsession.messaging.sending_receiving.pollers.Poller;
|
||||
import org.session.libsession.snode.SnodeModule;
|
||||
|
@ -7,8 +7,6 @@ import org.session.libsession.messaging.messages.signal.IncomingTextMessage
|
||||
import org.session.libsession.messaging.messages.signal.OutgoingTextMessage
|
||||
import org.session.libsession.messaging.open_groups.OpenGroup
|
||||
import org.session.libsession.messaging.open_groups.OpenGroupApi
|
||||
import org.session.libsession.messaging.sending_receiving.notifications.PushNotificationAPI
|
||||
import org.session.libsession.messaging.sending_receiving.pollers.ClosedGroupPollerV2
|
||||
import org.session.libsession.utilities.Address
|
||||
import org.session.libsession.utilities.GroupUtil
|
||||
import org.session.libsession.utilities.recipients.Recipient
|
||||
@ -21,7 +19,6 @@ import org.thoughtcrime.securesms.crypto.KeyPairUtilities
|
||||
import org.thoughtcrime.securesms.dependencies.DatabaseComponent
|
||||
import org.thoughtcrime.securesms.groups.GroupManager
|
||||
import java.security.SecureRandom
|
||||
import java.util.*
|
||||
import kotlin.random.asKotlinRandom
|
||||
|
||||
object MockDataGenerator {
|
||||
|
@ -18,7 +18,7 @@ import nl.komponents.kovenant.functional.map
|
||||
import okhttp3.MediaType
|
||||
import okhttp3.Request
|
||||
import okhttp3.RequestBody
|
||||
import org.session.libsession.messaging.sending_receiving.notifications.PushNotificationAPI
|
||||
import org.session.libsession.messaging.sending_receiving.notifications.LegacyGroupsPushManager
|
||||
import org.session.libsession.messaging.sending_receiving.notifications.PushNotificationMetadata
|
||||
import org.session.libsession.messaging.sending_receiving.notifications.Response
|
||||
import org.session.libsession.messaging.sending_receiving.notifications.SubscriptionRequest
|
||||
@ -63,6 +63,8 @@ class FirebasePushManager (private val context: Context): PushManager {
|
||||
}
|
||||
|
||||
fun decrypt(encPayload: ByteArray): ByteArray? {
|
||||
Log.d(TAG, "decrypt() called")
|
||||
|
||||
val encKey = getOrCreateNotificationKey()
|
||||
val nonce = encPayload.take(AEAD.XCHACHA20POLY1305_IETF_NPUBBYTES).toByteArray()
|
||||
val payload = encPayload.drop(AEAD.XCHACHA20POLY1305_IETF_NPUBBYTES).toByteArray()
|
||||
@ -90,19 +92,23 @@ class FirebasePushManager (private val context: Context): PushManager {
|
||||
|
||||
@Synchronized
|
||||
override fun refresh(force: Boolean) {
|
||||
Log.d(TAG, "refresh() called with: force = $force")
|
||||
|
||||
firebaseInstanceIdJob?.apply {
|
||||
if (force) cancel() else if (isActive) return
|
||||
}
|
||||
|
||||
firebaseInstanceIdJob = getFcmInstanceId { task ->
|
||||
when {
|
||||
task.isSuccessful -> task.result?.token?.let { refresh(it, force).get() }
|
||||
task.isSuccessful -> try { task.result?.token?.let { refresh(it, force).get() } } catch(e: Exception) { Log.d(TAG, "refresh() failed", e) }
|
||||
else -> Log.w(TAG, "getFcmInstanceId failed." + task.exception)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun refresh(token: String, force: Boolean): Promise<*, Exception> {
|
||||
Log.d(TAG, "refresh() called with: token = $token, force = $force")
|
||||
|
||||
val userPublicKey = getLocalNumber(context) ?: return emptyPromise()
|
||||
val userEdKey = KeyPairUtilities.getUserED25519KeyPair(context) ?: return emptyPromise()
|
||||
|
||||
@ -137,11 +143,12 @@ class FirebasePushManager (private val context: Context): PushManager {
|
||||
publicKey: String,
|
||||
userEd25519Key: KeyPair,
|
||||
namespaces: List<Int> = listOf(Namespace.DEFAULT)
|
||||
): Promise<*, Exception> = PushNotificationAPI.register(token) and getSubscription(
|
||||
): Promise<*, Exception> = LegacyGroupsPushManager.register(token, publicKey) and getSubscription(
|
||||
token, publicKey, userEd25519Key, namespaces
|
||||
) fail {
|
||||
Log.e(TAG, "Couldn't register for FCM due to error: $it.", it)
|
||||
} success {
|
||||
Log.d(TAG, "register() success!!")
|
||||
tokenManager.fcmToken = token
|
||||
}
|
||||
|
||||
@ -149,7 +156,7 @@ class FirebasePushManager (private val context: Context): PushManager {
|
||||
token: String,
|
||||
userPublicKey: String,
|
||||
userEdKey: KeyPair
|
||||
): Promise<*, Exception> = PushNotificationAPI.unregister() and getUnsubscription(
|
||||
): Promise<*, Exception> = LegacyGroupsPushManager.unregister() and getUnsubscription(
|
||||
token, userPublicKey, userEdKey
|
||||
) fail {
|
||||
Log.e(TAG, "Couldn't unregister for FCM due to error: ${it}.", it)
|
||||
@ -212,14 +219,14 @@ class FirebasePushManager (private val context: Context): PushManager {
|
||||
retryIfNeeded(maxRetryCount) { getResponseBody(path, requestParameters) }
|
||||
|
||||
private inline fun <reified T: Response> getResponseBody(path: String, requestParameters: String): Promise<T, Exception> {
|
||||
val url = "${PushNotificationAPI.server}/$path"
|
||||
val url = "${LegacyGroupsPushManager.server}/$path"
|
||||
val body = RequestBody.create(MediaType.get("application/json"), requestParameters)
|
||||
val request = Request.Builder().url(url).post(body).build()
|
||||
|
||||
return OnionRequestAPI.sendOnionRequest(
|
||||
request,
|
||||
PushNotificationAPI.server,
|
||||
PushNotificationAPI.serverPublicKey,
|
||||
LegacyGroupsPushManager.server,
|
||||
LegacyGroupsPushManager.serverPublicKey,
|
||||
Version.V4
|
||||
).map { response ->
|
||||
response.body!!.inputStream()
|
||||
|
@ -8,13 +8,15 @@ import dagger.hilt.android.AndroidEntryPoint
|
||||
import org.session.libsession.messaging.jobs.BatchMessageReceiveJob
|
||||
import org.session.libsession.messaging.jobs.JobQueue
|
||||
import org.session.libsession.messaging.jobs.MessageReceiveParameters
|
||||
import org.session.libsession.messaging.sending_receiving.notifications.PushNotificationAPI
|
||||
import org.session.libsession.messaging.sending_receiving.notifications.LegacyGroupsPushManager
|
||||
import org.session.libsession.messaging.utilities.MessageWrapper
|
||||
import org.session.libsession.utilities.TextSecurePreferences
|
||||
import org.session.libsignal.utilities.Base64
|
||||
import org.session.libsignal.utilities.Log
|
||||
import javax.inject.Inject
|
||||
|
||||
private const val TAG = "PushNotificationService"
|
||||
|
||||
@AndroidEntryPoint
|
||||
class PushNotificationService : FirebaseMessagingService() {
|
||||
|
||||
@ -22,27 +24,26 @@ class PushNotificationService : FirebaseMessagingService() {
|
||||
|
||||
override fun onNewToken(token: String) {
|
||||
super.onNewToken(token)
|
||||
Log.d("Loki", "New FCM token: $token.")
|
||||
Log.d(TAG, "New FCM token: $token.")
|
||||
TextSecurePreferences.getLocalNumber(this) ?: return
|
||||
if (TextSecurePreferences.getLocalNumber(this) != token) {
|
||||
if (TextSecurePreferences.getFCMToken(this) != token) {
|
||||
pushManager.refresh(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onMessageReceived(message: RemoteMessage) {
|
||||
Log.d("Loki", "Received a push notification.")
|
||||
Log.d(TAG, "Received a push notification.")
|
||||
val data: ByteArray? = if (message.data.containsKey("spns")) {
|
||||
// this is a v2 push notification
|
||||
try {
|
||||
pushManager.decrypt(Base64.decode(message.data["enc_payload"]))
|
||||
} catch(e: Exception) {
|
||||
Log.e("Loki", "Invalid push notification: ${e.message}")
|
||||
Log.e(TAG, "Invalid push notification: ${e.message}")
|
||||
return
|
||||
}
|
||||
} else {
|
||||
// old v1 push notification; we still need this for receiving legacy closed group notifications
|
||||
val base64EncodedData = message.data?.get("ENCRYPTED_DATA")
|
||||
base64EncodedData?.let { Base64.decode(it) }
|
||||
message.data?.get("ENCRYPTED_DATA")?.let(Base64::decode)
|
||||
}
|
||||
if (data != null) {
|
||||
try {
|
||||
@ -50,10 +51,10 @@ class PushNotificationService : FirebaseMessagingService() {
|
||||
val job = BatchMessageReceiveJob(listOf(MessageReceiveParameters(envelopeAsData)), null)
|
||||
JobQueue.shared.add(job)
|
||||
} catch (e: Exception) {
|
||||
Log.d("Loki", "Failed to unwrap data for message due to error: $e.")
|
||||
Log.d(TAG, "Failed to unwrap data for message due to error: $e.")
|
||||
}
|
||||
} else {
|
||||
Log.d("Loki", "Failed to decode data for message.")
|
||||
Log.d(TAG, "Failed to decode data for message.")
|
||||
val builder = NotificationCompat.Builder(this, NotificationChannels.OTHER)
|
||||
.setSmallIcon(network.loki.messenger.R.drawable.ic_notification)
|
||||
.setColor(resources.getColor(network.loki.messenger.R.color.textsecure_primary))
|
||||
@ -66,8 +67,8 @@ class PushNotificationService : FirebaseMessagingService() {
|
||||
}
|
||||
|
||||
override fun onDeletedMessages() {
|
||||
Log.d("Loki", "Called onDeletedMessages.")
|
||||
Log.d(TAG, "Called onDeletedMessages.")
|
||||
super.onDeletedMessages()
|
||||
PushNotificationAPI.register()
|
||||
LegacyGroupsPushManager.register()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,14 +3,13 @@ package org.session.libsession.messaging.jobs
|
||||
import com.esotericsoftware.kryo.Kryo
|
||||
import com.esotericsoftware.kryo.io.Input
|
||||
import com.esotericsoftware.kryo.io.Output
|
||||
import nl.komponents.kovenant.functional.map
|
||||
import okhttp3.MediaType
|
||||
import okhttp3.Request
|
||||
import okhttp3.RequestBody
|
||||
import org.session.libsession.messaging.jobs.Job.Companion.MAX_BUFFER_SIZE
|
||||
|
||||
import org.session.libsession.messaging.sending_receiving.notifications.PushNotificationAPI
|
||||
import org.session.libsession.messaging.sending_receiving.notifications.PushNotificationAPI.server
|
||||
import org.session.libsession.messaging.sending_receiving.notifications.LegacyGroupsPushManager
|
||||
import org.session.libsession.messaging.sending_receiving.notifications.LegacyGroupsPushManager.server
|
||||
import org.session.libsession.messaging.utilities.Data
|
||||
import org.session.libsession.snode.SnodeMessage
|
||||
import org.session.libsession.snode.OnionRequestAPI
|
||||
@ -42,7 +41,7 @@ class NotifyPNServerJob(val message: SnodeMessage) : Job {
|
||||
OnionRequestAPI.sendOnionRequest(
|
||||
request,
|
||||
server,
|
||||
PushNotificationAPI.serverPublicKey,
|
||||
LegacyGroupsPushManager.serverPublicKey,
|
||||
Version.V2
|
||||
) success { response ->
|
||||
when (response.info["code"]) {
|
||||
|
@ -8,7 +8,7 @@ import nl.komponents.kovenant.deferred
|
||||
import org.session.libsession.messaging.MessagingModuleConfiguration
|
||||
import org.session.libsession.messaging.messages.control.ClosedGroupControlMessage
|
||||
import org.session.libsession.messaging.sending_receiving.MessageSender.Error
|
||||
import org.session.libsession.messaging.sending_receiving.notifications.PushNotificationAPI
|
||||
import org.session.libsession.messaging.sending_receiving.notifications.LegacyGroupsPushManager
|
||||
import org.session.libsession.messaging.sending_receiving.pollers.ClosedGroupPollerV2
|
||||
import org.session.libsession.snode.SnodeAPI
|
||||
import org.session.libsession.utilities.Address
|
||||
@ -83,7 +83,7 @@ fun MessageSender.create(name: String, members: Collection<String>): Promise<Str
|
||||
}
|
||||
|
||||
// Notify the PN server
|
||||
PushNotificationAPI.subscribeGroup(groupPublicKey, userPublicKey)
|
||||
LegacyGroupsPushManager.register(publicKey = userPublicKey)
|
||||
// Start polling
|
||||
ClosedGroupPollerV2.shared.startPolling(groupPublicKey)
|
||||
// Fulfill the promise
|
||||
|
@ -23,7 +23,7 @@ import org.session.libsession.messaging.open_groups.OpenGroupApi
|
||||
import org.session.libsession.messaging.sending_receiving.attachments.PointerAttachment
|
||||
import org.session.libsession.messaging.sending_receiving.data_extraction.DataExtractionNotificationInfoMessage
|
||||
import org.session.libsession.messaging.sending_receiving.link_preview.LinkPreview
|
||||
import org.session.libsession.messaging.sending_receiving.notifications.PushNotificationAPI
|
||||
import org.session.libsession.messaging.sending_receiving.notifications.LegacyGroupsPushManager
|
||||
import org.session.libsession.messaging.sending_receiving.pollers.ClosedGroupPollerV2
|
||||
import org.session.libsession.messaging.sending_receiving.quotes.QuoteModel
|
||||
import org.session.libsession.messaging.utilities.SessionId
|
||||
@ -479,7 +479,7 @@ private fun handleNewClosedGroup(sender: String, sentTimestamp: Long, groupPubli
|
||||
// Set expiration timer
|
||||
storage.setExpirationTimer(groupID, expireTimer)
|
||||
// Notify the PN server
|
||||
PushNotificationAPI.subscribeGroup(groupPublicKey)
|
||||
LegacyGroupsPushManager.register(publicKey = userPublicKey)
|
||||
// Notify the user
|
||||
if (userPublicKey == sender && !groupExists) {
|
||||
val threadID = storage.getOrCreateThreadIdFor(Address.fromSerialized(groupID))
|
||||
@ -772,7 +772,7 @@ fun MessageReceiver.disableLocalGroupAndUnsubscribe(groupPublicKey: String, grou
|
||||
storage.setActive(groupID, false)
|
||||
storage.removeMember(groupID, Address.fromSerialized(userPublicKey))
|
||||
// Notify the PN server
|
||||
PushNotificationAPI.unsubscribeGroup(groupPublicKey, userPublicKey)
|
||||
LegacyGroupsPushManager.register(publicKey = userPublicKey)
|
||||
// Stop polling
|
||||
ClosedGroupPollerV2.shared.stopPolling(groupPublicKey)
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import android.annotation.SuppressLint
|
||||
import nl.komponents.kovenant.Promise
|
||||
import nl.komponents.kovenant.all
|
||||
import nl.komponents.kovenant.functional.map
|
||||
import nl.komponents.kovenant.task
|
||||
import okhttp3.MediaType
|
||||
import okhttp3.Request
|
||||
import okhttp3.RequestBody
|
||||
@ -18,50 +17,50 @@ import org.session.libsignal.utilities.emptyPromise
|
||||
import org.session.libsignal.utilities.retryIfNeeded
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object PushNotificationAPI {
|
||||
private const val TAG = "PushNotificationAPI"
|
||||
object LegacyGroupsPushManager {
|
||||
private const val TAG = "LegacyGroupsPushManager"
|
||||
|
||||
val context = MessagingModuleConfiguration.shared.context
|
||||
const val server = "https://push.getsession.org"
|
||||
const val serverPublicKey: String = "d7557fe563e2610de876c0ac7341b62f3c82d5eea4b62c702392ea4368f51b3b"
|
||||
private const val legacyServer = "https://live.apns.getsession.org"
|
||||
private const val legacyServer = "https://dev.apns.getsession.org"
|
||||
private const val legacyServerPublicKey = "642a6585919742e5a2d4dc51244964fbcd8bcab2b75612407de58b810740d049"
|
||||
private const val maxRetryCount = 4
|
||||
|
||||
private enum class ClosedGroupOperation(val rawValue: String) {
|
||||
Subscribe("subscribe_closed_group"),
|
||||
Unsubscribe("unsubscribe_closed_group");
|
||||
}
|
||||
|
||||
fun register(
|
||||
token: String? = TextSecurePreferences.getLegacyFCMToken(context)
|
||||
): Promise<*, Exception> = all(
|
||||
register(token, TextSecurePreferences.getLocalNumber(context)),
|
||||
subscribeGroups()
|
||||
)
|
||||
|
||||
fun register(token: String?, publicKey: String?): Promise<Unit, Exception> =
|
||||
token: String? = TextSecurePreferences.getFCMToken(context),
|
||||
publicKey: String? = TextSecurePreferences.getLocalNumber(context),
|
||||
legacyGroupPublicKeys: Collection<String> = MessagingModuleConfiguration.shared.storage.getAllClosedGroupPublicKeys()
|
||||
): Promise<Unit, Exception> =
|
||||
retryIfNeeded(maxRetryCount) {
|
||||
val parameters = mapOf("token" to token!!, "pubKey" to publicKey!!)
|
||||
val url = "$legacyServer/register"
|
||||
Log.d(TAG, "register() called")
|
||||
|
||||
val parameters = mapOf(
|
||||
"token" to token!!,
|
||||
"pubKey" to publicKey!!,
|
||||
"legacyGroupPublicKeys" to legacyGroupPublicKeys.takeIf { it.isNotEmpty() }!!
|
||||
)
|
||||
val url = "$legacyServer/register_legacy_groups_only"
|
||||
val body = RequestBody.create(MediaType.get("application/json"), JsonUtil.toJson(parameters))
|
||||
val request = Request.Builder().url(url).post(body).build()
|
||||
|
||||
OnionRequestAPI.sendOnionRequest(request, legacyServer, legacyServerPublicKey, Version.V2).map { response ->
|
||||
when (response.info["code"]) {
|
||||
null, 0 -> throw Exception("error: ${response.info["message"]}.")
|
||||
else -> TextSecurePreferences.setLegacyFCMToken(context, token)
|
||||
else -> Log.d(TAG, "register() success!!")
|
||||
}
|
||||
} fail { exception ->
|
||||
Log.d(TAG, "Couldn't register for FCM due to error: ${exception}.")
|
||||
}
|
||||
} fail { exception ->
|
||||
Log.d(TAG, "Couldn't register for FCM due to error: ${exception}.")
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister push notifications for 1-1 conversations as this is now done in FirebasePushManager.
|
||||
*/
|
||||
fun unregister(): Promise<*, Exception> {
|
||||
val token = TextSecurePreferences.getLegacyFCMToken(context) ?: emptyPromise()
|
||||
Log.d(TAG, "unregister() called")
|
||||
|
||||
val token = TextSecurePreferences.getFCMToken(context) ?: emptyPromise()
|
||||
|
||||
return retryIfNeeded(maxRetryCount) {
|
||||
val parameters = mapOf( "token" to token )
|
||||
@ -75,13 +74,14 @@ object PushNotificationAPI {
|
||||
legacyServerPublicKey,
|
||||
Version.V2
|
||||
) success {
|
||||
android.util.Log.d(TAG, "unregister() success!!")
|
||||
|
||||
when (it.info["code"]) {
|
||||
null, 0 -> throw Exception("error: ${it.info["message"]}.")
|
||||
else -> Log.d(TAG, "unregisterV1 success token: $token")
|
||||
}
|
||||
TextSecurePreferences.clearLegacyFCMToken(context)
|
||||
} fail {
|
||||
exception -> Log.d(TAG, "Couldn't disable FCM with token: $token due to error: ${exception}.")
|
||||
Log.d(TAG, "Couldn't disable FCM with token: $token due to error: $it.")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -91,30 +91,20 @@ object PushNotificationAPI {
|
||||
fun subscribeGroup(
|
||||
closedGroupPublicKey: String,
|
||||
publicKey: String = MessagingModuleConfiguration.shared.storage.getUserPublicKey()!!
|
||||
) = performGroupOperation(ClosedGroupOperation.Subscribe, closedGroupPublicKey, publicKey)
|
||||
|
||||
private fun subscribeGroups(
|
||||
closedGroupPublicKeys: Collection<String> = MessagingModuleConfiguration.shared.storage.getAllClosedGroupPublicKeys(),
|
||||
publicKey: String = MessagingModuleConfiguration.shared.storage.getUserPublicKey()!!
|
||||
) = closedGroupPublicKeys.map { performGroupOperation(ClosedGroupOperation.Subscribe, it, publicKey) }.let(::all)
|
||||
) = performGroupOperation("subscribe_closed_group", closedGroupPublicKey, publicKey)
|
||||
|
||||
fun unsubscribeGroup(
|
||||
closedGroupPublicKey: String,
|
||||
publicKey: String = MessagingModuleConfiguration.shared.storage.getUserPublicKey()!!
|
||||
) = performGroupOperation(ClosedGroupOperation.Unsubscribe, closedGroupPublicKey, publicKey)
|
||||
|
||||
private fun unsubscribeGroups(
|
||||
closedGroupPublicKeys: Collection<String> = MessagingModuleConfiguration.shared.storage.getAllClosedGroupPublicKeys(),
|
||||
publicKey: String = MessagingModuleConfiguration.shared.storage.getUserPublicKey()!!
|
||||
) = closedGroupPublicKeys.map { performGroupOperation(ClosedGroupOperation.Unsubscribe, it, publicKey) }.let(::all)
|
||||
) = performGroupOperation("unsubscribe_closed_group", closedGroupPublicKey, publicKey)
|
||||
|
||||
private fun performGroupOperation(
|
||||
operation: ClosedGroupOperation,
|
||||
operation: String,
|
||||
closedGroupPublicKey: String,
|
||||
publicKey: String
|
||||
): Promise<*, Exception> {
|
||||
val parameters = mapOf( "closedGroupPublicKey" to closedGroupPublicKey, "pubKey" to publicKey )
|
||||
val url = "$legacyServer/${operation.rawValue}"
|
||||
val url = "$legacyServer/$operation"
|
||||
val body = RequestBody.create(MediaType.get("application/json"), JsonUtil.toJson(parameters))
|
||||
val request = Request.Builder().url(url).post(body).build()
|
||||
|
||||
@ -127,10 +117,10 @@ object PushNotificationAPI {
|
||||
) success {
|
||||
when (it.info["code"]) {
|
||||
null, 0 -> throw Exception("${it.info["message"]}")
|
||||
else -> Log.d(TAG, "performGroupOperation success: ${operation.rawValue}")
|
||||
else -> Log.d(TAG, "performGroupOperation success: $operation")
|
||||
}
|
||||
} fail { exception ->
|
||||
Log.d(TAG, "performGroupOperation fail: ${operation.rawValue}: $closedGroupPublicKey due to error: ${exception}.")
|
||||
Log.d(TAG, "performGroupOperation fail: $operation: $closedGroupPublicKey due to error: ${exception}.")
|
||||
}
|
||||
}
|
||||
}
|
@ -250,7 +250,6 @@ interface TextSecurePreferences {
|
||||
const val GIF_METADATA_WARNING = "has_seen_gif_metadata_warning"
|
||||
const val GIF_GRID_LAYOUT = "pref_gif_grid_layout"
|
||||
const val IS_USING_FCM = "pref_is_using_fcm"
|
||||
const val FCM_TOKEN_LEGACY = "pref_fcm_token"
|
||||
const val FCM_TOKEN = "pref_fcm_token_2"
|
||||
const val LAST_FCM_TOKEN_UPLOAD_TIME = "pref_last_fcm_token_upload_time_2"
|
||||
const val LAST_CONFIGURATION_SYNC_TIME = "pref_last_configuration_sync_time"
|
||||
@ -313,21 +312,6 @@ interface TextSecurePreferences {
|
||||
setBooleanPreference(context, IS_USING_FCM, value)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getLegacyFCMToken(context: Context): String? {
|
||||
return getStringPreference(context, FCM_TOKEN_LEGACY, "")
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun setLegacyFCMToken(context: Context, token: String?) {
|
||||
setStringPreference(context, FCM_TOKEN_LEGACY, token)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun clearLegacyFCMToken(context: Context) {
|
||||
removePreference(context, FCM_TOKEN_LEGACY)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getFCMToken(context: Context): String? {
|
||||
return getStringPreference(context, FCM_TOKEN, "")
|
||||
|
Loading…
x
Reference in New Issue
Block a user