react-native-asleep 1.0.18 → 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 +5 -2
- package/build/AsleepStore.d.ts.map +1 -1
- package/build/AsleepStore.js +201 -51
- 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 +1 -1
- package/src/Asleep.types.ts +51 -1
- package/src/AsleepStore.ts +214 -52
- package/src/index.ts +19 -7
package/README.md
CHANGED
|
@@ -8,16 +8,7 @@ This SDK is under active development. The API may evolve between minor versions
|
|
|
8
8
|
|
|
9
9
|
## Overview
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
### Key Features
|
|
14
|
-
|
|
15
|
-
- **Non-invasive Sleep Tracking**: Uses device microphone for sleep analysis
|
|
16
|
-
- **Real-time Monitoring**: Live tracking status and progress updates
|
|
17
|
-
- **Detailed Sleep Reports**: Comprehensive sleep analysis and metrics
|
|
18
|
-
- **Zustand State Management**: Singleton pattern for consistent state across your app
|
|
19
|
-
- **Cross-platform Support**: Works on both iOS and Android
|
|
20
|
-
- **Event-driven Architecture**: Real-time callbacks for tracking events
|
|
11
|
+
Non-invasive sleep tracking via the device microphone — no wearables required. Detects sleep stages and produces detailed reports. Works on iOS and Android, exposes a single React hook plus typed data models.
|
|
21
12
|
|
|
22
13
|
## Installation
|
|
23
14
|
|
|
@@ -45,9 +36,9 @@ This library uses the Expo Modules API. Bare RN projects need Expo modules insta
|
|
|
45
36
|
npm install react-native-asleep zustand
|
|
46
37
|
```
|
|
47
38
|
|
|
48
|
-
|
|
39
|
+
`zustand` is a peer dependency through v1.x and will be removed in v2.0.
|
|
49
40
|
|
|
50
|
-
|
|
41
|
+
3. **iOS**: in `ios/`, run `bundle install` (once) then `bundle exec pod install`. The project's `Gemfile` avoids host Ruby/CocoaPods conflicts. **Android**: no extra step.
|
|
51
42
|
|
|
52
43
|
#### Static framework note
|
|
53
44
|
|
|
@@ -142,355 +133,129 @@ The library declares its own permissions; the manifest merger combines them into
|
|
|
142
133
|
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
|
|
143
134
|
```
|
|
144
135
|
|
|
145
|
-
`RECORD_AUDIO` and `POST_NOTIFICATIONS` are runtime permissions —
|
|
146
|
-
|
|
147
|
-
## Usage
|
|
136
|
+
`RECORD_AUDIO` and `POST_NOTIFICATIONS` are runtime permissions — request them via `useAsleep().requestRequiredPermissions()` (or `PermissionsAndroid`) before starting tracking.
|
|
148
137
|
|
|
149
|
-
|
|
138
|
+
## Quick Start
|
|
150
139
|
|
|
151
|
-
```
|
|
152
|
-
import
|
|
140
|
+
```tsx
|
|
141
|
+
import { useEffect } from "react";
|
|
142
|
+
import { Button, View } from "react-native";
|
|
153
143
|
import { useAsleep } from "react-native-asleep";
|
|
154
|
-
import { View, Text, Button } from "react-native";
|
|
155
144
|
|
|
156
|
-
|
|
145
|
+
function SleepTracker() {
|
|
157
146
|
const {
|
|
158
|
-
userId,
|
|
159
|
-
sessionId,
|
|
160
147
|
isTracking,
|
|
148
|
+
sessionId,
|
|
161
149
|
error,
|
|
162
150
|
initAsleepConfig,
|
|
151
|
+
checkAndRestoreTracking,
|
|
152
|
+
checkBatteryOptimization,
|
|
153
|
+
requestRequiredPermissions,
|
|
163
154
|
startTracking,
|
|
164
155
|
stopTracking,
|
|
165
|
-
getReport,
|
|
166
|
-
enableLog,
|
|
167
156
|
} = useAsleep();
|
|
168
157
|
|
|
158
|
+
// Required order before startTracking: configure -> restore any in-progress session -> battery check
|
|
169
159
|
useEffect(() => {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
// Initialize SDK with your API key
|
|
176
|
-
await initAsleepConfig({
|
|
177
|
-
apiKey: "YOUR_API_KEY",
|
|
178
|
-
userId: "optional-user-id", // Optional: SDK generates one if not provided
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
console.log("SDK initialized successfully");
|
|
182
|
-
} catch (error) {
|
|
183
|
-
console.error("Failed to initialize SDK:", error);
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
initSDK();
|
|
160
|
+
(async () => {
|
|
161
|
+
await initAsleepConfig({ apiKey: "YOUR_API_KEY" });
|
|
162
|
+
await checkAndRestoreTracking();
|
|
163
|
+
await checkBatteryOptimization();
|
|
164
|
+
})();
|
|
188
165
|
}, []);
|
|
189
166
|
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
console.error("Failed to start tracking:", error);
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
const handleStopTracking = async () => {
|
|
200
|
-
try {
|
|
201
|
-
await stopTracking();
|
|
202
|
-
console.log("Sleep tracking stopped");
|
|
203
|
-
} catch (error) {
|
|
204
|
-
console.error("Failed to stop tracking:", error);
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
const handleGetReport = async () => {
|
|
209
|
-
if (!sessionId) return;
|
|
210
|
-
|
|
211
|
-
try {
|
|
212
|
-
const report = await getReport(sessionId);
|
|
213
|
-
console.log("Sleep report:", report);
|
|
214
|
-
} catch (error) {
|
|
215
|
-
console.error("Failed to get report:", error);
|
|
216
|
-
}
|
|
167
|
+
const handleStart = async () => {
|
|
168
|
+
await requestRequiredPermissions();
|
|
169
|
+
await startTracking({
|
|
170
|
+
android: { notification: { title: "Sleep tracking", text: "Recording..." } },
|
|
171
|
+
});
|
|
217
172
|
};
|
|
218
173
|
|
|
219
174
|
return (
|
|
220
175
|
<View>
|
|
221
|
-
<
|
|
222
|
-
<Text>Session ID: {sessionId}</Text>
|
|
223
|
-
<Text>Status: {isTracking ? "Tracking" : "Not Tracking"}</Text>
|
|
224
|
-
|
|
225
|
-
<Button
|
|
226
|
-
title="Start Tracking"
|
|
227
|
-
onPress={handleStartTracking}
|
|
228
|
-
disabled={isTracking}
|
|
229
|
-
/>
|
|
230
|
-
<Button
|
|
231
|
-
title="Stop Tracking"
|
|
232
|
-
onPress={handleStopTracking}
|
|
233
|
-
disabled={!isTracking}
|
|
234
|
-
/>
|
|
235
|
-
<Button
|
|
236
|
-
title="Get Report"
|
|
237
|
-
onPress={handleGetReport}
|
|
238
|
-
disabled={!sessionId}
|
|
239
|
-
/>
|
|
176
|
+
<Button title={isTracking ? "Stop" : "Start"} onPress={isTracking ? stopTracking : handleStart} />
|
|
240
177
|
</View>
|
|
241
178
|
);
|
|
242
|
-
};
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
### Advanced Usage
|
|
246
|
-
|
|
247
|
-
#### Using AsleepSDK for Non-React Components
|
|
248
|
-
|
|
249
|
-
For use outside React components or for singleton access:
|
|
250
|
-
|
|
251
|
-
```typescript
|
|
252
|
-
import { AsleepSDK } from "react-native-asleep";
|
|
253
|
-
|
|
254
|
-
class SleepManager {
|
|
255
|
-
async initializeSDK() {
|
|
256
|
-
try {
|
|
257
|
-
await AsleepSDK.initAsleepConfig({
|
|
258
|
-
apiKey: "YOUR_API_KEY",
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
// Initialize event listeners
|
|
262
|
-
AsleepSDK.initialize();
|
|
263
|
-
|
|
264
|
-
console.log("SDK initialized");
|
|
265
|
-
} catch (error) {
|
|
266
|
-
console.error("SDK initialization failed:", error);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
async startSleepTracking() {
|
|
271
|
-
await AsleepSDK.startTracking();
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
async stopSleepTracking() {
|
|
275
|
-
return await AsleepSDK.stopTracking();
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
getCurrentStatus() {
|
|
279
|
-
return {
|
|
280
|
-
isTracking: AsleepSDK.isTracking(),
|
|
281
|
-
userId: AsleepSDK.getUserId(),
|
|
282
|
-
sessionId: AsleepSDK.getSessionId(),
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
179
|
}
|
|
286
180
|
```
|
|
287
181
|
|
|
288
|
-
|
|
182
|
+
For ODA (On-Device Analysis) mode, call `setup()` instead of `initAsleepConfig()`. See [`example/App.tsx`](./example/App.tsx) for the full flow including report fetch and event-driven state.
|
|
289
183
|
|
|
290
|
-
|
|
291
|
-
import { useAsleepStore } from "react-native-asleep";
|
|
184
|
+
## API surface
|
|
292
185
|
|
|
293
|
-
|
|
294
|
-
const currentState = useAsleepStore.getState();
|
|
186
|
+
The library exports a single React hook plus types:
|
|
295
187
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
(state) => state.isTracking,
|
|
299
|
-
(isTracking) => {
|
|
300
|
-
console.log("Tracking status changed:", isTracking);
|
|
301
|
-
}
|
|
302
|
-
);
|
|
188
|
+
```ts
|
|
189
|
+
import { useAsleep, type AsleepReport, type AsleepSession, type AsleepAverageReport } from "react-native-asleep";
|
|
303
190
|
```
|
|
304
191
|
|
|
305
|
-
|
|
192
|
+
`useAsleep()` returns reactive state (`isTracking`, `sessionId`, `error`, `analysisResult`, ...) and bound actions (`startTracking`, `stopTracking`, `getReport`, `getReportList`, `requestAnalysis`, ...). Hover the return type in your editor for the full surface; the type definitions in [`src/Asleep.types.ts`](./src/Asleep.types.ts) are the source of truth and stay in sync with the native modules.
|
|
306
193
|
|
|
307
|
-
|
|
194
|
+
On iOS, `isRecoveryRequired` becomes `true` when recording cannot resume while the app is in the background. After the app returns to the foreground, call `resumeTracking()`. The flag clears only after the next successful audio upload. `resumeTracking()` is iOS-only and rejects with `UNSUPPORTED_PLATFORM` on Android.
|
|
308
195
|
|
|
309
|
-
|
|
196
|
+
## Tracking lifecycle and platform compensations
|
|
310
197
|
|
|
311
|
-
|
|
198
|
+
The library handles a number of platform quirks internally so JS sees a consistent event model:
|
|
312
199
|
|
|
313
|
-
- `
|
|
314
|
-
- `
|
|
315
|
-
-
|
|
316
|
-
-
|
|
317
|
-
- `didClose: boolean` - Whether the last session was closed
|
|
318
|
-
- `log: string` - Latest log message
|
|
200
|
+
- iOS 3.2.1 `closeSessionSilently()` on 403/429 tears down a session without firing `didClose` — the wrapper detects terminal error codes and resets `isTracking` / `isAnalyzing` itself.
|
|
201
|
+
- Android SDK 3.2.x emits both `onFail` and `onFinish` for fatal codes — the wrapper suppresses the spurious `onTrackingClosed` so JS doesn't misread a fatal error as a clean close.
|
|
202
|
+
- iOS interruption recovery may emit duplicate `didResume` events — the wrapper deduplicates while still clearing `error`.
|
|
203
|
+
- iOS audio initialization failure stops recording without closing the native session — stop and restart the session; `resumeTracking()` cannot recover it.
|
|
319
204
|
|
|
320
|
-
|
|
205
|
+
See [AGENTS.md](./AGENTS.md#native-behavior-compensations) for the full table including upstream SDK versions and rationale.
|
|
321
206
|
|
|
322
|
-
|
|
323
|
-
- `startTracking(): Promise<void>` - Start sleep tracking
|
|
324
|
-
- `stopTracking(): Promise<void>` - Stop sleep tracking
|
|
325
|
-
- `getReport(sessionId: string): Promise<AsleepReport | null>` - Get sleep report
|
|
326
|
-
- `getReportList(fromDate: string, toDate: string): Promise<AsleepSession[]>` - Get list of reports
|
|
327
|
-
- `enableLog(enabled: boolean): void` - Enable/disable debug logging
|
|
328
|
-
- `setCustomNotification(title: string, text: string): Promise<void>` - Set custom notification (Android only)
|
|
207
|
+
## Error classification
|
|
329
208
|
|
|
330
|
-
|
|
209
|
+
`useAsleep().errorInfo` is a structured view of the last tracking failure. Its `category` field is the library's objective verdict on recoverability; the app decides what severity to log at:
|
|
331
210
|
|
|
332
|
-
|
|
211
|
+
| `category` | Meaning | Suggested app-side severity |
|
|
212
|
+
|---|---|---|
|
|
213
|
+
| `terminal` | Native session is gone; no `onTrackingClosed` will follow. Start a new session. | error |
|
|
214
|
+
| `recordingDead` | Recorder torn down but the session is still open; `stopTracking()` then start again. | error |
|
|
215
|
+
| `recoveryRequired` | Tracking is alive; call `resumeTracking()` in the foreground (`isRecoveryRequired` is also set). | warning |
|
|
216
|
+
| `transient` | The native session survived (e.g. one upload window failed after internal retries); later uploads continue. | warning |
|
|
217
|
+
| `unknown` | Unclassified code — do not assume it is benign. | error |
|
|
333
218
|
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
apiKey: string; // Required: Your API key
|
|
337
|
-
userId?: string; // Optional: User identifier
|
|
338
|
-
baseUrl?: string; // Optional: Custom API base URL
|
|
339
|
-
callbackUrl?: string; // Optional: Webhook callback URL
|
|
340
|
-
}
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
### AsleepReport
|
|
344
|
-
|
|
345
|
-
Sleep analysis report structure:
|
|
346
|
-
|
|
347
|
-
```typescript
|
|
348
|
-
interface AsleepReport {
|
|
349
|
-
sessionId: string;
|
|
350
|
-
sleepEfficiency: number;
|
|
351
|
-
sleepLatency: number;
|
|
352
|
-
sleepTime: number;
|
|
353
|
-
wakeTime: number;
|
|
354
|
-
lightSleepTime: number;
|
|
355
|
-
deepSleepTime: number;
|
|
356
|
-
remSleepTime: number;
|
|
357
|
-
// ... additional metrics
|
|
358
|
-
}
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
### AsleepSession
|
|
362
|
-
|
|
363
|
-
Session information structure:
|
|
364
|
-
|
|
365
|
-
```typescript
|
|
366
|
-
interface AsleepSession {
|
|
367
|
-
sessionId: string;
|
|
368
|
-
startTime: string;
|
|
369
|
-
endTime: string;
|
|
370
|
-
state: string;
|
|
371
|
-
// ... additional session data
|
|
372
|
-
}
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
## Event Handling
|
|
376
|
-
|
|
377
|
-
The SDK automatically handles events through the zustand store. Events are processed internally and state is updated accordingly. You can monitor state changes using useEffect:
|
|
378
|
-
|
|
379
|
-
```typescript
|
|
380
|
-
const { userId, sessionId, isTracking, error } = useAsleep();
|
|
219
|
+
```ts
|
|
220
|
+
const { errorInfo } = useAsleep();
|
|
381
221
|
|
|
382
222
|
useEffect(() => {
|
|
383
|
-
if (
|
|
384
|
-
|
|
223
|
+
if (!errorInfo) return;
|
|
224
|
+
if (errorInfo.category === "recoveryRequired" || errorInfo.category === "transient") {
|
|
225
|
+
analytics.track("asleep_recoverable_error", errorInfo); // visibility without paging
|
|
226
|
+
} else {
|
|
227
|
+
Sentry.captureException(new Error(`[Asleep] ${errorInfo.code}`), { extra: errorInfo });
|
|
385
228
|
}
|
|
386
|
-
}, [
|
|
387
|
-
|
|
388
|
-
useEffect(() => {
|
|
389
|
-
if (sessionId) {
|
|
390
|
-
console.log("New session created:", sessionId);
|
|
391
|
-
}
|
|
392
|
-
}, [sessionId]);
|
|
229
|
+
}, [errorInfo]);
|
|
393
230
|
```
|
|
394
231
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
### 1. SDK Initialization
|
|
398
|
-
|
|
399
|
-
- Initialize the SDK early in your app lifecycle
|
|
400
|
-
- Handle initialization errors gracefully
|
|
401
|
-
- Store API key securely (use environment variables)
|
|
402
|
-
|
|
403
|
-
### 2. Permission Handling
|
|
404
|
-
|
|
405
|
-
- Request microphone permission before starting tracking
|
|
406
|
-
- Provide clear explanation to users about why permission is needed
|
|
407
|
-
- Handle permission denial gracefully
|
|
408
|
-
|
|
409
|
-
### 3. Battery Optimization (Required)
|
|
410
|
-
|
|
411
|
-
#### Cross-Platform Requirement
|
|
412
|
-
|
|
413
|
-
**IMPORTANT**: Battery optimization check is required on both iOS and Android platforms. This ensures iOS developers properly handle battery optimization, preventing issues for their Android users in production.
|
|
232
|
+
`errorInfo.sdkCode` carries the numeric error code documented by the native Asleep SDKs (both platforms). The legacy `errorCode` event-payload field is deprecated: on iOS it holds a Swift enum ordinal from NSError bridging, not the documented code.
|
|
414
233
|
|
|
415
|
-
|
|
234
|
+
## Best practices
|
|
416
235
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
// Required before starting tracking on BOTH platforms
|
|
421
|
-
const batteryStatus = await AsleepSDK.checkBatteryOptimization();
|
|
422
|
-
|
|
423
|
-
if (!batteryStatus.exempted && Platform.OS === 'android') {
|
|
424
|
-
// Prompt user to disable battery optimization
|
|
425
|
-
Alert.alert(
|
|
426
|
-
'Battery Optimization Required',
|
|
427
|
-
'Sleep tracking requires battery optimization to be disabled for uninterrupted 6-8 hour sessions.',
|
|
428
|
-
[
|
|
429
|
-
{ text: 'Cancel', style: 'cancel' },
|
|
430
|
-
{
|
|
431
|
-
text: 'Open Settings',
|
|
432
|
-
onPress: async () => {
|
|
433
|
-
await AsleepSDK.requestBatteryOptimizationExemption();
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
]
|
|
437
|
-
);
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
// Now safe to start tracking
|
|
441
|
-
await AsleepSDK.startTracking();
|
|
442
|
-
```
|
|
443
|
-
|
|
444
|
-
#### Why This Matters
|
|
445
|
-
|
|
446
|
-
- **Android**: Battery optimization can interrupt long-running sleep tracking sessions
|
|
447
|
-
- **iOS**: While not technically needed, the check ensures consistent cross-platform code
|
|
448
|
-
- **Developer Experience**: iOS developers testing only on iOS might miss Android requirements
|
|
449
|
-
- **User Experience**: Prevents tracking failures for Android users of iOS-developed apps
|
|
450
|
-
|
|
451
|
-
### 4. Error Handling
|
|
452
|
-
|
|
453
|
-
- Always wrap SDK calls in try-catch blocks
|
|
454
|
-
- Monitor the error state for real-time error updates
|
|
455
|
-
- Provide user-friendly error messages
|
|
456
|
-
|
|
457
|
-
### 5. State Management
|
|
458
|
-
|
|
459
|
-
- Use the built-in zustand store for consistent state
|
|
460
|
-
- Subscribe to specific state changes when needed
|
|
461
|
-
- Avoid unnecessary re-renders by selecting specific state slices
|
|
462
|
-
|
|
463
|
-
## Example App
|
|
464
|
-
|
|
465
|
-
See the `/example` directory for a complete implementation example.
|
|
236
|
+
- **Permission flow**: call `requestRequiredPermissions()` *before* `startTracking()`. As of v1.0.18 the Android native module rejects `startTracking` with `PERMISSION_REQUIRED` when `RECORD_AUDIO` / `FOREGROUND_SERVICE_MICROPHONE` aren't granted.
|
|
237
|
+
- **Battery optimization (Android, required)**: long sessions get killed without an exemption. Call `checkBatteryOptimization()` before `startTracking()`; if not exempted, call `requestBatteryOptimizationExemption()` and follow the system prompt. iOS's no-op call keeps cross-platform code uniform.
|
|
238
|
+
- **Error handling**: gate log severity on `useAsleep().errorInfo?.category` (see [Error classification](#error-classification)) and switch on `errorInfo.code` for category-specific UI rather than parsing `message` substrings.
|
|
466
239
|
|
|
467
240
|
## Troubleshooting
|
|
468
241
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
3. **Network Errors**: Check internet connection and API key validity
|
|
474
|
-
4. **Battery Optimization Error**: Call `checkBatteryOptimization()` before `startTracking()` on all platforms
|
|
475
|
-
5. **Android Tracking Interrupted**: Ensure battery optimization is disabled via system settings
|
|
242
|
+
- **`PERMISSION_REQUIRED` from `startTracking`**: call `requestRequiredPermissions()` first, then retry.
|
|
243
|
+
- **`MISSING_PREREQUISITE` from `startTracking`**: call `checkAndRestoreTracking()` and `checkBatteryOptimization()` before `startTracking()`.
|
|
244
|
+
- **Tracking ends unexpectedly on Android**: battery optimization is on; call `checkBatteryOptimization()` and follow the prompt.
|
|
245
|
+
- **Network errors**: verify API key and connectivity.
|
|
476
246
|
|
|
477
|
-
|
|
247
|
+
Enable debug logs with `useAsleep().enableLog(true)`.
|
|
478
248
|
|
|
479
|
-
|
|
249
|
+
## Example app
|
|
480
250
|
|
|
481
|
-
|
|
482
|
-
const { enableLog } = useAsleep();
|
|
483
|
-
enableLog(true);
|
|
484
|
-
```
|
|
251
|
+
See [`example/`](./example) for a full implementation.
|
|
485
252
|
|
|
486
253
|
## License
|
|
487
254
|
|
|
488
|
-
|
|
255
|
+
MIT.
|
|
489
256
|
|
|
490
257
|
## Support
|
|
491
258
|
|
|
492
|
-
For issues and support:
|
|
493
|
-
|
|
494
259
|
- [GitHub Issues](https://github.com/asleep-ai/asleep-sdk-react-native/issues)
|
|
495
260
|
- [Asleep Documentation](https://docs.asleep.ai)
|
|
496
261
|
- [Asleep Dashboard](https://dashboard.asleep.ai)
|
|
@@ -67,6 +67,18 @@ class AsleepModule : Module() {
|
|
|
67
67
|
|
|
68
68
|
companion object {
|
|
69
69
|
public const val MICROPHONE_PERMISSION_REQUEST_CODE = 1001
|
|
70
|
+
|
|
71
|
+
// Error codes for which Android SDK 3.2.x AsleepCore.onErrorCodeReceived tears
|
|
72
|
+
// the session down and fires BOTH onFail and onFinish (dual dispatch). Only
|
|
73
|
+
// these may suppress the follow-up onFinish; for any other code the native
|
|
74
|
+
// session is still alive and a later onFinish is a genuine close.
|
|
75
|
+
// Must stay in sync with TERMINAL_TRACKING_SDK_CODES in src/AsleepStore.ts.
|
|
76
|
+
private val TERMINAL_TRACKING_ERROR_CODES = setOf(
|
|
77
|
+
11003, // ERR_AUDIO
|
|
78
|
+
22000, 22401, 22409, 22422, 22500, // ERR_CREATE_*
|
|
79
|
+
23499, // ERR_UPLOAD_TRACKING_TERMINATED
|
|
80
|
+
24000, 24400, 24401, 24403, 24404, 24500, // ERR_CLOSE_*
|
|
81
|
+
)
|
|
70
82
|
}
|
|
71
83
|
|
|
72
84
|
// Factory for the AsleepTrackingListener used by both connectSleepTracking
|
|
@@ -82,15 +94,22 @@ class AsleepModule : Module() {
|
|
|
82
94
|
private var failedTerminally = false
|
|
83
95
|
|
|
84
96
|
override fun onFail(errorCode: Int, detail: String) {
|
|
85
|
-
|
|
86
|
-
|
|
97
|
+
// Only terminal codes kill the native session (and dual-fire onFinish,
|
|
98
|
+
// which failedTerminally suppresses). For any other code tracking is
|
|
99
|
+
// still running: keep isTracking and let a later onFinish through as a
|
|
100
|
+
// genuine close.
|
|
101
|
+
if (errorCode in TERMINAL_TRACKING_ERROR_CODES) {
|
|
102
|
+
failedTerminally = true
|
|
103
|
+
isTracking = false
|
|
104
|
+
}
|
|
87
105
|
sendEvent("onDebugLog", mapOf("message" to "Sleep tracking failed: $errorCode - $detail"))
|
|
88
106
|
val code = if (errorCode == 23499) "UPLOAD_TRACKING_TERMINATED" else "TRACKING_FAILED"
|
|
89
107
|
sendEvent("onTrackingFailed", mapOf(
|
|
90
108
|
"error" to detail,
|
|
91
109
|
"code" to code,
|
|
92
110
|
"message" to detail,
|
|
93
|
-
"errorCode" to errorCode
|
|
111
|
+
"errorCode" to errorCode,
|
|
112
|
+
"sdkCode" to errorCode
|
|
94
113
|
))
|
|
95
114
|
promise?.reject("TRACKING_FAILED", "Sleep tracking failed: $errorCode - $detail", null)
|
|
96
115
|
}
|
|
@@ -150,7 +169,7 @@ class AsleepModule : Module() {
|
|
|
150
169
|
}
|
|
151
170
|
|
|
152
171
|
override fun onFail(errorCode: Int, detail: String) {
|
|
153
|
-
sendEvent("onSetupDidFail", mapOf("error" to detail))
|
|
172
|
+
sendEvent("onSetupDidFail", mapOf("error" to detail, "sdkCode" to errorCode))
|
|
154
173
|
sendEvent("onDebugLog", mapOf("message" to "Setup failed: $errorCode - $detail"))
|
|
155
174
|
promise.reject("SETUP_FAILED", "Setup failed: $errorCode - $detail", null)
|
|
156
175
|
}
|
|
@@ -215,7 +234,7 @@ class AsleepModule : Module() {
|
|
|
215
234
|
|
|
216
235
|
override fun onFail(errorCode: Int, detail: String) {
|
|
217
236
|
sendEvent("onDebugLog", mapOf("message" to "Initialization failed: $errorCode - $detail"))
|
|
218
|
-
sendEvent("onUserJoinFailed", mapOf("errorCode" to errorCode, "detail" to detail))
|
|
237
|
+
sendEvent("onUserJoinFailed", mapOf("errorCode" to errorCode, "detail" to detail, "sdkCode" to errorCode))
|
|
219
238
|
promise.reject("INITIALIZATION_FAILED", "Initialization failed: $errorCode - $detail", null)
|
|
220
239
|
}
|
|
221
240
|
}
|
|
@@ -264,24 +283,24 @@ class AsleepModule : Module() {
|
|
|
264
283
|
AsyncFunction("startTracking") { config: Map<String, Any>?, promise: Promise ->
|
|
265
284
|
try {
|
|
266
285
|
val audioPermission = ContextCompat.checkSelfPermission(appContext.reactContext!!, Manifest.permission.RECORD_AUDIO)
|
|
267
|
-
|
|
286
|
+
// FOREGROUND_SERVICE_MICROPHONE was introduced in API 34 (UPSIDE_DOWN_CAKE).
|
|
287
|
+
// Gating on TIRAMISU (API 33) would false-deny on Android 13 where the permission
|
|
288
|
+
// doesn't exist yet.
|
|
289
|
+
val fgsPermission = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
|
268
290
|
ContextCompat.checkSelfPermission(appContext.reactContext!!, Manifest.permission.FOREGROUND_SERVICE_MICROPHONE)
|
|
269
291
|
} else {
|
|
270
|
-
sendEvent("onDebugLog", mapOf("message" to "Requesting permissions"))
|
|
271
292
|
PackageManager.PERMISSION_GRANTED
|
|
272
293
|
}
|
|
273
294
|
if (audioPermission != PackageManager.PERMISSION_GRANTED || fgsPermission != PackageManager.PERMISSION_GRANTED) {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
arrayOf(Manifest.permission.RECORD_AUDIO)
|
|
282
|
-
},
|
|
283
|
-
MICROPHONE_PERMISSION_REQUEST_CODE
|
|
295
|
+
// beginSleepTracking would crash with SecurityException at
|
|
296
|
+
// startForeground(type=microphone) on API 34+. Reject so JS requests via
|
|
297
|
+
// requestRequiredPermissions() and retries.
|
|
298
|
+
promise.reject(
|
|
299
|
+
"PERMISSION_REQUIRED",
|
|
300
|
+
"Microphone permission must be granted before startTracking; request it via requestRequiredPermissions() first",
|
|
301
|
+
null
|
|
284
302
|
)
|
|
303
|
+
return@AsyncFunction
|
|
285
304
|
}
|
|
286
305
|
|
|
287
306
|
|
package/build/Asleep.types.d.ts
CHANGED
|
@@ -147,6 +147,10 @@ export type AsleepAnalysisResult = {
|
|
|
147
147
|
breathStages?: number[];
|
|
148
148
|
snoringStages?: number[];
|
|
149
149
|
};
|
|
150
|
+
export type AsleepAnalysisAck = {
|
|
151
|
+
status: "requested";
|
|
152
|
+
timestamp: number;
|
|
153
|
+
};
|
|
150
154
|
export type AudioSessionOption = "duckOthers" | "allowAirPlay" | "allowBluetooth" | "allowBluetoothA2DP";
|
|
151
155
|
export type TrackingConfig = {
|
|
152
156
|
android?: {
|
|
@@ -161,6 +165,34 @@ export type TrackingConfig = {
|
|
|
161
165
|
audioSessionOptions?: AudioSessionOption[];
|
|
162
166
|
};
|
|
163
167
|
};
|
|
168
|
+
/**
|
|
169
|
+
* Coarse classification of a tracking-runtime failure (onTrackingFailed),
|
|
170
|
+
* derived from the native error code. The library reports the objective fact;
|
|
171
|
+
* the app decides log severity. Recommended mapping:
|
|
172
|
+
* - "terminal" / "recordingDead" → error (session or recorder is gone)
|
|
173
|
+
* - "recoveryRequired" / "transient" → warning (tracking is still alive and a
|
|
174
|
+
* defined recovery path exists)
|
|
175
|
+
* - "unknown" → error (unclassified; do not assume it is benign)
|
|
176
|
+
*/
|
|
177
|
+
export type AsleepErrorCategory = "terminal" | "recordingDead" | "recoveryRequired" | "transient" | "unknown";
|
|
178
|
+
/**
|
|
179
|
+
* Structured view of the last onTrackingFailed event, exposed as
|
|
180
|
+
* useAsleep().errorInfo alongside the legacy `error` JSON string. Cleared to
|
|
181
|
+
* null wherever `error` is cleared.
|
|
182
|
+
*/
|
|
183
|
+
export type AsleepErrorInfo = {
|
|
184
|
+
/** Stable string code from the native module (e.g. "UPLOAD_TRACKING_TERMINATED"). */
|
|
185
|
+
code: string;
|
|
186
|
+
category: AsleepErrorCategory;
|
|
187
|
+
/**
|
|
188
|
+
* Numeric code documented by the native Asleep SDKs (range 10000-34999):
|
|
189
|
+
* iOS `AsleepError.errorCode.code` (v3.2.0+), Android listener `errorCode`.
|
|
190
|
+
*/
|
|
191
|
+
sdkCode?: number;
|
|
192
|
+
message?: string;
|
|
193
|
+
/** iOS: Swift enum case description for cases without an explicit code mapping. */
|
|
194
|
+
caseName?: string;
|
|
195
|
+
};
|
|
164
196
|
export type AsleepEventType = {
|
|
165
197
|
onTrackingCreated: {
|
|
166
198
|
sessionId?: string;
|
|
@@ -175,7 +207,13 @@ export type AsleepEventType = {
|
|
|
175
207
|
error: string;
|
|
176
208
|
code: string;
|
|
177
209
|
message?: string;
|
|
210
|
+
/**
|
|
211
|
+
* @deprecated On iOS this is the Swift enum declaration ordinal from
|
|
212
|
+
* NSError bridging, not the documented Asleep error code. Use `sdkCode`.
|
|
213
|
+
*/
|
|
178
214
|
errorCode?: number;
|
|
215
|
+
/** Numeric code documented by the native Asleep SDKs (both platforms). */
|
|
216
|
+
sdkCode?: number;
|
|
179
217
|
caseName?: string;
|
|
180
218
|
};
|
|
181
219
|
onTrackingInterrupted: undefined;
|
|
@@ -190,6 +228,8 @@ export type AsleepEventType = {
|
|
|
190
228
|
detail?: string;
|
|
191
229
|
caseName?: string;
|
|
192
230
|
code?: number;
|
|
231
|
+
/** Numeric code documented by the native Asleep SDKs (both platforms). */
|
|
232
|
+
sdkCode?: number;
|
|
193
233
|
};
|
|
194
234
|
onUserDeleted: {
|
|
195
235
|
userId: string;
|
|
@@ -200,6 +240,8 @@ export type AsleepEventType = {
|
|
|
200
240
|
onSetupDidComplete: undefined;
|
|
201
241
|
onSetupDidFail: {
|
|
202
242
|
error: string;
|
|
243
|
+
/** Numeric code documented by the native Asleep SDKs (both platforms). */
|
|
244
|
+
sdkCode?: number;
|
|
203
245
|
};
|
|
204
246
|
onSetupInProgress: {
|
|
205
247
|
progress: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Asleep.types.d.ts","sourceRoot":"","sources":["../src/Asleep.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MA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