@wayq/beekon-rn 0.0.3 → 0.0.6

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.
Files changed (84) hide show
  1. package/BeekonRn.podspec +5 -3
  2. package/CHANGELOG.md +103 -0
  3. package/README.md +326 -52
  4. package/android/build.gradle +9 -4
  5. package/android/src/main/java/in/wayq/beekonrn/BeekonRnModule.kt +411 -59
  6. package/ios/BeekonRn.mm +103 -24
  7. package/ios/BeekonRn.swift +465 -61
  8. package/ios/Frameworks/BeekonKit.xcframework/Info.plist +5 -5
  9. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/BeekonKit +0 -0
  10. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Info.plist +0 -0
  11. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios.abi.json +11424 -1279
  12. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  13. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios.swiftinterface +262 -36
  14. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/BeekonKit +0 -0
  15. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Info.plist +0 -0
  16. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios-simulator.abi.json +11424 -1279
  17. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  18. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +262 -36
  19. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +11424 -1279
  20. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  21. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +262 -36
  22. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/_CodeSignature/CodeResources +2 -80
  23. package/lib/module/NativeBeekonRn.js +35 -7
  24. package/lib/module/NativeBeekonRn.js.map +1 -1
  25. package/lib/module/beekon.js +246 -45
  26. package/lib/module/beekon.js.map +1 -1
  27. package/lib/module/index.js.map +1 -1
  28. package/lib/module/internal/mappers.js +166 -25
  29. package/lib/module/internal/mappers.js.map +1 -1
  30. package/lib/module/types/auth.js +4 -0
  31. package/lib/module/types/auth.js.map +1 -0
  32. package/lib/module/types/config.js +2 -0
  33. package/lib/module/types/enums.js +2 -0
  34. package/lib/module/types/enums.js.map +1 -0
  35. package/lib/module/types/error.js +20 -4
  36. package/lib/module/types/error.js.map +1 -1
  37. package/lib/module/types/geofence.js +2 -0
  38. package/lib/module/types/geofence.js.map +1 -0
  39. package/lib/module/types/location.js +2 -0
  40. package/lib/module/types/sync.js +2 -0
  41. package/lib/module/types/sync.js.map +1 -0
  42. package/lib/typescript/src/NativeBeekonRn.d.ts +150 -20
  43. package/lib/typescript/src/NativeBeekonRn.d.ts.map +1 -1
  44. package/lib/typescript/src/beekon.d.ts +110 -33
  45. package/lib/typescript/src/beekon.d.ts.map +1 -1
  46. package/lib/typescript/src/index.d.ts +6 -2
  47. package/lib/typescript/src/index.d.ts.map +1 -1
  48. package/lib/typescript/src/internal/mappers.d.ts +16 -6
  49. package/lib/typescript/src/internal/mappers.d.ts.map +1 -1
  50. package/lib/typescript/src/types/auth.d.ts +99 -0
  51. package/lib/typescript/src/types/auth.d.ts.map +1 -0
  52. package/lib/typescript/src/types/config.d.ts +66 -20
  53. package/lib/typescript/src/types/config.d.ts.map +1 -1
  54. package/lib/typescript/src/types/enums.d.ts +62 -0
  55. package/lib/typescript/src/types/enums.d.ts.map +1 -0
  56. package/lib/typescript/src/types/error.d.ts +21 -5
  57. package/lib/typescript/src/types/error.d.ts.map +1 -1
  58. package/lib/typescript/src/types/geofence.d.ts +36 -0
  59. package/lib/typescript/src/types/geofence.d.ts.map +1 -0
  60. package/lib/typescript/src/types/location.d.ts +22 -8
  61. package/lib/typescript/src/types/location.d.ts.map +1 -1
  62. package/lib/typescript/src/types/state.d.ts +13 -4
  63. package/lib/typescript/src/types/state.d.ts.map +1 -1
  64. package/lib/typescript/src/types/sync.d.ts +27 -0
  65. package/lib/typescript/src/types/sync.d.ts.map +1 -0
  66. package/package.json +8 -5
  67. package/scripts/fetch-beekonkit.sh +5 -5
  68. package/src/NativeBeekonRn.ts +165 -20
  69. package/src/beekon.ts +278 -48
  70. package/src/index.tsx +24 -2
  71. package/src/internal/mappers.ts +242 -27
  72. package/src/types/auth.ts +101 -0
  73. package/src/types/config.ts +68 -20
  74. package/src/types/enums.ts +80 -0
  75. package/src/types/error.ts +23 -5
  76. package/src/types/geofence.ts +37 -0
  77. package/src/types/location.ts +28 -8
  78. package/src/types/state.ts +13 -3
  79. package/src/types/sync.ts +23 -0
  80. package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeDirectory +0 -0
  81. package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeRequirements +0 -0
  82. package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeResources +0 -296
  83. package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeSignature +0 -0
  84. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/_CodeSignature/CodeResources +0 -146
package/ios/BeekonRn.mm CHANGED
@@ -1,8 +1,13 @@
1
1
  #import "BeekonRn.h"
2
- // Auto-generated bridging header from the Swift impl. With `use_frameworks!`
3
- // in the host Podfile (required for Swift pods), CocoaPods generates this
4
- // inside the BeekonRn framework, so the framework-style import is needed.
2
+ // Auto-generated Swift interop header for the BeekonRnImpl class. Its path
3
+ // depends on how the host links pods: under `<BeekonRn/…>` with
4
+ // `use_frameworks!` (framework), or as a same-target generated header with
5
+ // static linking (the React Native default). Support both.
6
+ #if __has_include(<BeekonRn/BeekonRn-Swift.h>)
5
7
  #import <BeekonRn/BeekonRn-Swift.h>
8
+ #else
9
+ #import "BeekonRn-Swift.h"
10
+ #endif
6
11
 
7
12
  @implementation BeekonRn {
8
13
  BeekonRnImpl *_impl;
@@ -13,32 +18,46 @@
13
18
  if (self) {
14
19
  __weak __typeof(self) weakSelf = self;
15
20
  _impl = [[BeekonRnImpl alloc]
16
- initOnState:^(NSDictionary *_Nonnull s) {
17
- [weakSelf emitOnState:s];
18
- }
19
- onLocation:^(NSDictionary *_Nonnull l) {
20
- [weakSelf emitOnLocation:l];
21
- }];
21
+ initOnState:^(NSDictionary *_Nonnull s) {
22
+ [weakSelf emitOnState:s];
23
+ }
24
+ onLocation:^(NSDictionary *_Nonnull l) {
25
+ [weakSelf emitOnLocation:l];
26
+ }
27
+ onGeofenceEvent:^(NSDictionary *_Nonnull e) {
28
+ [weakSelf emitOnGeofenceEvent:e];
29
+ }
30
+ onSyncStatus:^(NSDictionary *_Nonnull st) {
31
+ [weakSelf emitOnSyncStatus:st];
32
+ }
33
+ onAuthTokens:^(NSDictionary *_Nonnull t) {
34
+ [weakSelf emitOnAuthTokens:t];
35
+ }];
22
36
  }
23
37
  return self;
24
38
  }
25
39
 
40
+ // Called by React Native on teardown (RCTInvalidating). The Codegen base class
41
+ // derives from NSObject, which has no `invalidate`, so there's no super to call.
26
42
  - (void)invalidate {
27
43
  [_impl invalidate];
28
- [super invalidate];
29
44
  }
30
45
 
31
- - (void)configure:(JS::NativeBeekonRn::WireConfig &)config
46
+ /// Registers Beekon's background tasks. Call from the host AppDelegate's
47
+ /// `application:didFinishLaunchingWithOptions:` (it must run before that method
48
+ /// returns). Exposed as a class method so hosts don't import BeekonKit directly.
49
+ + (void)registerBackgroundTasks {
50
+ [BeekonRnImpl registerBackgroundTasks];
51
+ }
52
+
53
+ // MARK: - Lifecycle
54
+
55
+ - (void)configure:(NSDictionary *)config
32
56
  resolve:(RCTPromiseResolveBlock)resolve
33
57
  reject:(RCTPromiseRejectBlock)reject {
34
- // Codegen passes the struct; round-trip through NSDictionary so the Swift
35
- // side can decode generically without an iOS-specific spec import. iOS
36
- // ignores `androidNotification` — passed through but unused.
37
- NSDictionary *dict = @{
38
- @"intervalSeconds": @(config.intervalSeconds()),
39
- @"distanceMeters": @(config.distanceMeters()),
40
- };
41
- [_impl configure:dict resolver:resolve rejecter:reject];
58
+ // The config crosses as a plain dictionary (UnsafeObject); the Swift side
59
+ // parses it. iOS ignores `notification` (Android-only).
60
+ [_impl configure:config resolver:resolve rejecter:reject];
42
61
  }
43
62
 
44
63
  - (void)start:(RCTPromiseResolveBlock)resolve
@@ -51,11 +70,71 @@
51
70
  [_impl stopWithResolver:resolve rejecter:reject];
52
71
  }
53
72
 
54
- - (void)history:(double)fromMs
55
- toMs:(double)toMs
56
- resolve:(RCTPromiseResolveBlock)resolve
57
- reject:(RCTPromiseRejectBlock)reject {
58
- [_impl historyFromMs:fromMs toMs:toMs resolver:resolve rejecter:reject];
73
+ - (void)resumeIfNeeded:(RCTPromiseResolveBlock)resolve
74
+ reject:(RCTPromiseRejectBlock)reject {
75
+ [_impl resumeIfNeededWithResolver:resolve rejecter:reject];
76
+ }
77
+
78
+ - (void)getCurrentLocation:(double)timeoutMs
79
+ accuracy:(NSString *)accuracy
80
+ resolve:(RCTPromiseResolveBlock)resolve
81
+ reject:(RCTPromiseRejectBlock)reject {
82
+ [_impl getCurrentLocationTimeoutMs:timeoutMs
83
+ accuracy:accuracy
84
+ resolver:resolve
85
+ rejecter:reject];
86
+ }
87
+
88
+ // MARK: - History
89
+
90
+ - (void)getLocations:(double)fromMs
91
+ toMs:(double)toMs
92
+ resolve:(RCTPromiseResolveBlock)resolve
93
+ reject:(RCTPromiseRejectBlock)reject {
94
+ [_impl getLocationsFromMs:fromMs toMs:toMs resolver:resolve rejecter:reject];
95
+ }
96
+
97
+ - (void)deleteLocations:(double)beforeMs
98
+ resolve:(RCTPromiseResolveBlock)resolve
99
+ reject:(RCTPromiseRejectBlock)reject {
100
+ [_impl deleteLocationsBeforeMs:beforeMs resolver:resolve rejecter:reject];
101
+ }
102
+
103
+ - (void)pendingUploadCount:(RCTPromiseResolveBlock)resolve
104
+ reject:(RCTPromiseRejectBlock)reject {
105
+ [_impl pendingUploadCountWithResolver:resolve rejecter:reject];
106
+ }
107
+
108
+ // MARK: - Sync
109
+
110
+ - (void)sync:(RCTPromiseResolveBlock)resolve
111
+ reject:(RCTPromiseRejectBlock)reject {
112
+ [_impl syncWithResolver:resolve rejecter:reject];
113
+ }
114
+
115
+ - (void)setExtras:(NSArray *)entries
116
+ resolve:(RCTPromiseResolveBlock)resolve
117
+ reject:(RCTPromiseRejectBlock)reject {
118
+ [_impl setExtras:entries resolver:resolve rejecter:reject];
119
+ }
120
+
121
+ // MARK: - Geofences
122
+
123
+ - (void)addGeofences:(NSArray *)geofences
124
+ resolve:(RCTPromiseResolveBlock)resolve
125
+ reject:(RCTPromiseRejectBlock)reject {
126
+ [_impl addGeofences:geofences resolver:resolve rejecter:reject];
127
+ }
128
+
129
+ - (void)removeGeofences:(NSArray *)ids
130
+ resolve:(RCTPromiseResolveBlock)resolve
131
+ reject:(RCTPromiseRejectBlock)reject {
132
+ [_impl removeGeofences:ids resolver:resolve rejecter:reject];
133
+ }
134
+
135
+ - (void)listGeofences:(RCTPromiseResolveBlock)resolve
136
+ reject:(RCTPromiseRejectBlock)reject {
137
+ [_impl listGeofencesWithResolver:resolve rejecter:reject];
59
138
  }
60
139
 
61
140
  - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule: