@wayq/beekon-rn 0.0.9 → 0.1.2
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/BeekonRn.podspec +2 -2
- package/CHANGELOG.md +70 -7
- package/LICENSE.txt +3 -3
- package/README.md +111 -326
- package/android/build.gradle +2 -2
- package/android/src/main/AndroidManifest.xml +10 -0
- package/android/src/main/java/in/wayq/beekonrn/BeekonRnModule.kt +132 -1
- package/ios/BeekonRn.mm +5 -0
- package/ios/BeekonRn.swift +96 -10
- package/ios/Frameworks/BeekonKit.xcframework/LICENSE.txt +3 -3
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/BeekonKit +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Info.plist +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios.abi.json +6218 -3034
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios.swiftinterface +89 -5
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/BeekonKit +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Info.plist +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios-simulator.abi.json +6218 -3034
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +89 -5
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +6218 -3034
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +89 -5
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/_CodeSignature/CodeResources +1 -1
- package/lib/module/NativeBeekonRn.js +14 -0
- package/lib/module/NativeBeekonRn.js.map +1 -1
- package/lib/module/beekon.js +26 -1
- package/lib/module/beekon.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal/mappers.js +95 -2
- package/lib/module/internal/mappers.js.map +1 -1
- package/lib/module/types/permission.js +2 -0
- package/lib/module/types/permission.js.map +1 -0
- package/lib/typescript/src/NativeBeekonRn.d.ts +39 -0
- package/lib/typescript/src/NativeBeekonRn.d.ts.map +1 -1
- package/lib/typescript/src/beekon.d.ts +20 -0
- package/lib/typescript/src/beekon.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/internal/mappers.d.ts +4 -1
- package/lib/typescript/src/internal/mappers.d.ts.map +1 -1
- package/lib/typescript/src/types/geofence.d.ts +37 -0
- package/lib/typescript/src/types/geofence.d.ts.map +1 -1
- package/lib/typescript/src/types/permission.d.ts +78 -0
- package/lib/typescript/src/types/permission.d.ts.map +1 -0
- package/package.json +5 -5
- package/scripts/fetch-beekonkit.sh +6 -6
- package/src/NativeBeekonRn.ts +45 -0
- package/src/beekon.ts +33 -0
- package/src/index.tsx +12 -0
- package/src/internal/mappers.ts +140 -0
- package/src/types/geofence.ts +41 -0
- package/src/types/permission.ts +91 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How far the host app's location grant reaches. Mirrors the native
|
|
3
|
+
* `PermissionStatus` level on both platforms.
|
|
4
|
+
*
|
|
5
|
+
* Normalized — not platform permission constants. `'restricted'` is **iOS-only**
|
|
6
|
+
* (MDM / Screen Time); on Android "not yet asked" and "denied" cannot be told
|
|
7
|
+
* apart without an `Activity`, so both report `'notDetermined'`.
|
|
8
|
+
*
|
|
9
|
+
* - `'notDetermined'` — not yet decided; request to proceed.
|
|
10
|
+
* - `'denied'` — the user denied access (iOS). User-fixable in Settings.
|
|
11
|
+
* - `'restricted'` — blocked by an unchangeable policy (iOS-only).
|
|
12
|
+
* - `'foreground'` — granted while in use; foreground tracking only.
|
|
13
|
+
* - `'background'` — granted at all times; background tracking works.
|
|
14
|
+
*/
|
|
15
|
+
export type PermissionLevel =
|
|
16
|
+
| 'notDetermined'
|
|
17
|
+
| 'denied'
|
|
18
|
+
| 'restricted'
|
|
19
|
+
| 'foreground'
|
|
20
|
+
| 'background';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Precision of a granted location authorization. `null` unless granted.
|
|
24
|
+
*
|
|
25
|
+
* - `'full'` — precise location.
|
|
26
|
+
* - `'reduced'` — approximate only (iOS 14 / Android 12 "approximate").
|
|
27
|
+
*/
|
|
28
|
+
export type PermissionAccuracy = 'full' | 'reduced';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A point-in-time snapshot of the location-permission grant, returned by
|
|
32
|
+
* `Beekon.getPermissionStatus()`. Mirrors the native `PermissionStatus`.
|
|
33
|
+
*
|
|
34
|
+
* Beekon never *requests* permission — the app owns that. This is a read-only
|
|
35
|
+
* query for pre-start checks; it never prompts. It is a snapshot, not an
|
|
36
|
+
* observer: once tracking is running, permission loss surfaces on the `onState`
|
|
37
|
+
* stream as `{ kind: 'stopped', reason: 'permissionDenied' }`.
|
|
38
|
+
*/
|
|
39
|
+
export type PermissionStatus = {
|
|
40
|
+
/** How far the grant reaches. */
|
|
41
|
+
level: PermissionLevel;
|
|
42
|
+
/** Precision of the grant, or `null` when not authorized. */
|
|
43
|
+
accuracy: PermissionAccuracy | null;
|
|
44
|
+
/** `true` when authorized at all — foreground or background. */
|
|
45
|
+
isAuthorized: boolean;
|
|
46
|
+
/** `true` when background tracking is authorized. */
|
|
47
|
+
canTrackInBackground: boolean;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A permission Beekon may require, normalized across platforms. Mirrors the
|
|
52
|
+
* native `BeekonPermission`.
|
|
53
|
+
*
|
|
54
|
+
* - `'location'` — foreground location; required for all tracking.
|
|
55
|
+
* - `'backgroundLocation'` — background revival, geofences, stationary resume.
|
|
56
|
+
* - `'activityRecognition'` — motion-based stationary detection.
|
|
57
|
+
* - `'notifications'` — the foreground-service notification (**Android only**).
|
|
58
|
+
*/
|
|
59
|
+
export type BeekonPermission =
|
|
60
|
+
| 'location'
|
|
61
|
+
| 'backgroundLocation'
|
|
62
|
+
| 'activityRecognition'
|
|
63
|
+
| 'notifications';
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* How badly a {@link PermissionRequirement} is needed.
|
|
67
|
+
*
|
|
68
|
+
* - `'required'` — tracking cannot start, or an explicitly-enabled feature is dead, without it.
|
|
69
|
+
* - `'recommended'` — an active feature silently degrades without it; tracking still runs.
|
|
70
|
+
*/
|
|
71
|
+
export type PermissionImportance = 'required' | 'recommended';
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* One permission Beekon needs **for the current configuration**, each marked
|
|
75
|
+
* satisfied against the live grant — returned by `Beekon.getRequiredPermissions()`.
|
|
76
|
+
* Mirrors the native `PermissionRequirement`.
|
|
77
|
+
*
|
|
78
|
+
* Beekon never *requests* permission — the app owns that. This is the
|
|
79
|
+
* config-aware "doctor" companion to {@link PermissionStatus}: it reports
|
|
80
|
+
* activity-recognition (and, on Android, notifications) too.
|
|
81
|
+
*/
|
|
82
|
+
export type PermissionRequirement = {
|
|
83
|
+
/** The normalized permission. */
|
|
84
|
+
permission: BeekonPermission;
|
|
85
|
+
/** Whether tracking/a feature breaks (`'required'`) or merely degrades (`'recommended'`) when absent. */
|
|
86
|
+
importance: PermissionImportance;
|
|
87
|
+
/** Whether the live OS grant covers it right now. */
|
|
88
|
+
satisfied: boolean;
|
|
89
|
+
/** Human-readable explanation of why Beekon needs it / what degrades without it. */
|
|
90
|
+
rationale: string;
|
|
91
|
+
};
|