@@ -50,18 +50,24 @@ class CodePushMessagingService : FirebaseMessagingService(),
5050 override fun onMessageReceived (remoteMessage : RemoteMessage ) {
5151 Timber .d(" From: ${remoteMessage.from} " )
5252
53- // Check if message contains a data payload.
54- if (remoteMessage.data.isNotEmpty()) {
55- Timber .d(" Message data payload: ${remoteMessage.data} " )
56- val notification = remoteMessage.parse()
57-
58- if (notification != null ) {
59- val (type, titleKey, messageContent) = notification
60- val title = titleKey.localizedStringByKey(resources) ? : titleKey
61- val body = messageContent.localizedText(title, resources, currencyUtils)
62- notify(type, title, body)
63- } else {
64- notify(" Unknown" , resources.getString(R .string.app_name), " You have a new message." )
53+ LibsodiumInitializer .initializeWithCallback {
54+ // Check if message contains a data payload.
55+ if (remoteMessage.data.isNotEmpty()) {
56+ Timber .d(" Message data payload: ${remoteMessage.data} " )
57+ val notification = remoteMessage.parse()
58+
59+ if (notification != null ) {
60+ val (type, titleKey, messageContent) = notification
61+ val title = titleKey.localizedStringByKey(resources) ? : titleKey
62+ val body = messageContent.localizedText(title, resources, currencyUtils)
63+ notify(type, title, body)
64+ } else {
65+ notify(
66+ " Unknown" ,
67+ resources.getString(R .string.app_name),
68+ " You have a new message."
69+ )
70+ }
6571 }
6672 }
6773 }
0 commit comments