INNER CODE UNIT · Rust
install
jub0t/Concat · src/crates/concat-android/src/lib.rs:129
pub fn install(app: &AndroidApp) {
let app = app.clone();
concat::install_file_picker(Box::new(move |on_picked| {
let previous = PENDING
.lock()
.map(|mut slot| slot.replace(on_picked))
.ok()
.flatten();
if let Some(previous) = previous {
// A pick was already up; the one that asked first is told
// it got nothing rather than left waiting for ever.
previous(Vec::new());
}
if let Err(error) = pick(&app) {
log::error!("could not show the document picker: {error}");
if let Some(pending) = PENDING.lock().ok().and_then(|mut slot| slot.take()) {
pending(Vec::new());
}