Browse Source

add option format compatibility

Marino Faggiana 7 years ago
parent
commit
710e481720

+ 1 - 0
iOSClient/Database/NCDatabase.swift

@@ -38,6 +38,7 @@ class tableAccount: Object {
     @objc dynamic var autoUploadVideo: Bool = false
     @objc dynamic var autoUploadVideo: Bool = false
     @objc dynamic var autoUploadWWAnPhoto: Bool = false
     @objc dynamic var autoUploadWWAnPhoto: Bool = false
     @objc dynamic var autoUploadWWAnVideo: Bool = false
     @objc dynamic var autoUploadWWAnVideo: Bool = false
+    @objc dynamic var autoUploadFormatCompatibility: Bool = false
     @objc dynamic var displayName = ""
     @objc dynamic var displayName = ""
     @objc dynamic var email = ""
     @objc dynamic var email = ""
     @objc dynamic var enabled: Bool = false
     @objc dynamic var enabled: Bool = false

+ 1 - 1
iOSClient/Database/NCManageDatabase.swift

@@ -57,7 +57,7 @@ class NCManageDatabase: NSObject {
         let config = Realm.Configuration(
         let config = Realm.Configuration(
         
         
             fileURL: dirGroup?.appendingPathComponent("\(appDatabaseNextcloud)/\(k_databaseDefault)"),
             fileURL: dirGroup?.appendingPathComponent("\(appDatabaseNextcloud)/\(k_databaseDefault)"),
-            schemaVersion: 7,
+            schemaVersion: 8,
             
             
             migrationBlock: { migration, oldSchemaVersion in
             migrationBlock: { migration, oldSchemaVersion in
                 // We haven’t migrated anything yet, so oldSchemaVersion == 0
                 // We haven’t migrated anything yet, so oldSchemaVersion == 0

+ 3 - 1
iOSClient/Networking/CCNetworking.m

@@ -771,7 +771,9 @@
             
             
             [[PHImageManager defaultManager] requestImageDataForAsset:asset options:options resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {
             [[PHImageManager defaultManager] requestImageDataForAsset:asset options:options resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {
                 
                 
-                if ([dataUTI isEqualToString:@"public.heic"] && [CCUtility getFormatSaveAutoUploadCompatibility]) {
+                tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountActive];
+
+                if ([dataUTI isEqualToString:@"public.heic"] && tableAccount.autoUploadFormatCompatibility) {
                     
                     
                     UIImage *image = [UIImage imageWithData:imageData];
                     UIImage *image = [UIImage imageWithData:imageData];
                     NSData *imageDataJPEG = UIImageJPEGRepresentation(image, 1.0);
                     NSData *imageDataJPEG = UIImageJPEGRepresentation(image, 1.0);

+ 35 - 5
iOSClient/Settings/CCManageAutoUpload.m

@@ -155,6 +155,18 @@
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
     [section addFormRow:row];
     [section addFormRow:row];
 
 
+    // Auto Upload Format Compatibility
+    
+    section = [XLFormSectionDescriptor formSection];
+    [form addFormSection:section];
+    
+    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUploadFormatCompatibility" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_autoupload_format_compatibility_", nil)];
+    row.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"];
+    if (tableAccount.autoUploadCreateSubfolder) row.value = @1;
+    else row.value = @0;
+    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
+    [section addFormRow:row];
+    
     // Auto Upload file name
     // Auto Upload file name
     
     
     section = [XLFormSectionDescriptor formSection];
     section = [XLFormSectionDescriptor formSection];
@@ -253,10 +265,13 @@
             [[NCAutoUpload sharedInstance] checkIfLocationIsEnabled];
             [[NCAutoUpload sharedInstance] checkIfLocationIsEnabled];
                             
                             
             if(isLocationIsEnabled == YES) {
             if(isLocationIsEnabled == YES) {
-                    
-                UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"_autoupload_background_title_", nil) message:NSLocalizedString(@"_autoupload_background_msg_", nil) delegate:nil cancelButtonTitle:nil otherButtonTitles:NSLocalizedString(@"_ok_", nil), nil];
-                [alertView show];
-                    
+                
+                UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_autoupload_background_title_", nil) message:NSLocalizedString(@"_autoupload_background_msg_", nil) preferredStyle:UIAlertControllerStyleAlert];
+                UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"_ok_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {}];
+                
+                [alertController addAction:okAction];
+                [self presentViewController:alertController animated:YES completion:nil];
+                
                 [[NCManageDatabase sharedInstance] setAccountAutoUploadProperty:@"autoUploadBackground" state:YES];
                 [[NCManageDatabase sharedInstance] setAccountAutoUploadProperty:@"autoUploadBackground" state:YES];
                     
                     
             } else {
             } else {
@@ -320,6 +335,11 @@
         [[NCManageDatabase sharedInstance] setAccountAutoUploadProperty:@"autoUploadWWAnVideo" state:[[rowDescriptor.value valueData] boolValue]];
         [[NCManageDatabase sharedInstance] setAccountAutoUploadProperty:@"autoUploadWWAnVideo" state:[[rowDescriptor.value valueData] boolValue]];
     }
     }
     
     
+    if ([rowDescriptor.tag isEqualToString:@"autoUploadFormatCompatibility"]) {
+        
+        [[NCManageDatabase sharedInstance] setAccountAutoUploadProperty:@"autoUploadFormatCompatibility" state:[[rowDescriptor.value valueData] boolValue]];
+    }    
+    
     if ([rowDescriptor.tag isEqualToString:@"autoUploadCreateSubfolder"]) {
     if ([rowDescriptor.tag isEqualToString:@"autoUploadCreateSubfolder"]) {
         
         
         [[NCManageDatabase sharedInstance] setAccountAutoUploadProperty:@"autoUploadCreateSubfolder" state:[[rowDescriptor.value valueData] boolValue]];
         [[NCManageDatabase sharedInstance] setAccountAutoUploadProperty:@"autoUploadCreateSubfolder" state:[[rowDescriptor.value valueData] boolValue]];
@@ -349,6 +369,8 @@
     
     
     XLFormRowDescriptor *rowAutoUploadCreateSubfolder = [self.form formRowWithTag:@"autoUploadCreateSubfolder"];
     XLFormRowDescriptor *rowAutoUploadCreateSubfolder = [self.form formRowWithTag:@"autoUploadCreateSubfolder"];
 
 
+    XLFormRowDescriptor *rowAutoUploadFormatCompatibility = [self.form formRowWithTag:@"autoUploadFormatCompatibility"];
+    
     XLFormRowDescriptor *rowAutoUploadFileName = [self.form formRowWithTag:@"autoUploadFileName"];
     XLFormRowDescriptor *rowAutoUploadFileName = [self.form formRowWithTag:@"autoUploadFileName"];
     
     
     // - STATUS ---------------------
     // - STATUS ---------------------
@@ -375,9 +397,11 @@
     if (tableAccount.autoUploadFull)
     if (tableAccount.autoUploadFull)
         [rowAutoUploadFull setValue:@1]; else [rowAutoUploadFull setValue:@0];
         [rowAutoUploadFull setValue:@1]; else [rowAutoUploadFull setValue:@0];
     
     
+    if (tableAccount.autoUploadFormatCompatibility)
+        [rowAutoUploadFormatCompatibility setValue:@1]; else [rowAutoUploadFormatCompatibility setValue:@0];
+    
     if (tableAccount.autoUploadCreateSubfolder)
     if (tableAccount.autoUploadCreateSubfolder)
         [rowAutoUploadCreateSubfolder setValue:@1]; else [rowAutoUploadCreateSubfolder setValue:@0];
         [rowAutoUploadCreateSubfolder setValue:@1]; else [rowAutoUploadCreateSubfolder setValue:@0];
-    
 
 
     // - HIDDEN --------------------------------------------------------------------------
     // - HIDDEN --------------------------------------------------------------------------
     
     
@@ -393,6 +417,8 @@
     
     
     rowAutoUploadCreateSubfolder.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"];
     rowAutoUploadCreateSubfolder.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"];
     
     
+    rowAutoUploadFormatCompatibility.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"];
+
     rowAutoUploadFileName.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"];
     rowAutoUploadFileName.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"];
     
     
     // -----------------------------------------------------------------------------------
     // -----------------------------------------------------------------------------------
@@ -425,6 +451,10 @@
             else sectionName = @"";
             else sectionName = @"";
             break;
             break;
         case 6:
         case 6:
+            if (tableAccount.autoUpload) sectionName =  NSLocalizedString(@"_autoupload_format_compatibility_footer_", nil);
+            else sectionName = @"";
+            break;
+        case 7:
             if (tableAccount.autoUpload) sectionName =  NSLocalizedString(@"_autoupload_filenamemask_footer_", nil);
             if (tableAccount.autoUpload) sectionName =  NSLocalizedString(@"_autoupload_filenamemask_footer_", nil);
             else sectionName = @"";
             else sectionName = @"";
             break;
             break;

+ 2 - 0
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -178,6 +178,8 @@
 "_autoupload_create_subfolder_footer_" = "Store in subfolders based on year and month";
 "_autoupload_create_subfolder_footer_" = "Store in subfolders based on year and month";
 "_autoupload_filenamemask_"         = "Change filename mask";
 "_autoupload_filenamemask_"         = "Change filename mask";
 "_autoupload_filenamemask_footer_"  = "Change the automatic filename mask";
 "_autoupload_filenamemask_footer_"  = "Change the automatic filename mask";
+"_autoupload_format_compatibility_" = "Most Compatible";
+"_autoupload_format_compatibility_footer_" = "Most compatible will always use JPEG"
 
 
 // Manage Crypto Cloud
 // Manage Crypto Cloud
 
 

+ 0 - 4
iOSClient/Utility/CCUtility.h

@@ -91,8 +91,6 @@
 
 
 + (void)setShowHiddenFiles:(BOOL)show;
 + (void)setShowHiddenFiles:(BOOL)show;
 
 
-+ (void)setFormatSaveAutoUploadCompatibility:(BOOL)show;
-
 // GET
 // GET
 
 
 + (NSString *)getKeyChainPasscodeForUUID:(NSString *)uuid;
 + (NSString *)getKeyChainPasscodeForUUID:(NSString *)uuid;
@@ -137,8 +135,6 @@
 
 
 + (BOOL)getShowHiddenFiles;
 + (BOOL)getShowHiddenFiles;
 
 
-+ (BOOL)getFormatSaveAutoUploadCompatibility;
-
 // ===== Varius =====
 // ===== Varius =====
 
 
 + (NSString *)getUserAgent;
 + (NSString *)getUserAgent;

+ 0 - 11
iOSClient/Utility/CCUtility.m

@@ -221,12 +221,6 @@
     [UICKeyChainStore setString:sShow forKey:@"showHiddenFiles" service:k_serviceShareKeyChain];
     [UICKeyChainStore setString:sShow forKey:@"showHiddenFiles" service:k_serviceShareKeyChain];
 }
 }
 
 
-+ (void)setFormatSaveAutoUploadCompatibility:(BOOL)show
-{
-    NSString *sSet = (show) ? @"true" : @"false";
-    [UICKeyChainStore setString:sSet forKey:@"formatSaveAutoUploadCompatibility" service:k_serviceShareKeyChain];
-}
-
 #pragma ------------------------------ GET
 #pragma ------------------------------ GET
 
 
 + (NSString *)getKeyChainPasscodeForUUID:(NSString *)uuid
 + (NSString *)getKeyChainPasscodeForUUID:(NSString *)uuid
@@ -421,11 +415,6 @@
     return [[UICKeyChainStore stringForKey:@"showHiddenFiles" service:k_serviceShareKeyChain] boolValue];
     return [[UICKeyChainStore stringForKey:@"showHiddenFiles" service:k_serviceShareKeyChain] boolValue];
 }
 }
 
 
-+ (BOOL)getFormatSaveAutoUploadCompatibility
-{
-    return [[UICKeyChainStore stringForKey:@"formatSaveAutoUploadCompatibility" service:k_serviceShareKeyChain] boolValue];
-}
-
 #pragma --------------------------------------------------------------------------------------------
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ===== Varius =====
 #pragma mark ===== Varius =====
 #pragma --------------------------------------------------------------------------------------------
 #pragma --------------------------------------------------------------------------------------------