[Crashlytics] Require asking user consent
Require asking user consent for data transmission on first launch, or otherwise disable sending crash reports by default. Signed-off-by: Christopher Snowhill <kode54@gmail.com>lastfm
parent
eadac4c033
commit
2821cb36b5
|
@ -147,7 +147,8 @@ BOOL kAppControllerShuttingDown = NO;
|
|||
[[NSUserDefaults standardUserDefaults] registerDefaults:@{ @"NSApplicationCrashOnExceptions": @(YES) }];
|
||||
|
||||
[FIRApp configure];
|
||||
[FIRAnalytics setAnalyticsCollectionEnabled:YES];
|
||||
|
||||
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.crashlyticsConsented" options:(NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew) context:kAppControllerContext];
|
||||
|
||||
[[totalTimeField cell] setBackgroundStyle:NSBackgroundStyleRaised];
|
||||
|
||||
|
@ -285,7 +286,11 @@ BOOL kAppControllerShuttingDown = NO;
|
|||
return;
|
||||
}
|
||||
|
||||
if([keyPath isEqualToString:@"playlistController.currentEntry"]) {
|
||||
if([keyPath isEqualToString:@"values.crashlyticsConsented"]) {
|
||||
BOOL enabled = [[NSUserDefaults standardUserDefaults] boolForKey:@"crashlyticsConsented"];
|
||||
[[FIRCrashlytics crashlytics] setCrashlyticsCollectionEnabled:enabled];
|
||||
[FIRAnalytics setAnalyticsCollectionEnabled:enabled];
|
||||
} else if([keyPath isEqualToString:@"playlistController.currentEntry"]) {
|
||||
PlaylistEntry *entry = playlistController.currentEntry;
|
||||
NSString *appTitle = NSLocalizedString(@"CogTitle", @"");
|
||||
if(!entry) {
|
||||
|
|
|
@ -375,6 +375,8 @@ static NSString *xmlEscapeString(NSString * string) {
|
|||
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n\
|
||||
<plist version=\"1.0\">\n\
|
||||
<dict>\n\
|
||||
\t<key>FirebaseCrashlyticsCollectionEnabled</key>\n\
|
||||
\t<false/>\n\
|
||||
\t<key>SUEnableInstallerLauncherService</key>\n\
|
||||
\t<true/>\n\
|
||||
\t<key>CFBundleDevelopmentRegion</key>\n\
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>FirebaseCrashlyticsCollectionEnabled</key>
|
||||
<false/>
|
||||
<key>SUEnableInstallerLauncherService</key>
|
||||
<true/>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
|
|
|
@ -402,11 +402,11 @@
|
|||
<classReference key="objectClass" className="NSDictionary"/>
|
||||
</arrayController>
|
||||
<customView id="0nK-XQ-5MY" userLabel="GeneralView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="530" height="202"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="530" height="224"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dIu-uT-8YW">
|
||||
<rect key="frame" x="18" y="165" width="226" height="18"/>
|
||||
<rect key="frame" x="18" y="187" width="226" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="Allow insecure SSL connections" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="sva-DV-ina">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
|
@ -416,6 +416,17 @@
|
|||
<binding destination="52" name="value" keyPath="values.allowInsecureSSL" id="78K-25-qki"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="eG6-20-AS8">
|
||||
<rect key="frame" x="18" y="165" width="257" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="Send crash reports and usage data" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="zQ2-6O-3Og">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="52" name="value" keyPath="values.crashlyticsConsented" id="GQu-a0-JJs"/>
|
||||
</connections>
|
||||
</button>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="crf-C9-9YF">
|
||||
<rect key="frame" x="20" y="142" width="170" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
|
@ -534,7 +545,7 @@
|
|||
</connections>
|
||||
</scrollView>
|
||||
</subviews>
|
||||
<point key="canvasLocation" x="450" y="-211"/>
|
||||
<point key="canvasLocation" x="450" y="-200"/>
|
||||
</customView>
|
||||
<customView id="U4w-jw-ca5" userLabel="NotificationsView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="530" height="99"/>
|
||||
|
|
|
@ -8,6 +8,27 @@
|
|||
|
||||
#import "MainWindow.h"
|
||||
|
||||
void showCrashlyticsConsent(NSWindow *window) {
|
||||
BOOL askedConsent = [[NSUserDefaults standardUserDefaults] boolForKey:@"crashlyticsAskedConsent"];
|
||||
if(!askedConsent) {
|
||||
[window orderFront:window];
|
||||
|
||||
NSAlert *alert = [[NSAlert alloc] init];
|
||||
[alert setMessageText:NSLocalizedString(@"CrashlyticsConsentTitle", @"")];
|
||||
[alert setInformativeText:NSLocalizedString(@"CrashlyticsConsentText", @"")];
|
||||
[alert addButtonWithTitle:NSLocalizedString(@"ConsentYes",@"")];
|
||||
[alert addButtonWithTitle:NSLocalizedString(@"ConsentNo", @"")];
|
||||
|
||||
[alert beginSheetModalForWindow:window completionHandler:^(NSModalResponse returnCode) {
|
||||
if(returnCode == NSAlertFirstButtonReturn) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"crashlyticsConsented"];
|
||||
}
|
||||
}];
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"crashlyticsAskedConsent"];
|
||||
}
|
||||
}
|
||||
|
||||
@implementation MainWindow
|
||||
|
||||
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSWindowStyleMask)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation {
|
||||
|
@ -27,6 +48,10 @@
|
|||
hdcdLogo = [NSImage imageNamed:@"hdcdLogoTemplate"];
|
||||
|
||||
[self showHDCDLogo:NO];
|
||||
|
||||
if(![[NSUserDefaults standardUserDefaults] boolForKey:@"miniMode"]) {
|
||||
showCrashlyticsConsent(self);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)showHDCDLogo:(BOOL)show {
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
extern NSString *iTunesDropType;
|
||||
|
||||
extern void showCrashlyticsConsent(NSWindow *window);
|
||||
|
||||
@implementation MiniWindow
|
||||
|
||||
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSWindowStyleMask)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation {
|
||||
|
@ -46,6 +48,10 @@ extern NSString *iTunesDropType;
|
|||
fileType = NSFilenamesPboardType;
|
||||
}
|
||||
[self registerForDraggedTypes:@[fileType, iTunesDropType]];
|
||||
|
||||
if([[NSUserDefaults standardUserDefaults] boolForKey:@"miniMode"]) {
|
||||
showCrashlyticsConsent(self);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)toggleToolbarShown:(id)sender {
|
||||
|
|
|
@ -74,3 +74,8 @@
|
|||
"GainTrackPeak" = "Track Peak";
|
||||
"GainVolumeScale" = "Volume Scale";
|
||||
"GainNone" = "None";
|
||||
|
||||
"CrashlyticsConsentTitle" = "Crashlytics crash collection";
|
||||
"CrashlyticsConsentText" = "Would you like to allow Crashlytics to submit crash reports? You may turn this off again in Preferences. We won't ask you again.";
|
||||
"ConsentYes" = "Yes";
|
||||
"ConsentNo" = "No";
|
||||
|
|
|
@ -74,3 +74,8 @@
|
|||
"GainTrackPeak" = "Track Peak";
|
||||
"GainVolumeScale" = "Volume Scale";
|
||||
"GainNone" = "None";
|
||||
|
||||
"CrashlyticsConsentTitle" = "Crashlytics crash collection";
|
||||
"CrashlyticsConsentText" = "Would you like to allow Crashlytics to submit crash reports? You may turn this off again in Preferences. We won't ask you again.";
|
||||
"ConsentYes" = "Yes";
|
||||
"ConsentNo" = "No";
|
||||
|
|
Loading…
Reference in New Issue