@ammarahmed/notifee-react-native 7.3.1 → 7.4.1

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 (79) hide show
  1. package/android/build.gradle +36 -18
  2. package/android/schemas/app.notifee.core.database.NotifeeCoreDatabase/1.json +46 -0
  3. package/android/schemas/app.notifee.core.database.NotifeeCoreDatabase/2.json +53 -0
  4. package/android/src/main/java/app/notifee/core/AlarmPermissionBroadcastReceiver.java +19 -0
  5. package/android/src/main/java/app/notifee/core/BlockStateBroadcastReceiver.java +164 -0
  6. package/android/src/main/java/app/notifee/core/ChannelManager.java +351 -0
  7. package/android/src/main/java/app/notifee/core/ContextHolder.java +33 -0
  8. package/android/src/main/java/app/notifee/core/EventBus.java +63 -0
  9. package/android/src/main/java/app/notifee/core/EventSubscriber.java +82 -0
  10. package/android/src/main/java/app/notifee/core/ForegroundService.java +125 -0
  11. package/android/src/main/java/app/notifee/core/InitProvider.java +92 -0
  12. package/android/src/main/java/app/notifee/core/KeepForSdk.java +26 -0
  13. package/android/src/main/java/app/notifee/core/Logger.java +68 -0
  14. package/android/src/main/java/app/notifee/core/Notifee.java +533 -0
  15. package/android/src/main/java/app/notifee/core/NotifeeAlarmManager.java +256 -0
  16. package/android/src/main/java/app/notifee/core/NotificationAlarmReceiver.java +32 -0
  17. package/android/src/main/java/app/notifee/core/NotificationManager.java +903 -0
  18. package/android/src/main/java/app/notifee/core/NotificationPendingIntent.java +189 -0
  19. package/android/src/main/java/app/notifee/core/NotificationReceiverActivity.java +38 -0
  20. package/android/src/main/java/app/notifee/core/NotificationReceiverHandler.java +140 -0
  21. package/android/src/main/java/app/notifee/core/Preferences.java +79 -0
  22. package/android/src/main/java/app/notifee/core/RebootBroadcastReceiver.java +38 -0
  23. package/android/src/main/java/app/notifee/core/ReceiverService.java +268 -0
  24. package/android/src/main/java/app/notifee/core/Worker.java +87 -0
  25. package/android/src/main/java/app/notifee/core/database/NotifeeCoreDatabase.java +76 -0
  26. package/android/src/main/java/app/notifee/core/database/WorkDataDao.java +52 -0
  27. package/android/src/main/java/app/notifee/core/database/WorkDataEntity.java +68 -0
  28. package/android/src/main/java/app/notifee/core/database/WorkDataRepository.java +107 -0
  29. package/android/src/main/java/app/notifee/core/event/BlockStateEvent.java +102 -0
  30. package/android/src/main/java/app/notifee/core/event/ForegroundServiceEvent.java +48 -0
  31. package/android/src/main/java/app/notifee/core/event/InitialNotificationEvent.java +50 -0
  32. package/android/src/main/java/app/notifee/core/event/LogEvent.java +74 -0
  33. package/android/src/main/java/app/notifee/core/event/MainComponentEvent.java +33 -0
  34. package/android/src/main/java/app/notifee/core/event/NotificationEvent.java +97 -0
  35. package/android/src/main/java/app/notifee/core/interfaces/EventListener.java +39 -0
  36. package/android/src/main/java/app/notifee/core/interfaces/MethodCallResult.java +27 -0
  37. package/android/src/main/java/app/notifee/core/model/ChannelGroupModel.java +48 -0
  38. package/android/src/main/java/app/notifee/core/model/ChannelModel.java +123 -0
  39. package/android/src/main/java/app/notifee/core/model/IntervalTriggerModel.java +63 -0
  40. package/android/src/main/java/app/notifee/core/model/NotificationAndroidActionModel.java +125 -0
  41. package/android/src/main/java/app/notifee/core/model/NotificationAndroidModel.java +654 -0
  42. package/android/src/main/java/app/notifee/core/model/NotificationAndroidPressActionModel.java +146 -0
  43. package/android/src/main/java/app/notifee/core/model/NotificationAndroidStyleModel.java +341 -0
  44. package/android/src/main/java/app/notifee/core/model/NotificationModel.java +72 -0
  45. package/android/src/main/java/app/notifee/core/model/TimestampTriggerModel.java +163 -0
  46. package/android/src/main/java/app/notifee/core/model/package-info.java +4 -0
  47. package/android/src/main/java/app/notifee/core/utility/AlarmUtils.java +52 -0
  48. package/android/src/main/java/app/notifee/core/utility/Callbackable.java +12 -0
  49. package/android/src/main/java/app/notifee/core/utility/ColorUtils.java +62 -0
  50. package/android/src/main/java/app/notifee/core/utility/ExtendedListenableFuture.java +84 -0
  51. package/android/src/main/java/app/notifee/core/utility/IntentUtils.java +136 -0
  52. package/android/src/main/java/app/notifee/core/utility/ObjectUtils.java +187 -0
  53. package/android/src/main/java/app/notifee/core/utility/PowerManagerUtils.java +334 -0
  54. package/android/src/main/java/app/notifee/core/utility/ResourceUtils.java +309 -0
  55. package/android/src/main/java/app/notifee/core/utility/TextUtils.java +28 -0
  56. package/android/src/main/java/app/notifee/core/utility/package-info.java +4 -0
  57. package/dist/types/Notification.d.ts +8 -1
  58. package/dist/types/Notification.js +6 -0
  59. package/dist/types/Notification.js.map +1 -1
  60. package/dist/version.d.ts +1 -1
  61. package/jest-mock.js +7 -4
  62. package/package.json +1 -3
  63. package/src/types/Notification.ts +8 -0
  64. package/src/version.ts +1 -1
  65. package/android/libs/app/notifee/core/202108261756/core-202108261756.aar +0 -0
  66. package/android/libs/app/notifee/core/202108261756/core-202108261756.aar.md5 +0 -1
  67. package/android/libs/app/notifee/core/202108261756/core-202108261756.aar.sha1 +0 -1
  68. package/android/libs/app/notifee/core/202108261756/core-202108261756.aar.sha256 +0 -1
  69. package/android/libs/app/notifee/core/202108261756/core-202108261756.aar.sha512 +0 -1
  70. package/android/libs/app/notifee/core/202108261756/core-202108261756.pom +0 -9
  71. package/android/libs/app/notifee/core/202108261756/core-202108261756.pom.md5 +0 -1
  72. package/android/libs/app/notifee/core/202108261756/core-202108261756.pom.sha1 +0 -1
  73. package/android/libs/app/notifee/core/202108261756/core-202108261756.pom.sha256 +0 -1
  74. package/android/libs/app/notifee/core/202108261756/core-202108261756.pom.sha512 +0 -1
  75. package/android/libs/app/notifee/core/maven-metadata.xml +0 -13
  76. package/android/libs/app/notifee/core/maven-metadata.xml.md5 +0 -1
  77. package/android/libs/app/notifee/core/maven-metadata.xml.sha1 +0 -1
  78. package/android/libs/app/notifee/core/maven-metadata.xml.sha256 +0 -1
  79. package/android/libs/app/notifee/core/maven-metadata.xml.sha512 +0 -1
@@ -0,0 +1,63 @@
1
+ package app.notifee.core.model;
2
+
3
+ /*
4
+ * Copyright (c) 2016-present Invertase Limited & Contributors
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this library except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ *
18
+ */
19
+
20
+ import android.os.Bundle;
21
+ import androidx.annotation.NonNull;
22
+ import app.notifee.core.Logger;
23
+ import app.notifee.core.utility.ObjectUtils;
24
+ import java.util.concurrent.TimeUnit;
25
+
26
+ public class IntervalTriggerModel {
27
+ private Bundle mIntervalTriggerBundle;
28
+ private static final String TAG = "IntervalTriggerModel";
29
+
30
+ private IntervalTriggerModel(Bundle bundle) {
31
+ mIntervalTriggerBundle = bundle;
32
+ }
33
+
34
+ public static IntervalTriggerModel fromBundle(@NonNull Bundle bundle) {
35
+ return new IntervalTriggerModel(bundle);
36
+ }
37
+
38
+ public TimeUnit getTimeUnit() {
39
+ TimeUnit timeUnit = TimeUnit.SECONDS;
40
+ if (mIntervalTriggerBundle.containsKey("timeUnit")) {
41
+ String repeatIntervalTimeUnit = mIntervalTriggerBundle.getString("timeUnit");
42
+ try {
43
+ timeUnit = TimeUnit.valueOf(repeatIntervalTimeUnit);
44
+ } catch (IllegalArgumentException e) {
45
+ Logger.e(
46
+ TAG,
47
+ "An error occurred whilst trying to convert interval time unit: "
48
+ + repeatIntervalTimeUnit,
49
+ e);
50
+ }
51
+ }
52
+
53
+ return timeUnit;
54
+ }
55
+
56
+ public int getInterval() {
57
+ if (mIntervalTriggerBundle.containsKey("interval")) {
58
+ return ObjectUtils.getInt(mIntervalTriggerBundle.get("interval"));
59
+ }
60
+
61
+ return -1;
62
+ }
63
+ }
@@ -0,0 +1,125 @@
1
+ package app.notifee.core.model;
2
+
3
+ /*
4
+ * Copyright (c) 2016-present Invertase Limited & Contributors
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this library except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ *
18
+ */
19
+
20
+ import static app.notifee.core.ReceiverService.REMOTE_INPUT_RECEIVER_KEY;
21
+
22
+ import android.os.Bundle;
23
+ import androidx.annotation.Keep;
24
+ import androidx.annotation.NonNull;
25
+ import androidx.annotation.Nullable;
26
+ import androidx.core.app.NotificationCompat;
27
+ import androidx.core.app.RemoteInput;
28
+ import java.util.ArrayList;
29
+ import java.util.Objects;
30
+
31
+ @Keep
32
+ public class NotificationAndroidActionModel {
33
+
34
+ private Bundle mNotificationAndroidActionBundle;
35
+
36
+ private NotificationAndroidActionModel(Bundle actionBundle) {
37
+ mNotificationAndroidActionBundle = actionBundle;
38
+ }
39
+
40
+ public static NotificationAndroidActionModel fromBundle(Bundle actionBundle) {
41
+ return new NotificationAndroidActionModel(actionBundle);
42
+ }
43
+
44
+ public Bundle toBundle() {
45
+ return (Bundle) mNotificationAndroidActionBundle.clone();
46
+ }
47
+
48
+ /**
49
+ * Gets the title of the action
50
+ *
51
+ * @return String
52
+ */
53
+ public @NonNull String getTitle() {
54
+ return Objects.requireNonNull(mNotificationAndroidActionBundle.getString("title"));
55
+ }
56
+
57
+ /** Gets the icon of the action */
58
+ public @Nullable String getIcon() {
59
+ return mNotificationAndroidActionBundle.getString("icon");
60
+ }
61
+
62
+ /**
63
+ * Gets the pressAction instance for this action
64
+ *
65
+ * @return NotificationAndroidPressActionModel
66
+ */
67
+ public @NonNull NotificationAndroidPressActionModel getPressAction() {
68
+ Bundle pressActionBundle = mNotificationAndroidActionBundle.getBundle("pressAction");
69
+ return NotificationAndroidPressActionModel.fromBundle(pressActionBundle);
70
+ }
71
+
72
+ /**
73
+ * Gets a remote input instance for the action
74
+ *
75
+ * @param actionBuilder The allowGeneratedReplies is inside of the remote input to reduce
76
+ * confusion, but it lives on the action builder
77
+ * @return RemoteInput
78
+ */
79
+ public @Nullable RemoteInput getRemoteInput(NotificationCompat.Action.Builder actionBuilder) {
80
+ if (mNotificationAndroidActionBundle.containsKey("input")
81
+ && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT_WATCH) {
82
+ Bundle inputBundle =
83
+ Objects.requireNonNull(mNotificationAndroidActionBundle.getBundle("input"));
84
+
85
+ RemoteInput.Builder remoteInputBuilder = new RemoteInput.Builder(REMOTE_INPUT_RECEIVER_KEY);
86
+
87
+ if (inputBundle.containsKey("allowFreeFormInput")) {
88
+ remoteInputBuilder.setAllowFreeFormInput(inputBundle.getBoolean("allowFreeFormInput"));
89
+ }
90
+
91
+ if (inputBundle.containsKey("allowGeneratedReplies")) {
92
+ actionBuilder.setAllowGeneratedReplies(inputBundle.getBoolean("allowGeneratedReplies"));
93
+ }
94
+
95
+ if (inputBundle.containsKey("placeholder")) {
96
+ remoteInputBuilder.setLabel(inputBundle.getCharSequence("placeholder"));
97
+ }
98
+
99
+ if (inputBundle.containsKey("choices")) {
100
+ ArrayList<String> choicesArray = inputBundle.getStringArrayList("choices");
101
+ CharSequence[] choices =
102
+ Objects.requireNonNull(choicesArray).toArray(new CharSequence[choicesArray.size()]);
103
+ remoteInputBuilder.setChoices(choices);
104
+ }
105
+
106
+ if (inputBundle.containsKey("editableChoices")) {
107
+ boolean editable = inputBundle.getBoolean("editableChoices");
108
+ if (editable) {
109
+ remoteInputBuilder.setEditChoicesBeforeSending(
110
+ RemoteInput.EDIT_CHOICES_BEFORE_SENDING_ENABLED);
111
+ } else {
112
+ remoteInputBuilder.setEditChoicesBeforeSending(
113
+ RemoteInput.EDIT_CHOICES_BEFORE_SENDING_DISABLED);
114
+ }
115
+ } else {
116
+ remoteInputBuilder.setEditChoicesBeforeSending(
117
+ RemoteInput.EDIT_CHOICES_BEFORE_SENDING_AUTO);
118
+ }
119
+
120
+ return remoteInputBuilder.build();
121
+ }
122
+
123
+ return null;
124
+ }
125
+ }