Explorar el Código

Fix : reload Datasource on Photos, Verify if the account already exists on Login

Marino Faggiana hace 7 años
padre
commit
fb56cb2b3d
Se han modificado 3 ficheros con 13 adiciones y 4 borrados
  1. 5 0
      iOSClient/AppDelegate.m
  2. 2 2
      iOSClient/Login/CCLogin.m
  3. 6 2
      iOSClient/Photos/CCPhotos.m

+ 5 - 0
iOSClient/AppDelegate.m

@@ -269,6 +269,11 @@
         [_activeMain readFileReloadFolder];
     }
     
+    // refresh Photos tab
+    if (_activePhotos) {
+        [_activePhotos reloadDatasourceForced];
+    }
+    
     // Initializations
     [self applicationInitialized];
 }

+ 2 - 2
iOSClient/Login/CCLogin.m

@@ -339,9 +339,9 @@
 - (void)getUserProfileSuccess:(CCMetadataNet *)metadataNet userProfile:(OCUserProfile *)userProfile
 {
     // Verify if the account already exists
-    if (userProfile.id.length > 0 && self.baseUrl.text.length > 0) {
+    if (userProfile.id.length > 0 && self.baseUrl.text.length > 0 && self.user.text.length >0) {
     
-        tableAccount *accountAlreadyExists = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"url = %@ AND user = %@", self.baseUrl.text, userProfile.id]];
+        tableAccount *accountAlreadyExists = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"url = %@ AND user = %@ AND username != %@", self.baseUrl.text, userProfile.id, self.user.text]];
         
         if (accountAlreadyExists) {
             

+ 6 - 2
iOSClient/Photos/CCPhotos.m

@@ -492,9 +492,13 @@
         return;
     
     NSString *autoUploadPath = [[NCManageDatabase sharedInstance] getAccountAutoUploadPath:app.activeUrl];
+    NSDate *dateDateRecordDirectory = nil;
     
-    tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl = %@", app.activeAccount, autoUploadPath]];
-    NSDate *dateDateRecordDirectory = directory.dateReadDirectory;
+    NSArray *directories = [[NCManageDatabase sharedInstance] getTablesDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl BEGINSWITH %@", app.activeAccount, autoUploadPath] sorted:@"dateReadDirectory" ascending:false];
+    if ([directories count] > 0) {
+        tableDirectory *directory = [directories objectAtIndex:0];
+        dateDateRecordDirectory = directory.dateReadDirectory;
+    }
     
     if ([dateDateRecordDirectory compare:_dateReadDataSource] == NSOrderedDescending || dateDateRecordDirectory == nil || _dateReadDataSource == nil) {