Use new UN notification API.
This commit is contained in:
parent
d9e5f77bee
commit
eb8d10ed05
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#import <QuartzCore/QuartzCore.h>
|
#import <QuartzCore/QuartzCore.h>
|
||||||
#import <Countly/Countly.h>
|
#import <Countly/Countly.h>
|
||||||
|
#import <UserNotifications/UserNotifications.h>
|
||||||
#import "MPSitesWindowController.h"
|
#import "MPSitesWindowController.h"
|
||||||
#import "MPMacAppDelegate.h"
|
#import "MPMacAppDelegate.h"
|
||||||
#import "MPAppDelegate_Store.h"
|
#import "MPAppDelegate_Store.h"
|
||||||
@ -99,7 +100,16 @@
|
|||||||
self.siteTable.superview.superview.layer.mask = self.siteGradient;
|
self.siteTable.superview.superview.layer.mask = self.siteGradient;
|
||||||
|
|
||||||
self.siteTable.controller = self;
|
self.siteTable.controller = self;
|
||||||
prof_finish( @"ui" );
|
prof_rewind( @"ui" );
|
||||||
|
|
||||||
|
if (@available( macOS 10.14, * )) {
|
||||||
|
[[UNUserNotificationCenter currentNotificationCenter]
|
||||||
|
requestAuthorizationWithOptions:UNAuthorizationOptionAlert completionHandler:^(BOOL granted, NSError *error) {
|
||||||
|
if (!granted)
|
||||||
|
err( @"Couldn't obtain notification authorization: %@", error );
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
prof_finish( @"notifications" );
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
@ -550,13 +560,19 @@
|
|||||||
[self copyContent:self.shiftPressed? selectedSite.loginName: selectedSite.content];
|
[self copyContent:self.shiftPressed? selectedSite.loginName: selectedSite.content];
|
||||||
[NSApp hide:nil];
|
[NSApp hide:nil];
|
||||||
|
|
||||||
NSUserNotification *notification = [NSUserNotification new];
|
if (@available( macOS 10.14, * )) {
|
||||||
notification.title = @"Password Copied";
|
UNMutableNotificationContent *notification = [UNMutableNotificationContent new];
|
||||||
if (selectedSite.loginName.length)
|
notification.title = self.shiftPressed? @"Login Copied": @"Password Copied";
|
||||||
notification.subtitle = strf( @"%@ at %@", selectedSite.loginName, selectedSite.name );
|
if (selectedSite.loginName.length)
|
||||||
else
|
notification.subtitle = strf( @"%@ at %@", selectedSite.loginName, selectedSite.name );
|
||||||
notification.subtitle = selectedSite.name;
|
else
|
||||||
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
|
notification.subtitle = selectedSite.name;
|
||||||
|
[[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:
|
||||||
|
[UNNotificationRequest requestWithIdentifier:selectedSite.name content:notification trigger:nil]
|
||||||
|
withCompletionHandler:^(NSError *error) {
|
||||||
|
dbg( @"notification: %@, completed w/errror: %@", notification, error );
|
||||||
|
}];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updateUser {
|
- (void)updateUser {
|
||||||
|
Loading…
Reference in New Issue
Block a user