Browse Source

dev schema nextcloud

marinofaggiana 5 years ago
parent
commit
db0253c3e1
3 changed files with 39 additions and 26 deletions
  1. 26 14
      iOSClient/AppDelegate.m
  2. 3 2
      iOSClient/Main/CCMain.h
  3. 10 10
      iOSClient/Main/CCMain.m

+ 26 - 14
iOSClient/AppDelegate.m

@@ -1535,7 +1535,6 @@ PKPushRegistry *pushRegistry;
                 }
                 
                 if (matchedAccount) {
-                    
                     UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController;
                     
                     if (splitViewController.isCollapsed) {
@@ -1558,19 +1557,32 @@ PKPushRegistry *pushRegistry;
                         [tbc setSelectedIndex: k_tabBarApplicationIndexFile];
                     }
                     
-                    NSString *serverUrl = [CCUtility deletingLastPathComponentFromServerUrl:[NSString stringWithFormat:@"%@%@/%@", account.url, k_webDAV, path]];
-                    NSString *fileName = [path lastPathComponent];
-
-                    if ([self.activeMain.serverUrl isEqualToString:serverUrl]) {
-                        self.activeMain.scrollToFileName = fileName;
-                        [self.activeMain readFolder:serverUrl];
-                    } else {
-                        NSString *directoryName = [[path stringByDeletingLastPathComponent] lastPathComponent];
-                        NSString *serverUrl = [CCUtility deletingLastPathComponentFromServerUrl:[NSString stringWithFormat:@"%@%@/%@", account.url, k_webDAV, [path stringByDeletingLastPathComponent]]];
-
-                        tableMetadata *metadata = [CCUtility createMetadataWithAccount:account.account date:[NSDate date] directory:NO fileID:[[NSUUID UUID] UUIDString] serverUrl:serverUrl fileName:directoryName etag:@"" size:0 status:k_metadataStatusNormal url:@""];
-                        [self.activeMain performSegueDirectoryWithControlPasscode:true metadata:metadata scrollToFileName:fileName];
-                    }
+                    // GoTo home
+                    [CATransaction begin];
+                    [CATransaction setCompletionBlock:^{
+                        
+                        if ([path containsString:@"/"]) {
+                            
+                            // Push
+                            NSString *directoryName = [[path stringByDeletingLastPathComponent] lastPathComponent];
+                            NSString *serverUrl = [CCUtility deletingLastPathComponentFromServerUrl:[NSString stringWithFormat:@"%@%@/%@", account.url, k_webDAV, [path stringByDeletingLastPathComponent]]];
+                            
+                            tableMetadata *metadata = [CCUtility createMetadataWithAccount:account.account date:[NSDate date] directory:NO fileID:[[NSUUID UUID] UUIDString] serverUrl:serverUrl fileName:directoryName etag:@"" size:0 status:k_metadataStatusNormal url:@""];
+                            [self.activeMain performSegueDirectoryWithControlPasscode:true metadata:metadata scrollToFileNamePath:path];
+                            
+                        } else {
+                            
+                            // Reload folder
+                            NSString *serverUrl = [NSString stringWithFormat:@"%@%@", account.url, k_webDAV];
+                            
+                            self.activeMain.scrollToFileNamePath = path;
+                            [self.activeMain readFolder:serverUrl];
+                        }
+                        
+                    }];
+                    
+                    [self.activeMain.navigationController popToRootViewControllerAnimated:NO];
+                    [CATransaction commit];
                     
                 } else {
                     // Show add account dialog

+ 3 - 2
iOSClient/Main/CCMain.h

@@ -59,11 +59,12 @@
 @property (nonatomic, strong) UISearchController *searchController;
 @property (nonatomic, strong) UIView *reMenuBackgroundView;
 @property (nonatomic, strong) UITapGestureRecognizer *singleFingerTap;
-@property (nonatomic, strong) NSString *scrollToFileName;
+@property (nonatomic, strong) NSString *scrollToFileNamePath;
+
 @property BOOL isSelectedMode;
 
 - (void)shouldPerformSegue:(tableMetadata *)metadata;
-- (void)performSegueDirectoryWithControlPasscode:(BOOL)controlPasscode metadata:(tableMetadata *)metadata scrollToFileName:(NSString *)scrollToFileName;
+- (void)performSegueDirectoryWithControlPasscode:(BOOL)controlPasscode metadata:(tableMetadata *)metadata scrollToFileNamePath:(NSString *)scrollToFileNamePath;
 
 - (void)saveToPhotoAlbum:(tableMetadata *)metadata;
 

+ 10 - 10
iOSClient/Main/CCMain.m

@@ -2970,7 +2970,7 @@
             if (aViewController.fromType == CCBKPasscodeFromLockDirectory) {
                 
                 // possiamo procedere alla prossima directory
-                [self performSegueDirectoryWithControlPasscode:false metadata:self.metadata scrollToFileName:self.scrollToFileName];
+                [self performSegueDirectoryWithControlPasscode:false metadata:self.metadata scrollToFileNamePath:self.scrollToFileNamePath];
                 
                 // avviamo la sessione Passcode Lock con now
                 appDelegate.sessionePasscodeLock = [NSDate date];
@@ -3755,11 +3755,11 @@
     //
     [self.tableView reloadEmptyDataSet];
     
-    // scrollToFileName
-    if (self.scrollToFileName != nil && withScrollToFileName) {
+    // scrollToFileNamePath
+    if (self.scrollToFileNamePath != nil && withScrollToFileName ) {
         for (NSString *key in sectionDataSource.allRecordsDataSource) {
             tableMetadata *metadata = [sectionDataSource.allRecordsDataSource objectForKey:key];
-            if ([metadata.fileName isEqualToString:self.scrollToFileName]) {
+            if ([metadata.fileName isEqualToString:self.scrollToFileNamePath]) {
                 for (NSString *key in sectionDataSource.fileIDIndexPath) {
                     if ([key isEqualToString:metadata.fileID]) {
                         NSIndexPath *indexPath = [sectionDataSource.fileIDIndexPath objectForKey:key];
@@ -3774,7 +3774,7 @@
                 }
             }
         }
-        self.scrollToFileName = nil;
+        self.scrollToFileNamePath = nil;
     }
 }
 
@@ -4143,7 +4143,7 @@
     
     if (self.metadata.directory) {
         
-        [self performSegueDirectoryWithControlPasscode:true metadata:self.metadata scrollToFileName:self.scrollToFileName];
+        [self performSegueDirectoryWithControlPasscode:true metadata:self.metadata scrollToFileNamePath:self.scrollToFileNamePath];
     }
 }
 
@@ -4253,12 +4253,12 @@
 }
 
 // can i go to next viewcontroller
-- (void)performSegueDirectoryWithControlPasscode:(BOOL)controlPasscode metadata:(tableMetadata *)metadata scrollToFileName:(NSString *)scrollToFileName
+- (void)performSegueDirectoryWithControlPasscode:(BOOL)controlPasscode metadata:(tableMetadata *)metadata scrollToFileNamePath:(NSString *)scrollToFileNamePath
 {
     NSString *nomeDir;
     
     self.metadata = metadata;
-    self.scrollToFileName = scrollToFileName;
+    self.scrollToFileNamePath = scrollToFileNamePath;
     
     if (self.tableView.editing == NO) {
         
@@ -4319,7 +4319,7 @@
             
             viewController.serverUrl = serverUrlPush;
             viewController.titleMain = metadata.fileName;
-            viewController.scrollToFileName = scrollToFileName;
+            viewController.scrollToFileNamePath = scrollToFileNamePath;
             
             // save self
             [appDelegate.listMainVC setObject:viewController forKey:serverUrlPush];
@@ -4331,7 +4331,7 @@
             if (viewController.isViewLoaded) {
                 
                 viewController.titleMain = metadata.fileName;
-                viewController.scrollToFileName = scrollToFileName;
+                viewController.scrollToFileNamePath = scrollToFileNamePath;
                 
                 // Fix : Application tried to present modally an active controller
                 if ([self.navigationController isBeingPresented]) {