Skip to content

Apply Disable Favicon setting globally to match desktop#1811

Merged
mpbw2 merged 2 commits intomasterfrom
apply-iconsetting-globally
Feb 24, 2022
Merged

Apply Disable Favicon setting globally to match desktop#1811
mpbw2 merged 2 commits intomasterfrom
apply-iconsetting-globally

Conversation

@mpbw2
Copy link
Copy Markdown
Contributor

@mpbw2 mpbw2 commented Feb 24, 2022

Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

Make the "Disable Website Icons" option global to match desktop. I'm continuing to follow the Apply*Globally pattern established with the Theme change so a single block of code can be removed to restore per-account functionality in the future.

Code changes

  • StateService.cs: Created SetValueGloballyAsync method to support key/value based settings (values not in the Account object)
  • OptionsPageViewModel.cs: Removed previous Apply*Global calls since everything is contained within StateService now

Testing requirements

https://app.asana.com/0/1201803072708593/1201880420113232

Before you submit

  • I have added unit tests where it makes sense to do so (encouraged but not required)
  • This change requires a documentation update (notify the documentation team)
  • This change has particular deployment requirements (notify the DevOps team)

@mpbw2 mpbw2 requested review from a team and fedemkr February 24, 2022 17:49
Comment thread src/Core/Services/StateService.cs Outdated
Comment on lines +584 to +602
public async Task ApplyDisableFaviconGloballyAsync(bool? value)
{
// TODO remove this method (ApplyDisableFaviconGloballyAsync) to restore per-account icon support
await CheckStateAsync();
if (_state?.Accounts == null)
{
return;
}
var activeUserId = await GetActiveUserIdAsync();
foreach (var account in _state.Accounts)
{
var uid = account.Value?.Profile?.UserId;
// skip active user (theme already set)
if (uid != null && uid != activeUserId)
{
await SetDisableFaviconAsync(value, uid);
}
}
}
Copy link
Copy Markdown
Member

@fedemkr fedemkr Feb 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is using almost the same code as Task ApplyThemeGloballyAsync(string value). We could refactor a bit to share some more code, given that the only thing that changes is the call in the if; like a method that has a Task as a parameter that will be triggered in there

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took a slightly different approach to keep everything contained within StateService

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the new approach 😄

@mpbw2 mpbw2 requested a review from fedemkr February 24, 2022 21:53
@mpbw2 mpbw2 merged commit f948127 into master Feb 24, 2022
@mpbw2 mpbw2 deleted the apply-iconsetting-globally branch February 24, 2022 22:13
fedemkr added a commit that referenced this pull request Feb 25, 2022
* master: (82 commits)
  Autosync the updated translations (#1812)
  Apply Disable Favicon setting globally to match desktop (#1811)
  Fix for missing bio unlock on app restart (#1810)
  Changed link on Settings "Change Master Password" and "Two Step Login" to go to the web vault settings. Also refactored a bit to reuse the urls (#1809)
  take environment into account when checking for existing account (#1808)
  Account Switching (#1807)
  Fixes incorrect path in workflow (#1806)
  [BEEEP] - Added workflows to ignored paths (#1802)
  Add dry run option to release workflow (#1801)
  Changed Input keyboard on phone to be the telephone keyboard and also capitalized the keyboard on some fields of add/edit identity (#1800)
  Fix Options being seen in two lines on Add/edit Send (#1798)
  Fix icon image size to be adaptive on Large Font Size Accessibility which fixes row height on large vault (#1795)
  We're Hiring (#1797)
  Moved to new Google Service Account (#1789)
  Moved to new Google Service Account (#1788)
  Move to using shared workflow (#1787)
  Autosync the updated translations (#1786)
  Fixed some Large Font Accessibility issues on Vault and Send screens for Icons Display #1774 (#1785)
  Created initial workflow for workflow linting (#1783)
  Enforce Hold label (#1779)
  ...

# Conflicts:
#	src/App/Pages/Accounts/DeleteAccountViewModel.cs
#	src/App/Pages/Settings/ExportVaultPageViewModel.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants