diff --git a/example/pubspec.lock b/example/pubspec.lock
index 50e6fbb..0419a9f 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -14,7 +14,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.8.2"
+ version: "2.9.0"
boolean_selector:
dependency: transitive
description:
@@ -28,21 +28,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
- charcode:
- dependency: transitive
- description:
- name: charcode
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.3.1"
+ version: "1.2.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.1.1"
collection:
dependency: transitive
description:
@@ -70,7 +63,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0"
+ version: "1.3.1"
ffi:
dependency: transitive
description:
@@ -138,7 +131,7 @@ packages:
path: "../flutter_apns"
relative: true
source: path
- version: "1.5.4"
+ version: "1.6.0"
flutter_apns_only:
dependency: transitive
description:
@@ -190,28 +183,28 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.11"
+ version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
- version: "0.1.4"
+ version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.7.0"
+ version: "1.8.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.1"
+ version: "1.8.2"
path_provider:
dependency: "direct main"
description:
@@ -300,7 +293,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.2"
+ version: "1.9.0"
stack_trace:
dependency: transitive
description:
@@ -321,21 +314,21 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.1.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
+ version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.4.9"
+ version: "0.4.12"
timezone:
dependency: transitive
description:
diff --git a/flutter_apns/README.md b/flutter_apns/README.md
index 4d700f0..b2b8d57 100644
--- a/flutter_apns/README.md
+++ b/flutter_apns/README.md
@@ -112,6 +112,16 @@ If only care about apns - use flutter_apns_only plugin. It does not depend on fi
```
+## Critical Alert
+For use iOS Critical alert request entitlement to Apple throught this form:
+[https://developer.apple.com/contact/request/notifications-critical-alerts-entitlement/](https://developer.apple.com/contact/request/notifications-critical-alerts-entitlement/)
+
+After that assign CriticalAlert capability to your app identifier, update provisioning profiles and add this entry to app `.entitlements` file in your code:
+```
+ com.apple.developer.usernotifications.critical-alerts
+
+```
+
## Troubleshooting
1. Ensure that you are testing on actual device. NOTE: this may not be needed from 11.4: https://ohmyswift.com/blog/2020/02/13/simulating-remote-push-notifications-in-a-simulator/
diff --git a/flutter_apns/pubspec.lock b/flutter_apns/pubspec.lock
index feda0ef..b7c3f30 100644
--- a/flutter_apns/pubspec.lock
+++ b/flutter_apns/pubspec.lock
@@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.8.2"
+ version: "2.9.0"
boolean_selector:
dependency: transitive
description:
@@ -21,21 +21,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
- charcode:
- dependency: transitive
- description:
- name: charcode
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.3.1"
+ version: "1.2.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.1.1"
collection:
dependency: transitive
description:
@@ -49,7 +42,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0"
+ version: "1.3.1"
firebase_core:
dependency: "direct main"
description:
@@ -127,28 +120,28 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.11"
+ version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
- version: "0.1.4"
+ version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.7.0"
+ version: "1.8.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.1"
+ version: "1.8.2"
plugin_platform_interface:
dependency: transitive
description:
@@ -167,7 +160,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.2"
+ version: "1.9.0"
stack_trace:
dependency: transitive
description:
@@ -188,21 +181,21 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.1.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
+ version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.4.9"
+ version: "0.4.12"
vector_math:
dependency: transitive
description:
diff --git a/flutter_apns/pubspec.yaml b/flutter_apns/pubspec.yaml
index 6ccee89..8ccdf9d 100644
--- a/flutter_apns/pubspec.yaml
+++ b/flutter_apns/pubspec.yaml
@@ -19,7 +19,7 @@ dependencies:
sdk: flutter
firebase_core: ^1.20.0
firebase_messaging: ^12.0.1
- flutter_apns_only: ^1.5.2
+ flutter_apns_only: ^1.6.1
dev_dependencies:
flutter_test:
diff --git a/flutter_apns_only/ios/Classes/FlutterApnsPlugin.swift b/flutter_apns_only/ios/Classes/FlutterApnsPlugin.swift
index 6b4c401..58acccf 100644
--- a/flutter_apns_only/ios/Classes/FlutterApnsPlugin.swift
+++ b/flutter_apns_only/ios/Classes/FlutterApnsPlugin.swift
@@ -129,6 +129,9 @@ func getFlutterError(_ error: Error) -> FlutterError {
var provisionalRequested = false
if #available(iOS 12.0, *) {
+ if readBool("criticalAlert") {
+ options.append(.criticalAlert)
+ }
if readBool("provisional") {
options.append(.provisional)
provisionalRequested = true
@@ -145,12 +148,16 @@ func getFlutterError(_ error: Error) -> FlutterError {
}
center.getNotificationSettings { (settings) in
- let map = [
+ var map = [
"sound": settings.soundSetting == .enabled,
"badge": settings.badgeSetting == .enabled,
"alert": settings.alertSetting == .enabled,
"provisional": granted && provisionalRequested
]
+
+ if #available(iOS 12.0, *) {
+ map["criticalAlert"] = settings.criticalAlertSetting == .enabled
+ }
self.channel.invokeMethod("onIosSettingsRegistered", arguments: map)
}
diff --git a/flutter_apns_only/lib/flutter_apns_only.dart b/flutter_apns_only/lib/flutter_apns_only.dart
index 55fa133..f84b343 100644
--- a/flutter_apns_only/lib/flutter_apns_only.dart
+++ b/flutter_apns_only/lib/flutter_apns_only.dart
@@ -33,14 +33,16 @@ class ApnsPushConnectorOnly {
ApnsMessageHandler? _onResume;
Future requestNotificationPermissions(
- [IosNotificationSettings iosSettings = const IosNotificationSettings()]) async {
+ [IosNotificationSettings iosSettings =
+ const IosNotificationSettings()]) async {
final bool? result = await _channel.invokeMethod(
'requestNotificationPermissions', iosSettings.toMap());
return result ?? false;
}
Future getAuthorizationStatus() async {
- return _authorizationStatusForString(await _channel.invokeMethod('getAuthorizationStatus', []));
+ return _authorizationStatusForString(
+ await _channel.invokeMethod('getAuthorizationStatus', []));
}
final StreamController _iosSettingsStreamController =
@@ -142,23 +144,30 @@ class ApnsPushConnectorOnly {
}
class IosNotificationSettings {
- const IosNotificationSettings({
- this.sound = true,
- this.alert = true,
- this.badge = true,
- });
+ const IosNotificationSettings(
+ {this.sound = true,
+ this.alert = true,
+ this.badge = true,
+ this.criticalAlert = false});
IosNotificationSettings._fromMap(Map settings)
: sound = settings['sound'],
alert = settings['alert'],
- badge = settings['badge'];
+ badge = settings['badge'],
+ criticalAlert = settings['criticalAlert'];
final bool? sound;
final bool? alert;
final bool? badge;
+ final bool? criticalAlert;
Map toMap() {
- return {'sound': sound, 'alert': alert, 'badge': badge};
+ return {
+ 'sound': sound,
+ 'alert': alert,
+ 'badge': badge,
+ 'criticalAlert': criticalAlert
+ };
}
@override
diff --git a/flutter_apns_only/pubspec.lock b/flutter_apns_only/pubspec.lock
index ef5e1b7..7af4cde 100644
--- a/flutter_apns_only/pubspec.lock
+++ b/flutter_apns_only/pubspec.lock
@@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.8.2"
+ version: "2.9.0"
boolean_selector:
dependency: transitive
description:
@@ -21,21 +21,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
- charcode:
- dependency: transitive
- description:
- name: charcode
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.3.1"
+ version: "1.2.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.1.1"
collection:
dependency: transitive
description:
@@ -49,7 +42,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0"
+ version: "1.3.1"
flutter:
dependency: "direct main"
description: flutter
@@ -66,28 +59,28 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.11"
+ version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
- version: "0.1.4"
+ version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.7.0"
+ version: "1.8.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.1"
+ version: "1.8.2"
sky_engine:
dependency: transitive
description: flutter
@@ -99,7 +92,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.2"
+ version: "1.9.0"
stack_trace:
dependency: transitive
description:
@@ -120,21 +113,21 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.1.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
+ version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.4.9"
+ version: "0.4.12"
vector_math:
dependency: transitive
description:
diff --git a/flutter_apns_only/pubspec.yaml b/flutter_apns_only/pubspec.yaml
index b3e5eb9..a813dd8 100644
--- a/flutter_apns_only/pubspec.yaml
+++ b/flutter_apns_only/pubspec.yaml
@@ -1,6 +1,6 @@
name: flutter_apns_only
description: APNS push notification plugin. Works only on iOS. See flutter_apns for apns & firebase combo
-version: 1.6.0
+version: 1.6.1
homepage: https://github.com/mwaylabs/flutter-apns
environment: