Prevent asking for notification permissions until used by an HuC-3 game

This commit is contained in:
Lior Halphon 2020-08-22 00:56:12 +03:00
parent 766529d7be
commit 5cffdbcd27
2 changed files with 4 additions and 1 deletions

View File

@ -51,7 +51,9 @@
JOYHatsEmulateButtonsKey: @YES,
}];
[NSUserNotificationCenter defaultUserNotificationCenter].delegate = self;
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"GBNotificationsUsed"]) {
[NSUserNotificationCenter defaultUserNotificationCenter].delegate = self;
}
}
- (IBAction)toggleDeveloperMode:(id)sender

View File

@ -404,6 +404,7 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp)
unsigned time_to_alarm = GB_time_to_alarm(&gb);
if (time_to_alarm) {
[NSUserNotificationCenter defaultUserNotificationCenter].delegate = (id)[NSApp delegate];
NSUserNotification *notification = [[NSUserNotification alloc] init];
NSString *friendlyName = [[self.fileName lastPathComponent] stringByDeletingPathExtension];
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"\\([^)]+\\)|\\[[^\\]]+\\]" options:0 error:nil];