summaryrefslogtreecommitdiff
path: root/Juick/AppDelegate.m
diff options
context:
space:
mode:
Diffstat (limited to 'Juick/AppDelegate.m')
-rw-r--r--Juick/AppDelegate.m25
1 files changed, 22 insertions, 3 deletions
diff --git a/Juick/AppDelegate.m b/Juick/AppDelegate.m
index b5c4e27..7be4424 100644
--- a/Juick/AppDelegate.m
+++ b/Juick/AppDelegate.m
@@ -20,16 +20,23 @@
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[UINavigationBar appearance] setTintColor:[ColorScheme linkColor]];
+ [[UINavigationBar appearance] setBackgroundColor:[ColorScheme headerBackground]];
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [ColorScheme linkColor]}];
+ [[UIToolbar appearance] setTintColor:[ColorScheme linkColor]];
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
return YES;
}
-
--(void) application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
- [[UIApplication sharedApplication] registerForRemoteNotifications];
+- (void)registerForRemoteNotifications {
+ UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
+ center.delegate = self;
+ [center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error){
+ if(!error){
+ [[UIApplication sharedApplication] registerForRemoteNotifications];
+ }
+ }];
}
-(void) application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
@@ -46,4 +53,16 @@
NSLog(@"Error: %@", [error debugDescription]);
}
+//Called when a notification is delivered to a foreground app.
+-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler{
+ NSLog(@"User Info : %@",notification.request.content.userInfo);
+ completionHandler(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge);
+}
+
+//Called to let your app know which action was selected by the user for a given notification.
+-(void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler{
+ NSLog(@"User Info : %@",response.notification.request.content.userInfo);
+ completionHandler();
+}
+
@end