diff --git a/lib/core/utils/misc.dart b/lib/core/utils/misc.dart index ebd3104c..7c9a89c2 100644 --- a/lib/core/utils/misc.dart +++ b/lib/core/utils/misc.dart @@ -2,14 +2,9 @@ import 'package:fl_lib/fl_lib.dart'; import 'package:plain_notification_token/plain_notification_token.dart'; Future getToken() async { - if (isIOS) { - final plainNotificationToken = PlainNotificationToken(); - plainNotificationToken.requestPermission(); - - // If you want to wait until Permission dialog close, - // you need wait changing setting registered. - await plainNotificationToken.onIosSettingsRegistered.first; - return await plainNotificationToken.getToken(); - } - return null; + if (!isIOS) return null; + final instance = ApnsToken()..requestPermission(); + // Wait until Permission dialog closed + await instance.onIosSettingsRegistered.first; + return await instance.getToken(); } diff --git a/pubspec.lock b/pubspec.lock index 14b30215..922721ed 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -989,10 +989,11 @@ packages: plain_notification_token: dependency: "direct main" description: - name: plain_notification_token - sha256: "32481c1c6ad76613ed38822ffe819ea5d5534f9e07e8ff1d44aafe069f45ea24" - url: "https://pub.dev" - source: hosted + path: "." + ref: master + resolved-ref: "5f56dc56a6670e2533b0caa7d09d31d16e6c7663" + url: "https://github.com/lollipopkit/plain_notification_token" + source: git version: "0.0.4" platform: dependency: transitive diff --git a/pubspec.yaml b/pubspec.yaml index cfe5a168..b28b96a2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,7 +17,6 @@ dependencies: after_layout: ^1.1.0 easy_isolate: ^1.3.0 intl: ^0.19.0 - plain_notification_token: ^0.0.4 highlight: ^0.7.0 flutter_highlight: ^0.7.0 code_text_field: ^1.1.0 @@ -50,6 +49,10 @@ dependencies: git: url: https://github.com/lollipopkit/dart_computer ref: master + plain_notification_token: + git: + url: https://github.com/lollipopkit/plain_notification_token + ref: master fl_lib: git: url: https://github.com/lppcg/fl_lib