Browse Source

fix : Hardcoded for add new photo/video for tab Media view

Marino Faggiana 6 years ago
parent
commit
20758e6778

+ 3 - 3
iOSClient/Database/NCManageDatabase.swift

@@ -485,7 +485,7 @@ class NCManageDatabase: NSObject {
         }
     }
     
-    @objc func getAccountStartDirectoryPhotosTab(_ homeServerUrl: String) -> String {
+    @objc func getAccountStartDirectoryMediaTabView(_ homeServerUrl: String) -> String {
         
         guard let activeAccount = self.getAccountActive() else {
             return ""
@@ -500,7 +500,7 @@ class NCManageDatabase: NSObject {
         
         if result.startDirectoryPhotosTab == "" {
             
-            self.setAccountStartDirectoryPhotosTab(homeServerUrl)
+            self.setAccountStartDirectoryMediaTabView(homeServerUrl)
             return homeServerUrl
             
         } else {
@@ -508,7 +508,7 @@ class NCManageDatabase: NSObject {
         }
     }
     
-    @objc func setAccountStartDirectoryPhotosTab(_ directory: String) {
+    @objc func setAccountStartDirectoryMediaTabView(_ directory: String) {
         
         guard let activeAccount = self.getAccountActive() else {
             return

+ 5 - 5
iOSClient/Media/CCMedia.m

@@ -171,7 +171,7 @@
     [appDelegate aspectNavigationControllerBar:self.navigationController.navigationBar online:[appDelegate.reachability isReachable] hidden:NO];
  
     // curront folder search
-    NSString *directory = [[NCManageDatabase sharedInstance] getAccountStartDirectoryPhotosTab:[CCUtility getHomeServerUrlActiveUrl:appDelegate.activeUrl]];
+    NSString *directory = [[NCManageDatabase sharedInstance] getAccountStartDirectoryMediaTabView:[CCUtility getHomeServerUrlActiveUrl:appDelegate.activeUrl]];
     NSString *home = [CCUtility getHomeServerUrlActiveUrl:appDelegate.activeUrl];
     NSString *folder = @"";
     if (home.length > 0) {
@@ -484,12 +484,12 @@
 
 - (void)moveServerUrlTo:(NSString *)serverUrlTo title:(NSString *)title
 {
-    NSString *oldStartDirectoryPhotosTab = [[NCManageDatabase sharedInstance] getAccountStartDirectoryPhotosTab:[CCUtility getHomeServerUrlActiveUrl:appDelegate.activeUrl]];
+    NSString *oldStartDirectoryMediaTabView = [[NCManageDatabase sharedInstance] getAccountStartDirectoryMediaTabView:[CCUtility getHomeServerUrlActiveUrl:appDelegate.activeUrl]];
     
-    if (![serverUrlTo isEqualToString:oldStartDirectoryPhotosTab]) {
+    if (![serverUrlTo isEqualToString:oldStartDirectoryMediaTabView]) {
         
         // Save Start Directory
-        [[NCManageDatabase sharedInstance] setAccountStartDirectoryPhotosTab:serverUrlTo];
+        [[NCManageDatabase sharedInstance] setAccountStartDirectoryMediaTabView:serverUrlTo];
         
         // search PhotoVideo with new start directory
         [self searchPhotoVideo];
@@ -597,7 +597,7 @@
     // tableAccount *account = [[NCManageDatabase sharedInstance] getAccountActive];
     // account.dateSearchContentTypeImageVideo
     
-    NSString *startDirectory = [[NCManageDatabase sharedInstance] getAccountStartDirectoryPhotosTab:[CCUtility getHomeServerUrlActiveUrl:appDelegate.activeUrl]];
+    NSString *startDirectory = [[NCManageDatabase sharedInstance] getAccountStartDirectoryMediaTabView:[CCUtility getHomeServerUrlActiveUrl:appDelegate.activeUrl]];
     OCnetworking *ocNetworking = [[OCnetworking alloc] initWithDelegate:self metadataNet:nil withUser:appDelegate.activeUser withUserID:appDelegate.activeUserID withPassword:appDelegate.activePassword withUrl:appDelegate.activeUrl];
     
     [ocNetworking readFile:nil serverUrl:startDirectory account:appDelegate.activeAccount success:^(tableMetadata *metadata) {

+ 4 - 2
iOSClient/Networking/CCNetworking.m

@@ -1133,8 +1133,10 @@
 #ifndef EXTENSION
         AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
         [appDelegate.listProgressMetadata removeObjectForKey:metadata.fileID];
-        // Hardcoded for add new Photos
-        if ([metadata.typeFile isEqualToString:k_metadataTypeFile_image] || [metadata.typeFile isEqualToString:k_metadataTypeFile_video]) {
+        
+        // Hardcoded for add new photo/video for tab Media view
+        NSString *startDirectoryMediaTabView = [[NCManageDatabase sharedInstance] getAccountStartDirectoryMediaTabView:[CCUtility getHomeServerUrlActiveUrl:appDelegate.activeUrl]];
+        if ([serverUrl containsString:startDirectoryMediaTabView] && ([metadata.typeFile isEqualToString:k_metadataTypeFile_image] || [metadata.typeFile isEqualToString:k_metadataTypeFile_video])) {
             [appDelegate.activeMedia.addMetadatasFromUpload addObject:metadata];
         }
 #endif