Skip to content

Commit

Permalink
chore(notifications): updated native pigeon breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tyllark committed Dec 4, 2024
1 parent 4033a70 commit ae55ce7
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AmplifyLifecycleObserver : DefaultLifecycleObserver {
// Only set launchNotification to null when app resumes from background.
if (!isAppLaunch) {
AmplifyPushNotificationsPlugin.launchNotification = null
AmplifyPushNotificationsPlugin.flutterApi!!.nullifyLaunchNotification { }
AmplifyPushNotificationsPlugin.flutterApi!!.nullifyLaunchNotification(NoOpVoidResult())
}
refreshToken()
isAppLaunch = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class AmplifyPushNotificationsPlugin(
// Force init stream handlers when the app is opened from killed state so old handlers are removed.
StreamHandlers.initStreamHandlers(true)
StreamHandlers.initEventChannels(mainBinaryMessenger!!)
PushNotificationsHostApi.setup(mainBinaryMessenger!!, this)
PushNotificationsHostApi.setUp(mainBinaryMessenger!!, this)
flutterApi = PushNotificationsFlutterApi(mainBinaryMessenger!!)
applicationContext = flutterPluginBinding.applicationContext
sharedPreferences = applicationContext.getSharedPreferences(
Expand All @@ -117,7 +117,7 @@ class AmplifyPushNotificationsPlugin(
mainBinaryMessenger = null
_flutterEngineCache.clear()
StreamHandlers.deInit()
PushNotificationsHostApi.setup(binding.binaryMessenger, null)
PushNotificationsHostApi.setUp(binding.binaryMessenger, null)
flutterApi = null
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

package com.amazonaws.amplify.amplify_push_notifications

class NoOpVoidResult : PushNotificationsHostApiBindings.VoidResult {
override fun success() {}

override fun error(error: Throwable) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ class PushNotificationBackgroundService : JobIntentService(), MethodChannel.Meth
intent.extras?.let { bundle ->
bundle.getNotificationPayload()?.let {
AmplifyPushNotificationsPlugin.flutterApi!!.onNotificationReceivedInBackground(
it.toWritableMap()
) {}
it.toWritableMap(),
NoOpVoidResult()
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ class PushNotificationFirebaseMessagingService : FirebaseMessagingService() {
} else {
val notificationPayload = payload.toWritableMap()
AmplifyPushNotificationsPlugin.flutterApi!!.onNotificationReceivedInBackground(
notificationPayload
) {}
notificationPayload,
NoOpVoidResult()
)
}

}
Expand Down

0 comments on commit ae55ce7

Please sign in to comment.