mirror of
https://github.com/narrrl/proton-stream.git
synced 2026-11-04 00:47:00 +01:00
feat(core,app,android,ios): finish adding a first share where it pays off
- A link with a password of its own, added without one, now fails as "This link has a password of its own" instead of the handshake's refusal. The link's public flags are only asked for after a refusal. The desktop form turns its password toggle on. - After the first share is added, all three clients go to the library. While that share is being listed, the empty library says so instead of offering to add a share. - The desktop library offers posters and synopses once there is a library to put them on. The offer says what is sent, links to Settings, never turns anything on, and "Not now" is remembered.
This commit is contained in:
1 parent
0f96cc4514
commit
89e55aac12
11 files changed
+150
-10
No files matched your search
@@ -177,7 +177,11 @@ pub enum Event {
|
||||
/// The share the form asked for is stored; its crawl is starting.
|
||||
ShareAdded(String),
|
||||
/// The share the form asked for was refused, with why. Nothing was crawled.
|
||||
ShareRejected(String),
|
||||
ShareRejected {
|
||||
error: String,
|
||||
/// The link has a password of its own and none was given.
|
||||
needs_password: bool,
|
||||
},
|
||||
/// Shares opened; playback is possible from here.
|
||||
Connected {
|
||||
/// Shares that did not open, with why.
|
||||
@@ -305,6 +309,16 @@ pub enum Event {
|
||||
BrowseFailed(String),
|
||||
}
|
||||
|
||||
impl Event {
|
||||
/// The add form's refusal of `error`.
|
||||
fn rejected(error: &pstr_core::Error) -> Self {
|
||||
Self::ShareRejected {
|
||||
error: error.to_string(),
|
||||
needs_password: matches!(error, pstr_core::Error::PasswordNeeded),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Where the Proton account stands.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
||||
pub enum AccountStatus {
|
||||
@@ -671,7 +685,7 @@ impl Engine {
|
||||
.await
|
||||
{
|
||||
Ok((share, _)) => share,
|
||||
Err(error) => return engine.emit(Event::ShareRejected(error.to_string())),
|
||||
Err(error) => return engine.emit(Event::rejected(&error)),
|
||||
};
|
||||
engine.emit(Event::ShareAdded(share.name.clone()));
|
||||
engine.load_shares();
|
||||
@@ -720,7 +734,7 @@ impl Engine {
|
||||
};
|
||||
let share = match engine.store.add_folder(&name, folder) {
|
||||
Ok(share) => share,
|
||||
Err(error) => return engine.emit(Event::ShareRejected(error.to_string())),
|
||||
Err(error) => return engine.emit(Event::rejected(&error)),
|
||||
};
|
||||
engine.emit(Event::ShareAdded(share.name.clone()));
|
||||
engine.load_shares();
|
||||
|
||||
Reference in new issue
Block a user