@@ -9,8 +9,9 @@ extern void handlerCString(const char * _Nonnull, HsStablePtr);
99@end
1010
1111HsStablePtr globalHandler = 0;
12−HsStablePtr global_didRegisterForRemoteNotificationsWithDeviceToken = 0;
12+BOOL global_requestAuthorizationWithOptions = NO;
1313BOOL global_registerForRemoteNotifications = NO;
14+HsStablePtr global_didRegisterForRemoteNotificationsWithDeviceToken = 0;
1415
1516@implementation AppDelegate
1617
@@ -21,11 +22,13 @@ BOOL global_registerForRemoteNotifications = NO;
2122 self.window.backgroundColor = [UIColor whiteColor];
2223 [self.window makeKeyAndVisible];
2324 UNUserNotificationCenter* center = [UNUserNotificationCenter currentNotificationCenter];
24− [center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert + UNAuthorizationOptionSound + UNAuthorizationOptionBadge)
25− completionHandler:^(BOOL granted, NSError * _Nullable error) {
26− // Handler used to alter application behavior based on types of notifications authorized
27− // Perhaps we don't need to do anything here.
28− }];
25+ if (global_requestAuthorizationWithOptions) {
26+ [center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert + UNAuthorizationOptionSound + UNAuthorizationOptionBadge)
27+ completionHandler:^(BOOL granted, NSError * _Nullable error) {
28+ // Handler used to alter application behavior based on types of notifications authorized
29+ // Perhaps we don't need to do anything here.
30+ }];
31+ }
2932 if (global_registerForRemoteNotifications) {
3033 [application registerForRemoteNotifications];
3134 }
@@ -71,12 +74,14 @@ BOOL global_registerForRemoteNotifications = NO;
7174
7275void runInWKWebView(HsStablePtr handler,
7376 const char * _Nonnull progName,
77+ const BOOL hs_requestAuthorizationWithOptions,
7478 const BOOL hs_registerForRemoteNotifications,
7579 HsStablePtr hs_didRegisterForRemoteNotificationsWithDeviceToken) {
7680 @autoreleasepool {
7781 globalHandler = handler;
78− global_didRegisterForRemoteNotificationsWithDeviceToken = hs_didRegisterForRemoteNotificationsWithDeviceToken;
82+ global_requestAuthorizationWithOptions = hs_requestAuthorizationWithOptions;
7983 global_registerForRemoteNotifications = hs_registerForRemoteNotifications;
84+ global_didRegisterForRemoteNotificationsWithDeviceToken = hs_didRegisterForRemoteNotificationsWithDeviceToken;
8085 const char * _Nonnull argv [] = {"", 0};
8186 UIApplicationMain(0, argv, nil, NSStringFromClass([AppDelegate class]));
8287 }