react-native-polar-bridge 0.2.10 → 0.2.11

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.
@@ -64,7 +64,6 @@ class PolarBridgeModule(reactContext: ReactApplicationContext) :
64
64
  }
65
65
 
66
66
  override fun connectToDevice(deviceId: String, promise: Promise) {
67
- val map: WritableMap = Arguments.createMap()
68
67
  var connectedId: String? = null
69
68
  var battery: Int? = null
70
69
  var isResolved = false // Guard to ensure we only resolve once
@@ -94,6 +93,8 @@ class PolarBridgeModule(reactContext: ReactApplicationContext) :
94
93
 
95
94
  private fun runResolve() {
96
95
  if (connectedId != null && battery != null && !isResolved) {
96
+ isResolved = true
97
+ val map : WritableMap = Arguments.createMap() // Create map ONLY when ready
97
98
  map.putString("connectedDeviceId", connectedId)
98
99
  map.putInt("batteryLevel", battery)
99
100
  promise.resolve(map)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-polar-bridge",
3
- "version": "0.2.10",
3
+ "version": "0.2.11",
4
4
  "description": "Polar SDK for React Native",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",