react-native-alarmageddon 2.0.0 → 2.1.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.
- package/README.md +8 -6
- package/android/build/.transforms/4aeb440f8cdf777de34ab1099140d239/results.bin +1 -0
- package/android/build/.transforms/4aeb440f8cdf777de34ab1099140d239/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_alarm_default.wav.flat +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +2 -2
- package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +1 -1
- package/android/build/intermediates/incremental/mergeDebugAssets/merger.xml +1 -1
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +1 -1
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +1 -1
- package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +27 -27
- package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +37 -37
- package/android/build/tmp/kotlin-classes/debug/com/rnalarmmodule/AlarmModule.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/rnalarmmodule/AlarmReceiver.class +0 -0
- package/android/src/main/java/com/rnalarmmodule/AlarmModule.kt +14 -2
- package/android/src/main/java/com/rnalarmmodule/AlarmReceiver.kt +24 -14
- package/ios/AlarmModule.swift +60 -9
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +4 -0
package/README.md
CHANGED
|
@@ -153,10 +153,12 @@ if (activeAlarm) {
|
|
|
153
153
|
|
|
154
154
|
```typescript
|
|
155
155
|
type AlarmParams = {
|
|
156
|
-
id: string;
|
|
157
|
-
datetimeISO: string;
|
|
158
|
-
title?: string;
|
|
159
|
-
body?: string;
|
|
156
|
+
id: string; // Unique identifier for the alarm
|
|
157
|
+
datetimeISO: string; // ISO 8601 timestamp (e.g., "2025-01-15T08:30:00")
|
|
158
|
+
title?: string; // Notification title (default: "Alarm")
|
|
159
|
+
body?: string; // Notification body (default: "")
|
|
160
|
+
snoozeEnabled?: boolean; // Whether snoozing is enabled (default: true)
|
|
161
|
+
snoozeInterval?: number; // Snooze interval in minutes (default: 5)
|
|
160
162
|
};
|
|
161
163
|
|
|
162
164
|
type PermissionResult = {
|
|
@@ -242,7 +244,7 @@ Returns a subscription object with a `remove()` method to unsubscribe.
|
|
|
242
244
|
## Limitations
|
|
243
245
|
|
|
244
246
|
- **Expo**: This library is not compatible with Expo Go. You need to use a development build or eject.
|
|
245
|
-
- **iOS**:
|
|
247
|
+
- **iOS**: This library is not compatible with iOS.
|
|
246
248
|
- **Background Restrictions**: Some device manufacturers (Samsung, Xiaomi, Huawei, etc.) may kill background processes. Users may need to disable battery optimization for your app.
|
|
247
249
|
|
|
248
250
|
## Troubleshooting
|
|
@@ -269,4 +271,4 @@ Contributions are welcome! Please read our contributing guidelines and submit pu
|
|
|
269
271
|
|
|
270
272
|
## License
|
|
271
273
|
|
|
272
|
-
MIT License - see the [LICENSE](LICENSE) file for details.
|
|
274
|
+
MIT License - see the [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
o/classes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#Mon Jan 26
|
|
2
|
-
com.rnalarmmodule.react-native-alarmageddon-main-6\:/raw/alarm_default.wav=/Users/quaresma/projects/
|
|
1
|
+
#Mon Jan 26 14:43:01 BRT 2026
|
|
2
|
+
com.rnalarmmodule.react-native-alarmageddon-main-6\:/raw/alarm_default.wav=/Users/quaresma/projects/react-native-alarmageddon/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/alarm_default.wav
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<merger version="3"><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/quaresma/projects/
|
|
2
|
+
<merger version="3"><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/quaresma/projects/react-native-alarmageddon/android/src/main/res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main" generated-set="main$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/quaresma/projects/react-native-alarmageddon/android/src/main/res"><file name="alarm_default" path="/Users/quaresma/projects/react-native-alarmageddon/android/src/main/res/raw/alarm_default.wav" qualifiers="" type="raw"/></source></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="debug$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/quaresma/projects/react-native-alarmageddon/android/src/debug/res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="debug" generated-set="debug$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/quaresma/projects/react-native-alarmageddon/android/src/debug/res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="generated$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/quaresma/projects/react-native-alarmageddon/android/build/generated/res/resValues/debug"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="generated" generated-set="generated$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/quaresma/projects/react-native-alarmageddon/android/build/generated/res/resValues/debug"/></dataSet><mergedItems/></merger>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/quaresma/projects/
|
|
2
|
+
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/quaresma/projects/react-native-alarmageddon/android/src/main/assets"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/quaresma/projects/react-native-alarmageddon/android/src/debug/assets"/></dataSet><dataSet config="generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/quaresma/projects/react-native-alarmageddon/android/build/intermediates/shader_assets/debug/compileDebugShaders/out"/></dataSet></merger>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/quaresma/projects/
|
|
2
|
+
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/quaresma/projects/react-native-alarmageddon/android/src/main/jniLibs"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/quaresma/projects/react-native-alarmageddon/android/src/debug/jniLibs"/></dataSet></merger>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/quaresma/projects/
|
|
2
|
+
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/quaresma/projects/react-native-alarmageddon/android/src/main/shaders"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/quaresma/projects/react-native-alarmageddon/android/src/debug/shaders"/></dataSet></merger>
|
|
@@ -6,61 +6,61 @@
|
|
|
6
6
|
6
|
|
7
7
|
7 <!-- Alarm scheduling permissions -->
|
|
8
8
|
8 <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
|
|
9
|
-
8-->/Users/quaresma/projects/
|
|
10
|
-
8-->/Users/quaresma/projects/
|
|
9
|
+
8-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:5:5-79
|
|
10
|
+
8-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:5:22-76
|
|
11
11
|
9 <uses-permission android:name="android.permission.USE_EXACT_ALARM" />
|
|
12
|
-
9-->/Users/quaresma/projects/
|
|
13
|
-
9-->/Users/quaresma/projects/
|
|
12
|
+
9-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:6:5-74
|
|
13
|
+
9-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:6:22-71
|
|
14
14
|
10
|
|
15
15
|
11 <!-- Wake device and play sound -->
|
|
16
16
|
12 <uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
17
|
-
12-->/Users/quaresma/projects/
|
|
18
|
-
12-->/Users/quaresma/projects/
|
|
17
|
+
12-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:9:5-68
|
|
18
|
+
12-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:9:22-65
|
|
19
19
|
13 <uses-permission android:name="android.permission.VIBRATE" />
|
|
20
|
-
13-->/Users/quaresma/projects/
|
|
21
|
-
13-->/Users/quaresma/projects/
|
|
20
|
+
13-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:10:5-66
|
|
21
|
+
13-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:10:22-63
|
|
22
22
|
14
|
|
23
23
|
15 <!-- Boot persistence -->
|
|
24
24
|
16 <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
|
25
|
-
16-->/Users/quaresma/projects/
|
|
26
|
-
16-->/Users/quaresma/projects/
|
|
25
|
+
16-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:13:5-81
|
|
26
|
+
16-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:13:22-78
|
|
27
27
|
17
|
|
28
28
|
18 <!-- Notifications (Android 13+) -->
|
|
29
29
|
19 <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
|
30
|
-
19-->/Users/quaresma/projects/
|
|
31
|
-
19-->/Users/quaresma/projects/
|
|
30
|
+
19-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:16:5-77
|
|
31
|
+
19-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:16:22-74
|
|
32
32
|
20
|
|
33
33
|
21 <application>
|
|
34
|
-
21-->/Users/quaresma/projects/
|
|
34
|
+
21-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:18:5-35:19
|
|
35
35
|
22
|
|
36
36
|
23 <!-- Alarm broadcast receiver -->
|
|
37
37
|
24 <receiver
|
|
38
|
-
24-->/Users/quaresma/projects/
|
|
38
|
+
24-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:20:9-22:40
|
|
39
39
|
25 android:name="com.rnalarmmodule.AlarmReceiver"
|
|
40
|
-
25-->/Users/quaresma/projects/
|
|
40
|
+
25-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:21:13-42
|
|
41
41
|
26 android:exported="false" />
|
|
42
|
-
26-->/Users/quaresma/projects/
|
|
42
|
+
26-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:22:13-37
|
|
43
43
|
27
|
|
44
44
|
28 <!-- Boot and time change receiver for rescheduling alarms -->
|
|
45
45
|
29 <receiver
|
|
46
|
-
29-->/Users/quaresma/projects/
|
|
46
|
+
29-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:25:9-34:20
|
|
47
47
|
30 android:name="com.rnalarmmodule.BootReceiver"
|
|
48
|
-
30-->/Users/quaresma/projects/
|
|
48
|
+
30-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:26:13-41
|
|
49
49
|
31 android:enabled="true"
|
|
50
|
-
31-->/Users/quaresma/projects/
|
|
50
|
+
31-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:27:13-35
|
|
51
51
|
32 android:exported="true" >
|
|
52
|
-
32-->/Users/quaresma/projects/
|
|
52
|
+
32-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:28:13-36
|
|
53
53
|
33 <intent-filter>
|
|
54
|
-
33-->/Users/quaresma/projects/
|
|
54
|
+
33-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:29:13-33:29
|
|
55
55
|
34 <action android:name="android.intent.action.BOOT_COMPLETED" />
|
|
56
|
-
34-->/Users/quaresma/projects/
|
|
57
|
-
34-->/Users/quaresma/projects/
|
|
56
|
+
34-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:30:17-79
|
|
57
|
+
34-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:30:25-76
|
|
58
58
|
35 <action android:name="android.intent.action.TIME_SET" />
|
|
59
|
-
35-->/Users/quaresma/projects/
|
|
60
|
-
35-->/Users/quaresma/projects/
|
|
59
|
+
35-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:31:17-73
|
|
60
|
+
35-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:31:25-70
|
|
61
61
|
36 <action android:name="android.intent.action.TIMEZONE_CHANGED" />
|
|
62
|
-
36-->/Users/quaresma/projects/
|
|
63
|
-
36-->/Users/quaresma/projects/
|
|
62
|
+
36-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:32:17-81
|
|
63
|
+
36-->/Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:32:25-78
|
|
64
64
|
37 </intent-filter>
|
|
65
65
|
38 </receiver>
|
|
66
66
|
39 </application>
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len
CHANGED
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,71 +1,71 @@
|
|
|
1
1
|
-- Merging decision tree log ---
|
|
2
2
|
manifest
|
|
3
|
-
ADDED from /Users/quaresma/projects/
|
|
4
|
-
INJECTED from /Users/quaresma/projects/
|
|
3
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:1:1-36:12
|
|
4
|
+
INJECTED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:1:1-36:12
|
|
5
5
|
package
|
|
6
|
-
ADDED from /Users/quaresma/projects/
|
|
7
|
-
INJECTED from /Users/quaresma/projects/
|
|
6
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:2:5-32
|
|
7
|
+
INJECTED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml
|
|
8
8
|
xmlns:android
|
|
9
|
-
ADDED from /Users/quaresma/projects/
|
|
9
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:1:11-69
|
|
10
10
|
uses-permission#android.permission.SCHEDULE_EXACT_ALARM
|
|
11
|
-
ADDED from /Users/quaresma/projects/
|
|
11
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:5:5-79
|
|
12
12
|
android:name
|
|
13
|
-
ADDED from /Users/quaresma/projects/
|
|
13
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:5:22-76
|
|
14
14
|
uses-permission#android.permission.USE_EXACT_ALARM
|
|
15
|
-
ADDED from /Users/quaresma/projects/
|
|
15
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:6:5-74
|
|
16
16
|
android:name
|
|
17
|
-
ADDED from /Users/quaresma/projects/
|
|
17
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:6:22-71
|
|
18
18
|
uses-permission#android.permission.WAKE_LOCK
|
|
19
|
-
ADDED from /Users/quaresma/projects/
|
|
19
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:9:5-68
|
|
20
20
|
android:name
|
|
21
|
-
ADDED from /Users/quaresma/projects/
|
|
21
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:9:22-65
|
|
22
22
|
uses-permission#android.permission.VIBRATE
|
|
23
|
-
ADDED from /Users/quaresma/projects/
|
|
23
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:10:5-66
|
|
24
24
|
android:name
|
|
25
|
-
ADDED from /Users/quaresma/projects/
|
|
25
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:10:22-63
|
|
26
26
|
uses-permission#android.permission.RECEIVE_BOOT_COMPLETED
|
|
27
|
-
ADDED from /Users/quaresma/projects/
|
|
27
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:13:5-81
|
|
28
28
|
android:name
|
|
29
|
-
ADDED from /Users/quaresma/projects/
|
|
29
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:13:22-78
|
|
30
30
|
uses-permission#android.permission.POST_NOTIFICATIONS
|
|
31
|
-
ADDED from /Users/quaresma/projects/
|
|
31
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:16:5-77
|
|
32
32
|
android:name
|
|
33
|
-
ADDED from /Users/quaresma/projects/
|
|
33
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:16:22-74
|
|
34
34
|
application
|
|
35
|
-
ADDED from /Users/quaresma/projects/
|
|
35
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:18:5-35:19
|
|
36
36
|
receiver#com.rnalarmmodule.AlarmReceiver
|
|
37
|
-
ADDED from /Users/quaresma/projects/
|
|
37
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:20:9-22:40
|
|
38
38
|
android:exported
|
|
39
|
-
ADDED from /Users/quaresma/projects/
|
|
39
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:22:13-37
|
|
40
40
|
android:name
|
|
41
|
-
ADDED from /Users/quaresma/projects/
|
|
41
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:21:13-42
|
|
42
42
|
receiver#com.rnalarmmodule.BootReceiver
|
|
43
|
-
ADDED from /Users/quaresma/projects/
|
|
43
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:25:9-34:20
|
|
44
44
|
android:enabled
|
|
45
|
-
ADDED from /Users/quaresma/projects/
|
|
45
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:27:13-35
|
|
46
46
|
android:exported
|
|
47
|
-
ADDED from /Users/quaresma/projects/
|
|
47
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:28:13-36
|
|
48
48
|
android:name
|
|
49
|
-
ADDED from /Users/quaresma/projects/
|
|
49
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:26:13-41
|
|
50
50
|
intent-filter#action:name:android.intent.action.BOOT_COMPLETED+action:name:android.intent.action.TIMEZONE_CHANGED+action:name:android.intent.action.TIME_SET
|
|
51
|
-
ADDED from /Users/quaresma/projects/
|
|
51
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:29:13-33:29
|
|
52
52
|
action#android.intent.action.BOOT_COMPLETED
|
|
53
|
-
ADDED from /Users/quaresma/projects/
|
|
53
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:30:17-79
|
|
54
54
|
android:name
|
|
55
|
-
ADDED from /Users/quaresma/projects/
|
|
55
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:30:25-76
|
|
56
56
|
action#android.intent.action.TIME_SET
|
|
57
|
-
ADDED from /Users/quaresma/projects/
|
|
57
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:31:17-73
|
|
58
58
|
android:name
|
|
59
|
-
ADDED from /Users/quaresma/projects/
|
|
59
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:31:25-70
|
|
60
60
|
action#android.intent.action.TIMEZONE_CHANGED
|
|
61
|
-
ADDED from /Users/quaresma/projects/
|
|
61
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:32:17-81
|
|
62
62
|
android:name
|
|
63
|
-
ADDED from /Users/quaresma/projects/
|
|
63
|
+
ADDED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml:32:25-78
|
|
64
64
|
uses-sdk
|
|
65
|
-
INJECTED from /Users/quaresma/projects/
|
|
66
|
-
INJECTED from /Users/quaresma/projects/
|
|
67
|
-
INJECTED from /Users/quaresma/projects/
|
|
65
|
+
INJECTED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml reason: use-sdk injection requested
|
|
66
|
+
INJECTED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml
|
|
67
|
+
INJECTED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml
|
|
68
68
|
android:targetSdkVersion
|
|
69
|
-
INJECTED from /Users/quaresma/projects/
|
|
69
|
+
INJECTED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml
|
|
70
70
|
android:minSdkVersion
|
|
71
|
-
INJECTED from /Users/quaresma/projects/
|
|
71
|
+
INJECTED from /Users/quaresma/projects/react-native-alarmageddon/android/src/main/AndroidManifest.xml
|
|
Binary file
|
|
Binary file
|
|
@@ -65,6 +65,8 @@ class AlarmModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaM
|
|
|
65
65
|
val alarm = getAlarm(id) ?: throw Exception("Alarm not found")
|
|
66
66
|
val title = alarm.optString("title", "Alarm")
|
|
67
67
|
val body = alarm.optString("body", "")
|
|
68
|
+
val snoozeEnabled = alarm.optBoolean("snoozeEnabled", true)
|
|
69
|
+
val snoozeInterval = alarm.optInt("snoozeInterval", 5)
|
|
68
70
|
|
|
69
71
|
val intent = Intent(reactApplicationContext, AlarmReceiver::class.java).apply {
|
|
70
72
|
action = AlarmReceiver.ACTION_SNOOZE
|
|
@@ -72,6 +74,8 @@ class AlarmModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaM
|
|
|
72
74
|
putExtra("title", title)
|
|
73
75
|
putExtra("body", "$body (Snoozed)")
|
|
74
76
|
putExtra("snoozeMinutes", minutes)
|
|
77
|
+
putExtra("snoozeEnabled", snoozeEnabled)
|
|
78
|
+
putExtra("snoozeInterval", snoozeInterval)
|
|
75
79
|
}
|
|
76
80
|
reactApplicationContext.sendBroadcast(intent)
|
|
77
81
|
promise.resolve(null)
|
|
@@ -98,6 +102,8 @@ class AlarmModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaM
|
|
|
98
102
|
val datetimeISO = alarm.getString("datetimeISO") ?: throw Exception("datetimeISO required")
|
|
99
103
|
val title = alarm.getString("title") ?: "Alarm"
|
|
100
104
|
val body = alarm.getString("body") ?: ""
|
|
105
|
+
val snoozeEnabled = if (alarm.hasKey("snoozeEnabled")) alarm.getBoolean("snoozeEnabled") else true
|
|
106
|
+
val snoozeInterval = if (alarm.hasKey("snoozeInterval")) alarm.getInt("snoozeInterval") else 5
|
|
101
107
|
|
|
102
108
|
val sdf = SimpleDateFormat(DATE_PATTERN, Locale.getDefault())
|
|
103
109
|
val date = sdf.parse(datetimeISO) ?: throw Exception("Invalid date format")
|
|
@@ -113,6 +119,8 @@ class AlarmModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaM
|
|
|
113
119
|
putExtra("id", id)
|
|
114
120
|
putExtra("title", title)
|
|
115
121
|
putExtra("body", body)
|
|
122
|
+
putExtra("snoozeEnabled", snoozeEnabled)
|
|
123
|
+
putExtra("snoozeInterval", snoozeInterval)
|
|
116
124
|
}
|
|
117
125
|
|
|
118
126
|
val pendingIntent = PendingIntent.getBroadcast(
|
|
@@ -129,7 +137,7 @@ class AlarmModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaM
|
|
|
129
137
|
alarmManager.setExact(AlarmManager.RTC_WAKEUP, triggerAt, pendingIntent)
|
|
130
138
|
}
|
|
131
139
|
|
|
132
|
-
saveAlarm(id, datetimeISO, title, body)
|
|
140
|
+
saveAlarm(id, datetimeISO, title, body, snoozeEnabled, snoozeInterval)
|
|
133
141
|
Log.d(TAG, "Scheduled alarm id=$id at=$datetimeISO")
|
|
134
142
|
promise.resolve(null)
|
|
135
143
|
} catch (e: Exception) {
|
|
@@ -176,6 +184,8 @@ class AlarmModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaM
|
|
|
176
184
|
map.putString("datetimeISO", obj.optString("datetimeISO"))
|
|
177
185
|
map.putString("title", obj.optString("title"))
|
|
178
186
|
map.putString("body", obj.optString("body"))
|
|
187
|
+
map.putBoolean("snoozeEnabled", obj.optBoolean("snoozeEnabled", true))
|
|
188
|
+
map.putInt("snoozeInterval", obj.optInt("snoozeInterval", 5))
|
|
179
189
|
arr.pushMap(map)
|
|
180
190
|
}
|
|
181
191
|
promise.resolve(arr)
|
|
@@ -222,12 +232,14 @@ class AlarmModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaM
|
|
|
222
232
|
// Required for NativeEventEmitter
|
|
223
233
|
}
|
|
224
234
|
|
|
225
|
-
private fun saveAlarm(id: String, datetimeISO: String, title: String, body: String) {
|
|
235
|
+
private fun saveAlarm(id: String, datetimeISO: String, title: String, body: String, snoozeEnabled: Boolean = true, snoozeInterval: Int = 5) {
|
|
226
236
|
val obj = JSONObject()
|
|
227
237
|
.put("id", id)
|
|
228
238
|
.put("datetimeISO", datetimeISO)
|
|
229
239
|
.put("title", title)
|
|
230
240
|
.put("body", body)
|
|
241
|
+
.put("snoozeEnabled", snoozeEnabled)
|
|
242
|
+
.put("snoozeInterval", snoozeInterval)
|
|
231
243
|
val prefs = reactApplicationContext.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
|
|
232
244
|
prefs.edit().putString(id, obj.toString()).apply()
|
|
233
245
|
}
|
|
@@ -62,6 +62,8 @@ class AlarmReceiver : BroadcastReceiver() {
|
|
|
62
62
|
|
|
63
63
|
val title = intent.getStringExtra("title") ?: "Alarm"
|
|
64
64
|
val body = intent.getStringExtra("body") ?: ""
|
|
65
|
+
val snoozeEnabled = intent.getBooleanExtra("snoozeEnabled", true)
|
|
66
|
+
val snoozeInterval = intent.getIntExtra("snoozeInterval", SNOOZE_MINUTES)
|
|
65
67
|
activeAlarmId = id
|
|
66
68
|
|
|
67
69
|
emitActiveAlarmId(activeAlarmId)
|
|
@@ -69,7 +71,7 @@ class AlarmReceiver : BroadcastReceiver() {
|
|
|
69
71
|
acquireWakeLock(context)
|
|
70
72
|
setupAudio(context)
|
|
71
73
|
playAlarm(context, id)
|
|
72
|
-
showNotificationWithActions(context, id, title, body)
|
|
74
|
+
showNotificationWithActions(context, id, title, body, snoozeEnabled, snoozeInterval)
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
private fun acquireWakeLock(context: Context) {
|
|
@@ -181,7 +183,7 @@ class AlarmReceiver : BroadcastReceiver() {
|
|
|
181
183
|
}.start()
|
|
182
184
|
}
|
|
183
185
|
|
|
184
|
-
private fun showNotificationWithActions(context: Context, id: String, title: String, body: String) {
|
|
186
|
+
private fun showNotificationWithActions(context: Context, id: String, title: String, body: String, snoozeEnabled: Boolean = true, snoozeInterval: Int = SNOOZE_MINUTES) {
|
|
185
187
|
val nm = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
|
186
188
|
|
|
187
189
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
@@ -203,17 +205,21 @@ class AlarmReceiver : BroadcastReceiver() {
|
|
|
203
205
|
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
|
204
206
|
)
|
|
205
207
|
|
|
206
|
-
val
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
208
|
+
val snoozePendingIntent = if (snoozeEnabled) {
|
|
209
|
+
val snoozeIntent = Intent(context, AlarmReceiver::class.java).apply {
|
|
210
|
+
action = ACTION_SNOOZE
|
|
211
|
+
putExtra("id", id)
|
|
212
|
+
putExtra("title", title)
|
|
213
|
+
putExtra("body", "$body (Snoozed)")
|
|
214
|
+
putExtra("snoozeMinutes", snoozeInterval)
|
|
215
|
+
putExtra("snoozeEnabled", snoozeEnabled)
|
|
216
|
+
putExtra("snoozeInterval", snoozeInterval)
|
|
217
|
+
}
|
|
218
|
+
PendingIntent.getBroadcast(
|
|
219
|
+
context, id.hashCode() + 2, snoozeIntent,
|
|
220
|
+
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
|
221
|
+
)
|
|
222
|
+
} else null
|
|
217
223
|
|
|
218
224
|
// Try to get the host app's launcher activity
|
|
219
225
|
val launchIntent = context.packageManager.getLaunchIntentForPackage(context.packageName)?.apply {
|
|
@@ -235,11 +241,15 @@ class AlarmReceiver : BroadcastReceiver() {
|
|
|
235
241
|
.setPriority(NotificationCompat.PRIORITY_HIGH)
|
|
236
242
|
.setCategory(NotificationCompat.CATEGORY_ALARM)
|
|
237
243
|
.addAction(android.R.drawable.ic_menu_close_clear_cancel, "Stop", stopPendingIntent)
|
|
238
|
-
.addAction(android.R.drawable.ic_menu_recent_history, "Snooze", snoozePendingIntent)
|
|
239
244
|
.setOngoing(true)
|
|
240
245
|
.setSound(null)
|
|
241
246
|
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
|
|
242
247
|
|
|
248
|
+
// Only add snooze action if snooze is enabled
|
|
249
|
+
if (snoozeEnabled && snoozePendingIntent != null) {
|
|
250
|
+
builder.addAction(android.R.drawable.ic_menu_recent_history, "Snooze", snoozePendingIntent)
|
|
251
|
+
}
|
|
252
|
+
|
|
243
253
|
if (fullScreenPendingIntent != null) {
|
|
244
254
|
builder.setFullScreenIntent(fullScreenPendingIntent, true)
|
|
245
255
|
builder.setContentIntent(fullScreenPendingIntent)
|
package/ios/AlarmModule.swift
CHANGED
|
@@ -47,6 +47,8 @@ class AlarmModule: RCTEventEmitter {
|
|
|
47
47
|
|
|
48
48
|
let title = alarm["title"] as? String ?? "Alarm"
|
|
49
49
|
let body = alarm["body"] as? String ?? ""
|
|
50
|
+
let snoozeEnabled = alarm["snoozeEnabled"] as? Bool ?? true
|
|
51
|
+
let snoozeInterval = alarm["snoozeInterval"] as? Int ?? 5
|
|
50
52
|
|
|
51
53
|
// Parse ISO date
|
|
52
54
|
let dateFormatter = ISO8601DateFormatter()
|
|
@@ -79,8 +81,15 @@ class AlarmModule: RCTEventEmitter {
|
|
|
79
81
|
content.title = title
|
|
80
82
|
content.body = body
|
|
81
83
|
content.sound = UNNotificationSound.default
|
|
82
|
-
content.categoryIdentifier = "ALARM_CATEGORY"
|
|
83
|
-
content.userInfo = [
|
|
84
|
+
content.categoryIdentifier = snoozeEnabled ? "ALARM_CATEGORY_WITH_SNOOZE" : "ALARM_CATEGORY"
|
|
85
|
+
content.userInfo = [
|
|
86
|
+
"alarmId": id,
|
|
87
|
+
"snoozeEnabled": snoozeEnabled,
|
|
88
|
+
"snoozeInterval": snoozeInterval
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
// Register notification category with appropriate actions
|
|
92
|
+
registerNotificationCategory(snoozeEnabled: snoozeEnabled)
|
|
84
93
|
|
|
85
94
|
// Create trigger
|
|
86
95
|
let calendar = Calendar.current
|
|
@@ -97,11 +106,43 @@ class AlarmModule: RCTEventEmitter {
|
|
|
97
106
|
}
|
|
98
107
|
|
|
99
108
|
// Save alarm to UserDefaults
|
|
100
|
-
self.saveAlarm(id: id, datetimeISO: datetimeISO, title: title, body: body)
|
|
109
|
+
self.saveAlarm(id: id, datetimeISO: datetimeISO, title: title, body: body, snoozeEnabled: snoozeEnabled, snoozeInterval: snoozeInterval)
|
|
101
110
|
resolve(nil)
|
|
102
111
|
}
|
|
103
112
|
}
|
|
104
113
|
|
|
114
|
+
private func registerNotificationCategory(snoozeEnabled: Bool) {
|
|
115
|
+
let stopAction = UNNotificationAction(
|
|
116
|
+
identifier: "STOP_ACTION",
|
|
117
|
+
title: "Stop",
|
|
118
|
+
options: [.destructive, .foreground]
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
if snoozeEnabled {
|
|
122
|
+
let snoozeAction = UNNotificationAction(
|
|
123
|
+
identifier: "SNOOZE_ACTION",
|
|
124
|
+
title: "Snooze",
|
|
125
|
+
options: []
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
let categoryWithSnooze = UNNotificationCategory(
|
|
129
|
+
identifier: "ALARM_CATEGORY_WITH_SNOOZE",
|
|
130
|
+
actions: [stopAction, snoozeAction],
|
|
131
|
+
intentIdentifiers: [],
|
|
132
|
+
options: [.customDismissAction]
|
|
133
|
+
)
|
|
134
|
+
UNUserNotificationCenter.current().setNotificationCategories([categoryWithSnooze])
|
|
135
|
+
} else {
|
|
136
|
+
let categoryWithoutSnooze = UNNotificationCategory(
|
|
137
|
+
identifier: "ALARM_CATEGORY",
|
|
138
|
+
actions: [stopAction],
|
|
139
|
+
intentIdentifiers: [],
|
|
140
|
+
options: [.customDismissAction]
|
|
141
|
+
)
|
|
142
|
+
UNUserNotificationCenter.current().setNotificationCategories([categoryWithoutSnooze])
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
105
146
|
@objc(cancelAlarm:resolver:rejecter:)
|
|
106
147
|
func cancelAlarm(_ id: String,
|
|
107
148
|
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
@@ -166,15 +207,23 @@ class AlarmModule: RCTEventEmitter {
|
|
|
166
207
|
|
|
167
208
|
// Get alarm details
|
|
168
209
|
if let alarm = getAlarmById(id: id) {
|
|
169
|
-
let title = alarm["title"]
|
|
170
|
-
let body = (alarm["body"]
|
|
210
|
+
let title = alarm["title"] ?? "Alarm"
|
|
211
|
+
let body = (alarm["body"] ?? "") + " (Snoozed)"
|
|
212
|
+
let snoozeEnabled = (alarm["snoozeEnabled"] as NSString?)?.boolValue ?? true
|
|
213
|
+
let snoozeInterval = Int(alarm["snoozeInterval"] ?? "5") ?? 5
|
|
171
214
|
|
|
172
215
|
let content = UNMutableNotificationContent()
|
|
173
216
|
content.title = title
|
|
174
217
|
content.body = body
|
|
175
218
|
content.sound = UNNotificationSound.default
|
|
176
|
-
content.categoryIdentifier = "ALARM_CATEGORY"
|
|
177
|
-
content.userInfo = [
|
|
219
|
+
content.categoryIdentifier = snoozeEnabled ? "ALARM_CATEGORY_WITH_SNOOZE" : "ALARM_CATEGORY"
|
|
220
|
+
content.userInfo = [
|
|
221
|
+
"alarmId": id,
|
|
222
|
+
"snoozeEnabled": snoozeEnabled,
|
|
223
|
+
"snoozeInterval": snoozeInterval
|
|
224
|
+
]
|
|
225
|
+
|
|
226
|
+
registerNotificationCategory(snoozeEnabled: snoozeEnabled)
|
|
178
227
|
|
|
179
228
|
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: TimeInterval(minutes * 60), repeats: false)
|
|
180
229
|
let request = UNNotificationRequest(identifier: id, content: content, trigger: trigger)
|
|
@@ -202,13 +251,15 @@ class AlarmModule: RCTEventEmitter {
|
|
|
202
251
|
|
|
203
252
|
// MARK: - Storage Helpers
|
|
204
253
|
|
|
205
|
-
private func saveAlarm(id: String, datetimeISO: String, title: String, body: String) {
|
|
254
|
+
private func saveAlarm(id: String, datetimeISO: String, title: String, body: String, snoozeEnabled: Bool = true, snoozeInterval: Int = 5) {
|
|
206
255
|
var alarms = getAlarmsDict()
|
|
207
256
|
alarms[id] = [
|
|
208
257
|
"id": id,
|
|
209
258
|
"datetimeISO": datetimeISO,
|
|
210
259
|
"title": title,
|
|
211
|
-
"body": body
|
|
260
|
+
"body": body,
|
|
261
|
+
"snoozeEnabled": String(snoozeEnabled),
|
|
262
|
+
"snoozeInterval": String(snoozeInterval)
|
|
212
263
|
]
|
|
213
264
|
UserDefaults.standard.set(alarms, forKey: AlarmModule.PREFS_KEY)
|
|
214
265
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -10,6 +10,10 @@ export type AlarmParams = {
|
|
|
10
10
|
title?: string;
|
|
11
11
|
/** Body text to display in the notification */
|
|
12
12
|
body?: string;
|
|
13
|
+
/** Whether snoozing is enabled for this alarm */
|
|
14
|
+
snoozeEnabled?: boolean;
|
|
15
|
+
/** Interval in minutes for snoozing */
|
|
16
|
+
snoozeInterval?: number;
|
|
13
17
|
};
|
|
14
18
|
/**
|
|
15
19
|
* Result of permission request
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,sCAAsC;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,yFAAyF;IACzF,WAAW,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,sCAAsC;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,yFAAyF;IACzF,WAAW,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,uCAAuC;IACvC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,IAAI,CAAC;AAmCT;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;AAElE;;;;GAIG;AACH,iBAAe,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC,CAyBnD;AAED;;;;GAIG;AACH,iBAAe,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAE9D;AAED;;;GAGG;AACH,iBAAe,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEpD;AAED;;;GAGG;AACH,iBAAe,UAAU,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAElD;AAED;;;GAGG;AACH,iBAAe,kBAAkB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAE7D;AAED;;;;GAIG;AACH,iBAAe,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAErE;AAED;;;GAGG;AACH,iBAAe,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzD;AAED;;;;GAIG;AACH,iBAAe,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE5E;AAED;;;GAGG;AACH,iBAAe,sBAAsB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAEjE;AAED;;;;;GAKG;AACH,iBAAS,kBAAkB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,iBAAiB,CAK3E;AAED;;GAEG;AACH,QAAA,MAAM,aAAa;;;;;;;;;;;CAWlB,CAAC;AAEF,eAAe,aAAa,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,kBAAkB,GACnB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-alarmageddon",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Native exact alarm scheduling for React Native with sound, snooze, and boot persistence",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|
|
39
|
-
"url": "https://github.com/
|
|
39
|
+
"url": "https://github.com/joaoGabriel55/react-native-alarmageddon.git"
|
|
40
40
|
},
|
|
41
41
|
"bugs": {
|
|
42
|
-
"url": "https://github.com/
|
|
42
|
+
"url": "https://github.com/joaoGabriel55/react-native-alarmageddon/issues"
|
|
43
43
|
},
|
|
44
|
-
"homepage": "https://github.com/
|
|
44
|
+
"homepage": "https://github.com/joaoGabriel55/react-native-alarmageddon#readme",
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"react": ">=16.8.0",
|
|
47
47
|
"react-native": ">=0.60.0"
|
package/src/index.ts
CHANGED
|
@@ -17,6 +17,10 @@ export type AlarmParams = {
|
|
|
17
17
|
title?: string;
|
|
18
18
|
/** Body text to display in the notification */
|
|
19
19
|
body?: string;
|
|
20
|
+
/** Whether snoozing is enabled for this alarm */
|
|
21
|
+
snoozeEnabled?: boolean;
|
|
22
|
+
/** Interval in minutes for snoozing */
|
|
23
|
+
snoozeInterval?: number;
|
|
20
24
|
};
|
|
21
25
|
|
|
22
26
|
/**
|