[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,8 +147,9 @@ BOOL kAppControllerShuttingDown = NO;
|
||||||
[[NSUserDefaults standardUserDefaults] registerDefaults:@{ @"NSApplicationCrashOnExceptions": @(YES) }];
|
[[NSUserDefaults standardUserDefaults] registerDefaults:@{ @"NSApplicationCrashOnExceptions": @(YES) }];
|
||||||
|
|
||||||
[FIRApp configure];
|
[FIRApp configure];
|
||||||
[FIRAnalytics setAnalyticsCollectionEnabled:YES];
|
|
||||||
|
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.crashlyticsConsented" options:(NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew) context:kAppControllerContext];
|
||||||
|
|
||||||
[[totalTimeField cell] setBackgroundStyle:NSBackgroundStyleRaised];
|
[[totalTimeField cell] setBackgroundStyle:NSBackgroundStyleRaised];
|
||||||
|
|
||||||
[self.infoButton setToolTip:NSLocalizedString(@"InfoButtonTooltip", @"")];
|
[self.infoButton setToolTip:NSLocalizedString(@"InfoButtonTooltip", @"")];
|
||||||
|
@ -284,8 +285,12 @@ BOOL kAppControllerShuttingDown = NO;
|
||||||
if(context != kAppControllerContext) {
|
if(context != kAppControllerContext) {
|
||||||
return;
|
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;
|
PlaylistEntry *entry = playlistController.currentEntry;
|
||||||
NSString *appTitle = NSLocalizedString(@"CogTitle", @"");
|
NSString *appTitle = NSLocalizedString(@"CogTitle", @"");
|
||||||
if(!entry) {
|
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\
|
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n\
|
||||||
<plist version=\"1.0\">\n\
|
<plist version=\"1.0\">\n\
|
||||||
<dict>\n\
|
<dict>\n\
|
||||||
|
\t<key>FirebaseCrashlyticsCollectionEnabled</key>\n\
|
||||||
|
\t<false/>\n\
|
||||||
\t<key>SUEnableInstallerLauncherService</key>\n\
|
\t<key>SUEnableInstallerLauncherService</key>\n\
|
||||||
\t<true/>\n\
|
\t<true/>\n\
|
||||||
\t<key>CFBundleDevelopmentRegion</key>\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">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>FirebaseCrashlyticsCollectionEnabled</key>
|
||||||
|
<false/>
|
||||||
<key>SUEnableInstallerLauncherService</key>
|
<key>SUEnableInstallerLauncherService</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
|
|
@ -402,11 +402,11 @@
|
||||||
<classReference key="objectClass" className="NSDictionary"/>
|
<classReference key="objectClass" className="NSDictionary"/>
|
||||||
</arrayController>
|
</arrayController>
|
||||||
<customView id="0nK-XQ-5MY" userLabel="GeneralView">
|
<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"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dIu-uT-8YW">
|
<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"/>
|
<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">
|
<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"/>
|
<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"/>
|
<binding destination="52" name="value" keyPath="values.allowInsecureSSL" id="78K-25-qki"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</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">
|
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="crf-C9-9YF">
|
||||||
<rect key="frame" x="20" y="142" width="170" height="16"/>
|
<rect key="frame" x="20" y="142" width="170" height="16"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
|
@ -534,7 +545,7 @@
|
||||||
</connections>
|
</connections>
|
||||||
</scrollView>
|
</scrollView>
|
||||||
</subviews>
|
</subviews>
|
||||||
<point key="canvasLocation" x="450" y="-211"/>
|
<point key="canvasLocation" x="450" y="-200"/>
|
||||||
</customView>
|
</customView>
|
||||||
<customView id="U4w-jw-ca5" userLabel="NotificationsView">
|
<customView id="U4w-jw-ca5" userLabel="NotificationsView">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="530" height="99"/>
|
<rect key="frame" x="0.0" y="0.0" width="530" height="99"/>
|
||||||
|
|
|
@ -8,6 +8,27 @@
|
||||||
|
|
||||||
#import "MainWindow.h"
|
#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
|
@implementation MainWindow
|
||||||
|
|
||||||
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSWindowStyleMask)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation {
|
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSWindowStyleMask)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation {
|
||||||
|
@ -27,6 +48,10 @@
|
||||||
hdcdLogo = [NSImage imageNamed:@"hdcdLogoTemplate"];
|
hdcdLogo = [NSImage imageNamed:@"hdcdLogoTemplate"];
|
||||||
|
|
||||||
[self showHDCDLogo:NO];
|
[self showHDCDLogo:NO];
|
||||||
|
|
||||||
|
if(![[NSUserDefaults standardUserDefaults] boolForKey:@"miniMode"]) {
|
||||||
|
showCrashlyticsConsent(self);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)showHDCDLogo:(BOOL)show {
|
- (void)showHDCDLogo:(BOOL)show {
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
extern NSString *iTunesDropType;
|
extern NSString *iTunesDropType;
|
||||||
|
|
||||||
|
extern void showCrashlyticsConsent(NSWindow *window);
|
||||||
|
|
||||||
@implementation MiniWindow
|
@implementation MiniWindow
|
||||||
|
|
||||||
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSWindowStyleMask)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation {
|
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSWindowStyleMask)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation {
|
||||||
|
@ -46,6 +48,10 @@ extern NSString *iTunesDropType;
|
||||||
fileType = NSFilenamesPboardType;
|
fileType = NSFilenamesPboardType;
|
||||||
}
|
}
|
||||||
[self registerForDraggedTypes:@[fileType, iTunesDropType]];
|
[self registerForDraggedTypes:@[fileType, iTunesDropType]];
|
||||||
|
|
||||||
|
if([[NSUserDefaults standardUserDefaults] boolForKey:@"miniMode"]) {
|
||||||
|
showCrashlyticsConsent(self);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)toggleToolbarShown:(id)sender {
|
- (void)toggleToolbarShown:(id)sender {
|
||||||
|
|
|
@ -74,3 +74,8 @@
|
||||||
"GainTrackPeak" = "Track Peak";
|
"GainTrackPeak" = "Track Peak";
|
||||||
"GainVolumeScale" = "Volume Scale";
|
"GainVolumeScale" = "Volume Scale";
|
||||||
"GainNone" = "None";
|
"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";
|
"GainTrackPeak" = "Track Peak";
|
||||||
"GainVolumeScale" = "Volume Scale";
|
"GainVolumeScale" = "Volume Scale";
|
||||||
"GainNone" = "None";
|
"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