Skip to content

Commit

Permalink
Use unique identifier for notifications instead of incremental integer
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaHirapara authored and andydotxyz committed Dec 30, 2020
1 parent b0e24a3 commit 274ed61
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/app_darwin.m
Expand Up @@ -22,8 +22,6 @@ - (BOOL)userNotificationCenter:(NSUserNotificationCenter*)center

@end

static int notifyNum = 0;

void sendNSUserNotification(const char *, const char *);

bool isBundled() {
Expand All @@ -40,10 +38,12 @@ void sendNotification(const char *title, const char *body) {
if (center.delegate == nil) {
center.delegate = [[FyneUserNotificationCenterDelegate new] autorelease];
}

NSString *uuid = [[NSUUID UUID] UUIDString];
NSUserNotification *notification = [[NSUserNotification new] autorelease];
notification.title = [NSString stringWithUTF8String:title];
notification.informativeText = [NSString stringWithUTF8String:body];
notification.identifier = [NSString stringWithFormat:@"%@-fyne-notify-%d", [[NSBundle mainBundle] bundleIdentifier], ++notifyNum];
notification.identifier = [NSString stringWithFormat:@"%@-fyne-notify-%@", [[NSBundle mainBundle] bundleIdentifier], uuid];
[center scheduleNotification:notification];
}

Expand Down

0 comments on commit 274ed61

Please sign in to comment.