Browse Source

add the "Disable crash reporter" on Advanced/Settings

marinofaggiana 6 years ago
parent
commit
195439d868

+ 3 - 1
iOSClient/AppDelegate.m

@@ -204,7 +204,9 @@ PKPushRegistry *pushRegistry;
     self.timerUpdateApplicationIconBadgeNumber = [NSTimer scheduledTimerWithTimeInterval:k_timerUpdateApplicationIconBadgeNumber target:self selector:@selector(updateApplicationIconBadgeNumber) userInfo:nil repeats:YES];
 
     // Fabric
-    [Fabric with:@[[Crashlytics class]]];
+    if (![CCUtility getDisableCrashservice]) {
+        [Fabric with:@[[Crashlytics class]]];
+    }
     
     // Store review
     if ([[NCUtility sharedInstance] isSimulatorOrTestFlight] == false) {

+ 15 - 0
iOSClient/Images.xcassets/crashservice.imageset/Contents.json

@@ -0,0 +1,15 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "crashservice.pdf"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  },
+  "properties" : {
+    "preserves-vector-representation" : true
+  }
+}

BIN
iOSClient/Images.xcassets/crashservice.imageset/crashservice.pdf


+ 24 - 0
iOSClient/Settings/CCAdvanced.m

@@ -86,6 +86,19 @@
         [section addFormRow:row];
     }
     
+    // Section : Privacy --------------------------------------------------------------
+
+    section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_privacy_", nil)];
+    [form addFormSection:section];
+    section.footerTitle = NSLocalizedString(@"_privacy_footer_", nil);
+    
+    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"crashservice" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_crashservice_title_", nil)];
+    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
+    [row.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"crashservice"] width:50 height:50 color:[NCBrandColor sharedInstance].icon] forKey:@"imageView.image"];
+    if ([CCUtility getDisableCrashservice]) row.value = @"1";
+    else row.value = @"0";
+    [section addFormRow:row];
+    
     // Section CLEAR CACHE -------------------------------------------------
     
     section = [XLFormSectionDescriptor formSection];
@@ -166,6 +179,17 @@
         
         [CCUtility setDisableFilesApp:[[rowDescriptor.value valueData] boolValue]];
     }
+    
+    if ([rowDescriptor.tag isEqualToString:@"crashservice"]) {
+        
+        [CCUtility setDisableCrashservice:[[rowDescriptor.value valueData] boolValue]];
+        
+        UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_crashservice_title_", nil) message:NSLocalizedString(@"_crashservice_alert_", nil) preferredStyle:UIAlertControllerStyleAlert];
+        UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"_ok_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {}];
+        
+        [alertController addAction:okAction];
+        [self presentViewController:alertController animated:YES completion:nil];
+    }
 }
 
 #pragma --------------------------------------------------------------------------------------------

+ 4 - 0
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -234,6 +234,10 @@
 "_show_hidden_files_"           = "Show hidden files";
 "_format_compatibility_"        = "Most Compatible";
 "_format_compatibility_footer_" = "\"Most compatible\" will save, when possible, photos as JPEG";
+"_privacy_"                     = "Privacy";
+"_privacy_footer_"              = "Nextcloud iOS use a service for the analysis of crash, your personal information is not sent with the report. If you want disable this please setting on ON the \"Disable crash reporter\"";
+"_crashservice_title_"          = "Disable crash reporter";
+"_crashservice_alert_"          = "This option requires program termination to take effect";
 
 // Login
 

+ 3 - 0
iOSClient/Utility/CCUtility.h

@@ -150,6 +150,9 @@
 + (NSInteger)getMediaWidthImage;
 + (void)setMediaWidthImage:(NSInteger)width;
 
++ (BOOL)getDisableCrashservice;
++ (void)setDisableCrashservice:(BOOL)disable;
+
 // ===== Varius =====
 
 + (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL;

+ 11 - 0
iOSClient/Utility/CCUtility.m

@@ -568,6 +568,17 @@
     [UICKeyChainStore setString:widthString forKey:@"mediaWidthImage" service:k_serviceShareKeyChain];
 }
 
++ (BOOL)getDisableCrashservice
+{
+    return [[UICKeyChainStore stringForKey:@"crashservice" service:k_serviceShareKeyChain] boolValue];
+}
+
++ (void)setDisableCrashservice:(BOOL)disable
+{
+    NSString *sDisable = (disable) ? @"true" : @"false";
+    [UICKeyChainStore setString:sDisable forKey:@"crashservice" service:k_serviceShareKeyChain];
+}
+
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ===== Various =====
 #pragma --------------------------------------------------------------------------------------------