Skip to content

Commit 31cc669

Browse files
committed
Handle FCM tokenTask.exception nullability
When we upgrade to FCM 23.0.8 they changed the defintion to tokenTask.exception to be possiblity null. Updated our code to handle thier change. Changes above also exposed the getToken defintion was out of sync with between PushRegistratorAbstractGoogle and PushRegistratorFCM so this was addressed.
1 parent 9961531 commit 31cc669

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

OneSignalSDK/onesignal/notifications/src/main/java/com/onesignal/notifications/internal/registration/impl/PushRegistratorAbstractGoogle.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import com.onesignal.notifications.internal.registration.IPushRegistrator
3434
import com.onesignal.user.internal.subscriptions.SubscriptionStatus
3535
import kotlinx.coroutines.delay
3636
import java.io.IOException
37+
import java.util.concurrent.ExecutionException
3738

3839
/**
3940
* The abstract google push registration service. It is expected [PushRegistratorFCM] will extend
@@ -47,7 +48,7 @@ internal abstract class PushRegistratorAbstractGoogle(
4748
IPushRegistrator, IPushRegistratorCallback {
4849
abstract val providerName: String
4950

50-
@Throws(Throwable::class)
51+
@Throws(ExecutionException::class, InterruptedException::class, IOException::class)
5152
abstract suspend fun getToken(senderId: String): String
5253

5354
override suspend fun registerForPush(): IPushRegistrator.RegisterResult {

OneSignalSDK/onesignal/notifications/src/main/java/com/onesignal/notifications/internal/registration/impl/PushRegistratorFCM.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ internal class PushRegistratorFCM(
128128
try {
129129
token = Tasks.await(tokenTask)
130130
} catch (e: ExecutionException) {
131-
throw tokenTask.exception
131+
throw tokenTask.exception ?: e
132132
}
133133
}
134134

0 commit comments

Comments
 (0)