Marino Faggiana 8 роки тому
батько
коміт
040eb53307

+ 9 - 1
iOSClient/AppDelegate.m

@@ -749,7 +749,7 @@
             backgroundColor = [UIColor colorWithRed:0.588 green:0.797 blue:0.000 alpha:0.90];
             break;
         case TWMessageBarMessageTypeInfo:
-            backgroundColor = [NCBrandColor sharedInstance].nextcloud;
+            backgroundColor = [NCBrandColor sharedInstance].brand;
             break;
         default:
             break;
@@ -989,7 +989,15 @@
         
             [NCBrandColor sharedInstance].brand = [CCGraphics colorFromHexString:tableCapabilities.themingColor];
             [[NSNotificationCenter defaultCenter] postNotificationName:@"changeTheming" object:nil];
+            
+        } else {
+            
+            [NCBrandColor sharedInstance].brand = [NCBrandColor sharedInstance].customer;
         }
+        
+    } else {
+        
+        [NCBrandColor sharedInstance].brand = [NCBrandColor sharedInstance].customer;
     }
 }
 

+ 2 - 1
iOSClient/Brand/NCBrand.swift

@@ -32,11 +32,12 @@ class NCBrandColor: NSObject {
 
     // Color
     public var brand:                   UIColor = UIColor(red: 0.0/255.0, green: 130.0/255.0, blue: 201.0/255.0, alpha: 1.0)    // BLU NC : #0082c9
+    public let customer:                UIColor = UIColor(red: 0.0/255.0, green: 130.0/255.0, blue: 201.0/255.0, alpha: 1.0)    // BLU NC : #0082c9
+
     public var connectionNo:            UIColor = UIColor(red: 204.0/255.0, green: 204.0/255.0, blue: 204.0/255.0, alpha: 1.0)
     public var cryptocloud:             UIColor = UIColor(red: 241.0/255.0, green: 90.0/255.0, blue: 34.0/255.0, alpha: 1.0)
     public var navigationBarProgress:   UIColor = .white
     public var navigationBarText:       UIColor = .white
-    public var nextcloud:               UIColor = UIColor(red: 0.0/255.0, green: 130.0/255.0, blue: 201.0/255.0, alpha: 1.0)    // BLU NC : #0082c9
     public let nextcloudText:           String  = "#0082c9"
     public var menuBackground:          UIColor = .white
     public var moreNormal:              UIColor = .black

+ 5 - 1
iOSClient/FileSystem/CCCoreData.h

@@ -249,13 +249,17 @@
 
 //+ (void)verifyVersionCoreData;
 
++ (void)flushTableAccount:(NSString *)account;
 + (void)flushTableActivityAccount:(NSString *)account;
 + (void)flushTableAutomaticUploadAccount:(NSString *)account selector:(NSString *)selector;
 + (void)flushTableCapabilitiesAccount:(NSString *)account;
++ (void)flushTableCertificates;
 + (void)flushTableDirectoryAccount:(NSString *)account;
++ (void)flushTableExternalSitesAccount:(NSString *)account;
++ (void)flushTableGPS;
 + (void)flushTableLocalFileAccount:(NSString *)account;
 + (void)flushTableMetadataAccount:(NSString *)account;
-+ (void)flushTableGPS;
++ (void)flushTableShareAccount:(NSString *)account;
 
 + (void)flushAllDatabase;
 @end

+ 73 - 11
iOSClient/FileSystem/CCCoreData.m

@@ -2275,6 +2275,26 @@
     }
 }
 
+#pragma --------------------------------------------------------------------------------------------
+#pragma mark ===== Flush Database =====
+#pragma --------------------------------------------------------------------------------------------
+
++ (void)flushTableAccount:(NSString *)account
+{
+    NSManagedObjectContext *context = [NSManagedObjectContext MR_defaultContext];
+    
+    if (account) {
+        
+        [TableAccount MR_deleteAllMatchingPredicate:[NSPredicate predicateWithFormat:@"(account == %@)", account] inContext:context];
+        
+    } else {
+        
+        [TableAccount MR_truncateAllInContext:context];
+    }
+    
+    [context MR_saveToPersistentStoreAndWait];
+}
+
 + (void)flushTableActivityAccount:(NSString *)account
 {
     NSManagedObjectContext *context = [NSManagedObjectContext MR_defaultContext];
@@ -2305,6 +2325,31 @@
     [context MR_saveToPersistentStoreAndWait];
 }
 
++ (void)flushTableCapabilitiesAccount:(NSString *)account
+{
+    NSManagedObjectContext *context = [NSManagedObjectContext MR_defaultContext];
+    
+    if (account) {
+        
+        [TableCapabilities MR_deleteAllMatchingPredicate:[NSPredicate predicateWithFormat:@"(account == %@)", account] inContext:context];
+        
+    } else {
+        
+        [TableCapabilities MR_truncateAllInContext:context];
+    }
+    
+    [context MR_saveToPersistentStoreAndWait];
+}
+
++ (void)flushTableCertificates
+{
+    NSManagedObjectContext *context = [NSManagedObjectContext MR_defaultContext];
+    
+    [TableCertificates MR_truncateAllInContext:context];
+    
+    [context MR_saveToPersistentStoreAndWait];
+}
+
 + (void)flushTableDirectoryAccount:(NSString *)account
 {
     NSManagedObjectContext *context = [NSManagedObjectContext MR_defaultContext];
@@ -2321,6 +2366,31 @@
     [context MR_saveToPersistentStoreAndWait];
 }
 
++ (void)flushTableExternalSitesAccount:(NSString *)account
+{
+    NSManagedObjectContext *context = [NSManagedObjectContext MR_defaultContext];
+    
+    if (account) {
+        
+        [TableExternalSites MR_deleteAllMatchingPredicate:[NSPredicate predicateWithFormat:@"(account == %@)", account] inContext:context];
+        
+    } else {
+        
+        [TableExternalSites MR_truncateAllInContext:context];
+    }
+    
+    [context MR_saveToPersistentStoreAndWait];
+}
+
++ (void)flushTableGPS
+{
+    NSManagedObjectContext *context = [NSManagedObjectContext MR_defaultContext];
+    
+    [TableGPS MR_truncateAllInContext:context];
+    
+    [context MR_saveToPersistentStoreAndWait];
+}
+
 + (void)flushTableLocalFileAccount:(NSString *)account
 {
     NSManagedObjectContext *context = [NSManagedObjectContext MR_defaultContext];
@@ -2353,30 +2423,22 @@
     [context MR_saveToPersistentStoreAndWait];
 }
 
-+ (void)flushTableCapabilitiesAccount:(NSString *)account
++ (void)flushTableShareAccount:(NSString *)account
 {
     NSManagedObjectContext *context = [NSManagedObjectContext MR_defaultContext];
     
     if (account) {
         
-        [TableCapabilities MR_deleteAllMatchingPredicate:[NSPredicate predicateWithFormat:@"(account == %@)", account] inContext:context];
+        [TableShare MR_deleteAllMatchingPredicate:[NSPredicate predicateWithFormat:@"(account == %@)", account] inContext:context];
         
     } else {
         
-        [TableCapabilities MR_truncateAllInContext:context];
+        [TableShare MR_truncateAllInContext:context];
     }
     
     [context MR_saveToPersistentStoreAndWait];
 }
 
-+ (void)flushTableGPS
-{
-    NSManagedObjectContext *context = [NSManagedObjectContext MR_defaultContext];
-
-    [TableGPS MR_truncateAllInContext:context];
-    
-    [context MR_saveToPersistentStoreAndWait];
-}
 
 + (void)flushAllDatabase
 {

+ 3 - 0
iOSClient/Main/CCMain.m

@@ -1211,6 +1211,9 @@
 
 - (void)getCapabilitiesOfServerFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
 {
+    // Change Theming color
+    [app settingThemingColorBrand];
+    
     if (errorCode == 401)
         [self changePasswordAccount];
 }

+ 5 - 3
iOSClient/Settings/CCAdvanced.m

@@ -317,13 +317,15 @@
             [[NSURLCache sharedURLCache] setMemoryCapacity:0];
             [[NSURLCache sharedURLCache] setDiskCapacity:0];
             
+            [CCCoreData flushTableActivityAccount:app.activeAccount];
             [CCCoreData flushTableAutomaticUploadAccount:app.activeAccount selector:nil];
+            [CCCoreData flushTableCapabilitiesAccount:app.activeAccount];
             [CCCoreData flushTableDirectoryAccount:app.activeAccount];
+            [CCCoreData flushTableExternalSitesAccount:app.activeAccount];
             [CCCoreData flushTableLocalFileAccount:app.activeAccount];
             [CCCoreData flushTableMetadataAccount:app.activeAccount];
-            [CCCoreData flushTableActivityAccount:app.activeAccount];
-            [CCCoreData flushTableCapabilitiesAccount:app.activeAccount];
-            
+            [CCCoreData flushTableShareAccount:app.activeAccount];
+
             [self emptyUserDirectoryUser:app.activeUser url:app.activeUrl];
             
             [self emptyLocalDirectory];

+ 9 - 7
iOSClient/Settings/CCManageAccount.m

@@ -322,13 +322,15 @@
 
 - (void)deleteAccount:(NSString *)account
 {
-    [CCCoreData deleteAccount:account];
-        
-    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(account == %@)", account];
-    
-    [CCCoreData deleteMetadataWithPredicate:predicate];
-    [CCCoreData deleteLocalFileWithPredicate:predicate];
-    [CCCoreData deleteDirectoryFromPredicate:predicate];
+    [CCCoreData flushTableAccount:account];
+    [CCCoreData flushTableActivityAccount:account];
+    [CCCoreData flushTableAutomaticUploadAccount:account selector:nil];
+    [CCCoreData flushTableCapabilitiesAccount:account];
+    [CCCoreData flushTableDirectoryAccount:account];
+    [CCCoreData flushTableExternalSitesAccount:account];
+    [CCCoreData flushTableLocalFileAccount:account];
+    [CCCoreData flushTableMetadataAccount:account];
+    [CCCoreData flushTableShareAccount:account];
 }
 
 - (void)answerDelAccount:(XLFormRowDescriptor *)sender