diff --git a/apps/multiplatform/android/src/main/java/chat/simplex/app/PushService.kt b/apps/multiplatform/android/src/main/java/chat/simplex/app/PushService.kt index f3cfb06679..37d3a72ad1 100644 --- a/apps/multiplatform/android/src/main/java/chat/simplex/app/PushService.kt +++ b/apps/multiplatform/android/src/main/java/chat/simplex/app/PushService.kt @@ -3,6 +3,9 @@ package chat.simplex.app import chat.simplex.common.model.CC import chat.simplex.common.platform.Log import chat.simplex.common.platform.chatModel +import chat.simplex.common.platform.ntfManager +import chat.simplex.common.views.helpers.generalGetString +import chat.simplex.res.MR import kotlinx.coroutines.* import kotlinx.serialization.Serializable import kotlinx.serialization.json.Json @@ -58,12 +61,22 @@ class PushService: PushService() { override fun onRegistrationFailed(reason: FailedReason, instance: String) { Log.d(TAG, "onRegistrationFailed: $reason") - // TODO: notification to inform about failed registration + val title = generalGetString(MR.strings.icon_descr_instant_notifications) + val text = when (reason) { + FailedReason.NETWORK -> generalGetString(MR.strings.unifiedpush_registration_failed_network) + FailedReason.VAPID_REQUIRED, // Should not happen, VAPID will be required + FailedReason.INTERNAL_ERROR -> generalGetString(MR.strings.unifiedpush_registration_failed_unknown) + FailedReason.ACTION_REQUIRED -> generalGetString(MR.strings.unifiedpush_registration_failed_action) + + } + ntfManager.showMessage(title, text) } override fun onUnregistered(instance: String) { Log.d(TAG, "onUnregistered") - // TODO: notification to inform about unregistration + val title = generalGetString(MR.strings.icon_descr_instant_notifications) + val text = generalGetString(MR.strings.unifiedpush_unregistered) + ntfManager.showMessage(title, text) CoroutineScope(Dispatchers.Default).launch { chatModel.controller.sendCmd( null, diff --git a/apps/multiplatform/android/src/main/java/chat/simplex/app/model/NtfManager.android.kt b/apps/multiplatform/android/src/main/java/chat/simplex/app/model/NtfManager.android.kt index cf19589d4a..b4da80716b 100644 --- a/apps/multiplatform/android/src/main/java/chat/simplex/app/model/NtfManager.android.kt +++ b/apps/multiplatform/android/src/main/java/chat/simplex/app/model/NtfManager.android.kt @@ -231,6 +231,9 @@ object NtfManager { val builder = NotificationCompat.Builder(context, MessageChannel) .setContentTitle(title) .setContentText(text) + .setStyle( + NotificationCompat.BigTextStyle().bigText(text) + ) .setPriority(NotificationCompat.PRIORITY_HIGH) .setGroup(MessageGroup) .setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_CHILDREN) diff --git a/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml b/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml index 39daacf355..5879f49218 100644 --- a/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml +++ b/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml @@ -280,6 +280,10 @@ You don\'t have any push service installed on your device.\n\nPlease installed one and try again.\n\nFor more information, visit\ Select Push Service Multiple push services are installed on your system, please select the service you wish to use. + SimpleX is no longer registered with your UnifiedPush distributor. The distributor may have been uninstalled or been logged out. You should reset your notifications settings. + Registration with your UnifiedPush distributor failed due to a network issue. Please try again when your network is back. + Registration with your UnifiedPush distributor failed due to a missing requirement from your distributor. + Registration with your UnifiedPush distributor failed due to an unknown issue. This could be a missing requirement from your distributor. SimpleX Lock