Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cordova-plugin-local-notifications
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nabil Sadki
cordova-plugin-local-notifications
Commits
0fe90469
Commit
0fe90469
authored
Jun 30, 2017
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move registration for custom dismiss action to UNUserNotificationCenter
parent
19d5b97a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
11 deletions
+29
-11
APPLocalNotification.m
src/ios/APPLocalNotification.m
+2
-11
UNUserNotificationCenter+APPLocalNotification.h
src/ios/UNUserNotificationCenter+APPLocalNotification.h
+4
-0
UNUserNotificationCenter+APPLocalNotification.m
src/ios/UNUserNotificationCenter+APPLocalNotification.m
+23
-0
No files found.
src/ios/APPLocalNotification.m
View file @
0fe90469
...
...
@@ -631,8 +631,7 @@
if
([
action
isEqualToString
:
UNNotificationDefaultActionIdentifier
])
{
event
=
@"click"
;
}
}
else
if
([
action
isEqualToString
:
UNNotificationDismissActionIdentifier
])
{
event
=
@"clear"
;
}
...
...
@@ -655,15 +654,7 @@
_center
=
[
UNUserNotificationCenter
currentNotificationCenter
];
_center
.
delegate
=
self
;
UNNotificationCategory
*
generalCategory
=
[
UNNotificationCategory
categoryWithIdentifier
:
@"GENERAL"
actions
:@[]
intentIdentifiers
:
@[]
options
:
UNNotificationCategoryOptionCustomDismissAction
];
// Register the notification categories.
[
_center
setNotificationCategories
:[
NSSet
setWithObjects
:
generalCategory
,
nil
]];
[
_center
registerGeneralNotificationCategory
];
}
#pragma mark -
...
...
src/ios/UNUserNotificationCenter+APPLocalNotification.h
View file @
0fe90469
...
...
@@ -25,6 +25,8 @@
@interface
UNUserNotificationCenter
(
APPLocalNotification
)
extern
NSString
*
const
kAPPGeneralCategory
;
typedef
NS_ENUM
(
NSUInteger
,
APPNotificationType
)
{
NotifcationTypeAll
=
0
,
NotifcationTypeScheduled
=
1
,
...
...
@@ -36,6 +38,8 @@ typedef NS_ENUM(NSUInteger, APPNotificationType) {
@property
(
readonly
,
getter
=
getNotifications
)
NSArray
*
localNotifications
;
@property
(
readonly
,
getter
=
getNotificationIds
)
NSArray
*
localNotificationIds
;
-
(
void
)
registerGeneralNotificationCategory
;
// List of all notification IDs from given type
-
(
NSArray
*
)
getNotificationIdsByType
:(
APPNotificationType
)
type
;
...
...
src/ios/UNUserNotificationCenter+APPLocalNotification.m
View file @
0fe90469
...
...
@@ -26,9 +26,32 @@
@import
UserNotifications
;
NSString
*
const
kAPPGeneralCategory
=
@"GENERAL"
;
@implementation
UNUserNotificationCenter
(
APPLocalNotification
)
#pragma mark -
#pragma mark NotificationCategory
/**
* Register general notification category to listen for dismiss actions.
*
* @return [ Void ]
*/
-
(
void
)
registerGeneralNotificationCategory
{
UNNotificationCategory
*
category
;
category
=
[
UNNotificationCategory
categoryWithIdentifier
:
@"GENERAL"
actions
:@[]
intentIdentifiers
:
@[]
options
:
UNNotificationCategoryOptionCustomDismissAction
];
[
self
setNotificationCategories
:[
NSSet
setWithObjects
:
category
,
nil
]];
}
#pragma mark -
#pragma mark LocalNotifications
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment