Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core)!: rename plugin::PermissionState::Unknown to plugin::PermissionState::Prompt #10978

Merged
merged 4 commits into from
Sep 13, 2024
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
5 changes: 5 additions & 0 deletions .changes/fix-permission-state-unknown-display.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri": patch:breaking
---

Rename `PermissionState::Unknown` to `PermissionState::Prompt`.
10 changes: 5 additions & 5 deletions crates/tauri/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -910,20 +910,20 @@ pub enum PermissionState {
Granted,
/// Permission access has been denied.
Denied,
/// Permission must be requested.
#[default]
Prompt,
/// Permission must be requested, but you must explain to the user why your app needs that permission. **Android only**.
PromptWithRationale,
/// Unknown state. Must request permission.
#[default]
Unknown,
}

impl std::fmt::Display for PermissionState {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Granted => write!(f, "granted"),
Self::Denied => write!(f, "denied"),
Self::Prompt => write!(f, "prompt"),
Self::PromptWithRationale => write!(f, "prompt-with-rationale"),
Self::Unknown => write!(f, "Unknown"),
}
}
}
Expand All @@ -946,8 +946,8 @@ impl<'de> Deserialize<'de> for PermissionState {
match s.to_lowercase().as_str() {
"granted" => Ok(Self::Granted),
"denied" => Ok(Self::Denied),
"prompt" => Ok(Self::Prompt),
"prompt-with-rationale" => Ok(Self::PromptWithRationale),
"prompt" => Ok(Self::Unknown),
_ => Err(DeError::custom(format!("unknown permission state '{s}'"))),
}
}
Expand Down