react-native-asleep 1.0.17 → 1.1.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/README.md +69 -304
- package/android/src/main/java/ai/asleep/reactnative/AsleepModule.kt +36 -17
- package/build/Asleep.types.d.ts +42 -0
- package/build/Asleep.types.d.ts.map +1 -1
- package/build/Asleep.types.js.map +1 -1
- package/build/AsleepStore.d.ts +6 -3
- package/build/AsleepStore.d.ts.map +1 -1
- package/build/AsleepStore.js +312 -115
- package/build/AsleepStore.js.map +1 -1
- package/build/index.d.ts +9 -4
- package/build/index.d.ts.map +1 -1
- package/build/index.js +10 -9
- package/build/index.js.map +1 -1
- package/ios/AsleepModule.swift +60 -4
- package/package.json +6 -23
- package/src/Asleep.types.ts +51 -1
- package/src/AsleepStore.ts +319 -133
- package/src/index.ts +19 -7
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from "expo-modules-core";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
|
-
import { Alert
|
|
3
|
+
import { Alert } from "react-native";
|
|
4
4
|
import {
|
|
5
5
|
AsleepConfig,
|
|
6
6
|
AsleepSetupConfig,
|
|
@@ -108,12 +108,11 @@ class Asleep {
|
|
|
108
108
|
return AsleepModule.requestRequiredPermissions();
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
-
setCustomNotification = async (
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
111
|
+
setCustomNotification = async (_title: string, _text: string): Promise<void> => {
|
|
112
|
+
// Native method removed; notification config now flows through startTracking options.
|
|
113
|
+
console.warn(
|
|
114
|
+
"[Asleep] setCustomNotification is deprecated and a no-op; pass `{ android: { notification: { title, text, icon } } }` to startTracking() instead",
|
|
115
|
+
);
|
|
117
116
|
};
|
|
118
117
|
|
|
119
118
|
private convertKeysToCamelCase = (obj: any): any => {
|
|
@@ -152,7 +151,9 @@ export const useAsleep = () => {
|
|
|
152
151
|
const {
|
|
153
152
|
didClose,
|
|
154
153
|
isTracking,
|
|
154
|
+
isRecoveryRequired,
|
|
155
155
|
error,
|
|
156
|
+
errorInfo,
|
|
156
157
|
userId,
|
|
157
158
|
sessionId,
|
|
158
159
|
log,
|
|
@@ -163,6 +164,7 @@ export const useAsleep = () => {
|
|
|
163
164
|
requestBatteryOptimizationExemption,
|
|
164
165
|
startTracking,
|
|
165
166
|
stopTracking,
|
|
167
|
+
resumeTracking,
|
|
166
168
|
getReport,
|
|
167
169
|
getReportList,
|
|
168
170
|
getAverageReport,
|
|
@@ -193,7 +195,9 @@ export const useAsleep = () => {
|
|
|
193
195
|
return {
|
|
194
196
|
didClose,
|
|
195
197
|
isTracking,
|
|
198
|
+
isRecoveryRequired,
|
|
196
199
|
error,
|
|
200
|
+
errorInfo,
|
|
197
201
|
userId,
|
|
198
202
|
sessionId,
|
|
199
203
|
log,
|
|
@@ -206,6 +210,7 @@ export const useAsleep = () => {
|
|
|
206
210
|
requestBatteryOptimizationExemption,
|
|
207
211
|
startTracking,
|
|
208
212
|
stopTracking,
|
|
213
|
+
resumeTracking,
|
|
209
214
|
getReport,
|
|
210
215
|
getReportList,
|
|
211
216
|
getAverageReport,
|
|
@@ -244,6 +249,8 @@ export const AsleepSDK = {
|
|
|
244
249
|
|
|
245
250
|
stopTracking: () => useAsleepStore.getState().stopTracking(),
|
|
246
251
|
|
|
252
|
+
resumeTracking: () => useAsleepStore.getState().resumeTracking(),
|
|
253
|
+
|
|
247
254
|
getReport: (sessionId: string) => useAsleepStore.getState().getReport(sessionId),
|
|
248
255
|
|
|
249
256
|
getReportList: (fromDate: string, toDate: string) => useAsleepStore.getState().getReportList(fromDate, toDate),
|
|
@@ -260,6 +267,8 @@ export const AsleepSDK = {
|
|
|
260
267
|
|
|
261
268
|
isTracking: () => useAsleepStore.getState().isTracking,
|
|
262
269
|
|
|
270
|
+
isRecoveryRequired: () => useAsleepStore.getState().isRecoveryRequired,
|
|
271
|
+
|
|
263
272
|
isAnalyzing: () => useAsleepStore.getState().isAnalyzing,
|
|
264
273
|
|
|
265
274
|
isSetupInProgress: () => useAsleepStore.getState().isSetupInProgress,
|
|
@@ -291,6 +300,8 @@ export default asleep;
|
|
|
291
300
|
export type {
|
|
292
301
|
AsleepConfig,
|
|
293
302
|
AsleepSetupConfig,
|
|
303
|
+
AsleepErrorCategory,
|
|
304
|
+
AsleepErrorInfo,
|
|
294
305
|
AsleepEventType,
|
|
295
306
|
AsleepReport,
|
|
296
307
|
AsleepSession,
|
|
@@ -299,5 +310,6 @@ export type {
|
|
|
299
310
|
AsleepNeverSleptSession,
|
|
300
311
|
AsleepStat,
|
|
301
312
|
AsleepAnalysisResult,
|
|
313
|
+
AsleepAnalysisAck,
|
|
302
314
|
TrackingConfig,
|
|
303
315
|
} from "./Asleep.types";
|