diff --git a/app/src/play/kotlin/org/thoughtcrime/securesms/notifications/FirebasePushManager.kt b/app/src/play/kotlin/org/thoughtcrime/securesms/notifications/FirebasePushManager.kt index c169f145c9..702d686122 100644 --- a/app/src/play/kotlin/org/thoughtcrime/securesms/notifications/FirebasePushManager.kt +++ b/app/src/play/kotlin/org/thoughtcrime/securesms/notifications/FirebasePushManager.kt @@ -143,7 +143,6 @@ class FirebasePushManager(private val context: Context, private val prefs: TextS retryIfNeeded(maxRetryCount) { getResponseBody(request.build()).map { response -> if (response.success == true) { - TextSecurePreferences.setIsUsingFCM(context, false) TextSecurePreferences.setFCMToken(context, null) Log.d("Loki", "Unsubscribe FCM success") } else { diff --git a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageHandler.kt b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageHandler.kt index 0d24f630a0..7643f67b94 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageHandler.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageHandler.kt @@ -478,7 +478,7 @@ private fun handleNewClosedGroup(sender: String, sentTimestamp: Long, groupPubli // Set expiration timer storage.setExpirationTimer(groupID, expireTimer) // Notify the PN server - PushNotificationAPI.subscribeGroup(groupPublicKey, userPublicKey) + PushNotificationAPI.subscribeGroup(groupPublicKey) // Notify the user if (userPublicKey == sender && !groupExists) { val threadID = storage.getOrCreateThreadIdFor(Address.fromSerialized(groupID)) diff --git a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/notifications/MessageNotifier.kt b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/notifications/MessageNotifier.kt index 37480543b7..8de01ca53e 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/notifications/MessageNotifier.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/notifications/MessageNotifier.kt @@ -14,4 +14,4 @@ interface MessageNotifier { fun updateNotification(context: Context, threadId: Long, signal: Boolean) fun updateNotification(context: Context, signal: Boolean, reminderCount: Int) fun clearReminder(context: Context) -} \ No newline at end of file +} diff --git a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/notifications/PushNotificationAPI.kt b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/notifications/PushNotificationAPI.kt index a7c260ab94..aff4987f8a 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/notifications/PushNotificationAPI.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/notifications/PushNotificationAPI.kt @@ -59,38 +59,22 @@ object PushNotificationAPI { fun subscribeGroup( closedGroupPublicKey: String, publicKey: String = MessagingModuleConfiguration.shared.storage.getUserPublicKey()!! - ) { - performGroupOperation(ClosedGroupOperation.Subscribe, closedGroupPublicKey, publicKey) - } + ) = performGroupOperation(ClosedGroupOperation.Subscribe, closedGroupPublicKey, publicKey) private fun subscribeGroups( closedGroupPublicKeys: Collection = MessagingModuleConfiguration.shared.storage.getAllClosedGroupPublicKeys(), publicKey: String = MessagingModuleConfiguration.shared.storage.getUserPublicKey()!! - ) { - performGroupOperations(ClosedGroupOperation.Subscribe, closedGroupPublicKeys, publicKey) - } + ) = closedGroupPublicKeys.forEach { performGroupOperation(ClosedGroupOperation.Subscribe, it, publicKey) } fun unsubscribeGroup( closedGroupPublicKey: String, publicKey: String = MessagingModuleConfiguration.shared.storage.getUserPublicKey()!! - ) { - performGroupOperation(ClosedGroupOperation.Unsubscribe, closedGroupPublicKey, publicKey) - } + ) = performGroupOperation(ClosedGroupOperation.Unsubscribe, closedGroupPublicKey, publicKey) private fun unsubscribeGroups( closedGroupPublicKeys: Collection = MessagingModuleConfiguration.shared.storage.getAllClosedGroupPublicKeys(), publicKey: String = MessagingModuleConfiguration.shared.storage.getUserPublicKey()!! - ) { - performGroupOperations(ClosedGroupOperation.Unsubscribe, closedGroupPublicKeys, publicKey) - } - - private fun performGroupOperations( - operation: ClosedGroupOperation, - closedGroupPublicKeys: Collection, - publicKey: String - ) { - closedGroupPublicKeys.forEach { performGroupOperation(operation, it, publicKey) } - } + ) = closedGroupPublicKeys.forEach { performGroupOperation(ClosedGroupOperation.Unsubscribe, it, publicKey) } private fun performGroupOperation( operation: ClosedGroupOperation, diff --git a/libsession/src/main/java/org/session/libsession/utilities/TextSecurePreferences.kt b/libsession/src/main/java/org/session/libsession/utilities/TextSecurePreferences.kt index b1ab1090f7..9c13699dda 100644 --- a/libsession/src/main/java/org/session/libsession/utilities/TextSecurePreferences.kt +++ b/libsession/src/main/java/org/session/libsession/utilities/TextSecurePreferences.kt @@ -986,7 +986,6 @@ interface TextSecurePreferences { fun clearAll(context: Context) { getDefaultSharedPreferences(context).edit().clear().commit() } - } }