react-native-alarmageddon 1.0.0

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/lib/index.d.ts ADDED
@@ -0,0 +1,147 @@
1
+ import { EmitterSubscription } from 'react-native';
2
+ /**
3
+ * Parameters for scheduling an alarm
4
+ */
5
+ export type AlarmParams = {
6
+ /** Unique identifier for the alarm */
7
+ id: string;
8
+ /** ISO 8601 datetime string for when the alarm should trigger */
9
+ datetimeISO: string;
10
+ /** Title shown in the notification */
11
+ title?: string;
12
+ /** Body text shown in the notification */
13
+ body?: string;
14
+ /** URI of the sound to play (uses default alarm sound if not provided) */
15
+ soundUri?: string;
16
+ /** Whether to vibrate when alarm triggers (default: true) */
17
+ vibrate?: boolean;
18
+ /** Number of minutes for snooze (default: 5) */
19
+ snoozeMinutes?: number;
20
+ /** Number of seconds before alarm auto-stops (default: 60) */
21
+ autoStopSeconds?: number;
22
+ };
23
+ /**
24
+ * Stored alarm data returned from listAlarms
25
+ */
26
+ export type StoredAlarm = {
27
+ id: string;
28
+ datetimeISO: string;
29
+ title: string;
30
+ body: string;
31
+ vibrate: boolean;
32
+ snoozeMinutes: number;
33
+ autoStopSeconds: number;
34
+ };
35
+ /**
36
+ * Permission request result
37
+ */
38
+ export type PermissionResult = {
39
+ granted: boolean;
40
+ exactAlarmGranted?: boolean;
41
+ };
42
+ /**
43
+ * Active alarm info
44
+ */
45
+ export type ActiveAlarmInfo = {
46
+ activeAlarmId: string;
47
+ } | null;
48
+ /**
49
+ * Request notification permission (required on Android 13+)
50
+ * @returns Promise resolving to true if permission granted
51
+ */
52
+ declare function requestNotificationPermission(): Promise<boolean>;
53
+ /**
54
+ * Request exact alarm permission (required on Android 12+)
55
+ * Opens system settings if not granted
56
+ * @returns Promise resolving to permission result
57
+ */
58
+ declare function requestExactAlarmPermission(): Promise<PermissionResult>;
59
+ /**
60
+ * Check if exact alarm permission is granted
61
+ * @returns Promise resolving to true if permission granted
62
+ */
63
+ declare function checkExactAlarmPermission(): Promise<boolean>;
64
+ /**
65
+ * Open system settings for exact alarm permission
66
+ */
67
+ declare function openExactAlarmSettings(): Promise<void>;
68
+ /**
69
+ * Ensure all required permissions are granted
70
+ * Requests both notification and exact alarm permissions
71
+ * @returns Promise resolving to true if all permissions granted
72
+ */
73
+ declare function ensurePermissions(): Promise<boolean>;
74
+ /**
75
+ * Schedule an alarm
76
+ * @param alarm - Alarm parameters
77
+ */
78
+ declare function scheduleAlarm(alarm: AlarmParams): Promise<void>;
79
+ /**
80
+ * Cancel a scheduled alarm
81
+ * @param id - Alarm ID to cancel
82
+ */
83
+ declare function cancelAlarm(id: string): Promise<void>;
84
+ /**
85
+ * List all scheduled alarms
86
+ * @returns Promise resolving to array of stored alarms
87
+ */
88
+ declare function listAlarms(): Promise<StoredAlarm[]>;
89
+ /**
90
+ * Snooze an alarm for a specified number of minutes
91
+ * @param id - Alarm ID to snooze
92
+ * @param minutes - Number of minutes to snooze (default: 5)
93
+ */
94
+ declare function snoozeAlarm(id: string, minutes?: number): Promise<void>;
95
+ /**
96
+ * Stop the currently playing alarm
97
+ * @param id - Alarm ID to stop
98
+ */
99
+ declare function stopCurrentAlarm(id: string): Promise<void>;
100
+ /**
101
+ * Snooze the currently playing alarm
102
+ * @param id - Alarm ID to snooze
103
+ * @param minutes - Number of minutes to snooze (default: 5)
104
+ */
105
+ declare function snoozeCurrentAlarm(id: string, minutes?: number): Promise<void>;
106
+ /**
107
+ * Get the currently playing alarm (if any)
108
+ * @returns Promise resolving to active alarm info or null
109
+ */
110
+ declare function getCurrentAlarmPlaying(): Promise<ActiveAlarmInfo>;
111
+ /**
112
+ * Subscribe to alarm state changes
113
+ * Callback receives the alarm ID when an alarm starts, or null when stopped
114
+ * @param callback - Function called when alarm state changes
115
+ * @returns Cleanup function to remove the subscription
116
+ */
117
+ declare function onAlarmStateChange(callback: (alarmId: string | null) => void): () => void;
118
+ /**
119
+ * Add event listener for alarm state changes
120
+ * @param event - Event name ('activeAlarmId')
121
+ * @param callback - Callback function
122
+ * @returns EmitterSubscription for removal
123
+ */
124
+ declare function addEventListener(event: 'activeAlarmId', callback: (alarmId: string | null) => void): EmitterSubscription;
125
+ /**
126
+ * Main module export with all alarm functions
127
+ */
128
+ declare const RNAlarmModule: {
129
+ ensurePermissions: typeof ensurePermissions;
130
+ requestNotificationPermission: typeof requestNotificationPermission;
131
+ requestExactAlarmPermission: typeof requestExactAlarmPermission;
132
+ checkExactAlarmPermission: typeof checkExactAlarmPermission;
133
+ openExactAlarmSettings: typeof openExactAlarmSettings;
134
+ scheduleAlarm: typeof scheduleAlarm;
135
+ cancelAlarm: typeof cancelAlarm;
136
+ listAlarms: typeof listAlarms;
137
+ snoozeAlarm: typeof snoozeAlarm;
138
+ stopCurrentAlarm: typeof stopCurrentAlarm;
139
+ snoozeCurrentAlarm: typeof snoozeCurrentAlarm;
140
+ getCurrentAlarmPlaying: typeof getCurrentAlarmPlaying;
141
+ onAlarmStateChange: typeof onAlarmStateChange;
142
+ addEventListener: typeof addEventListener;
143
+ };
144
+ export default RNAlarmModule;
145
+ export { RNAlarmModule };
146
+ export { ensurePermissions, requestNotificationPermission, requestExactAlarmPermission, checkExactAlarmPermission, openExactAlarmSettings, scheduleAlarm, cancelAlarm, listAlarms, snoozeAlarm, stopCurrentAlarm, snoozeCurrentAlarm, getCurrentAlarmPlaying, onAlarmStateChange, addEventListener, };
147
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,mBAAmB,EACpB,MAAM,cAAc,CAAC;AAEtB;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,sCAAsC;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,iEAAiE;IACjE,WAAW,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1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 'react-native';
2
+ const { AlarmModule } = NativeModules;
3
+ // Validate module exists
4
+ if (!AlarmModule) {
5
+ throw new Error('react-native-alarmageddon: NativeModule is null. ' +
6
+ 'Ensure you have linked the native module correctly. ' +
7
+ 'On Android, run `npx react-native run-android` to rebuild.');
8
+ }
9
+ const eventEmitter = new NativeEventEmitter(NativeModules.AlarmModule);
10
+ /**
11
+ * Request notification permission (required on Android 13+)
12
+ * @returns Promise resolving to true if permission granted
13
+ */
14
+ async function requestNotificationPermission() {
15
+ if (Platform.OS !== 'android') {
16
+ return true;
17
+ }
18
+ try {
19
+ if (Platform.Version >= 33) {
20
+ const status = await PermissionsAndroid.request('android.permission.POST_NOTIFICATIONS');
21
+ return status === PermissionsAndroid.RESULTS.GRANTED;
22
+ }
23
+ return true;
24
+ }
25
+ catch (error) {
26
+ console.warn('Failed to request notification permission:', error);
27
+ return false;
28
+ }
29
+ }
30
+ /**
31
+ * Request exact alarm permission (required on Android 12+)
32
+ * Opens system settings if not granted
33
+ * @returns Promise resolving to permission result
34
+ */
35
+ async function requestExactAlarmPermission() {
36
+ if (Platform.OS !== 'android') {
37
+ return { granted: true, exactAlarmGranted: true };
38
+ }
39
+ return AlarmModule.requestPermissions();
40
+ }
41
+ /**
42
+ * Check if exact alarm permission is granted
43
+ * @returns Promise resolving to true if permission granted
44
+ */
45
+ async function checkExactAlarmPermission() {
46
+ if (Platform.OS !== 'android') {
47
+ return true;
48
+ }
49
+ return AlarmModule.checkExactAlarmPermission();
50
+ }
51
+ /**
52
+ * Open system settings for exact alarm permission
53
+ */
54
+ async function openExactAlarmSettings() {
55
+ if (Platform.OS === 'android') {
56
+ return AlarmModule.openExactAlarmSettings();
57
+ }
58
+ }
59
+ /**
60
+ * Ensure all required permissions are granted
61
+ * Requests both notification and exact alarm permissions
62
+ * @returns Promise resolving to true if all permissions granted
63
+ */
64
+ async function ensurePermissions() {
65
+ if (Platform.OS !== 'android') {
66
+ return true;
67
+ }
68
+ const [notificationGranted, exactAlarmResult] = await Promise.all([
69
+ requestNotificationPermission(),
70
+ requestExactAlarmPermission(),
71
+ ]);
72
+ return notificationGranted && exactAlarmResult.granted;
73
+ }
74
+ /**
75
+ * Schedule an alarm
76
+ * @param alarm - Alarm parameters
77
+ */
78
+ async function scheduleAlarm(alarm) {
79
+ if (!alarm.id) {
80
+ throw new Error('Alarm ID is required');
81
+ }
82
+ if (!alarm.datetimeISO) {
83
+ throw new Error('datetimeISO is required');
84
+ }
85
+ return AlarmModule.scheduleAlarm(alarm);
86
+ }
87
+ /**
88
+ * Cancel a scheduled alarm
89
+ * @param id - Alarm ID to cancel
90
+ */
91
+ async function cancelAlarm(id) {
92
+ if (!id) {
93
+ throw new Error('Alarm ID is required');
94
+ }
95
+ return AlarmModule.cancelAlarm(id);
96
+ }
97
+ /**
98
+ * List all scheduled alarms
99
+ * @returns Promise resolving to array of stored alarms
100
+ */
101
+ async function listAlarms() {
102
+ return AlarmModule.listAlarms();
103
+ }
104
+ /**
105
+ * Snooze an alarm for a specified number of minutes
106
+ * @param id - Alarm ID to snooze
107
+ * @param minutes - Number of minutes to snooze (default: 5)
108
+ */
109
+ async function snoozeAlarm(id, minutes = 5) {
110
+ if (!id) {
111
+ throw new Error('Alarm ID is required');
112
+ }
113
+ return AlarmModule.snoozeAlarm(id, minutes);
114
+ }
115
+ /**
116
+ * Stop the currently playing alarm
117
+ * @param id - Alarm ID to stop
118
+ */
119
+ async function stopCurrentAlarm(id) {
120
+ if (!id) {
121
+ throw new Error('Alarm ID is required');
122
+ }
123
+ return AlarmModule.stopCurrentAlarm(id);
124
+ }
125
+ /**
126
+ * Snooze the currently playing alarm
127
+ * @param id - Alarm ID to snooze
128
+ * @param minutes - Number of minutes to snooze (default: 5)
129
+ */
130
+ async function snoozeCurrentAlarm(id, minutes = 5) {
131
+ if (!id) {
132
+ throw new Error('Alarm ID is required');
133
+ }
134
+ return AlarmModule.snoozeCurrentAlarm(id, minutes);
135
+ }
136
+ /**
137
+ * Get the currently playing alarm (if any)
138
+ * @returns Promise resolving to active alarm info or null
139
+ */
140
+ async function getCurrentAlarmPlaying() {
141
+ return AlarmModule.getCurrentAlarmPlaying();
142
+ }
143
+ /**
144
+ * Subscribe to alarm state changes
145
+ * Callback receives the alarm ID when an alarm starts, or null when stopped
146
+ * @param callback - Function called when alarm state changes
147
+ * @returns Cleanup function to remove the subscription
148
+ */
149
+ function onAlarmStateChange(callback) {
150
+ const subscription = eventEmitter.addListener('activeAlarmId', callback);
151
+ return () => subscription.remove();
152
+ }
153
+ /**
154
+ * Add event listener for alarm state changes
155
+ * @param event - Event name ('activeAlarmId')
156
+ * @param callback - Callback function
157
+ * @returns EmitterSubscription for removal
158
+ */
159
+ function addEventListener(event, callback) {
160
+ return eventEmitter.addListener(event, callback);
161
+ }
162
+ /**
163
+ * Main module export with all alarm functions
164
+ */
165
+ const RNAlarmModule = {
166
+ // Permissions
167
+ ensurePermissions,
168
+ requestNotificationPermission,
169
+ requestExactAlarmPermission,
170
+ checkExactAlarmPermission,
171
+ openExactAlarmSettings,
172
+ // Alarm management
173
+ scheduleAlarm,
174
+ cancelAlarm,
175
+ listAlarms,
176
+ snoozeAlarm,
177
+ // Active alarm control
178
+ stopCurrentAlarm,
179
+ snoozeCurrentAlarm,
180
+ getCurrentAlarmPlaying,
181
+ // Event handling
182
+ onAlarmStateChange,
183
+ addEventListener,
184
+ };
185
+ export default RNAlarmModule;
186
+ export { RNAlarmModule };
187
+ // Export individual functions for tree-shaking
188
+ export { ensurePermissions, requestNotificationPermission, requestExactAlarmPermission, checkExactAlarmPermission, openExactAlarmSettings, scheduleAlarm, cancelAlarm, listAlarms, snoozeAlarm, stopCurrentAlarm, snoozeCurrentAlarm, getCurrentAlarmPlaying, onAlarmStateChange, addEventListener, };
189
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,kBA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B,aAAa;IACb,WAAW;IACX,UAAU;IACV,WAAW;IAEX,uBAAuB;IACvB,gBAAgB;IAChB,kBAAkB;IAClB,sBAAsB;IAEtB,iBAAiB;IACjB,kBAAkB;IAClB,gBAAgB;CACjB,CAAC;AAEF,eAAe,aAAa,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,+CAA+C;AAC/C,OAAO,EACL,iBAAiB,EACjB,6BAA6B,EAC7B,2BAA2B,EAC3B,yBAAyB,EACzB,sBAAsB,EACtB,aAAa,EACb,WAAW,EACX,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,GACjB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "react-native-alarmageddon",
3
+ "version": "1.0.0",
4
+ "description": "Native exact alarm scheduling for React Native with sound, snooze, and boot persistence",
5
+ "main": "lib/index.js",
6
+ "module": "lib/index.js",
7
+ "types": "lib/index.d.ts",
8
+ "react-native": "src/index.ts",
9
+ "source": "src/index.ts",
10
+ "files": [
11
+ "lib/",
12
+ "src/",
13
+ "android/",
14
+ "ios/",
15
+ "react-native.config.js",
16
+ "react-native-alarmageddon.podspec",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "prepare": "npm run build",
22
+ "prepublishOnly": "npm run build",
23
+ "clean": "rm -rf lib/",
24
+ "typecheck": "tsc --noEmit"
25
+ },
26
+ "keywords": [
27
+ "react-native",
28
+ "alarm",
29
+ "scheduler",
30
+ "notification",
31
+ "android",
32
+ "exact-alarm",
33
+ "wake-alarm",
34
+ "snooze",
35
+ "boot-persistence",
36
+ "alarmmanager",
37
+ "foreground-service"
38
+ ],
39
+ "author": "",
40
+ "license": "MIT",
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "https://github.com/user/react-native-alarmageddon.git"
44
+ },
45
+ "bugs": {
46
+ "url": "https://github.com/user/react-native-alarmageddon/issues"
47
+ },
48
+ "homepage": "https://github.com/user/react-native-alarmageddon#readme",
49
+ "peerDependencies": {
50
+ "react": ">=16.8.0",
51
+ "react-native": ">=0.60.0"
52
+ },
53
+ "devDependencies": {
54
+ "@types/react": "^18.2.0",
55
+ "@types/react-native": "^0.72.0",
56
+ "react": "^18.2.0",
57
+ "react-native": "^0.73.0",
58
+ "typescript": "^5.3.0"
59
+ },
60
+ "engines": {
61
+ "node": ">=16.0.0"
62
+ }
63
+ }
@@ -0,0 +1,25 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "react-native-alarmageddon"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+
13
+ s.platforms = { :ios => "11.0" }
14
+ s.source = { :git => "https://github.com/user/react-native-alarmageddon.git", :tag => "#{s.version}" }
15
+
16
+ s.source_files = "ios/**/*.{h,m,mm,swift}"
17
+
18
+ s.dependency "React-Core"
19
+
20
+ # Swift/Objective-C bridging
21
+ s.pod_target_xcconfig = {
22
+ "DEFINES_MODULE" => "YES",
23
+ "SWIFT_OBJC_BRIDGING_HEADER" => "$(PODS_TARGET_SRCROOT)/ios/AlarmModule-Bridging-Header.h"
24
+ }
25
+ end
@@ -0,0 +1,12 @@
1
+ module.exports = {
2
+ dependency: {
3
+ platforms: {
4
+ android: {
5
+ sourceDir: './android',
6
+ packageImportPath: 'import com.rnalarmmodule.AlarmPackage;',
7
+ packageInstance: 'new AlarmPackage()',
8
+ },
9
+ ios: null, // iOS stub - not implemented yet
10
+ },
11
+ },
12
+ };