marinofaggiana %!s(int64=4) %!d(string=hai) anos
pai
achega
ba04f60d7b

+ 8 - 15
iOSClient/AppDelegate.m

@@ -190,9 +190,10 @@
 //
 - (void)applicationWillEnterForeground:(UIApplication *)application
 {
-    // Test Maintenance
-    if (self.activeAccount.length == 0 || self.maintenanceMode)
-        return;
+    if (self.activeAccount.length == 0 || self.maintenanceMode) { return; }
+    
+    [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:k_notificationCenter_applicationWillEnterForeground object:nil];
+
     
     NSLog(@"[LOG] Request Passcode");
     [self passcodeWithAutomaticallyPromptForBiometricValidation:true];
@@ -210,7 +211,6 @@
     [self pushNotification];
     
     NSLog(@"[LOG] RichDocument");
-    [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:k_notificationCenter_richdocumentGrabFocus object:nil];
 }
 
 //
@@ -218,16 +218,8 @@
 //
 - (void)applicationDidBecomeActive:(UIApplication *)application
 {
-    // Test Maintenance
-    if (self.activeAccount.length == 0 || self.maintenanceMode)
-        return;
+    if (self.activeAccount.length == 0 || self.maintenanceMode) { return; }
         
-    // middelware ping
-    if ([[NCBrandOptions sharedInstance] use_middlewarePing]) {
-        NSLog(@"[LOG] Middleware Ping");
-        [[NCService shared] middlewarePing];
-    }
-
     // Brand
     #if defined(HC)
     tableAccount *account = [[NCManageDatabase sharedInstance] getAccountActive];
@@ -246,9 +238,10 @@
 //
 - (void)applicationDidEnterBackground:(UIApplication *)application
 {
-    NSLog(@"[LOG] Enter in Background");
-            
+    if (self.activeAccount.length == 0 || self.maintenanceMode) { return; }
+
     [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:k_notificationCenter_applicationDidEnterBackground object:nil];
+    
     [self passcodeWithAutomaticallyPromptForBiometricValidation:false];
 }
 

+ 0 - 2
iOSClient/Brand/NCBrand.swift

@@ -53,7 +53,6 @@ import UIKit
     @objc public var pushNotificationServerProxy:       String = "https://push-notifications.nextcloud.com"
     @objc public var linkLoginHost:                     String = "https://nextcloud.com/install"
     @objc public var linkloginPreferredProviders:       String = "https://nextcloud.com/signup";
-    @objc public var middlewarePingUrl:                 String = ""
     @objc public var webLoginAutenticationProtocol:     String = "nc://"                                            // example "abc://"
     // Personalized
     @objc public var webCloseViewProtocolPersonalized:  String = ""                                                 // example "abc://change/plan"      Don't touch me !!
@@ -74,7 +73,6 @@ import UIKit
     @objc public var use_themingColor:                  Bool = true
     //@objc public var use_themingBackground:             Bool = true                                               // Deprecated
     @objc public var use_themingLogo:                   Bool = false
-    @objc public var use_middlewarePing:                Bool = false
     @objc public var use_storeLocalAutoUploadAll:       Bool = false
     @objc public var use_configuration:                 Bool = false                                                // Don't touch me !!
     @objc public var use_loginflowv2:                   Bool = false                                                // Don't touch me !!

+ 1 - 0
iOSClient/CCGlobal.h

@@ -296,6 +296,7 @@
 // Notification Center
 
 #define k_notificationCenter_applicationDidEnterBackground  @"applicationDidEnterBackground"
+#define k_notificationCenter_applicationWillEnterForeground @"applicationWillEnterForeground"
 
 #define k_notificationCenter_initializeMain             @"initializeMain"
 #define k_notificationCenter_setTitleMain               @"setTitleMain"

+ 6 - 8
iOSClient/Media/NCMedia.swift

@@ -62,7 +62,8 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
 
         appDelegate.activeMedia = self
         
-        NotificationCenter.default.addObserver(self, selector: #selector(reloadDataSource), name: NSNotification.Name(rawValue: k_notificationCenter_initializeMain), object: nil)
+        //NotificationCenter.default.addObserver(self, selector: #selector(reloadDataSource), name: NSNotification.Name(rawValue: k_notificationCenter_initializeMain), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(reloadDataSource), name: NSNotification.Name(rawValue: k_notificationCenter_applicationWillEnterForeground), object: nil)
     }
     
     override func viewDidLoad() {
@@ -118,7 +119,6 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
         super.viewDidAppear(animated)
         
         mediaCommandTitle()
-        readFiles()
         searchNewPhotoVideo()
     }
     
@@ -528,9 +528,7 @@ extension NCMedia {
     
     private func reloadDataSourceWithCompletion(_ completion: @escaping () -> Void) {
         
-        if (appDelegate.activeAccount == nil || appDelegate.activeAccount.count == 0 || appDelegate.maintenanceMode == true) {
-            return
-        }
+        if (appDelegate.activeAccount == nil || appDelegate.activeAccount.count == 0 || appDelegate.maintenanceMode == true || self.view.window == nil) { return }
         
         var predicate: NSPredicate?
         
@@ -550,6 +548,7 @@ extension NCMedia {
                 
                 self.reloadDataThenPerform {
                     self.mediaCommandTitle()
+                    self.readFiles()
                 }
             }
             completion()
@@ -592,7 +591,6 @@ extension NCMedia {
         NCCommunication.shared.searchMedia(lessDate: lessDate, greaterDate: greaterDate, elementDate: "d:getlastmodified/" ,showHiddenFiles: CCUtility.getShowHiddenFiles(), user: appDelegate.activeUser) { (account, files, errorCode, errorDescription) in
             
             self.newInProgress = false
-            self.collectionView.reloadData()
 
             if errorCode == 0 && account == self.appDelegate.activeAccount && files?.count ?? 0 > 0 {
                 
@@ -601,13 +599,13 @@ extension NCMedia {
                     NCManageDatabase.sharedInstance.setAccountDateLessMedia(date: files?.last?.date)
                 }
                 NCManageDatabase.sharedInstance.setAccountDateUpdateNewMedia()
-                
-                self.reloadDataSource()
             }
             
             if errorCode == 0 && files?.count ?? 0 == 0 && self.metadatas.count == 0 {
                 self.searchOldPhotoVideo()
             }
+            
+            self.reloadDataSource()
         }
     }
     

+ 1 - 8
iOSClient/Networking/NCService.swift

@@ -220,14 +220,7 @@ class NCService: NSObject {
             }
         }
     }
-    
-    @objc public func middlewarePing() {
-        
-        if (appDelegate.activeAccount == nil || appDelegate.activeAccount.count == 0 || appDelegate.maintenanceMode == true) {
-            return
-        }
-    }
-    
+   
     //MARK: - Thirt Part
     
     private func requestHC() {