SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit 5cffdbcd278b0839b5f1369092c606462ff3de75 parent 766529d7bec1108815563527b81d1c355bfd2757 Author: Lior Halphon <LIJI32@gmail.com> Date: Sat, 22 Aug 2020 00:56:12 +0300 Prevent asking for notification permissions until used by an HuC-3 game Diffstat:
| M | Cocoa/AppDelegate.m | 4 | +++- |
| M | Cocoa/Document.m | 1 | + |
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/Cocoa/AppDelegate.m b/Cocoa/AppDelegate.m @@ -51,7 +51,9 @@ JOYHatsEmulateButtonsKey: @YES, }]; - [NSUserNotificationCenter defaultUserNotificationCenter].delegate = self; + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"GBNotificationsUsed"]) { + [NSUserNotificationCenter defaultUserNotificationCenter].delegate = self; + } } - (IBAction)toggleDeveloperMode:(id)sender diff --git a/Cocoa/Document.m b/Cocoa/Document.m @@ -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];
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.