Browse Source

add function: isSimulatorOrTestFlight

Marino Faggiana 6 years ago
parent
commit
0bcf87d108
2 changed files with 13 additions and 5 deletions
  1. 5 5
      iOSClient/AppDelegate.m
  2. 8 0
      iOSClient/Utility/NCUtility.swift

+ 5 - 5
iOSClient/AppDelegate.m

@@ -212,11 +212,11 @@
     [self logUser];
     
     // Store review
-#if !TARGET_OS_SIMULATOR && !defined(DEBUG)
-    NCStoreReview *review = [NCStoreReview new];
-    [review incrementAppRuns];
-    [review showStoreReview];
-#endif
+    if ([[NCUtility sharedInstance] isSimulatorOrTestFlight] == false) {
+        NCStoreReview *review = [NCStoreReview new];
+        [review incrementAppRuns];
+        [review showStoreReview];
+    }
     
     return YES;
 }

+ 8 - 0
iOSClient/Utility/NCUtility.swift

@@ -268,5 +268,13 @@ class NCUtility: NSObject {
         activityIndicator.stopAnimating()
         activityIndicator.removeFromSuperview()
     }
+    
+    @objc func isSimulatorOrTestFlight() -> Bool {
+        guard let path = Bundle.main.appStoreReceiptURL?.path else {
+            return false
+        }
+        return path.contains("CoreSimulator") || path.contains("sandboxReceipt")
+    }
+
 }