mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-03 06:54:19 +00:00
add Status::Restore, Status::Restored
This commit is contained in:
parent
eca93df1eb
commit
f52b1fcf99
@ -319,6 +319,10 @@ impl Page {
|
|||||||
transaction: &Transaction,
|
transaction: &Transaction,
|
||||||
app_browser_window_tab_item_id: &i64,
|
app_browser_window_tab_item_id: &i64,
|
||||||
) -> Result<(), String> {
|
) -> Result<(), String> {
|
||||||
|
// Update status
|
||||||
|
self.meta.set_status(Status::Restore);
|
||||||
|
|
||||||
|
// Begin page restore
|
||||||
match Database::records(transaction, app_browser_window_tab_item_id) {
|
match Database::records(transaction, app_browser_window_tab_item_id) {
|
||||||
Ok(records) => {
|
Ok(records) => {
|
||||||
for record in records {
|
for record in records {
|
||||||
@ -330,6 +334,9 @@ impl Page {
|
|||||||
Err(e) => return Err(e.to_string()),
|
Err(e) => return Err(e.to_string()),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update status
|
||||||
|
self.meta.set_status(Status::Restored);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,7 +368,7 @@ impl Page {
|
|||||||
pub fn progress_fraction(&self) -> Option<f64> {
|
pub fn progress_fraction(&self) -> Option<f64> {
|
||||||
// Interpret status to progress fraction
|
// Interpret status to progress fraction
|
||||||
match self.meta.status() {
|
match self.meta.status() {
|
||||||
Status::Reload => Some(0.0),
|
Status::Reload | Status::Restore => Some(0.0),
|
||||||
Status::Resolving => Some(0.1),
|
Status::Resolving => Some(0.1),
|
||||||
Status::Resolved => Some(0.2),
|
Status::Resolved => Some(0.2),
|
||||||
Status::Connecting => Some(0.3),
|
Status::Connecting => Some(0.3),
|
||||||
@ -372,7 +379,7 @@ impl Page {
|
|||||||
Status::TlsHandshaked => Some(0.8),
|
Status::TlsHandshaked => Some(0.8),
|
||||||
Status::Complete => Some(0.9),
|
Status::Complete => Some(0.9),
|
||||||
Status::Failure | Status::Redirect | Status::Success | Status::Input => Some(1.0),
|
Status::Failure | Status::Redirect | Status::Success | Status::Input => Some(1.0),
|
||||||
Status::New => None,
|
Status::New | Status::Restored => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,8 @@ pub enum Status {
|
|||||||
Reload,
|
Reload,
|
||||||
Resolved,
|
Resolved,
|
||||||
Resolving,
|
Resolving,
|
||||||
|
Restore,
|
||||||
|
Restored,
|
||||||
Success,
|
Success,
|
||||||
TlsHandshaked,
|
TlsHandshaked,
|
||||||
TlsHandshaking,
|
TlsHandshaking,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user