react-native-asleep 1.0.3 → 1.0.5

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/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## [1.0.5](https://github.com/asleep-ai/asleep-sdk-react-native/compare/v1.0.4...v1.0.5) (2025-07-23)
2
+
3
+
4
+ ### fix
5
+
6
+ * Add publishConfig and publishing documentation ([](https://github.com/asleep-ai/asleep-sdk-react-native/commit/08fc2bd449b8112f22d86d3295445feb2958c9a2))
7
+ * feat: Enable Bluetooth audio support for iOS sleep tracking (#27) ([](https://github.com/asleep-ai/asleep-sdk-react-native/commit/42f372b43466f8ba4c89307af5b87a776cb66032)), closes [#27](https://github.com/asleep-ai/asleep-sdk-react-native/issues/27)
8
+ * Remove recursive publish script from package.json ([](https://github.com/asleep-ai/asleep-sdk-react-native/commit/14d464877f63a2df53f4ea819dc90a19ab89f197))
9
+
10
+ ## [1.0.4](https://github.com/asleep-ai/asleep-sdk-react-native/compare/v1.0.3...v1.0.4) (2025-07-10)
11
+
12
+
13
+ ### fix
14
+
15
+ * Fix DeleteReportListener interface implementation ([](https://github.com/asleep-ai/asleep-sdk-react-native/commit/4349a9066db56c9a8a1508aa2874a543d5a58bd6))
16
+
1
17
  ## [1.0.3](https://github.com/asleep-ai/asleep-sdk-react-native/compare/v1.0.2...v1.0.3) (2025-07-08)
2
18
 
3
19
 
@@ -320,8 +320,8 @@ class AsleepModule : Module() {
320
320
  sendEvent("onDebugLog", mapOf("message" to "deleteSession: $sessionId"))
321
321
 
322
322
  _reportManager?.deleteReport(sessionId, object : Reports.DeleteReportListener {
323
- override fun onSuccess() {
324
- sendEvent("onDebugLog", mapOf("message" to "deleteSession completed"))
323
+ override fun onSuccess(sessionId: String?) {
324
+ sendEvent("onDebugLog", mapOf("message" to "deleteSession completed for sessionId: $sessionId"))
325
325
  promise.resolve("Session deleted successfully")
326
326
  }
327
327
 
@@ -0,0 +1,36 @@
1
+ # Publishing Guide
2
+
3
+ This package uses [semantic-release](https://semantic-release.gitbook.io/) for automated version management and package publishing.
4
+
5
+ ## Automated Release Process
6
+
7
+ Releases are triggered automatically via GitHub Actions when changes are pushed to the `main` branch:
8
+
9
+ 1. Push changes to `main` branch
10
+ 2. GitHub Actions runs the Release workflow
11
+ 3. semantic-release analyzes commits and determines version bump
12
+ 4. Automatically publishes to npm if needed
13
+
14
+ ## Manual Release
15
+
16
+ To trigger a release manually:
17
+
18
+ ```bash
19
+ # From GitHub UI
20
+ # Go to Actions → Release → Run workflow
21
+
22
+ # Or using GitHub CLI
23
+ gh workflow run release.yml --ref main
24
+ ```
25
+
26
+ ## Important Notes
27
+
28
+ - **DO NOT** add a custom `publish` script to package.json
29
+ - **DO NOT** run `npm publish` manually
30
+ - All releases must go through semantic-release to maintain version consistency
31
+
32
+ ## Configuration
33
+
34
+ - Release configuration: `.releaserc.js`
35
+ - Publish settings: `package.json` → `publishConfig`
36
+ - Workflow: `.github/workflows/release.yml`
@@ -0,0 +1,45 @@
1
+ import AVFoundation
2
+ import ObjectiveC
3
+
4
+ // MARK: - Temporary Audio Session Swizzling for Bluetooth Support
5
+ //
6
+ // PURPOSE: Enable recording from phone microphone while playing audio through AirPods/Bluetooth
7
+ // This allows users to track sleep sounds while listening to white noise through Bluetooth devices.
8
+ //
9
+ // IMPACT:
10
+ // - Adds Bluetooth A2DP as an available audio route option (doesn't force its use)
11
+ // - Will be removed when AsleepSDK natively supports this configuration
12
+ //
13
+ // TODO: Remove this entire file when AsleepSDK iOS implements proper audio configuration
14
+
15
+ extension AVAudioSession {
16
+ private static let swizzleOnce: () = {
17
+ let originalSelector = #selector(AVAudioSession.setCategory(_:mode:options:))
18
+ let swizzledSelector = #selector(AVAudioSession.swizzled_setCategory(_:mode:options:))
19
+
20
+ guard let originalMethod = class_getInstanceMethod(AVAudioSession.self, originalSelector),
21
+ let swizzledMethod = class_getInstanceMethod(AVAudioSession.self, swizzledSelector) else {
22
+ // Using assertionFailure will crash in debug builds if swizzling fails,
23
+ // making the issue immediately obvious, while being a no-op in release builds.
24
+ assertionFailure("Failed to swizzle AVAudioSession.setCategory. Bluetooth audio may not work as expected.")
25
+ return
26
+ }
27
+
28
+ method_exchangeImplementations(originalMethod, swizzledMethod)
29
+ }()
30
+
31
+ static func swizzleSetCategory() {
32
+ // This triggers the lazy initialization of swizzleOnce, ensuring the
33
+ // swizzling code is executed exactly once in a thread-safe manner.
34
+ _ = swizzleOnce
35
+ }
36
+
37
+ @objc private func swizzled_setCategory(_ category: AVAudioSession.Category, mode: AVAudioSession.Mode, options: AVAudioSession.CategoryOptions) throws {
38
+ // Always add allowBluetoothA2DP to the options
39
+ var modifiedOptions = options
40
+ modifiedOptions.insert(.allowBluetoothA2DP)
41
+
42
+ // Call the original implementation with modified options
43
+ try swizzled_setCategory(category, mode: mode, options: modifiedOptions)
44
+ }
45
+ }
@@ -8,6 +8,10 @@ public class AsleepModule: Module {
8
8
 
9
9
  public func definition() -> ModuleDefinition {
10
10
  Name("Asleep")
11
+
12
+ OnCreate {
13
+ AVAudioSession.swizzleSetCategory()
14
+ }
11
15
 
12
16
  Events("onTrackingCreated")
13
17
  Events("onTrackingUploaded")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-asleep",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Asleep SDK for React Native",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -9,7 +9,6 @@
9
9
  "clean": "expo-module clean",
10
10
  "lint": "expo-module lint",
11
11
  "test": "expo-module test",
12
- "publish": "npm publish",
13
12
  "prepare": "expo-module prepare",
14
13
  "prepublishOnly": "expo-module prepublishOnly",
15
14
  "expo-module": "expo-module",
@@ -29,6 +28,10 @@
29
28
  "author": "Qube <qube@asleep.ai> (https://github.com/Sun-Woo-Kim)",
30
29
  "license": "SEE LICENSE IN <filename>",
31
30
  "homepage": "https://github.com/asleep-ai/asleep-sdk-react-native#readme",
31
+ "publishConfig": {
32
+ "access": "public",
33
+ "registry": "https://registry.npmjs.org/"
34
+ },
32
35
  "devDependencies": {
33
36
  "@semantic-release/changelog": "^6.0.3",
34
37
  "@semantic-release/commit-analyzer": "^13.0.1",