diff --git a/i18n/en/cosmicding.ftl b/i18n/en/cosmicding.ftl index f2cddcd..5530549 100644 --- a/i18n/en/cosmicding.ftl +++ b/i18n/en/cosmicding.ftl @@ -28,6 +28,8 @@ edit-bookmark = Edit Bookmark enabled-public-sharing = Public bookmarks sharing enabled enabled-sharing = Bookmarks sharing enabled failed = failed +failed-refreshing-accounts = Failed refreshing some accounts ({$accounts}) +failed-refreshing-bookmarks-for-account = Failed refreshing account {$account} failed-to-find-linkding-api-endpoint = Failed to find linkding API endpoint failed-to-parse-response = Failed to parse response file = File diff --git a/i18n/sv/cosmicding.ftl b/i18n/sv/cosmicding.ftl index 7826c66..7d4b2a2 100644 --- a/i18n/sv/cosmicding.ftl +++ b/i18n/sv/cosmicding.ftl @@ -28,6 +28,8 @@ edit-bookmark = Redigera bokmärke enabled-public-sharing = Delning av offentliga bokmärken har aktiverats enabled-sharing = Bokmärkesdelning har aktiverats failed = misslyckades +failed-refreshing-accounts = Misslyckades att uppdatera vissa konton ({$accounts}) +failed-refreshing-bookmarks-for-account = Misslyckades att uppdatera konto {$account} failed-to-find-linkding-api-endpoint = Det gick inte att hitta linkding API-slutpunkt failed-to-parse-response = Misslyckades att tolka svar file = Fil diff --git a/src/app.rs b/src/app.rs index 61b5b7b..3ea896d 100644 --- a/src/app.rs +++ b/src/app.rs @@ -666,8 +666,12 @@ impl Application for Cosmicding { } } Message::DoneRefreshBookmarksForAllAccounts(remote_responses) => { + let mut failed_accounts: Vec = Vec::new(); if let Some(ref mut database) = &mut self.bookmarks_cursor.database { for response in remote_responses { + if response.successful == false { + failed_accounts.push(response.account.display_name.clone()); + } block_on(async { db::SqliteDatabase::aggregate_bookmarks_for_acount( database, @@ -682,11 +686,22 @@ impl Application for Cosmicding { commands.push(self.update(Message::LoadAccounts)); commands.push(self.update(Message::LoadBookmarks)); self.state = ApplicationState::Normal; - commands.push( - self.toasts - .push(widget::toaster::Toast::new(fl!("refreshed-bookmarks"))) - .map(cosmic::app::Message::App), - ); + if !failed_accounts.is_empty() { + commands.push( + self.toasts + .push(widget::toaster::Toast::new(fl!( + "failed-refreshing-accounts", + accounts = failed_accounts.join(", ") + ))) + .map(cosmic::app::Message::App), + ); + } else { + commands.push( + self.toasts + .push(widget::toaster::Toast::new(fl!("refreshed-bookmarks"))) + .map(cosmic::app::Message::App), + ); + } } } Message::StartRefreshBookmarksForAccount(account) => { @@ -713,8 +728,12 @@ impl Application for Cosmicding { } } Message::DoneRefreshBookmarksForAccount(account, remote_responses) => { + let mut failure_refreshing = false; if let Some(ref mut database) = &mut self.bookmarks_cursor.database { for response in remote_responses { + if response.successful == false { + failure_refreshing = true; + } block_on(async { db::SqliteDatabase::aggregate_bookmarks_for_acount( database, @@ -729,14 +748,25 @@ impl Application for Cosmicding { commands.push(self.update(Message::LoadAccounts)); commands.push(self.update(Message::LoadBookmarks)); self.state = ApplicationState::Normal; - commands.push( - self.toasts - .push(widget::toaster::Toast::new(fl!( - "refreshed-bookmarks-for-account", - acc = account.display_name - ))) - .map(cosmic::app::Message::App), - ); + if failure_refreshing { + commands.push( + self.toasts + .push(widget::toaster::Toast::new(fl!( + "failed-refreshing-bookmarks-for-account", + account = account.display_name + ))) + .map(cosmic::app::Message::App), + ); + } else { + commands.push( + self.toasts + .push(widget::toaster::Toast::new(fl!( + "refreshed-bookmarks-for-account", + acc = account.display_name + ))) + .map(cosmic::app::Message::App), + ); + } } } Message::StartRefreshAccountProfile(account) => {