M12 — the Android client, end to end #2
@@ -683,8 +683,10 @@ pub fn record_pending_delete(conn: &Connection, entity: &str, id: &str) -> rusql
|
||||
/// default rather than one being invented here — the meaning of "unset" belongs
|
||||
/// with the setting, not with the storage.
|
||||
pub fn pref(conn: &Connection, key: &str) -> rusqlite::Result<Option<String>> {
|
||||
conn.query_row("SELECT value FROM prefs WHERE key = ?1", [key], |r| r.get(0))
|
||||
.optional()
|
||||
conn.query_row("SELECT value FROM prefs WHERE key = ?1", [key], |r| {
|
||||
r.get(0)
|
||||
})
|
||||
.optional()
|
||||
}
|
||||
|
||||
pub fn set_pref(conn: &Connection, key: &str, value: &str) -> rusqlite::Result<()> {
|
||||
|
||||
@@ -92,7 +92,10 @@ fn self_update_blocker() -> Option<String> {
|
||||
fn read_channel(db: &State<'_, Db>) -> Result<Channel, String> {
|
||||
let conn = db.0.lock().map_err(|e| e.to_string())?;
|
||||
let raw = store::pref(&conn, CHANNEL_PREF).map_err(|e| e.to_string())?;
|
||||
Ok(raw.as_deref().map(Channel::parse).unwrap_or(Channel::Stable))
|
||||
Ok(raw
|
||||
.as_deref()
|
||||
.map(Channel::parse)
|
||||
.unwrap_or(Channel::Stable))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
|
||||
Reference in New Issue
Block a user