Delay requests to show notifications
This commit is contained in:
parent
c665fcb2ed
commit
83b959c126
@ -359,19 +359,21 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp)
|
|||||||
NSTimer *hex_timer = [NSTimer timerWithTimeInterval:0.25 target:self selector:@selector(reloadMemoryView) userInfo:nil repeats:YES];
|
NSTimer *hex_timer = [NSTimer timerWithTimeInterval:0.25 target:self selector:@selector(reloadMemoryView) userInfo:nil repeats:YES];
|
||||||
[[NSRunLoop mainRunLoop] addTimer:hex_timer forMode:NSDefaultRunLoopMode];
|
[[NSRunLoop mainRunLoop] addTimer:hex_timer forMode:NSDefaultRunLoopMode];
|
||||||
|
|
||||||
/* Clear pending alarms, don't play alarms while playing*/
|
/* Clear pending alarms, don't play alarms while playing */
|
||||||
NSUserNotificationCenter *center = [NSUserNotificationCenter defaultUserNotificationCenter];
|
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"GBNotificationsUsed"]) {
|
||||||
for (NSUserNotification *notification in [center scheduledNotifications]) {
|
NSUserNotificationCenter *center = [NSUserNotificationCenter defaultUserNotificationCenter];
|
||||||
if ([notification.identifier isEqualToString:self.fileName]) {
|
for (NSUserNotification *notification in [center scheduledNotifications]) {
|
||||||
[center removeScheduledNotification:notification];
|
if ([notification.identifier isEqualToString:self.fileName]) {
|
||||||
break;
|
[center removeScheduledNotification:notification];
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (NSUserNotification *notification in [center deliveredNotifications]) {
|
for (NSUserNotification *notification in [center deliveredNotifications]) {
|
||||||
if ([notification.identifier isEqualToString:self.fileName]) {
|
if ([notification.identifier isEqualToString:self.fileName]) {
|
||||||
[center removeDeliveredNotification:notification];
|
[center removeDeliveredNotification:notification];
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,7 +414,8 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp)
|
|||||||
notification.identifier = self.fileName;
|
notification.identifier = self.fileName;
|
||||||
notification.deliveryDate = [NSDate dateWithTimeIntervalSinceNow:time_to_alarm];
|
notification.deliveryDate = [NSDate dateWithTimeIntervalSinceNow:time_to_alarm];
|
||||||
notification.soundName = NSUserNotificationDefaultSoundName;
|
notification.soundName = NSUserNotificationDefaultSoundName;
|
||||||
[center scheduleNotification:notification];
|
[[NSUserNotificationCenter defaultUserNotificationCenter] scheduleNotification:notification];
|
||||||
|
[[NSUserDefaults standardUserDefaults] setBool:true forKey:@"GBNotificationsUsed"];
|
||||||
}
|
}
|
||||||
[_view setRumble:0];
|
[_view setRumble:0];
|
||||||
stopping = false;
|
stopping = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user