Skip to content

Commit

Permalink
refactor(geolocation): simplify API, defer permission checks (#1773)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored Sep 16, 2024
1 parent fd75401 commit 6076569
Show file tree
Hide file tree
Showing 28 changed files with 445 additions and 13,960 deletions.
5 changes: 5 additions & 0 deletions .changes/geolocation-permission-refactor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"geolocation": patch
---

No longer request permission automatically and leave to the user how to handle the `checkPermissions` and `requestPermissions` APIs.
5 changes: 5 additions & 0 deletions .changes/update-geolocation-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"geolocation-js": patch
---

Update API to match other plugins.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@ target/
# compiled plugins
dist-js/

# plugins .tauri director
# plugins .tauri directory
/plugins/*/.tauri

# examples
examples/*/dist
plugins/*/examples/*/dist
examples/*/src-tauri/gen/schemas
plugins/*/examples/*/src-tauri/gen/schemas

# logs
logs
*.log
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ CHANGELOG.md
# mobile build
**/ios/.build
**/.tauri
plugins/*/android/build
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions examples/api/.gitignore

This file was deleted.

Empty file removed examples/api/dist/.gitkeep
Empty file.
2 changes: 2 additions & 0 deletions examples/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"@tauri-apps/plugin-clipboard-manager": "2.0.0-rc.2",
"@tauri-apps/plugin-dialog": "2.0.0-rc.1",
"@tauri-apps/plugin-fs": "2.0.0-rc.2",
"@tauri-apps/plugin-geolocation": "2.0.0-rc.1",
"@tauri-apps/plugin-global-shortcut": "2.0.0-rc.1",
"@tauri-apps/plugin-haptics": "2.0.0-rc.1",
"@tauri-apps/plugin-http": "2.0.0-rc.2",
"@tauri-apps/plugin-nfc": "2.0.0-rc.1",
"@tauri-apps/plugin-notification": "2.0.0-rc.1",
Expand Down
2 changes: 2 additions & 0 deletions examples/api/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ tauri-plugin-window-state = { path = "../../../plugins/window-state", version =
tauri-plugin-barcode-scanner = { path = "../../../plugins/barcode-scanner/", version = "2.0.0-rc.4" }
tauri-plugin-nfc = { path = "../../../plugins/nfc", version = "2.0.0-rc.3" }
tauri-plugin-biometric = { path = "../../../plugins/biometric/", version = "2.0.0-rc.3" }
tauri-plugin-geolocation = { path = "../../../plugins/geolocation/", version = "2.0.0-rc.3" }
tauri-plugin-haptics = { path = "../../../plugins/haptics/", version = "2.0.0-rc.3" }

[features]
prod = ["tauri/custom-protocol"]
6 changes: 5 additions & 1 deletion examples/api/src-tauri/capabilities/mobile.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
"barcode-scanner:allow-scan",
"barcode-scanner:allow-cancel",
"barcode-scanner:allow-request-permissions",
"barcode-scanner:allow-check-permissions"
"barcode-scanner:allow-check-permissions",
"geolocation:allow-check-permissions",
"geolocation:allow-request-permissions",
"geolocation:allow-watch-position",
"geolocation:allow-get-current-position"
]
}
1 change: 0 additions & 1 deletion examples/api/src-tauri/gen/android/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5,713 changes: 0 additions & 5,713 deletions examples/api/src-tauri/gen/schemas/desktop-schema.json

This file was deleted.

7,661 changes: 0 additions & 7,661 deletions examples/api/src-tauri/gen/schemas/mobile-schema.json

This file was deleted.

2 changes: 2 additions & 0 deletions examples/api/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ pub fn run() {
app.handle().plugin(tauri_plugin_barcode_scanner::init())?;
app.handle().plugin(tauri_plugin_nfc::init())?;
app.handle().plugin(tauri_plugin_biometric::init())?;
app.handle().plugin(tauri_plugin_geolocation::init())?;
app.handle().plugin(tauri_plugin_haptics::init())?;
}

let mut webview_window_builder =
Expand Down
Loading

0 comments on commit 6076569

Please sign in to comment.