浏览代码

improvements

Marino Faggiana 8 年之前
父节点
当前提交
30f28ae389
共有 3 个文件被更改,包括 66 次插入54 次删除
  1. 5 0
      iOSClient/AppDelegate.m
  2. 9 4
      iOSClient/Main/CCMain.m
  3. 52 50
      iOSClient/Main/CCMore.swift

+ 5 - 0
iOSClient/AppDelegate.m

@@ -902,6 +902,11 @@
     UITabBarController *tabBarController = [splitViewController.viewControllers firstObject];
     
     UIButton *buttonPlus = [tabBarController.view viewWithTag:99];
+    
+    UIImage *buttonImage = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"tabBarPlus"] color:[NCBrandColor sharedInstance].brand];
+    [buttonPlus setBackgroundImage:buttonImage forState:UIControlStateNormal];
+    [buttonPlus setBackgroundImage:buttonImage forState:UIControlStateHighlighted];
+    
     if (buttonPlus) {
 
         if (visible) {

+ 9 - 4
iOSClient/Main/CCMain.m

@@ -1199,6 +1199,10 @@
             [UIImagePNGRepresentation(avatar) writeToFile:[NSString stringWithFormat:@"%@/avatar.png", app.directoryUser] atomically:YES];
         else
             [[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/avatar.png", app.directoryUser] error:nil];
+        
+        dispatch_async(dispatch_get_main_queue(), ^{
+            [[NSNotificationCenter defaultCenter] postNotificationName:@"changeUserProfile" object:nil];
+        });
     });
 }
 
@@ -1220,10 +1224,7 @@
     // Update capabilities db
     [CCCoreData setCapabilities:capabilities account:app.activeAccount];
     
-    // Change Theming color
-    [app settingThemingColorBrand];
-    
-    // Download Theming Background
+    // Download Theming Background & Change Theming color
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
         
         if (k_option_use_themingBackground == YES) {
@@ -1234,6 +1235,10 @@
             else
                 [[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/themingBackground.png", app.directoryUser] error:nil];
         }
+        
+        dispatch_async(dispatch_get_main_queue(), ^{
+            [app settingThemingColorBrand];
+        });
     });
 
     // Search bar if change version

+ 52 - 50
iOSClient/Main/CCMore.swift

@@ -63,10 +63,12 @@ class CCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
         themingBackground.isUserInteractionEnabled = true
         themingBackground.addGestureRecognizer(tapImageLogo)
         
-        // Notification theming
+        // Notification
         NotificationCenter.default.addObserver(self, selector: #selector(self.changeTheming), name: NSNotification.Name(rawValue: "changeTheming"), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(self.changeUserProfile), name: NSNotification.Name(rawValue: "changeUserProfile"), object: nil)
     }
     
+    // Apparirà
     override func viewWillAppear(_ animated: Bool) {
         
         super.viewWillAppear(animated)
@@ -128,56 +130,14 @@ class CCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
             }
         }
         
-        // Display Name user & Quota
-        tableAccont = CCCoreData.getActiveAccount()
-        if (tableAccont != nil) {
-        
-            if let displayName = self.tableAccont!.displayName {
-                if displayName.isEmpty {
-                    labelUsername.text = self.tableAccont!.user
-                }
-                else{
-                    labelUsername.text = self.tableAccont!.displayName
-                }
-            }
-            else{
-                labelUsername.text = self.tableAccont!.user
-            }
-            
-            progressQuota.progress = Float((self.tableAccont?.quotaRelative)!) / 100
-            progressQuota.progressTintColor = NCBrandColor.sharedInstance.brand
-
-            let quota : String = CCUtility.transformedSize(Double((self.tableAccont?.quotaTotal)!))
-            let quotaUsed : String = CCUtility.transformedSize(Double((self.tableAccont?.quotaUsed)!))
-        
-            labelQuota.text = String.localizedStringWithFormat(NSLocalizedString("_quota_using_", comment: ""), quotaUsed, quota)
-            
-            // imageLogo
-            let theminBackgroundFile = UIImage.init(contentsOfFile: "\(appDelegate.directoryUser!)/themingBackground.png")
-            if (theminBackgroundFile != nil) {
-                themingBackground.image = theminBackgroundFile
-            } else {
-                themingBackground.image = UIImage.init(named: NCBrandImages.sharedInstance.themingBackground)
-            }
-        }
-        
         if (quotaMenu.count > 0) {
             
             let item = quotaMenu[0]
             labelQuotaExternalSite.text = item.name
         }
         
-        // Avatar
-        let themingAvatarFile : UIImage? = UIImage.init(contentsOfFile: "\(appDelegate.directoryUser!)/avatar.png")
-        
-        if (themingAvatarFile != nil) {
-        
-            themingAvatar.image = themingAvatarFile
-            
-        } else {
-            
-            themingAvatar.image = UIImage.init(named: "moreAvatar")
-        }
+        // User data
+        changeUserProfile()
         
         // Title
         self.navigationItem.title = NSLocalizedString("_more_", comment: "")
@@ -194,11 +154,6 @@ class CCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
         tableView.reloadData()
     }
     
-    override func viewDidAppear(_ animated: Bool) {
-        super.viewDidAppear(animated)
-
-    }
-    
     override func viewWillDisappear(_ animated: Bool) {
         super.viewWillDisappear(animated)
         
@@ -207,11 +162,58 @@ class CCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
     
     func changeTheming() {
         
+        // Theming Background
+        let theminBackgroundFile = UIImage.init(contentsOfFile: "\(appDelegate.directoryUser!)/themingBackground.png")
+        if (theminBackgroundFile != nil) {
+            themingBackground.image = theminBackgroundFile
+        } else {
+            themingBackground.image = UIImage.init(named: NCBrandImages.sharedInstance.themingBackground)
+        }
+
         if (self.isViewLoaded && (self.view.window != nil)) {
             appDelegate.changeTheming(self)
         }
     }
     
+    func changeUserProfile() {
+     
+        let themingAvatarFile : UIImage? = UIImage.init(contentsOfFile: "\(appDelegate.directoryUser!)/avatar.png")
+        
+        if (themingAvatarFile != nil) {
+            
+            themingAvatar.image = themingAvatarFile
+            
+        } else {
+            
+            themingAvatar.image = UIImage.init(named: "moreAvatar")
+        }
+        
+        // Display Name user & Quota
+        tableAccont = CCCoreData.getActiveAccount()
+        if (tableAccont != nil) {
+            
+            if let displayName = self.tableAccont!.displayName {
+                if displayName.isEmpty {
+                    labelUsername.text = self.tableAccont!.user
+                }
+                else{
+                    labelUsername.text = self.tableAccont!.displayName
+                }
+            }
+            else{
+                labelUsername.text = self.tableAccont!.user
+            }
+            
+            progressQuota.progress = Float((self.tableAccont?.quotaRelative)!) / 100
+            progressQuota.progressTintColor = NCBrandColor.sharedInstance.brand
+            
+            let quota : String = CCUtility.transformedSize(Double((self.tableAccont?.quotaTotal)!))
+            let quotaUsed : String = CCUtility.transformedSize(Double((self.tableAccont?.quotaUsed)!))
+            
+            labelQuota.text = String.localizedStringWithFormat(NSLocalizedString("_quota_using_", comment: ""), quotaUsed, quota)
+        }
+    }
+    
     func numberOfSections(in tableView: UITableView) -> Int {
         
         return 2