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

* fix(core): plugin::PermissionState::Unknown wrong display impl

* prompt

* rename variant

* fix
This commit is contained in:
Lucas Fernandes Nogueira 2024-09-13 08:38:59 -03:00 committed by GitHub
parent be18ed50d8
commit fe5ff1228c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 5 deletions

View File

@ -0,0 +1,5 @@
---
"tauri": patch:breaking
---
Rename `PermissionState::Unknown` to `PermissionState::Prompt`.

View File

@ -910,11 +910,11 @@ 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 {
@ -922,8 +922,8 @@ impl std::fmt::Display for PermissionState {
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"),
}
}
}
@ -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}'"))),
}
}