Sign in with Google, Apple…: remember prompt, item row, new-login picker
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -41,6 +41,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
notes: None,
|
||||
favorite: false,
|
||||
tags: vec![],
|
||||
sign_in_with: None,
|
||||
modified_at: 0,
|
||||
})?;
|
||||
let broker = Broker::new(core, Arc::new(Quiet), PairingStore::in_memory());
|
||||
|
||||
@@ -81,6 +81,22 @@ struct Detail {
|
||||
totp: Option<String>,
|
||||
notes: Option<String>,
|
||||
tags: Vec<String>,
|
||||
/// "Google · [email protected]" when the account signs in with a provider.
|
||||
sign_in_with: Option<SignInView>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct SignInView {
|
||||
provider: String,
|
||||
#[serde(default)]
|
||||
provider_name: String,
|
||||
account: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct ProviderView {
|
||||
id: String,
|
||||
name: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@@ -92,6 +108,8 @@ struct NewLogin {
|
||||
totp: Option<String>,
|
||||
#[serde(default)]
|
||||
tags: Vec<String>,
|
||||
#[serde(default)]
|
||||
sign_in_with: Option<SignInView>,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
@@ -249,9 +267,19 @@ fn get_item(app: State<'_, App>, id: String) -> CmdResult<Detail> {
|
||||
totp: d.totp,
|
||||
notes: d.notes,
|
||||
tags: d.tags,
|
||||
sign_in_with: d.sign_in_with.map(|w| SignInView {
|
||||
provider_name: kv_ffi::sign_in_provider_name(w.provider.clone()),
|
||||
provider: w.provider,
|
||||
account: w.account,
|
||||
}),
|
||||
})
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn sign_in_providers() -> Vec<ProviderView> {
|
||||
kv_ffi::sign_in_providers().into_iter().map(|p| ProviderView { id: p.id, name: p.name }).collect()
|
||||
}
|
||||
|
||||
/// Replaces an item's tags (the core normalises them); everything else about the item stays.
|
||||
#[tauri::command]
|
||||
fn set_tags(app: State<'_, App>, id: String, tags: Vec<String>) -> CmdResult<()> {
|
||||
@@ -276,6 +304,7 @@ fn save_item(app: State<'_, App>, item: NewLogin) -> CmdResult<String> {
|
||||
notes: None,
|
||||
favorite: false,
|
||||
tags: item.tags,
|
||||
sign_in_with: item.sign_in_with.map(|w| kv_ffi::SignInWithDto { provider: w.provider, account: w.account }),
|
||||
modified_at: 0,
|
||||
})
|
||||
.map_err(err)
|
||||
@@ -701,6 +730,7 @@ fn main() {
|
||||
pending_saves,
|
||||
pending_passkeys,
|
||||
set_tags,
|
||||
sign_in_providers,
|
||||
resolve_passkey,
|
||||
resolve_save,
|
||||
sync_status,
|
||||
|
||||
@@ -38,6 +38,7 @@ fn login(title: &str) -> ItemDto {
|
||||
notes: None,
|
||||
favorite: false,
|
||||
tags: vec![],
|
||||
sign_in_with: None,
|
||||
modified_at: 0,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,6 +90,7 @@ fn pair_and_fill_through_the_native_host() {
|
||||
notes: None,
|
||||
favorite: false,
|
||||
tags: vec![],
|
||||
sign_in_with: None,
|
||||
modified_at: 0,
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user