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
Binary file
Binary file
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-147 -70 294 345">
3
+ <g fill="#a4c639">
4
+ <use stroke-width="14.4" xlink:href="#b" stroke="#FFF"/>
5
+ <use xlink:href="#a" transform="scale(-1,1)"/>
6
+ <g id="a" stroke="#FFF" stroke-width="7.2">
7
+ <rect rx="6.5" transform="rotate(29)" height="86" width="13" y="-86" x="14"/>
8
+ <rect id="c" rx="24" height="133" width="48" y="41" x="-143"/>
9
+ <use y="97" x="85" xlink:href="#c"/>
10
+ </g>
11
+ <g id="b">
12
+ <ellipse cy="41" rx="91" ry="84"/>
13
+ <rect rx="22" height="182" width="182" y="20" x="-91"/>
14
+ </g>
15
+ </g>
16
+ <g stroke="#FFF" stroke-width="7.2" fill="#FFF">
17
+ <path d="m-95 44.5h190"/><circle cx="-42" r="4"/><circle cx="42" r="4"/>
18
+ </g>
19
+ </svg>
Binary file
Binary file
Binary file
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"/></svg>
Binary file
Binary file
Binary file
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "cordova-plugin-local-notifications-continued",
3
+ "version": "1.2.4",
4
+ "description": "Schedules and queries for local notifications",
5
+ "cordova": {
6
+ "id": "cordova-plugin-local-notifications-continued",
7
+ "platforms": [
8
+ "android",
9
+ "ios"
10
+ ]
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/GitToTheHub/cordova-plugin-local-notifications-continued.git"
15
+ },
16
+ "keywords": [
17
+ "notification",
18
+ "local notification",
19
+ "user notification",
20
+ "schedule notification",
21
+ "ecosystem:cordova",
22
+ "cordova-ios",
23
+ "cordova-android"
24
+ ],
25
+ "engines": {
26
+ "cordovaDependencies": {
27
+ "0.9.0-beta.3": {
28
+ "cordova": ">=3.6.0",
29
+ "cordova-android": ">=6.0.0",
30
+ "cordova-ios": ">=4.3.0",
31
+ "cordova-plugin-device": ">=2.0.0"
32
+ },
33
+ "1.0.0": {
34
+ "cordova": ">=12.0.0",
35
+ "cordova-android": ">=13.0.0",
36
+ "cordova-ios": ">=7.0.0",
37
+ "cordova-plugin-device": ">=3.0.0"
38
+ }
39
+ }
40
+ },
41
+ "author": "Sebastián Katzer",
42
+ "contributors": [{
43
+ "name": "Manuel Beck",
44
+ "email": "email@manuelbeck.software",
45
+ "url": "https://manuelbeck.software"
46
+ }],
47
+ "funding": "https://github.com/sponsors/GitToTheHub",
48
+ "license": "Apache 2.0",
49
+ "bugs": {
50
+ "url": "https://github.com/GitToTheHub/cordova-plugin-local-notifications-continued/issues"
51
+ },
52
+ "homepage": "https://github.com/GitToTheHub/cordova-plugin-local-notifications-continued#readme"
53
+ }
package/plugin.xml ADDED
@@ -0,0 +1,266 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <!--
4
+ * Apache 2.0 License
5
+ *
6
+ * Copyright (c) Sebastian Katzer 2017
7
+ * Copyright (c) Manuel Beck 2024
8
+ *
9
+ * This file contains Original Code and/or Modifications of Original Code
10
+ * as defined in and that are subject to the Apache License
11
+ * Version 2.0 (the 'License'). You may not use this file except in
12
+ * compliance with the License. Please obtain a copy of the License at
13
+ * http://opensource.org/licenses/Apache-2.0/ and read it before using this
14
+ * file.
15
+ *
16
+ * The Original Code and all software distributed under the License are
17
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
18
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
19
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
21
+ * Please see the License for the specific language governing rights and
22
+ * limitations under the License.
23
+ -->
24
+
25
+ <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
26
+ xmlns:android="http://schemas.android.com/apk/res/android"
27
+ id="cordova-plugin-local-notifications-continued"
28
+ version="1.2.4">
29
+
30
+ <name>LocalNotification</name>
31
+
32
+ <description>Schedules and queries for local notifications</description>
33
+
34
+ <repo>https://github.com/GitToTheHub/cordova-plugin-local-notifications-continued.git</repo>
35
+
36
+ <keywords>notification, local notification, user notification</keywords>
37
+
38
+ <license>Apache 2.0</license>
39
+
40
+ <author>Sebastián Katzer, Manuel Beck</author>
41
+
42
+ <dependency id="cordova-plugin-device" version=">=3.0.0" />
43
+
44
+ <!-- js -->
45
+ <js-module src="www/local-notification.js" name="LocalNotification">
46
+ <clobbers target="cordova.plugins.notification.local" />
47
+ </js-module>
48
+
49
+ <!-- ios -->
50
+ <platform name="ios">
51
+ <config-file target="config.xml" parent="/*">
52
+ <feature name="LocalNotification">
53
+ <param name="ios-package" value="APPLocalNotification" onload="true" />
54
+ <param name="onload" value="true" />
55
+ </feature>
56
+ </config-file>
57
+
58
+ <framework src="UserNotifications.framework" />
59
+ <framework src="CoreLocation.framework" />
60
+
61
+ <header-file src="src/ios/APPLocalNotification.h" />
62
+ <source-file src="src/ios/APPLocalNotification.m" />
63
+
64
+ <header-file src="src/ios/APPNotificationCategory.h" />
65
+ <source-file src="src/ios/APPNotificationCategory.m" />
66
+
67
+ <header-file src="src/ios/APPNotificationContent.h" />
68
+ <source-file src="src/ios/APPNotificationContent.m" />
69
+
70
+ <header-file src="src/ios/APPNotificationOptions.h" />
71
+ <source-file src="src/ios/APPNotificationOptions.m" />
72
+
73
+ <header-file src="src/ios/UNUserNotificationCenter+APPLocalNotification.h" />
74
+ <source-file src="src/ios/UNUserNotificationCenter+APPLocalNotification.m" />
75
+
76
+ <header-file src="src/ios/UNNotificationRequest+APPLocalNotification.h" />
77
+ <source-file src="src/ios/UNNotificationRequest+APPLocalNotification.m" />
78
+ </platform>
79
+
80
+ <!-- android -->
81
+ <platform name="android">
82
+ <!--
83
+ Enable Cordova-Android's Kotlin support
84
+ Note: This is only needed for Cordova-Android 13.0.0 and lower.
85
+ For cordova-android 14.0.0 this can be removed.
86
+ -->
87
+ <config-file target="config.xml" parent="/*">
88
+ <preference name="GradlePluginKotlinEnabled" value="true" />
89
+ </config-file>
90
+
91
+ <framework src="src/android/build/localnotification.gradle" custom="true" type="gradleReference"/>
92
+
93
+ <preference name="ANDROIDX_CORE_VERSION" default="1.12.0"/>
94
+ <framework src="androidx.core:core:$ANDROIDX_CORE_VERSION" />
95
+
96
+ <config-file target="res/xml/config.xml" parent="/*">
97
+ <feature name="LocalNotification">
98
+ <param name="android-package" value="de.appplant.cordova.plugin.localnotification.LocalNotification"/>
99
+ </feature>
100
+ </config-file>
101
+
102
+ <config-file target="AndroidManifest.xml" parent="/manifest/application">
103
+
104
+ <!--
105
+ FileProvider to share files located in "[App path]/files/shared_files" and make them accessible through an content:// Uri.
106
+ Asset files, where the www files are, are not accessible by a "file:///android_asset" Uri. To make them
107
+ accessible, they are copied to a shared folder and can be accessed by a content:// Uri.
108
+ You can also put your own files there with cordova-plugin-file. To access the directory use
109
+ cordova.file.dataDirectory + 'shared_files'. To use the file in this plugin, you can use "shared://myFile.png",
110
+ which would point to cordova.file.dataDirectory + 'shared_files/myFile.png'.
111
+
112
+ Explanation of the attributes:
113
+ android:exported="false": The FileProvider ist not public
114
+ android:grantUriPermissions="true": Grant temporary access to files
115
+ -->
116
+ <provider
117
+ android:name="de.appplant.cordova.plugin.localnotification.util.PluginFileProvider"
118
+ android:authorities="${applicationId}.localnotifications.provider"
119
+ android:exported="false"
120
+ android:grantUriPermissions="true">
121
+ <meta-data
122
+ android:name="android.support.FILE_PROVIDER_PATHS"
123
+ android:resource="@xml/shared_files_provider_paths"/>
124
+ </provider>
125
+
126
+ <!--
127
+ Activity used to handle notification or action clicks without trampoline error on Android 12+,
128
+ when the app should be started from the background or killed state.
129
+
130
+ Explanation of the attributes:
131
+ - android:taskAffinity="": Combined with the FLAG_ACTIVITY_NEW_TASK flag that you use in code,
132
+ set this attribute blank to ensure this activity doesn't go into the app's default task.
133
+ Any existing tasks that have the app's default affinity aren't affected.
134
+ - android:excludeFromRecents="true": Excludes the new task from the Recents screen so that
135
+ the user can't accidentally navigate back to it.
136
+ -->
137
+ <activity
138
+ android:name="de.appplant.cordova.plugin.localnotification.ClickActivity"
139
+ android:launchMode="singleTask"
140
+ android:taskAffinity=""
141
+ android:excludeFromRecents="true" />
142
+
143
+ <!-- A notification will be triggered/shown -->
144
+ <receiver
145
+ android:name="de.appplant.cordova.plugin.localnotification.receiver.TriggerReceiver"
146
+ android:exported="false" />
147
+
148
+ <!-- Notification cleared by the user -->
149
+ <receiver
150
+ android:name="de.appplant.cordova.plugin.localnotification.receiver.ClearReceiver"
151
+ android:exported="false" />
152
+
153
+ <receiver
154
+ android:name="de.appplant.cordova.plugin.localnotification.receiver.RestoreReceiver"
155
+ android:exported="false" >
156
+ <intent-filter>
157
+ <!--
158
+ Reschedule all alarms, when the device is booted and unlocked by the user
159
+ -->
160
+ <action android:name="android.intent.action.BOOT_COMPLETED" />
161
+
162
+ <!--
163
+ Reschedule all alarms, when the app is updated
164
+ -->
165
+ <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
166
+
167
+ <!--
168
+ An app is granted the Manifest.permission.SCHEDULE_EXACT_ALARM permission.
169
+ When the user revokes the Manifest.permission.SCHEDULE_EXACT_ALARM permission, all alarms scheduled with
170
+ setExact(int, long, PendingIntent), setExactAndAllowWhileIdle(int, long, PendingIntent) and setAlarmClock(android.app.AlarmManager.AlarmClockInfo, android.app.PendingIntent)
171
+ will be deleted.
172
+ This broadcast will not be sent when the user revokes the permission.
173
+ -->
174
+ <action android:name="android.app.action.SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGED" />
175
+ </intent-filter>
176
+ </receiver>
177
+ </config-file>
178
+
179
+ <config-file target="AndroidManifest.xml" parent="/manifest">
180
+ <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
181
+
182
+ <!-- Needed, to turn the screen on, when a notification is posted -->
183
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
184
+
185
+ <!-- Runtime permission for Android 13 and higher to post notifications -->
186
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
187
+ </config-file>
188
+
189
+ <source-file
190
+ src="src/android/xml/shared_files_provider_paths.xml"
191
+ target-dir="res/xml" />
192
+
193
+ <source-file
194
+ src="src/android/LocalNotification.java"
195
+ target-dir="src/de/appplant/cordova/plugin/localnotification" />
196
+
197
+ <source-file
198
+ src="src/android/ClickActivity.java"
199
+ target-dir="src/de/appplant/cordova/plugin/localnotification" />
200
+
201
+ <source-file
202
+ src="src/android/receiver/ClearReceiver.java"
203
+ target-dir="src/de/appplant/cordova/plugin/localnotification/receiver" />
204
+
205
+ <source-file
206
+ src="src/android/receiver/RestoreReceiver.java"
207
+ target-dir="src/de/appplant/cordova/plugin/localnotification/receiver" />
208
+
209
+ <source-file
210
+ src="src/android/receiver/TriggerReceiver.java"
211
+ target-dir="src/de/appplant/cordova/plugin/localnotification/receiver" />
212
+
213
+ <source-file
214
+ src="src/android/action/Action.java"
215
+ target-dir="src/de/appplant/cordova/plugin/localnotification/action" />
216
+
217
+ <source-file
218
+ src="src/android/action/ActionGroup.java"
219
+ target-dir="src/de/appplant/cordova/plugin/localnotification/action" />
220
+
221
+ <source-file
222
+ src="src/android/trigger/TriggerHandler.java"
223
+ target-dir="src/de/appplant/cordova/plugin/localnotification/trigger" />
224
+
225
+ <source-file
226
+ src="src/android/trigger/TriggerHandlerAt.java"
227
+ target-dir="src/de/appplant/cordova/plugin/localnotification/trigger" />
228
+
229
+ <source-file
230
+ src="src/android/trigger/TriggerHandlerIn.java"
231
+ target-dir="src/de/appplant/cordova/plugin/localnotification/trigger" />
232
+
233
+ <source-file
234
+ src="src/android/trigger/TriggerHandlerEvery.java"
235
+ target-dir="src/de/appplant/cordova/plugin/localnotification/trigger" />
236
+
237
+ <source-file
238
+ src="src/android/util/PluginFileProvider.java"
239
+ target-dir="src/de/appplant/cordova/plugin/localnotification/util" />
240
+
241
+ <source-file
242
+ src="src/android/util/AssetUtil.java"
243
+ target-dir="src/de/appplant/cordova/plugin/localnotification/util" />
244
+
245
+ <source-file
246
+ src="src/android/util/CallbackContextUtil.java"
247
+ target-dir="src/de/appplant/cordova/plugin/localnotification/util" />
248
+
249
+ <source-file
250
+ src="src/android/Manager.java"
251
+ target-dir="src/de/appplant/cordova/plugin/localnotification" />
252
+
253
+ <source-file
254
+ src="src/android/Notification.java"
255
+ target-dir="src/de/appplant/cordova/plugin/localnotification" />
256
+
257
+ <source-file
258
+ src="src/android/Options.java"
259
+ target-dir="src/de/appplant/cordova/plugin/localnotification" />
260
+
261
+ <source-file
262
+ src="src/android/OptionsTrigger.java"
263
+ target-dir="src/de/appplant/cordova/plugin/localnotification" />
264
+ </platform>
265
+
266
+ </plugin>
@@ -0,0 +1,72 @@
1
+ /*
2
+ * Apache 2.0 License
3
+ *
4
+ * Copyright (c) Sebastian Katzer 2017
5
+ * Copyright (c) Manuel Beck 2024
6
+ *
7
+ * This file contains Original Code and/or Modifications of Original Code
8
+ * as defined in and that are subject to the Apache License
9
+ * Version 2.0 (the 'License'). You may not use this file except in
10
+ * compliance with the License. Please obtain a copy of the License at
11
+ * http://opensource.org/licenses/Apache-2.0/ and read it before using this
12
+ * file.
13
+ *
14
+ * The Original Code and all software distributed under the License are
15
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
19
+ * Please see the License for the specific language governing rights and
20
+ * limitations under the License.
21
+ */
22
+
23
+ package de.appplant.cordova.plugin.localnotification;
24
+
25
+ import android.app.Activity;
26
+ import android.content.Intent;
27
+ import android.os.Bundle;
28
+ import android.util.Log;
29
+
30
+ import de.appplant.cordova.plugin.localnotification.Notification;
31
+ import de.appplant.cordova.plugin.localnotification.action.Action;
32
+
33
+ /**
34
+ * Handle a notification or action click.
35
+ * To be able to launch the app on Android 12 and newer, an Activity must be used,
36
+ * instead of a BroadcastReceiver, otherwise a trampoline error would occur,
37
+ * if the app is in background or killed, see:
38
+ * https://developer.android.com/about/versions/12/behavior-changes-12#notification-trampolines
39
+ */
40
+ public class ClickActivity extends Activity {
41
+
42
+ private static final String TAG = "ClickActivity";
43
+
44
+ @Override
45
+ public void onCreate(Bundle savedInstanceState) {
46
+ super.onCreate(savedInstanceState);
47
+ Intent intent = getIntent();
48
+ Log.d(TAG, "Notification clicked, extras=" + intent.getExtras());
49
+
50
+ int notificationId = intent.getIntExtra(Notification.EXTRA_ID, -1);
51
+ // Get the clicked action id, if an action was clicked, otherwise it is null
52
+ String actionId = intent.getStringExtra(Action.EXTRA_ID);
53
+ Notification notification = Notification.getFromSharedPreferences(getApplicationContext(), notificationId);
54
+
55
+ // Check if the notification data is available
56
+ // Normally it should be available, but in some cases it isn't
57
+ if (notification != null) {
58
+ // Handle action click
59
+ if (actionId != null) {
60
+ notification.handleActionClick(intent, actionId);
61
+
62
+ // Handle notification click
63
+ } else {
64
+ notification.handleClick();
65
+ }
66
+ } else {
67
+ Log.w(TAG, "Notification data not found, id=" + notificationId);
68
+ }
69
+
70
+ finish();
71
+ }
72
+ }