expo-beacon 0.5.1 → 0.5.3

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.
@@ -98,10 +98,12 @@ public class ExpoBeaconModule: Module {
98
98
  }()
99
99
 
100
100
  public func definition() -> ModuleDefinition {
101
- migrateUserDefaultsIfNeeded()
102
-
103
101
  Name("ExpoBeacon")
104
102
 
103
+ OnCreate {
104
+ self.migrateUserDefaultsIfNeeded()
105
+ }
106
+
105
107
  Events("onBeaconEnter", "onBeaconExit", "onBeaconDistance", "onBeaconFound", "onEddystoneFound", "onEddystoneEnter", "onEddystoneExit", "onEddystoneDistance")
106
108
 
107
109
  // MARK: - Scan
@@ -240,11 +242,10 @@ public class ExpoBeaconModule: Module {
240
242
  // MARK: - Eddystone Pair
241
243
 
242
244
  Function("pairEddystone") { (identifier: String, namespace: String, instance: String) -> Void in
243
- let hexPattern = /^[0-9a-fA-F]+$/
244
- guard namespace.count == 20, namespace.wholeMatch(of: hexPattern) != nil else {
245
+ guard namespace.count == 20, namespace.range(of: "^[0-9a-fA-F]+$", options: .regularExpression) != nil else {
245
246
  throw Exception(name: "INVALID_NAMESPACE", description: "Namespace must be 20 hex characters, got: \(namespace)")
246
247
  }
247
- guard instance.count == 12, instance.wholeMatch(of: hexPattern) != nil else {
248
+ guard instance.count == 12, instance.range(of: "^[0-9a-fA-F]+$", options: .regularExpression) != nil else {
248
249
  throw Exception(name: "INVALID_INSTANCE", description: "Instance must be 12 hex characters, got: \(instance)")
249
250
  }
250
251
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-beacon",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "Expo module for scanning, pairing, and monitoring iBeacons on Android and iOS",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",