cordova-plugin-local-notifications-continued 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/.github/FUNDING.yml +1 -0
  2. package/.github/ISSUE_TEMPLATE/report_issue.yml +126 -0
  3. package/CHANGELOG.md +358 -0
  4. package/LICENSE +202 -0
  5. package/README.md +1531 -0
  6. package/images/android-actions-with-input-clicked.png +0 -0
  7. package/images/android-actions-with-input-not-clicked.png +0 -0
  8. package/images/android-actions.png +0 -0
  9. package/images/android-alarms-and-reminders-in-app-settings.png +0 -0
  10. package/images/android-alarms-and-reminders-setting.png +0 -0
  11. package/images/android-app-hibernation-notification.png +0 -0
  12. package/images/android-app-hibernation-settings-android-12.png +0 -0
  13. package/images/android-app-hibernation-settings-android-13-14.png +0 -0
  14. package/images/android-app-hibernation-settings-android-15.png +0 -0
  15. package/images/android-attachments-image-folded.png +0 -0
  16. package/images/android-attachments-image-unfolded.png +0 -0
  17. package/images/android-chat.png +0 -0
  18. package/images/android-icon.svg +19 -0
  19. package/images/android-inbox.png +0 -0
  20. package/images/android-notification-example.png +0 -0
  21. package/images/android-progress.png +0 -0
  22. package/images/android-request-permission.png +0 -0
  23. package/images/android-stack.png +0 -0
  24. package/images/apple-icon.svg +1 -0
  25. package/images/cordova-app-notified-logo.png +0 -0
  26. package/images/ios-actions-with-input.png +0 -0
  27. package/images/ios-actions.png +0 -0
  28. package/images/ios-attachments-image-folded.png +0 -0
  29. package/images/ios-attachments-image-unfolded.png +0 -0
  30. package/images/ios-notification.png +0 -0
  31. package/images/ios-request-permission.png +0 -0
  32. package/images/logo.png +0 -0
  33. package/package.json +53 -0
  34. package/plugin.xml +266 -0
  35. package/src/android/ClickActivity.java +72 -0
  36. package/src/android/LocalNotification.java +779 -0
  37. package/src/android/Manager.java +327 -0
  38. package/src/android/Notification.java +844 -0
  39. package/src/android/Options.java +956 -0
  40. package/src/android/OptionsTrigger.java +104 -0
  41. package/src/android/action/Action.java +214 -0
  42. package/src/android/action/ActionGroup.java +135 -0
  43. package/src/android/build/localnotification.gradle +29 -0
  44. package/src/android/receiver/ClearReceiver.java +61 -0
  45. package/src/android/receiver/RestoreReceiver.java +70 -0
  46. package/src/android/receiver/TriggerReceiver.java +70 -0
  47. package/src/android/trigger/TriggerHandler.java +195 -0
  48. package/src/android/trigger/TriggerHandlerAt.java +63 -0
  49. package/src/android/trigger/TriggerHandlerEvery.java +257 -0
  50. package/src/android/trigger/TriggerHandlerIn.java +69 -0
  51. package/src/android/util/AssetUtil.java +385 -0
  52. package/src/android/util/CallbackContextUtil.java +88 -0
  53. package/src/android/util/PluginFileProvider.java +34 -0
  54. package/src/android/xml/shared_files_provider_paths.xml +38 -0
  55. package/src/ios/APPLocalNotification.h +56 -0
  56. package/src/ios/APPLocalNotification.m +650 -0
  57. package/src/ios/APPNotificationCategory.h +28 -0
  58. package/src/ios/APPNotificationCategory.m +107 -0
  59. package/src/ios/APPNotificationContent.h +32 -0
  60. package/src/ios/APPNotificationContent.m +122 -0
  61. package/src/ios/APPNotificationOptions.h +42 -0
  62. package/src/ios/APPNotificationOptions.m +689 -0
  63. package/src/ios/UNNotificationRequest+APPLocalNotification.h +32 -0
  64. package/src/ios/UNNotificationRequest+APPLocalNotification.m +100 -0
  65. package/src/ios/UNUserNotificationCenter+APPLocalNotification.h +60 -0
  66. package/src/ios/UNUserNotificationCenter+APPLocalNotification.m +344 -0
  67. package/www/local-notification.js +1104 -0
@@ -0,0 +1,107 @@
1
+ /*
2
+ * Apache 2.0 License
3
+ *
4
+ * Copyright (c) Sebastian Katzer 2017
5
+ *
6
+ * This file contains Original Code and/or Modifications of Original Code
7
+ * as defined in and that are subject to the Apache License
8
+ * Version 2.0 (the 'License'). You may not use this file except in
9
+ * compliance with the License. Please obtain a copy of the License at
10
+ * http://opensource.org/licenses/Apache-2.0/ and read it before using this
11
+ * file.
12
+ *
13
+ * The Original Code and all software distributed under the License are
14
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18
+ * Please see the License for the specific language governing rights and
19
+ * limitations under the License.
20
+ */
21
+
22
+ #import "APPNotificationCategory.h"
23
+
24
+ @import UserNotifications;
25
+
26
+ @implementation APPNotificationCategory : NSObject
27
+
28
+ #pragma mark -
29
+ #pragma mark Public
30
+
31
+ /**
32
+ * Parse the provided spec map into an action group.
33
+ * @param list A key-value property map. Must contain an id and a list of actions.
34
+ * @return [ UNNotificationCategory* ]
35
+ */
36
+ + (UNNotificationCategory*) parse:(NSArray*)list withId:(NSString*)groupId
37
+ {
38
+ return [UNNotificationCategory categoryWithIdentifier:groupId
39
+ actions:[self parseActions:list]
40
+ intentIdentifiers:@[]
41
+ options:UNNotificationCategoryOptionCustomDismissAction];
42
+ }
43
+
44
+ #pragma mark -
45
+ #pragma mark Private
46
+
47
+ /**
48
+ * The actions of the action group.
49
+ *
50
+ * @return [ NSArray* ]
51
+ */
52
+ + (NSArray<UNNotificationAction *> *) parseActions:(NSArray*)items
53
+ {
54
+ NSMutableArray* actions = [[NSMutableArray alloc] init];
55
+
56
+ for (NSDictionary* item in items) {
57
+ NSString* id = item[@"id"];
58
+ NSString* title = item[@"title"];
59
+ NSString* type = item[@"type"];
60
+
61
+ UNNotificationActionOptions options = UNNotificationActionOptionNone;
62
+ UNNotificationAction* action;
63
+
64
+ if ([item[@"launch"] boolValue]) {
65
+ options = UNNotificationActionOptionForeground;
66
+ }
67
+
68
+ if ([item[@"ui"] isEqualToString:@"decline"]) {
69
+ options = options | UNNotificationActionOptionDestructive;
70
+ }
71
+
72
+ if ([item[@"needsAuth"] boolValue]) {
73
+ options = options | UNNotificationActionOptionAuthenticationRequired;
74
+ }
75
+
76
+ if ([type isEqualToString:@"input"]) {
77
+ NSString* submitTitle = item[@"submitTitle"];
78
+ NSString* placeholder = item[@"emptyText"];
79
+
80
+ if (!submitTitle.length) {
81
+ submitTitle = @"Submit";
82
+ }
83
+
84
+ action = [UNTextInputNotificationAction actionWithIdentifier:id
85
+ title:title
86
+ options:options
87
+ textInputButtonTitle:submitTitle
88
+ textInputPlaceholder:placeholder];
89
+ } else
90
+ if (!type.length || [type isEqualToString:@"button"]) {
91
+ action = [UNNotificationAction actionWithIdentifier:id
92
+ title:title
93
+ options:options];
94
+ } else {
95
+ NSLog(@"Unknown action type: %@", type);
96
+ }
97
+
98
+ if (action) {
99
+ NSLog(@"Adding action: %@", action);
100
+ [actions addObject:action];
101
+ }
102
+ }
103
+
104
+ return actions;
105
+ }
106
+
107
+ @end
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Apache 2.0 License
3
+ *
4
+ * Copyright (c) Sebastian Katzer 2017
5
+ *
6
+ * This file contains Original Code and/or Modifications of Original Code
7
+ * as defined in and that are subject to the Apache License
8
+ * Version 2.0 (the 'License'). You may not use this file except in
9
+ * compliance with the License. Please obtain a copy of the License at
10
+ * http://opensource.org/licenses/Apache-2.0/ and read it before using this
11
+ * file.
12
+ *
13
+ * The Original Code and all software distributed under the License are
14
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18
+ * Please see the License for the specific language governing rights and
19
+ * limitations under the License.
20
+ */
21
+
22
+ #import "APPNotificationOptions.h"
23
+
24
+ @import UserNotifications;
25
+
26
+ @interface APPNotificationContent : UNMutableNotificationContent
27
+
28
+ - (id) initWithOptions:(NSDictionary*)dict;
29
+ - (APPNotificationOptions*) options;
30
+ - (UNNotificationRequest*) request;
31
+
32
+ @end
@@ -0,0 +1,122 @@
1
+ /*
2
+ * Apache 2.0 License
3
+ *
4
+ * Copyright (c) Sebastian Katzer 2017
5
+ *
6
+ * This file contains Original Code and/or Modifications of Original Code
7
+ * as defined in and that are subject to the Apache License
8
+ * Version 2.0 (the 'License'). You may not use this file except in
9
+ * compliance with the License. Please obtain a copy of the License at
10
+ * http://opensource.org/licenses/Apache-2.0/ and read it before using this
11
+ * file.
12
+ *
13
+ * The Original Code and all software distributed under the License are
14
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18
+ * Please see the License for the specific language governing rights and
19
+ * limitations under the License.
20
+ */
21
+
22
+ #import "APPNotificationContent.h"
23
+ #import "APPNotificationOptions.h"
24
+ #import <objc/runtime.h>
25
+
26
+ @import UserNotifications;
27
+
28
+ static char optionsKey;
29
+
30
+ @implementation APPNotificationContent : UNMutableNotificationContent
31
+
32
+ #pragma mark -
33
+ #pragma mark Init
34
+
35
+ /**
36
+ * Initialize a notification with the given options.
37
+ * @param dict A key-value property map.
38
+ * @return [ UNMutableNotificationContent ]
39
+ */
40
+ - (id) initWithOptions:(NSDictionary*)dict
41
+ {
42
+ self = [self init];
43
+
44
+ [self setUserInfo:dict];
45
+ [self __init];
46
+
47
+ return self;
48
+ }
49
+
50
+ /**
51
+ * Initialize a notification by using the options found under userInfo.
52
+ */
53
+ - (void) __init
54
+ {
55
+ self.title = self.options.title;
56
+ self.subtitle = self.options.subtitle;
57
+ self.body = self.options.text;
58
+ self.sound = self.options.sound;
59
+ // -1 will not change the badge, 0 will clear it
60
+ self.badge = self.options.badgeNumber == -1 ? nil : [NSNumber numberWithInt:self.options.badgeNumber];
61
+ self.attachments = self.options.attachments;
62
+ self.categoryIdentifier = self.options.actionGroupId;
63
+ }
64
+
65
+ #pragma mark -
66
+ #pragma mark Public
67
+
68
+ /**
69
+ * The options used to initialize the notification.
70
+ *
71
+ * @return [ APPNotificationOptions* ] options
72
+ */
73
+ - (APPNotificationOptions*) options
74
+ {
75
+ APPNotificationOptions* options = [self getOptions];
76
+
77
+ if (!options) {
78
+ options = [[APPNotificationOptions alloc]
79
+ initWithDict:[self userInfo]];
80
+
81
+ [self setOptions:options];
82
+ }
83
+
84
+ return options;
85
+ }
86
+
87
+ /**
88
+ * Creates a notification request object that you use to schedule a notification.
89
+ *
90
+ * @return [ UNNotificationRequest* ]
91
+ */
92
+ - (UNNotificationRequest*) request
93
+ {
94
+ APPNotificationOptions* options = [self getOptions];
95
+
96
+ return [UNNotificationRequest requestWithIdentifier:options.identifier
97
+ content:self
98
+ trigger:options.trigger];
99
+ }
100
+
101
+ #pragma mark -
102
+ #pragma mark Private
103
+
104
+ /**
105
+ * The options used to initialize the notification.
106
+ *
107
+ * @return [ APPNotificationOptions* ]
108
+ */
109
+ - (APPNotificationOptions*) getOptions
110
+ {
111
+ return objc_getAssociatedObject(self, &optionsKey);
112
+ }
113
+
114
+ /**
115
+ * Set the options used to initialize the notification.
116
+ */
117
+ - (void) setOptions:(APPNotificationOptions*)options
118
+ {
119
+ objc_setAssociatedObject(self, &optionsKey, options, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
120
+ }
121
+
122
+ @end
@@ -0,0 +1,42 @@
1
+ /*
2
+ * Apache 2.0 License
3
+ *
4
+ * Copyright (c) Sebastian Katzer 2017
5
+ *
6
+ * This file contains Original Code and/or Modifications of Original Code
7
+ * as defined in and that are subject to the Apache License
8
+ * Version 2.0 (the 'License'). You may not use this file except in
9
+ * compliance with the License. Please obtain a copy of the License at
10
+ * http://opensource.org/licenses/Apache-2.0/ and read it before using this
11
+ * file.
12
+ *
13
+ * The Original Code and all software distributed under the License are
14
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18
+ * Please see the License for the specific language governing rights and
19
+ * limitations under the License.
20
+ */
21
+
22
+ @import UserNotifications;
23
+
24
+ @interface APPNotificationOptions : NSObject
25
+
26
+ @property (readonly, getter=id) NSNumber* id;
27
+ @property (readonly, getter=identifier) NSString* identifier;
28
+ @property (readonly, getter=actionGroupId) NSString* actionGroupId;
29
+ @property (readonly, getter=title) NSString* title;
30
+ @property (readonly, getter=subtitle) NSString* subtitle;
31
+ @property (readonly, getter=badgeNumber) int badgeNumber;
32
+ @property (readonly, getter=text) NSString* text;
33
+ @property (readonly, getter=iOSForeground) BOOL iOSForeground;
34
+ @property (readonly, getter=silent) BOOL silent;
35
+ @property (readonly, getter=sound) UNNotificationSound* sound;
36
+ @property (readonly, getter=userInfo) NSDictionary* userInfo;
37
+ @property (readonly, getter=attachments) NSArray<UNNotificationAttachment*>*attachments;
38
+
39
+ - (id) initWithDict:(NSDictionary*) dict;
40
+ - (UNNotificationTrigger*) trigger;
41
+
42
+ @end