@tokamakdev/plugin-location 0.1.0-beta.126 → 0.1.0-beta.127
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/package.json +2 -2
- package/src/index.ts +14 -4
- package/tokamak-plugin.json +0 -36
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokamakdev/plugin-location",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.127",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/mantty/tokamak.git",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"./android": "./android/bindings.ts"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@tokamakdev/plugin": "0.1.0-beta.
|
|
17
|
+
"@tokamakdev/plugin": "0.1.0-beta.127"
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
20
|
"android",
|
package/src/index.ts
CHANGED
|
@@ -38,7 +38,8 @@ class Location extends Plugin {
|
|
|
38
38
|
/**
|
|
39
39
|
* The device's position, asking for in-use permission where the user has not answered. Rejects
|
|
40
40
|
* with `NotAllowedError` without it, `TimeoutError` after `timeout`, and `NotReadableError`
|
|
41
|
-
* when location is unavailable.
|
|
41
|
+
* when location is unavailable. Asking off screen rejects with `NeedsUIError`, as
|
|
42
|
+
* `requestPermission` does.
|
|
42
43
|
*/
|
|
43
44
|
async getCurrentPosition(options: PositionOptions = {}): Promise<Position> {
|
|
44
45
|
await this.#authorize();
|
|
@@ -49,7 +50,10 @@ class Location extends Plugin {
|
|
|
49
50
|
throw background && (await this.permission()).background !== "granted" ? backgroundDenied() : unavailable("Location is unavailable");
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* Positions as the device moves, after `getCurrentPosition`'s permission checks, which can reject
|
|
55
|
+
* with `NeedsUIError` off screen. A slow reader receives the newest.
|
|
56
|
+
*/
|
|
53
57
|
watchPosition(): JsonStream<Position> {
|
|
54
58
|
return valueStream<Position>(async (next, error) => {
|
|
55
59
|
await this.#authorize();
|
|
@@ -97,7 +101,10 @@ class Location extends Plugin {
|
|
|
97
101
|
return this.call("servicesEnabled");
|
|
98
102
|
}
|
|
99
103
|
|
|
100
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* Opens the app's page in the system settings, where the user changes its location permission.
|
|
106
|
+
* Rejects with `NeedsUIError` off screen on iOS and Android.
|
|
107
|
+
*/
|
|
101
108
|
openSettings(): Promise<void> {
|
|
102
109
|
return this.call("openSettings");
|
|
103
110
|
}
|
|
@@ -152,7 +159,10 @@ class Location extends Plugin {
|
|
|
152
159
|
return this.stream("onRegionTransition");
|
|
153
160
|
}
|
|
154
161
|
|
|
155
|
-
/**
|
|
162
|
+
/**
|
|
163
|
+
* Receives the visits the Worker's `onVisit` receives, while the listening page or Worker runs.
|
|
164
|
+
* @platforms ios macos
|
|
165
|
+
*/
|
|
156
166
|
onVisit(): JsonStream<Visit> {
|
|
157
167
|
return this.stream("onVisit");
|
|
158
168
|
}
|
package/tokamak-plugin.json
CHANGED
|
@@ -94,41 +94,5 @@
|
|
|
94
94
|
"web": {
|
|
95
95
|
"module": "web/client.ts",
|
|
96
96
|
"export": "location"
|
|
97
|
-
},
|
|
98
|
-
"operations": {
|
|
99
|
-
"getCurrentPosition": {
|
|
100
|
-
"foreground": [
|
|
101
|
-
"ios"
|
|
102
|
-
]
|
|
103
|
-
},
|
|
104
|
-
"watchPosition": {
|
|
105
|
-
"foreground": [
|
|
106
|
-
"ios"
|
|
107
|
-
]
|
|
108
|
-
},
|
|
109
|
-
"requestPermission": {
|
|
110
|
-
"foreground": [
|
|
111
|
-
"ios",
|
|
112
|
-
"android"
|
|
113
|
-
]
|
|
114
|
-
},
|
|
115
|
-
"openSettings": {
|
|
116
|
-
"foreground": [
|
|
117
|
-
"ios",
|
|
118
|
-
"android"
|
|
119
|
-
]
|
|
120
|
-
},
|
|
121
|
-
"startUpdates": {
|
|
122
|
-
"foreground": [
|
|
123
|
-
"ios",
|
|
124
|
-
"android"
|
|
125
|
-
]
|
|
126
|
-
},
|
|
127
|
-
"onVisit": {
|
|
128
|
-
"platforms": {
|
|
129
|
-
"ios": true,
|
|
130
|
-
"macos": true
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
97
|
}
|
|
134
98
|
}
|