Browse Source

clear code

Marino Faggiana 8 years ago
parent
commit
d0658f8f6d

+ 2 - 2
Nextcloud.xcodeproj/project.pbxproj

@@ -2986,6 +2986,8 @@
 				F7ACE4291BAC0268006C0017 /* Acknowledgements.h */,
 				F7ACE42A1BAC0268006C0017 /* Acknowledgements.m */,
 				F7ACE42B1BAC0268006C0017 /* Acknowledgements.rtf */,
+				F7A321AB1E9E6AD50069AD1B /* CCAdvanced.h */,
+				F7A321AC1E9E6AD50069AD1B /* CCAdvanced.m */,
 				F7ACE42C1BAC0268006C0017 /* CCManageAccount.h */,
 				F7ACE42D1BAC0268006C0017 /* CCManageAccount.m */,
 				F7ACE42E1BAC0268006C0017 /* CCManageCameraUpload.h */,
@@ -2994,8 +2996,6 @@
 				F7F6AC4D1E525AD300E8EB45 /* CCManageCryptoCloud.m */,
 				F73C002D1E55D7DF00EEEFA7 /* CCManageCryptoCloudSecurity.h */,
 				F73C002E1E55D7DF00EEEFA7 /* CCManageCryptoCloudSecurity.m */,
-				F7A321AB1E9E6AD50069AD1B /* CCAdvanced.h */,
-				F7A321AC1E9E6AD50069AD1B /* CCAdvanced.m */,
 				F7ACE4301BAC0268006C0017 /* CCSettings.h */,
 				F7ACE4311BAC0268006C0017 /* CCSettings.m */,
 			);

+ 1 - 0
iOSClient/Brand/CCNextcloudConstant.h

@@ -66,6 +66,7 @@
 
 #define COLOR_NAVIGATIONBAR_TEXT        [UIColor whiteColor]
 #define COLOR_NAVIGATIONBAR_PROGRESS    [UIColor whiteColor]
+
 #define COLOR_TABBAR                    [UIColor whiteColor]
 #define COLOR_TABBAR_TEXT               [UIColor colorWithRed:0.0/255.0 green:130.0/255.0 blue:201.0/255.0 alpha:1.0]                   // BLU NC : #0082c9
 

+ 0 - 33
iOSClient/Settings/CCManagePhotos.h

@@ -1,33 +0,0 @@
-//
-//  CCManagePhotos.h
-//  Crypto Cloud Technology Nextcloud
-//
-//  Created by Marino Faggiana on 22/05/16.
-//  Copyright (c) 2014 TWS. All rights reserved.
-//
-//  Author Marino Faggiana <m.faggiana@twsweb.it>
-//
-//  This program is free software: you can redistribute it and/or modify
-//  it under the terms of the GNU General Public License as published by
-//  the Free Software Foundation, either version 3 of the License, or
-//  (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-//
-//  You should have received a copy of the GNU General Public License
-//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import "XLFormViewController.h"
-#import "XLForm.h"
-#import "CCMove.h"
-#import "CCMain.h"
-#import "CCCoreData.h"
-
-@interface CCManagePhotos : XLFormViewController <CCMoveDelegate>
-
-
-@end

+ 0 - 194
iOSClient/Settings/CCManagePhotos.m

@@ -1,194 +0,0 @@
-//
-//  CCManagePhotos.m
-//  Crypto Cloud Technology Nextcloud
-//
-//  Created by Marino Faggiana on 22/05/16.
-//  Copyright (c) 2014 TWS. All rights reserved.
-//
-//  Author Marino Faggiana <m.faggiana@twsweb.it>
-//
-//  This program is free software: you can redistribute it and/or modify
-//  it under the terms of the GNU General Public License as published by
-//  the Free Software Foundation, either version 3 of the License, or
-//  (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-//
-//  You should have received a copy of the GNU General Public License
-//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import "CCManagePhotos.h"
-
-#import "AppDelegate.h"
-
-@implementation CCManagePhotos
-
-//  From Settings
-- (id)initWithCoder:(NSCoder *)aDecoder
-{
-    if (self = [super initWithCoder:aDecoder])  {
-
-        [self initializeForm];
-    }
-    
-    return self;
-}
-
-- (void)initializeForm
-{
-    XLFormDescriptor *form ;
-    XLFormSectionDescriptor *section;
-    XLFormRowDescriptor *row;
-    
-    form = [XLFormDescriptor formDescriptorWithTitle:NSLocalizedString(@"_photo_camera_", nil)];
-
-    // Camera Upload change location
-
-    section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_change_folder_photos_", nil)];
-    section.footerTitle = NSLocalizedString(@"_upload_camera_change_location_footer_", nil);
-    [form addFormSection:section];
-    
-    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"camerauploadlocationnow" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_upload_camera_location_now_", nil)];
-    row.value = [CCCoreData getCameraUploadFolderNameActiveAccount:app.activeAccount];
-    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
-    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
-    [section addFormRow:row];
-    
-    NSString *title = [NSString stringWithFormat:@"%@ : %@", NSLocalizedString(@"_upload_camera_location_default_", nil), folderDefaultCameraUpload];
-    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"camerauploadlocationdefault" rowType:XLFormRowDescriptorTypeButton title:title];
-    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
-    [row.cellConfig setObject:[UIImage imageNamed:image_settingsManagePhotos] forKey:@"imageView.image"];
-    row.action.formSelector = @selector(locationDefault:);
-    [section addFormRow:row];
-
-    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"camerauploadchangelocation" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_upload_camera_change_location_", nil)];
-    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
-    [row.cellConfig setObject:[UIImage imageNamed:image_settingsManagePhotosChange] forKey:@"imageView.image"];
-    row.action.formSelector = @selector(changeLocation:);
-    [section addFormRow:row];
-    
-    // end
-    
-    section = [XLFormSectionDescriptor formSection];
-    [form addFormSection:section];
-    
-    self.form = form;
-}
-
-// Apparirà
-- (void)viewWillAppear:(BOOL)animated
-{
-    [super viewWillAppear:animated];
-    
-    // Color
-    [CCAspect aspectNavigationControllerBar:self.navigationController.navigationBar hidden:NO];
-    [CCAspect aspectTabBar:self.tabBarController.tabBar hidden:NO];
-    
-    //
-    [self reloadForm];
-}
-
-- (void)move:(NSString *)serverUrlTo title:(NSString *)title selectedMetadatas:(NSArray *)selectedMetadatas
-{
-    NSString *fileName, *newPath;
-    
-    if (serverUrlTo) {
-        
-        if ([app.typeCloud isEqualToString:typeCloudOwnCloud] || [app.typeCloud isEqualToString:typeCloudNextcloud]) {
-            
-            NSURL *url = [NSURL URLWithString:[serverUrlTo stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
-            fileName = [serverUrlTo lastPathComponent];
-            
-            newPath = [[url URLByDeletingLastPathComponent] absoluteString];
-            newPath = [newPath substringToIndex:[newPath length] -1];
-            
-        }
-        
-        if ([serverUrlTo isEqualToString:[CCUtility getHomeServerUrlActiveUrl:app.activeUrl typeCloud:app.typeCloud]]) {
-            
-            UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"_error_", nil) message:NSLocalizedString(@"_camera_upload_not_select_home_", nil) delegate:nil cancelButtonTitle:nil otherButtonTitles:NSLocalizedString(@"_ok_", nil), nil];
-            [alertView show];
-            
-        } else {
-            
-            NSString *oldPath = [CCCoreData getCameraUploadFolderPathActiveAccount:app.activeAccount activeUrl:app.activeUrl typeCloud:app.typeCloud];
-            
-            [CCCoreData setCameraUploadFolderName:fileName activeAccount:app.activeAccount];
-            [CCCoreData setCameraUploadFolderPath:newPath activeUrl:app.activeUrl typeCloud:app.typeCloud activeAccount:app.activeAccount];
-            
-            [CCCoreData clearDateReadDirectory:oldPath activeAccount:app.activeAccount];
-            [CCCoreData clearDateReadDirectory:newPath activeAccount:app.activeAccount];
-            
-            if (app.activeAccount && app.activeUrl && app.activePhotosCameraUpload)
-                [app.activePhotosCameraUpload reloadDatasourceForced];
-            
-            [self reloadForm];
-        }
-    }
-}
-
-- (void)done:(XLFormRowDescriptor *)sender
-{
-    [self dismissViewControllerAnimated:YES completion:nil];
-}
-
-- (void)changeLocation:(XLFormRowDescriptor *)sender
-{
-    [self deselectFormRow:sender];
-    
-    UINavigationController *navigationController = [[UIStoryboard storyboardWithName:@"CCMove" bundle:nil] instantiateViewControllerWithIdentifier:@"CCMove"];
-    
-    CCMove *viewController = (CCMove *)navigationController.topViewController;
-
-    viewController.delegate = self;
-    viewController.move.title = NSLocalizedString(@"_select_", nil);
-    viewController.onlyClearDirectory = YES;
-    viewController.tintColor = COLOR_BRAND;
-    viewController.barTintColor = COLOR_BAR;
-    viewController.tintColorTitle = COLOR_GRAY;
-    viewController.networkingOperationQueue = app.netQueue;
-    
-    [self presentViewController:navigationController animated:YES completion:nil];
-}
-
-- (void)locationDefault:(XLFormRowDescriptor *)sender
-{
-    [self deselectFormRow:sender];
-  
-    NSString *oldPath = [CCCoreData getCameraUploadFolderPathActiveAccount:app.activeAccount activeUrl:app.activeUrl typeCloud:app.typeCloud];
-    NSString *newPath = [CCUtility getHomeServerUrlActiveUrl:app.activeUrl typeCloud:app.typeCloud];
-
-    [CCCoreData setCameraUploadFolderName:folderDefaultCameraUpload activeAccount:app.activeAccount];
-    [CCCoreData setCameraUploadFolderPath:newPath activeUrl:app.activeUrl typeCloud:app.typeCloud activeAccount:app.activeAccount];
-    
-    [CCCoreData clearDateReadDirectory:oldPath activeAccount:app.activeAccount];
-    [CCCoreData clearDateReadDirectory:newPath activeAccount:app.activeAccount];
-
-    // rebuild
-    if (app.activeAccount && app.activeUrl && app.activePhotosCameraUpload)
-        [app.activePhotosCameraUpload reloadDatasourceForced];
-    
-    // Create Folder cameraUpload
-    if (([app.typeCloud isEqualToString:typeCloudOwnCloud] || [app.typeCloud isEqualToString:typeCloudNextcloud]) && app.activeMain)
-        [app.activeMain createFolderCameraUpload];
-
-    [self reloadForm];
-}
-
-- (void)reloadForm
-{
-    self.form.delegate = nil;
-    
-    XLFormRowDescriptor *rowCameraUploadLocationNow = [self.form formRowWithTag:@"camerauploadlocationnow"];
-    [rowCameraUploadLocationNow setValue:[CCCoreData getCameraUploadFolderNameActiveAccount:app.activeAccount]];
-    
-    [self.tableView reloadData];
-    
-    self.form.delegate = self;
-}
-
-@end

+ 0 - 30
iOSClient/Settings/CCManageSynchronizations.h

@@ -1,30 +0,0 @@
-//
-//  CCManageSynchronizations.h
-//  Crypto Cloud Technology Nextcloud
-//
-//  Created by Marino Faggiana on 04/11/15.
-//  Copyright (c) 2014 TWS. All rights reserved.
-//
-//  Author Marino Faggiana <m.faggiana@twsweb.it>
-//
-//  This program is free software: you can redistribute it and/or modify
-//  it under the terms of the GNU General Public License as published by
-//  the Free Software Foundation, either version 3 of the License, or
-//  (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-//
-//  You should have received a copy of the GNU General Public License
-//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import "XLFormViewController.h"
-#import "XLForm.h"
-
-@interface CCManageSynchronizations : XLFormViewController
-
-
-@end

+ 0 - 168
iOSClient/Settings/CCManageSynchronizations.m

@@ -1,168 +0,0 @@
-//
-//  CCManageSynchronizations.m
-//  Crypto Cloud Technology Nextcloud
-//
-//  Created by Marino Faggiana on 04/11/15.
-//  Copyright (c) 2014 TWS. All rights reserved.
-//
-//  Author Marino Faggiana <m.faggiana@twsweb.it>
-//
-//  This program is free software: you can redistribute it and/or modify
-//  it under the terms of the GNU General Public License as published by
-//  the Free Software Foundation, either version 3 of the License, or
-//  (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-//
-//  You should have received a copy of the GNU General Public License
-//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import "CCManageSynchronizations.h"
-
-#import "AppDelegate.h"
-
-@implementation CCManageSynchronizations
-
-- (id)initWithCoder:(NSCoder *)aDecoder
-{
-    self = [super initWithCoder:aDecoder];
-    
-    if (self) {
-        
-        [self initializeForm];        
-    }
-    
-    return self;
-}
-
-- (void)initializeForm
-{
-    XLFormDescriptor *form ;
-    XLFormSectionDescriptor *section;
-    XLFormRowDescriptor *row;
-
-    form = [XLFormDescriptor formDescriptorWithTitle:NSLocalizedString(@"_synchronizations_", nil)];
-    
-    section = [XLFormSectionDescriptor formSection];
-    [form addFormSection:section];
-    section.footerTitle = NSLocalizedString(@"_sync_wifi_how_", nil);
-    
-    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"synchronizationswifi" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_wifi_only_", nil)];
-    if ([CCUtility getSynchronizationsOnlyWiFi]) row.value = @1;
-    else row.value = @0;
-    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
-    [section addFormRow:row];
-    
-    section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_sync_active_", nil) sectionOptions:XLFormSectionOptionCanDelete];
-    [form addFormSection:section];
-    
-    [self synchronizationsActive:section];
-    
-    section = [XLFormSectionDescriptor formSection];
-    [form addFormSection:section];
-    
-    self.form = form;
-}
-
-- (void)viewDidLoad
-{
-    [super viewDidLoad];
-    
-    // Color
-    [CCAspect aspectNavigationControllerBar:self.navigationController.navigationBar hidden:NO];
-    [CCAspect aspectTabBar:self.tabBarController.tabBar hidden:NO];
-    
-    [self.tableView setEditing:!self.tableView.editing animated:YES];
-}
-
-// Apparirà
-- (void)viewWillAppear:(BOOL)animated
-{
-    [super viewWillAppear:animated];
-    
-    // Color
-    [CCAspect aspectNavigationControllerBar:self.navigationController.navigationBar hidden:NO];
-    [CCAspect aspectTabBar:self.tabBarController.tabBar hidden:NO];
-}
-
--(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue
-{
-    [super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue];
-    
-    if ([rowDescriptor.tag isEqualToString:@"synchronizationswifi"]) {
-        
-        if ([[rowDescriptor.value valueData] boolValue] == YES) {
-            
-            [CCUtility setSynchronizationsOnlyWiFi:YES];
-            
-        } else {
-            
-            [CCUtility setSynchronizationsOnlyWiFi:NO];
-        }
-    }
-}
-
--(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
-{
-    NSLog(@"[LOG] Should delete %i",(int)indexPath.row);
-    
-    XLFormRowDescriptor *rowDescriptor = [self.form formRowAtIndex:indexPath];
-    
-    [CCCoreData removeSynchronizedDirectoryID:rowDescriptor.tag activeAccount:app.activeAccount];
-    
-    [super tableView:tableView commitEditingStyle:editingStyle forRowAtIndexPath:indexPath];
-        
-    XLFormSectionDescriptor *section = [self.form formSectionAtIndex:indexPath.section];
-
-    [self synchronizationsActive:section];
-}
-
-- (void)synchronizationsActive:(XLFormSectionDescriptor *)section
-{
-    XLFormRowDescriptor *row;
-
-    NSArray *tableSynchronized = [CCCoreData getSynchronizedDirectoryActiveAccount:app.activeAccount];
-    NSString *home = [CCUtility getHomeServerUrlActiveUrl:app.activeUrl typeCloud:app.typeCloud];
-    NSString *title;
-    
-    [section.formRows removeAllObjects];
-    [self.tableView reloadData];
-    
-    if ([tableSynchronized count] > 0) {
-        
-        for (TableDirectory *directory in tableSynchronized) {
-            
-            if ([app.typeCloud isEqualToString:typeCloudOwnCloud] || [app.typeCloud isEqualToString:typeCloudNextcloud])
-                title = [directory.serverUrl stringByReplacingOccurrencesOfString:home withString:@""];
-            
-            title = [title lastPathComponent];
-            if ([CCUtility isCryptoString:title]) {
-                
-                CCMetadata *metadata = [CCCoreData getMetadataWithPreficate:[NSPredicate predicateWithFormat:@"(fileNameData == %@) AND (directory == 1) AND (account == %@)", title, app.activeAccount] context:nil];
-                title = metadata.fileNamePrint;
-                row = [XLFormRowDescriptor formRowDescriptorWithTag:directory.directoryID rowType:XLFormRowDescriptorTypeInfo title:title];
-                [row.cellConfig setObject:COLOR_BRAND forKey:@"textLabel.textColor"];
-                
-            } else {
-             
-                row = [XLFormRowDescriptor formRowDescriptorWithTag:directory.directoryID rowType:XLFormRowDescriptorTypeInfo title:title];
-            }
-            
-            [section addFormRow:row];
-        }
-        
-        section.title = NSLocalizedString(@"_sync_active_", nil);
-        section.footerTitle = NSLocalizedString(@"_sync_active_footer_", nil);
-        
-    } else {
-        
-        section.title = @"";
-        section.footerTitle = @"";
-    }
-}
-
-@end

+ 1 - 0
iOSClient/Settings/CCSettings.m

@@ -239,6 +239,7 @@
     [super viewDidLoad];
     
     self.title = NSLocalizedString(@"_settings_", nil);
+    self.tableView.backgroundColor = [UIColor whiteColor];
     
     // Color
     [CCAspect aspectNavigationControllerBar:self.navigationController.navigationBar encrypted:NO online:[app.reachability isReachable] hidden:NO];