Prepared for v0.1.0 release.
This commit is contained in:
parent
451923f9f8
commit
11b7eacf0e
15
Cargo.toml
15
Cargo.toml
|
@ -2,10 +2,23 @@
|
|||
name = "robius-open"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
authors = [
|
||||
"Klim Tsoutsman <klim@tsoutsman.com>",
|
||||
"Kevin Boos <kevinaboos@gmail.com>",
|
||||
"Project Robius Maintainers",
|
||||
]
|
||||
description = "Rust abstractions for opening URIs on multiple platforms"
|
||||
documentation = "https://docs.rs/robius-open"
|
||||
homepage = "https://robius.rs/"
|
||||
keywords = ["robius", "URI", "open", "URL", "intent"]
|
||||
categories = ["os", "hardware-support", "api-bindings"]
|
||||
license = "MIT"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/project-robius/robius-open"
|
||||
|
||||
[dependencies]
|
||||
cfg-if = "1.0.0"
|
||||
log = { version = "0.4.21", optional = true }
|
||||
log = { version = "0.4", optional = true }
|
||||
|
||||
[target.'cfg(target_os = "android")'.dependencies.jni]
|
||||
version = "0.21.1"
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
# `robius-open`
|
||||
|
||||
[![Latest Version](https://img.shields.io/crates/v/robius_open.svg)](https://crates.io/crates/robius_open)
|
||||
[![Docs](https://docs.rs/robius_open/badge.svg)](https://docs.rs/robius_open/latest/robius_open/)
|
||||
[![Project Robius Matrix Chat](https://img.shields.io/matrix/robius-general%3Amatrix.org?server_fqdn=matrix.org&style=flat&logo=matrix&label=Project%20Robius%20Matrix%20Chat&color=B7410E)](https://matrix.to/#/#robius:matrix.org)
|
||||
|
||||
This crate provides easy Rust interfaces to open URIs across multiple platforms, including:
|
||||
- macOS (via `NSWorkspace`)
|
||||
- Android (via `android/content/Intent`)
|
||||
- Linux (via `xdg-open`)
|
||||
- Windows (via `start`)
|
||||
- iOS (via `UIApplication`)
|
||||
|
||||
URIs take many different forms: URLs (`http://`), `tel:`, `mailto:`, `file://`, and more (see the [official list of schemes](https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml)).
|
||||
|
||||
## Examples
|
||||
|
||||
```rust
|
||||
use robius_open::Uri;
|
||||
Uri::new("tel:+61 123 456 789")
|
||||
.open()
|
||||
.expect("failed to open telephone URI");
|
||||
```
|
||||
|
||||
```rust
|
||||
use robius_open::Uri;
|
||||
Uri::new("http://www.google.com")
|
||||
.open()
|
||||
.expect("failed to open URL");
|
||||
```
|
||||
|
||||
|
||||
## Android usage
|
||||
To use this crate on Android, you must add the following to your app manifest:
|
||||
```xml
|
||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
|
||||
tools:ignore="QueryAllPackagesPermission" />
|
||||
|
||||
<queries>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
</intent>
|
||||
</queries>
|
||||
```
|
||||
or alternatively, disable the `android-result` feature.
|
||||
|
||||
However, disabling this feature will make `Uri::open()` always return `Ok`, regardless of whether the URI was successfully opened.
|
|
@ -12,7 +12,7 @@
|
|||
//! - Android (`android/content/Intent`)
|
||||
//! - Linux (`xdg-open`)
|
||||
//! - Windows (`start`)
|
||||
//! - WIP: iOS (`UIApplication`)
|
||||
//! - iOS (`UIApplication`)
|
||||
//!
|
||||
//! # Android
|
||||
//! To use the library on Android, you must add the following to the app
|
||||
|
|
Loading…
Reference in New Issue