Skip to content

Commit

Permalink
Use resolveDeferred instead of resolveResult
Browse files Browse the repository at this point in the history
  • Loading branch information
crow committed Jan 5, 2025
1 parent e67eba3 commit 3521b93
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions android/src/main/kotlin/com/airship/flutter/AirshipPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,14 @@ class AirshipPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
}
}
"push#isUserNotificationsEnabled" -> result.resolveResult(call) { proxy.push.isUserNotificationsEnabled() }
"push#getNotificationStatus" -> result.resolveResult(call) {
"push#getNotificationStatus" -> result.resolveDeferred(call) { callback ->
coroutineScope.launch {
proxy.push.getNotificationStatus()
try {
val status = proxy.push.getNotificationStatus()
callback(status, null)
} catch (e: Exception) {
callback(null, e)
}
}
}
"push#getActiveNotifications" -> result.resolveResult(call) {
Expand Down

0 comments on commit 3521b93

Please sign in to comment.