Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
74 changes: 63 additions & 11 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ tauri = { version = "2.9.3" }
thiserror = "2.0.17"
tracing = { version = "0.1.41", default-features = false, features = ["std", "log", "release_max_level_warn"] }

[target.'cfg(windows)'.dependencies]
windows = { version = "0.62.2", features = ["Networking_Connectivity"] }

[build-dependencies]
tauri-plugin = { version = "2.5.1", features = ["build"] }
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ decisions.

| Platform | Supported |
| -------- | --------- |
| Windows | Planned |
| Windows | Yes |
| macOS | Planned |
| Android | Planned |
| iOS | Planned |
Expand Down Expand Up @@ -171,20 +171,20 @@ fn check_connection<R: tauri::Runtime>(app: &tauri::AppHandle<R>) {

The `connectionStatus()` function returns a `ConnectionStatus` object:

| Field | Type | Description |
| ---------------- | ---------------- | ---------------------------------------------------------------- |
| `connected` | `boolean` | Whether the device has an active internet connection |
| `metered` | `boolean` | Whether data usage is billed or limited |
| `constrained` | `boolean` | Whether the connection is data-constrained or restricted |
| `connectionType` | `ConnectionType` | The physical transport: `wifi`, `ethernet`, `cellular`, `unknown`|
| Field | Type | Description |
| ---------------- | ---------------- | ----------------------------------------------------------------- |
| `connected` | `boolean` | Whether the device has an active internet connection |
| `metered` | `boolean` | Whether data usage is billed or limited |
| `constrained` | `boolean` | Whether the connection is data-constrained or restricted |
| `connectionType` | `ConnectionType` | The physical transport: `wifi`, `ethernet`, `cellular`, `unknown` |

#### Platform mapping

| Field | Windows | iOS | Android |
| ------------- | ----------------------------------------- | ------------------------- | -------------------------------- |
| `metered` | `NetworkCostType` Fixed/Variable | `NWPath.isExpensive` | absence of `NOT_METERED` |
| `constrained` | `ApproachingDataLimit`, `OverDataLimit`, `Roaming` | `NWPath.isConstrained` | Data Saver / `RESTRICT_BACKGROUND` |
| `connectionType` | WWAN/WLAN/IANA interface type | `NWInterface.InterfaceType` | `TRANSPORT_*` capabilities |
| Field | Windows | iOS | Android |
| ---------------- | ----------------------------------------------------------------------------------- | --------------------------- | ---------------------------------- |
| `metered` | `NetworkCostType` Unknown/Fixed/Variable | `NWPath.isExpensive` | absence of `NOT_METERED` |
| `constrained` | `ConstrainedInternetAccess`, data-limit, roaming, or background data restrictions | `NWPath.isConstrained` | Data Saver / `RESTRICT_BACKGROUND` |
| `connectionType` | WWAN/WLAN/IANA interface type | `NWInterface.InterfaceType` | `TRANSPORT_*` capabilities |

## Development Standards

Expand Down
4 changes: 4 additions & 0 deletions examples/tauri-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
src-tauri/target
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please ignore src-tauri/gen and remove this folder from source control? This is ignored in our other plugin repositories.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the example app ignore rules to include src-tauri/gen, and removed that generated directory from source control so it won’t keep showing up in the repo.

src-tauri/gen
21 changes: 21 additions & 0 deletions examples/tauri-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Connectivity Example App

This example Tauri app exercises the local `@silvermine/tauri-plugin-connectivity`
package through a path dependency.

## Run

1. Install dependencies:

```sh
npm install
```

2. Start the example:

```sh
npm run dev
```

The app shows the current connectivity status and lets you refresh it while
switching between offline, Wi-Fi, Ethernet, or metered connections.
12 changes: 12 additions & 0 deletions examples/tauri-app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tauri Plugin Connectivity Example</title>
<script type="module" src="/src/main.ts"></script>
</head>
<body>
<div id="app"></div>
</body>
</html>
Loading
Loading