Skip to content

Commit 6076569

Browse files
authored
refactor(geolocation): simplify API, defer permission checks (tauri-apps#1773)
1 parent fd75401 commit 6076569

File tree

28 files changed

+445
-13960
lines changed

28 files changed

+445
-13960
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"geolocation": patch
3+
---
4+
5+
No longer request permission automatically and leave to the user how to handle the `checkPermissions` and `requestPermissions` APIs.

.changes/update-geolocation-api.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"geolocation-js": patch
3+
---
4+
5+
Update API to match other plugins.

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,15 @@ target/
2626
# compiled plugins
2727
dist-js/
2828

29-
# plugins .tauri director
29+
# plugins .tauri directory
3030
/plugins/*/.tauri
3131

32+
# examples
33+
examples/*/dist
34+
plugins/*/examples/*/dist
35+
examples/*/src-tauri/gen/schemas
36+
plugins/*/examples/*/src-tauri/gen/schemas
37+
3238
# logs
3339
logs
3440
*.log

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ CHANGELOG.md
2424
# mobile build
2525
**/ios/.build
2626
**/.tauri
27+
plugins/*/android/build

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/api/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

examples/api/dist/.gitkeep

Whitespace-only changes.

examples/api/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
"@tauri-apps/plugin-clipboard-manager": "2.0.0-rc.2",
1717
"@tauri-apps/plugin-dialog": "2.0.0-rc.1",
1818
"@tauri-apps/plugin-fs": "2.0.0-rc.2",
19+
"@tauri-apps/plugin-geolocation": "2.0.0-rc.1",
1920
"@tauri-apps/plugin-global-shortcut": "2.0.0-rc.1",
21+
"@tauri-apps/plugin-haptics": "2.0.0-rc.1",
2022
"@tauri-apps/plugin-http": "2.0.0-rc.2",
2123
"@tauri-apps/plugin-nfc": "2.0.0-rc.1",
2224
"@tauri-apps/plugin-notification": "2.0.0-rc.1",

examples/api/src-tauri/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ tauri-plugin-window-state = { path = "../../../plugins/window-state", version =
5959
tauri-plugin-barcode-scanner = { path = "../../../plugins/barcode-scanner/", version = "2.0.0-rc.4" }
6060
tauri-plugin-nfc = { path = "../../../plugins/nfc", version = "2.0.0-rc.3" }
6161
tauri-plugin-biometric = { path = "../../../plugins/biometric/", version = "2.0.0-rc.3" }
62+
tauri-plugin-geolocation = { path = "../../../plugins/geolocation/", version = "2.0.0-rc.3" }
63+
tauri-plugin-haptics = { path = "../../../plugins/haptics/", version = "2.0.0-rc.3" }
6264

6365
[features]
6466
prod = ["tauri/custom-protocol"]

examples/api/src-tauri/capabilities/mobile.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
"barcode-scanner:allow-scan",
1212
"barcode-scanner:allow-cancel",
1313
"barcode-scanner:allow-request-permissions",
14-
"barcode-scanner:allow-check-permissions"
14+
"barcode-scanner:allow-check-permissions",
15+
"geolocation:allow-check-permissions",
16+
"geolocation:allow-request-permissions",
17+
"geolocation:allow-watch-position",
18+
"geolocation:allow-get-current-position"
1519
]
1620
}

0 commit comments

Comments
 (0)