Bladeren bron

Add icon Notification

Marino Faggiana 8 jaren geleden
bovenliggende
commit
873a7c2d85

+ 1 - 0
iOSClient/CCImages.h

@@ -67,6 +67,7 @@
 #define image_settingsManagePhotosChange        @"settingsManagePhotosChangeNextcloud"
 #define image_tabBarFile                        @"tabBarNextcloud"
 #define image_thumbs                            @"thumbsNextcloud"
+#define image_notification                      @"notification"
 
 #endif
 

+ 23 - 0
iOSClient/Images.xcassets/notification.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "notification.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "notification@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "notification@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
iOSClient/Images.xcassets/notification.imageset/notification.png


BIN
iOSClient/Images.xcassets/notification.imageset/notification@2x.png


BIN
iOSClient/Images.xcassets/notification.imageset/notification@3x.png


+ 43 - 10
iOSClient/Main/CCMain.m

@@ -202,7 +202,8 @@
     // Menu e Bar
     [self createReMainMenu];
     [self createReSelectMenu];
-    if (_isSelectedMode) [self setUINavigationBarSeleziona];
+    if (_isSelectedMode)
+        [self setUINavigationBarSelected];
     else [self setUINavigationBarDefault];
     
     // Plus Button
@@ -519,15 +520,27 @@
 {
     [CCAspect aspectNavigationControllerBar:self.navigationController.navigationBar hidden:NO];
     
+    UIBarButtonItem *buttonMore, *buttonNotification;
+    
     // =
-    UIImage *icon = [UIImage imageNamed:image_more];
-    UIBarButtonItem *buttonMore = [[UIBarButtonItem alloc] initWithImage:icon style:UIBarButtonItemStylePlain target:self action:@selector(toggleReMainMenu)];
+    buttonMore = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:image_more] style:UIBarButtonItemStylePlain target:self action:@selector(toggleReMainMenu)];
     buttonMore.enabled = true;
     
     // <
     self.navigationController.navigationBar.hidden = NO;
-    //self.navigationItem.rightBarButtonItems = [[NSArray alloc] initWithObjects:buttonAdd, buttonMore, nil];
-    self.navigationItem.rightBarButtonItems = [[NSArray alloc] initWithObjects:buttonMore, nil];
+    
+    // Notification
+    if ([app.listOfNotifications count] > 0) {
+        
+        buttonNotification = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:image_notification] style:UIBarButtonItemStylePlain target:self action:@selector(getNotificationsOfServerSuccess:)];
+        buttonNotification.tintColor = COLOR_BRAND;
+        buttonNotification.enabled = true;
+    }
+    
+    if (buttonNotification)
+        self.navigationItem.rightBarButtonItems = [[NSArray alloc] initWithObjects:buttonMore, buttonNotification, nil];
+    else
+        self.navigationItem.rightBarButtonItems = [[NSArray alloc] initWithObjects:buttonMore, nil];
 
     self.navigationItem.leftBarButtonItem = nil;
     
@@ -535,7 +548,7 @@
     [app.reSelectMenu close];
 }
 
-- (void)setUINavigationBarSeleziona
+- (void)setUINavigationBarSelected
 {
     [CCAspect aspectNavigationControllerBar:self.navigationController.navigationBar hidden:NO];
     
@@ -1018,9 +1031,10 @@
     AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
     
     // Insert/update listOfNotifications in Dictionary App.listOfNotifications
-    for (OCNotifications *notification in listOfNotifications)
-        [appDelegate.listOfNotifications setObject:notification forKey:[NSString stringWithFormat:@"%lu", (unsigned long)notification.idNotification]];
-        
+    if ([listOfNotifications isKindOfClass:[NSArray class]])
+        for (OCNotifications *notification in listOfNotifications)
+            [appDelegate.listOfNotifications setObject:notification forKey:[NSString stringWithFormat:@"%lu", (unsigned long)notification.idNotification]];
+    
     for (NSString *idNotification in app.listOfNotifications) {
         
         OCNotifications *notification = [app.listOfNotifications objectForKey:idNotification];
@@ -1056,6 +1070,9 @@
             for (OCNotificationsAction *action in notification.actions)
                 [buttons addObject:action.label];
             
+            // Add button postpone
+            [buttons addObject:NSLocalizedString(@"_postpone_", nil)];
+            
             [JSAlertView alert:notification.subject withTitle:nil buttons:buttons withCompletionHandler:^(NSInteger buttonIndex, NSString *buttonTitle) {
                 
                 NSLog(@"Pressed %@ at index %ld", buttonTitle, (long)buttonIndex);
@@ -1075,6 +1092,10 @@
             }];
         }
     }
+    
+    // Update NavigationBar
+    if (!_isSelectedMode)
+        [self setUINavigationBarDefault];
 }
 
 - (void)setNotificationServerSuccess:(CCMetadataNet *)metadataNet
@@ -1084,16 +1105,28 @@
     [appDelegate.listOfNotifications removeObjectForKey:metadataNet.identifier];
     
     NSLog(@"delete Notification id :%@", metadataNet.identifier);
+    
+    // Update NavigationBar
+    if (!_isSelectedMode)
+        [self setUINavigationBarDefault];
 }
 
 - (void)setNotificationServerFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
 {
     NSLog(@"Error Notification");
+    
+    // Update NavigationBar
+    if (!_isSelectedMode)
+        [self setUINavigationBarDefault];
 }
 
 - (void)getNotificationsOfServerFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
 {
     NSLog(@"Error Notification");
+    
+    // Update NavigationBar
+    if (!_isSelectedMode)
+        [self setUINavigationBarDefault];
 }
 
 #pragma --------------------------------------------------------------------------------------------
@@ -4839,7 +4872,7 @@
     _isSelectedMode = edit;
     
     if (edit)
-        [self setUINavigationBarSeleziona];
+        [self setUINavigationBarSelected];
     else
         [self setUINavigationBarDefault];
     

+ 2 - 2
iOSClient/PhotosCameraUpload/CCPhotosCameraUpload.m

@@ -134,7 +134,7 @@
     self.navigationItem.title = NSLocalizedString(@"_photo_camera_", nil);
 }
 
-- (void)setUINavigationBarSeleziona
+- (void)setUINavigationBarSelected
 {
     UIImage *icon;
     
@@ -160,7 +160,7 @@
     _cellEditing = edit;
     
     if (edit)
-        [self setUINavigationBarSeleziona];
+        [self setUINavigationBarSelected];
     else
         [self setUINavigationBarDefault];
 }