Skip to content

Commit fe5ff12

Browse files
authored
refactor(core)!: rename plugin::PermissionState::Unknown to plugin::PermissionState::Prompt (#10978)
* fix(core): plugin::PermissionState::Unknown wrong display impl * prompt * rename variant * fix
1 parent be18ed5 commit fe5ff12

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch:breaking
3+
---
4+
5+
Rename `PermissionState::Unknown` to `PermissionState::Prompt`.

crates/tauri/src/plugin.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -910,20 +910,20 @@ pub enum PermissionState {
910910
Granted,
911911
/// Permission access has been denied.
912912
Denied,
913+
/// Permission must be requested.
914+
#[default]
915+
Prompt,
913916
/// Permission must be requested, but you must explain to the user why your app needs that permission. **Android only**.
914917
PromptWithRationale,
915-
/// Unknown state. Must request permission.
916-
#[default]
917-
Unknown,
918918
}
919919

920920
impl std::fmt::Display for PermissionState {
921921
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
922922
match self {
923923
Self::Granted => write!(f, "granted"),
924924
Self::Denied => write!(f, "denied"),
925+
Self::Prompt => write!(f, "prompt"),
925926
Self::PromptWithRationale => write!(f, "prompt-with-rationale"),
926-
Self::Unknown => write!(f, "Unknown"),
927927
}
928928
}
929929
}
@@ -946,8 +946,8 @@ impl<'de> Deserialize<'de> for PermissionState {
946946
match s.to_lowercase().as_str() {
947947
"granted" => Ok(Self::Granted),
948948
"denied" => Ok(Self::Denied),
949+
"prompt" => Ok(Self::Prompt),
949950
"prompt-with-rationale" => Ok(Self::PromptWithRationale),
950-
"prompt" => Ok(Self::Unknown),
951951
_ => Err(DeError::custom(format!("unknown permission state '{s}'"))),
952952
}
953953
}

0 commit comments

Comments
 (0)