1
0
mirror of https://github.com/bitwarden/mobile.git synced 2025-03-12 13:19:10 +01:00
bitwarden-mobile/src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

716 lines
29 KiB
C#
Raw Normal View History

Account Switching (#1807) * Account Switching (#1720) * Account switching * WIP * wip * wip * updates to send test logic * fixed Send tests * fixes for theme handling on account switching and re-adding existing account * switch fixes * fixes * fixes * cleanup * vault timeout fixes * account list status enhancements * logout fixes and token handling improvements * merge latest (#1727) * remove duplicate dependency * fix for initial login token storage paradox (#1730) * Fix avatar color update toolbar item issue on iOS for account switching (#1735) * Updated account switching menu UI (#1733) * updated account switching menu UI * additional changes * add key suffix to constant * GetFirstLetters method tweaks * Fix crash on account switching when logging out when having more than user at a time (#1740) * single account migration to multi-account on app update (#1741) * Account Switching Tap to dismiss (#1743) * Added tap to dismiss on the Account switching overlay and improved a bit the code * Fix account switching overlay background transparent on the proper place * Fixed transparent background and the shadow on the account switching overlay * Fix iOS top space on Account switching list overlay after modal (#1746) * Fix top space added to Account switching list overlay after closing modal * Fix top space added to Account switching list overlay after closing modal on lock, login and home views just in case we add modals in the future there as well * Usability: dismiss account list on certain events (#1748) * dismiss account list on certain events * use new FireAndForget method for back button logic * Create and use Account Switching overlay control (#1753) * Added Account switching overlay control and its own ViewModel and refactored accordingly * Fix account switching Accounts list binding update * Implemented dismiss account switching overlay when changing tabs and when selecting the same tab. Also updated the deprecated listener on CustomTabbedRenderer on Android (#1755) * Overriden Equals on AvatarImageSource so it doesn't get set multiple times when it's the same image thus producing blinking on tab chaged (#1756) * Usability improvements for logout on vault timeout (#1781) * accountswitching fixes (#1784) * Fix for invalid PIN lock state when switching accounts (#1792) * fix for pin lock flow * named tuple values and updated async * clear send service cache on account switch (#1796) * Global theme and account removal (#1793) * Global theme and account removal * remove redundant call to hide account list overlay * cleanup and additional tweaks * add try/catch to remove account dialog flow Co-authored-by: Federico Maccaroni <fedemkr@gmail.com>
2022-02-23 18:40:17 +01:00
using System;
using System.Collections.Generic;
using System.Linq;
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
using System.Threading;
Account Switching (#1807) * Account Switching (#1720) * Account switching * WIP * wip * wip * updates to send test logic * fixed Send tests * fixes for theme handling on account switching and re-adding existing account * switch fixes * fixes * fixes * cleanup * vault timeout fixes * account list status enhancements * logout fixes and token handling improvements * merge latest (#1727) * remove duplicate dependency * fix for initial login token storage paradox (#1730) * Fix avatar color update toolbar item issue on iOS for account switching (#1735) * Updated account switching menu UI (#1733) * updated account switching menu UI * additional changes * add key suffix to constant * GetFirstLetters method tweaks * Fix crash on account switching when logging out when having more than user at a time (#1740) * single account migration to multi-account on app update (#1741) * Account Switching Tap to dismiss (#1743) * Added tap to dismiss on the Account switching overlay and improved a bit the code * Fix account switching overlay background transparent on the proper place * Fixed transparent background and the shadow on the account switching overlay * Fix iOS top space on Account switching list overlay after modal (#1746) * Fix top space added to Account switching list overlay after closing modal * Fix top space added to Account switching list overlay after closing modal on lock, login and home views just in case we add modals in the future there as well * Usability: dismiss account list on certain events (#1748) * dismiss account list on certain events * use new FireAndForget method for back button logic * Create and use Account Switching overlay control (#1753) * Added Account switching overlay control and its own ViewModel and refactored accordingly * Fix account switching Accounts list binding update * Implemented dismiss account switching overlay when changing tabs and when selecting the same tab. Also updated the deprecated listener on CustomTabbedRenderer on Android (#1755) * Overriden Equals on AvatarImageSource so it doesn't get set multiple times when it's the same image thus producing blinking on tab chaged (#1756) * Usability improvements for logout on vault timeout (#1781) * accountswitching fixes (#1784) * Fix for invalid PIN lock state when switching accounts (#1792) * fix for pin lock flow * named tuple values and updated async * clear send service cache on account switch (#1796) * Global theme and account removal (#1793) * Global theme and account removal * remove redundant call to hide account list overlay * cleanup and additional tweaks * add try/catch to remove account dialog flow Co-authored-by: Federico Maccaroni <fedemkr@gmail.com>
2022-02-23 18:40:17 +01:00
using System.Threading.Tasks;
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
using System.Windows.Input;
Account Switching (#1807) * Account Switching (#1720) * Account switching * WIP * wip * wip * updates to send test logic * fixed Send tests * fixes for theme handling on account switching and re-adding existing account * switch fixes * fixes * fixes * cleanup * vault timeout fixes * account list status enhancements * logout fixes and token handling improvements * merge latest (#1727) * remove duplicate dependency * fix for initial login token storage paradox (#1730) * Fix avatar color update toolbar item issue on iOS for account switching (#1735) * Updated account switching menu UI (#1733) * updated account switching menu UI * additional changes * add key suffix to constant * GetFirstLetters method tweaks * Fix crash on account switching when logging out when having more than user at a time (#1740) * single account migration to multi-account on app update (#1741) * Account Switching Tap to dismiss (#1743) * Added tap to dismiss on the Account switching overlay and improved a bit the code * Fix account switching overlay background transparent on the proper place * Fixed transparent background and the shadow on the account switching overlay * Fix iOS top space on Account switching list overlay after modal (#1746) * Fix top space added to Account switching list overlay after closing modal * Fix top space added to Account switching list overlay after closing modal on lock, login and home views just in case we add modals in the future there as well * Usability: dismiss account list on certain events (#1748) * dismiss account list on certain events * use new FireAndForget method for back button logic * Create and use Account Switching overlay control (#1753) * Added Account switching overlay control and its own ViewModel and refactored accordingly * Fix account switching Accounts list binding update * Implemented dismiss account switching overlay when changing tabs and when selecting the same tab. Also updated the deprecated listener on CustomTabbedRenderer on Android (#1755) * Overriden Equals on AvatarImageSource so it doesn't get set multiple times when it's the same image thus producing blinking on tab chaged (#1756) * Usability improvements for logout on vault timeout (#1781) * accountswitching fixes (#1784) * Fix for invalid PIN lock state when switching accounts (#1792) * fix for pin lock flow * named tuple values and updated async * clear send service cache on account switch (#1796) * Global theme and account removal (#1793) * Global theme and account removal * remove redundant call to hide account list overlay * cleanup and additional tweaks * add try/catch to remove account dialog flow Co-authored-by: Federico Maccaroni <fedemkr@gmail.com>
2022-02-23 18:40:17 +01:00
using Bit.App.Abstractions;
using Bit.App.Controls;
2019-05-30 06:29:00 +02:00
using Bit.App.Resources;
2019-05-30 05:35:34 +02:00
using Bit.App.Utilities;
2019-04-19 22:45:16 +02:00
using Bit.Core.Abstractions;
using Bit.Core.Enums;
2019-04-19 22:45:16 +02:00
using Bit.Core.Models.Domain;
using Bit.Core.Models.View;
2019-03-29 17:52:57 +01:00
using Bit.Core.Utilities;
using Xamarin.CommunityToolkit.ObjectModel;
2019-03-29 17:52:57 +01:00
using Xamarin.Forms;
2019-03-29 04:52:33 +01:00
namespace Bit.App.Pages
{
public class GroupingsPageViewModel : VaultFilterViewModel
2019-03-29 04:52:33 +01:00
{
private const int NoFolderListSize = 100;
2019-04-25 05:37:47 +02:00
private bool _refreshing;
2019-05-29 04:57:59 +02:00
private bool _doingLoad;
2019-04-25 05:37:47 +02:00
private bool _loading;
private bool _loaded;
private bool _showAddCipherButton;
private bool _showNoData;
private bool _showList;
2019-06-08 18:18:49 +02:00
private bool _websiteIconsEnabled;
private bool _syncRefreshing;
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
private bool _showTotpFilter;
private bool _totpFilterEnable;
2019-04-25 05:28:41 +02:00
private string _noDataText;
2019-04-19 22:45:16 +02:00
private List<CipherView> _allCiphers;
2019-05-01 18:28:49 +02:00
private Dictionary<string, int> _folderCounts = new Dictionary<string, int>();
private Dictionary<string, int> _collectionCounts = new Dictionary<string, int>();
private Dictionary<CipherType, int> _typeCounts = new Dictionary<CipherType, int>();
private int _deletedCount = 0;
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
private CancellationTokenSource _totpTickCts;
private Task _totpTickTask;
2019-04-19 22:45:16 +02:00
private readonly ICipherService _cipherService;
private readonly IFolderService _folderService;
private readonly ICollectionService _collectionService;
private readonly ISyncService _syncService;
[Auto Logout] Final review of feature (#932) * Initial commit of LockService name refactor (#831) * [Auto-Logout] Update Service layer logic (#835) * Initial commit of service logic update * Added default value for action * Updated ToggleTokensAsync conditional * Removed unused variables, updated action conditional * Initial commit: lockOption/lock refactor app layer (#840) * [Auto-Logout] Settings Refactor - Application Layer Part 2 (#844) * Initial commit of app layer part 2 * Updated biometrics position * Reverted resource name refactor * LockOptions refactor revert * Updated method casing :: Removed VaultTimeout prefix for timeouts * Fixed dupe string resource (#854) * Updated dependency to use VaultTimeoutService (#896) * [Auto Logout] Xamarin Forms in AutoFill flow (iOS) (#902) * fix typo in PINRequireMasterPasswordRestart (#900) * initial commit for xf usage in autofill * Fixed databinding for hint button * Updated Two Factor page launch - removed unused imports * First pass at broadcast/messenger implentation for autofill * setting theme in extension using theme manager * extension app resources * App resources from main app * fix ref to twoFactorPage * apply resources to page * load empty app for sytling in extension * move ios renderers to ios core * static ref to resources and GetResourceColor helper * fix method ref * move application.current.resources refs to helper * switch login page alerts to device action dialogs * run on main thread * showDialog with device action service * abstract action sheet to device action service * add support for yubikey * add yubikey iimages to extension * support close button action * add support to action extension * remove empty lines Co-authored-by: Jonas Kittner <54631600+theendlessriver13@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kyle.spearrin@gmail.com> * [Auto Logout] Update lock option to be default value (#929) * Initial commit - make lock action default * Removed extra whitespace Co-authored-by: Jonas Kittner <54631600+theendlessriver13@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kyle.spearrin@gmail.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com>
2020-05-29 18:26:36 +02:00
private readonly IVaultTimeoutService _vaultTimeoutService;
2019-05-30 06:29:00 +02:00
private readonly IDeviceActionService _deviceActionService;
private readonly IPlatformUtilsService _platformUtilsService;
private readonly IMessagingService _messagingService;
2019-06-08 18:18:49 +02:00
private readonly IStateService _stateService;
private readonly IPasswordRepromptService _passwordRepromptService;
private readonly IOrganizationService _organizationService;
private readonly IPolicyService _policyService;
private readonly ILogger _logger;
2019-03-29 17:52:57 +01:00
2019-03-29 18:24:44 +01:00
public GroupingsPageViewModel()
2019-03-29 04:52:33 +01:00
{
2019-04-19 22:45:16 +02:00
_cipherService = ServiceContainer.Resolve<ICipherService>("cipherService");
_folderService = ServiceContainer.Resolve<IFolderService>("folderService");
_collectionService = ServiceContainer.Resolve<ICollectionService>("collectionService");
_syncService = ServiceContainer.Resolve<ISyncService>("syncService");
[Auto Logout] Final review of feature (#932) * Initial commit of LockService name refactor (#831) * [Auto-Logout] Update Service layer logic (#835) * Initial commit of service logic update * Added default value for action * Updated ToggleTokensAsync conditional * Removed unused variables, updated action conditional * Initial commit: lockOption/lock refactor app layer (#840) * [Auto-Logout] Settings Refactor - Application Layer Part 2 (#844) * Initial commit of app layer part 2 * Updated biometrics position * Reverted resource name refactor * LockOptions refactor revert * Updated method casing :: Removed VaultTimeout prefix for timeouts * Fixed dupe string resource (#854) * Updated dependency to use VaultTimeoutService (#896) * [Auto Logout] Xamarin Forms in AutoFill flow (iOS) (#902) * fix typo in PINRequireMasterPasswordRestart (#900) * initial commit for xf usage in autofill * Fixed databinding for hint button * Updated Two Factor page launch - removed unused imports * First pass at broadcast/messenger implentation for autofill * setting theme in extension using theme manager * extension app resources * App resources from main app * fix ref to twoFactorPage * apply resources to page * load empty app for sytling in extension * move ios renderers to ios core * static ref to resources and GetResourceColor helper * fix method ref * move application.current.resources refs to helper * switch login page alerts to device action dialogs * run on main thread * showDialog with device action service * abstract action sheet to device action service * add support for yubikey * add yubikey iimages to extension * support close button action * add support to action extension * remove empty lines Co-authored-by: Jonas Kittner <54631600+theendlessriver13@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kyle.spearrin@gmail.com> * [Auto Logout] Update lock option to be default value (#929) * Initial commit - make lock action default * Removed extra whitespace Co-authored-by: Jonas Kittner <54631600+theendlessriver13@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kyle.spearrin@gmail.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com>
2020-05-29 18:26:36 +02:00
_vaultTimeoutService = ServiceContainer.Resolve<IVaultTimeoutService>("vaultTimeoutService");
2019-05-30 06:29:00 +02:00
_deviceActionService = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService");
_platformUtilsService = ServiceContainer.Resolve<IPlatformUtilsService>("platformUtilsService");
_messagingService = ServiceContainer.Resolve<IMessagingService>("messagingService");
2019-06-08 18:18:49 +02:00
_stateService = ServiceContainer.Resolve<IStateService>("stateService");
_passwordRepromptService = ServiceContainer.Resolve<IPasswordRepromptService>("passwordRepromptService");
_organizationService = ServiceContainer.Resolve<IOrganizationService>("organizationService");
_policyService = ServiceContainer.Resolve<IPolicyService>("policyService");
_logger = ServiceContainer.Resolve<ILogger>("logger");
2019-04-19 22:45:16 +02:00
2019-04-25 05:37:47 +02:00
Loading = true;
GroupedItems = new ObservableRangeCollection<IGroupingsPageListItem>();
2019-04-25 05:37:47 +02:00
RefreshCommand = new Command(async () =>
{
Refreshing = true;
await LoadAsync();
});
CipherOptionsCommand = new AsyncCommand<CipherView>(cipher => AppHelpers.CipherListOptions(Page, cipher, _passwordRepromptService),
onException: ex => _logger.Exception(ex),
allowsMultipleExecutions: false);
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
VaultFilterCommand = new AsyncCommand(VaultFilterOptionsAsync,
onException: ex => _logger.Exception(ex),
allowsMultipleExecutions: false);
Account Switching (#1807) * Account Switching (#1720) * Account switching * WIP * wip * wip * updates to send test logic * fixed Send tests * fixes for theme handling on account switching and re-adding existing account * switch fixes * fixes * fixes * cleanup * vault timeout fixes * account list status enhancements * logout fixes and token handling improvements * merge latest (#1727) * remove duplicate dependency * fix for initial login token storage paradox (#1730) * Fix avatar color update toolbar item issue on iOS for account switching (#1735) * Updated account switching menu UI (#1733) * updated account switching menu UI * additional changes * add key suffix to constant * GetFirstLetters method tweaks * Fix crash on account switching when logging out when having more than user at a time (#1740) * single account migration to multi-account on app update (#1741) * Account Switching Tap to dismiss (#1743) * Added tap to dismiss on the Account switching overlay and improved a bit the code * Fix account switching overlay background transparent on the proper place * Fixed transparent background and the shadow on the account switching overlay * Fix iOS top space on Account switching list overlay after modal (#1746) * Fix top space added to Account switching list overlay after closing modal * Fix top space added to Account switching list overlay after closing modal on lock, login and home views just in case we add modals in the future there as well * Usability: dismiss account list on certain events (#1748) * dismiss account list on certain events * use new FireAndForget method for back button logic * Create and use Account Switching overlay control (#1753) * Added Account switching overlay control and its own ViewModel and refactored accordingly * Fix account switching Accounts list binding update * Implemented dismiss account switching overlay when changing tabs and when selecting the same tab. Also updated the deprecated listener on CustomTabbedRenderer on Android (#1755) * Overriden Equals on AvatarImageSource so it doesn't get set multiple times when it's the same image thus producing blinking on tab chaged (#1756) * Usability improvements for logout on vault timeout (#1781) * accountswitching fixes (#1784) * Fix for invalid PIN lock state when switching accounts (#1792) * fix for pin lock flow * named tuple values and updated async * clear send service cache on account switch (#1796) * Global theme and account removal (#1793) * Global theme and account removal * remove redundant call to hide account list overlay * cleanup and additional tweaks * add try/catch to remove account dialog flow Co-authored-by: Federico Maccaroni <fedemkr@gmail.com>
2022-02-23 18:40:17 +01:00
AccountSwitchingOverlayViewModel = new AccountSwitchingOverlayViewModel(_stateService, _messagingService, _logger)
Account Switching (#1807) * Account Switching (#1720) * Account switching * WIP * wip * wip * updates to send test logic * fixed Send tests * fixes for theme handling on account switching and re-adding existing account * switch fixes * fixes * fixes * cleanup * vault timeout fixes * account list status enhancements * logout fixes and token handling improvements * merge latest (#1727) * remove duplicate dependency * fix for initial login token storage paradox (#1730) * Fix avatar color update toolbar item issue on iOS for account switching (#1735) * Updated account switching menu UI (#1733) * updated account switching menu UI * additional changes * add key suffix to constant * GetFirstLetters method tweaks * Fix crash on account switching when logging out when having more than user at a time (#1740) * single account migration to multi-account on app update (#1741) * Account Switching Tap to dismiss (#1743) * Added tap to dismiss on the Account switching overlay and improved a bit the code * Fix account switching overlay background transparent on the proper place * Fixed transparent background and the shadow on the account switching overlay * Fix iOS top space on Account switching list overlay after modal (#1746) * Fix top space added to Account switching list overlay after closing modal * Fix top space added to Account switching list overlay after closing modal on lock, login and home views just in case we add modals in the future there as well * Usability: dismiss account list on certain events (#1748) * dismiss account list on certain events * use new FireAndForget method for back button logic * Create and use Account Switching overlay control (#1753) * Added Account switching overlay control and its own ViewModel and refactored accordingly * Fix account switching Accounts list binding update * Implemented dismiss account switching overlay when changing tabs and when selecting the same tab. Also updated the deprecated listener on CustomTabbedRenderer on Android (#1755) * Overriden Equals on AvatarImageSource so it doesn't get set multiple times when it's the same image thus producing blinking on tab chaged (#1756) * Usability improvements for logout on vault timeout (#1781) * accountswitching fixes (#1784) * Fix for invalid PIN lock state when switching accounts (#1792) * fix for pin lock flow * named tuple values and updated async * clear send service cache on account switch (#1796) * Global theme and account removal (#1793) * Global theme and account removal * remove redundant call to hide account list overlay * cleanup and additional tweaks * add try/catch to remove account dialog flow Co-authored-by: Federico Maccaroni <fedemkr@gmail.com>
2022-02-23 18:40:17 +01:00
{
AllowAddAccountRow = true
};
2019-03-29 17:52:57 +01:00
}
public bool MainPage { get; set; }
public CipherType? Type { get; set; }
public string FolderId { get; set; }
public string CollectionId { get; set; }
2019-05-07 04:35:42 +02:00
public Func<CipherView, bool> Filter { get; set; }
public bool Deleted { get; set; }
2019-06-05 06:29:49 +02:00
public bool HasCiphers { get; set; }
public bool HasFolders { get; set; }
2019-06-05 19:59:08 +02:00
public bool HasCollections { get; set; }
public bool ShowNoFolderCipherGroup => NoFolderCiphers != null
&& NoFolderCiphers.Count < NoFolderListSize
&& (Collections is null || !Collections.Any());
2019-04-19 22:45:16 +02:00
public List<CipherView> Ciphers { get; set; }
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
public List<CipherView> TOTPCiphers { get; set; }
2019-04-19 22:45:16 +02:00
public List<CipherView> FavoriteCiphers { get; set; }
public List<CipherView> NoFolderCiphers { get; set; }
public List<FolderView> Folders { get; set; }
public List<TreeNode<FolderView>> NestedFolders { get; set; }
public List<Core.Models.View.CollectionView> Collections { get; set; }
public List<TreeNode<Core.Models.View.CollectionView>> NestedCollections { get; set; }
protected override ICipherService cipherService => _cipherService;
protected override IPolicyService policyService => _policyService;
protected override IOrganizationService organizationService => _organizationService;
protected override ILogger logger => _logger;
2019-04-25 05:37:47 +02:00
public bool Refreshing
{
get => _refreshing;
set => SetProperty(ref _refreshing, value);
}
public bool SyncRefreshing
{
get => _syncRefreshing;
set => SetProperty(ref _syncRefreshing, value);
}
2019-03-29 17:52:57 +01:00
public bool Loading
{
get => _loading;
set => SetProperty(ref _loading, value);
}
2019-04-19 22:45:16 +02:00
public bool Loaded
2019-03-29 17:52:57 +01:00
{
2019-04-19 22:45:16 +02:00
get => _loaded;
2019-04-25 05:28:41 +02:00
set => SetProperty(ref _loaded, value);
}
public bool ShowAddCipherButton
{
get => _showAddCipherButton;
set => SetProperty(ref _showAddCipherButton, value);
}
public bool ShowNoData
{
get => _showNoData;
set => SetProperty(ref _showNoData, value);
}
public string NoDataText
{
get => _noDataText;
set => SetProperty(ref _noDataText, value);
}
public bool ShowList
{
get => _showList;
set => SetProperty(ref _showList, value);
2019-04-19 22:45:16 +02:00
}
2019-06-08 18:18:49 +02:00
public bool WebsiteIconsEnabled
{
get => _websiteIconsEnabled;
set => SetProperty(ref _websiteIconsEnabled, value);
}
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
public bool ShowTotp
{
get => _showTotpFilter;
set => SetProperty(ref _showTotpFilter, value);
}
Account Switching (#1807) * Account Switching (#1720) * Account switching * WIP * wip * wip * updates to send test logic * fixed Send tests * fixes for theme handling on account switching and re-adding existing account * switch fixes * fixes * fixes * cleanup * vault timeout fixes * account list status enhancements * logout fixes and token handling improvements * merge latest (#1727) * remove duplicate dependency * fix for initial login token storage paradox (#1730) * Fix avatar color update toolbar item issue on iOS for account switching (#1735) * Updated account switching menu UI (#1733) * updated account switching menu UI * additional changes * add key suffix to constant * GetFirstLetters method tweaks * Fix crash on account switching when logging out when having more than user at a time (#1740) * single account migration to multi-account on app update (#1741) * Account Switching Tap to dismiss (#1743) * Added tap to dismiss on the Account switching overlay and improved a bit the code * Fix account switching overlay background transparent on the proper place * Fixed transparent background and the shadow on the account switching overlay * Fix iOS top space on Account switching list overlay after modal (#1746) * Fix top space added to Account switching list overlay after closing modal * Fix top space added to Account switching list overlay after closing modal on lock, login and home views just in case we add modals in the future there as well * Usability: dismiss account list on certain events (#1748) * dismiss account list on certain events * use new FireAndForget method for back button logic * Create and use Account Switching overlay control (#1753) * Added Account switching overlay control and its own ViewModel and refactored accordingly * Fix account switching Accounts list binding update * Implemented dismiss account switching overlay when changing tabs and when selecting the same tab. Also updated the deprecated listener on CustomTabbedRenderer on Android (#1755) * Overriden Equals on AvatarImageSource so it doesn't get set multiple times when it's the same image thus producing blinking on tab chaged (#1756) * Usability improvements for logout on vault timeout (#1781) * accountswitching fixes (#1784) * Fix for invalid PIN lock state when switching accounts (#1792) * fix for pin lock flow * named tuple values and updated async * clear send service cache on account switch (#1796) * Global theme and account removal (#1793) * Global theme and account removal * remove redundant call to hide account list overlay * cleanup and additional tweaks * add try/catch to remove account dialog flow Co-authored-by: Federico Maccaroni <fedemkr@gmail.com>
2022-02-23 18:40:17 +01:00
public AccountSwitchingOverlayViewModel AccountSwitchingOverlayViewModel { get; }
public ObservableRangeCollection<IGroupingsPageListItem> GroupedItems { get; set; }
2019-04-25 05:37:47 +02:00
public Command RefreshCommand { get; set; }
public ICommand CipherOptionsCommand { get; }
2019-06-13 20:08:21 +02:00
public bool LoadedOnce { get; set; }
2019-03-29 17:52:57 +01:00
2019-04-19 22:45:16 +02:00
public async Task LoadAsync()
{
if (_doingLoad)
2019-05-29 04:57:59 +02:00
{
return;
}
Account Switching (#1807) * Account Switching (#1720) * Account switching * WIP * wip * wip * updates to send test logic * fixed Send tests * fixes for theme handling on account switching and re-adding existing account * switch fixes * fixes * fixes * cleanup * vault timeout fixes * account list status enhancements * logout fixes and token handling improvements * merge latest (#1727) * remove duplicate dependency * fix for initial login token storage paradox (#1730) * Fix avatar color update toolbar item issue on iOS for account switching (#1735) * Updated account switching menu UI (#1733) * updated account switching menu UI * additional changes * add key suffix to constant * GetFirstLetters method tweaks * Fix crash on account switching when logging out when having more than user at a time (#1740) * single account migration to multi-account on app update (#1741) * Account Switching Tap to dismiss (#1743) * Added tap to dismiss on the Account switching overlay and improved a bit the code * Fix account switching overlay background transparent on the proper place * Fixed transparent background and the shadow on the account switching overlay * Fix iOS top space on Account switching list overlay after modal (#1746) * Fix top space added to Account switching list overlay after closing modal * Fix top space added to Account switching list overlay after closing modal on lock, login and home views just in case we add modals in the future there as well * Usability: dismiss account list on certain events (#1748) * dismiss account list on certain events * use new FireAndForget method for back button logic * Create and use Account Switching overlay control (#1753) * Added Account switching overlay control and its own ViewModel and refactored accordingly * Fix account switching Accounts list binding update * Implemented dismiss account switching overlay when changing tabs and when selecting the same tab. Also updated the deprecated listener on CustomTabbedRenderer on Android (#1755) * Overriden Equals on AvatarImageSource so it doesn't get set multiple times when it's the same image thus producing blinking on tab chaged (#1756) * Usability improvements for logout on vault timeout (#1781) * accountswitching fixes (#1784) * Fix for invalid PIN lock state when switching accounts (#1792) * fix for pin lock flow * named tuple values and updated async * clear send service cache on account switch (#1796) * Global theme and account removal (#1793) * Global theme and account removal * remove redundant call to hide account list overlay * cleanup and additional tweaks * add try/catch to remove account dialog flow Co-authored-by: Federico Maccaroni <fedemkr@gmail.com>
2022-02-23 18:40:17 +01:00
var authed = await _stateService.IsAuthenticatedAsync();
if (!authed)
{
return;
}
[Auto Logout] Final review of feature (#932) * Initial commit of LockService name refactor (#831) * [Auto-Logout] Update Service layer logic (#835) * Initial commit of service logic update * Added default value for action * Updated ToggleTokensAsync conditional * Removed unused variables, updated action conditional * Initial commit: lockOption/lock refactor app layer (#840) * [Auto-Logout] Settings Refactor - Application Layer Part 2 (#844) * Initial commit of app layer part 2 * Updated biometrics position * Reverted resource name refactor * LockOptions refactor revert * Updated method casing :: Removed VaultTimeout prefix for timeouts * Fixed dupe string resource (#854) * Updated dependency to use VaultTimeoutService (#896) * [Auto Logout] Xamarin Forms in AutoFill flow (iOS) (#902) * fix typo in PINRequireMasterPasswordRestart (#900) * initial commit for xf usage in autofill * Fixed databinding for hint button * Updated Two Factor page launch - removed unused imports * First pass at broadcast/messenger implentation for autofill * setting theme in extension using theme manager * extension app resources * App resources from main app * fix ref to twoFactorPage * apply resources to page * load empty app for sytling in extension * move ios renderers to ios core * static ref to resources and GetResourceColor helper * fix method ref * move application.current.resources refs to helper * switch login page alerts to device action dialogs * run on main thread * showDialog with device action service * abstract action sheet to device action service * add support for yubikey * add yubikey iimages to extension * support close button action * add support to action extension * remove empty lines Co-authored-by: Jonas Kittner <54631600+theendlessriver13@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kyle.spearrin@gmail.com> * [Auto Logout] Update lock option to be default value (#929) * Initial commit - make lock action default * Removed extra whitespace Co-authored-by: Jonas Kittner <54631600+theendlessriver13@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kyle.spearrin@gmail.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com>
2020-05-29 18:26:36 +02:00
if (await _vaultTimeoutService.IsLockedAsync())
{
return;
}
Account Switching (#1807) * Account Switching (#1720) * Account switching * WIP * wip * wip * updates to send test logic * fixed Send tests * fixes for theme handling on account switching and re-adding existing account * switch fixes * fixes * fixes * cleanup * vault timeout fixes * account list status enhancements * logout fixes and token handling improvements * merge latest (#1727) * remove duplicate dependency * fix for initial login token storage paradox (#1730) * Fix avatar color update toolbar item issue on iOS for account switching (#1735) * Updated account switching menu UI (#1733) * updated account switching menu UI * additional changes * add key suffix to constant * GetFirstLetters method tweaks * Fix crash on account switching when logging out when having more than user at a time (#1740) * single account migration to multi-account on app update (#1741) * Account Switching Tap to dismiss (#1743) * Added tap to dismiss on the Account switching overlay and improved a bit the code * Fix account switching overlay background transparent on the proper place * Fixed transparent background and the shadow on the account switching overlay * Fix iOS top space on Account switching list overlay after modal (#1746) * Fix top space added to Account switching list overlay after closing modal * Fix top space added to Account switching list overlay after closing modal on lock, login and home views just in case we add modals in the future there as well * Usability: dismiss account list on certain events (#1748) * dismiss account list on certain events * use new FireAndForget method for back button logic * Create and use Account Switching overlay control (#1753) * Added Account switching overlay control and its own ViewModel and refactored accordingly * Fix account switching Accounts list binding update * Implemented dismiss account switching overlay when changing tabs and when selecting the same tab. Also updated the deprecated listener on CustomTabbedRenderer on Android (#1755) * Overriden Equals on AvatarImageSource so it doesn't get set multiple times when it's the same image thus producing blinking on tab chaged (#1756) * Usability improvements for logout on vault timeout (#1781) * accountswitching fixes (#1784) * Fix for invalid PIN lock state when switching accounts (#1792) * fix for pin lock flow * named tuple values and updated async * clear send service cache on account switch (#1796) * Global theme and account removal (#1793) * Global theme and account removal * remove redundant call to hide account list overlay * cleanup and additional tweaks * add try/catch to remove account dialog flow Co-authored-by: Federico Maccaroni <fedemkr@gmail.com>
2022-02-23 18:40:17 +01:00
if (await _stateService.GetSyncOnRefreshAsync() && Refreshing && !SyncRefreshing)
{
SyncRefreshing = true;
await _syncService.SyncPasswordlessLoginRequestsAsync();
await _syncService.FullSyncAsync(false);
return;
}
_deviceActionService.SetScreenCaptureAllowedAsync().FireAndForget();
await InitVaultFilterAsync(MainPage);
if (MainPage)
{
PageTitle = ShowVaultFilter ? AppResources.Vaults : AppResources.MyVault;
}
2019-05-29 04:57:59 +02:00
_doingLoad = true;
2019-06-13 20:08:21 +02:00
LoadedOnce = true;
2019-04-25 05:28:41 +02:00
ShowNoData = false;
Loading = true;
ShowList = false;
ShowAddCipherButton = !Deleted;
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
2019-04-25 05:28:41 +02:00
var groupedItems = new List<GroupingsPageListGroup>();
var page = Page as GroupingsPage;
2019-04-25 05:28:41 +02:00
Account Switching (#1807) * Account Switching (#1720) * Account switching * WIP * wip * wip * updates to send test logic * fixed Send tests * fixes for theme handling on account switching and re-adding existing account * switch fixes * fixes * fixes * cleanup * vault timeout fixes * account list status enhancements * logout fixes and token handling improvements * merge latest (#1727) * remove duplicate dependency * fix for initial login token storage paradox (#1730) * Fix avatar color update toolbar item issue on iOS for account switching (#1735) * Updated account switching menu UI (#1733) * updated account switching menu UI * additional changes * add key suffix to constant * GetFirstLetters method tweaks * Fix crash on account switching when logging out when having more than user at a time (#1740) * single account migration to multi-account on app update (#1741) * Account Switching Tap to dismiss (#1743) * Added tap to dismiss on the Account switching overlay and improved a bit the code * Fix account switching overlay background transparent on the proper place * Fixed transparent background and the shadow on the account switching overlay * Fix iOS top space on Account switching list overlay after modal (#1746) * Fix top space added to Account switching list overlay after closing modal * Fix top space added to Account switching list overlay after closing modal on lock, login and home views just in case we add modals in the future there as well * Usability: dismiss account list on certain events (#1748) * dismiss account list on certain events * use new FireAndForget method for back button logic * Create and use Account Switching overlay control (#1753) * Added Account switching overlay control and its own ViewModel and refactored accordingly * Fix account switching Accounts list binding update * Implemented dismiss account switching overlay when changing tabs and when selecting the same tab. Also updated the deprecated listener on CustomTabbedRenderer on Android (#1755) * Overriden Equals on AvatarImageSource so it doesn't get set multiple times when it's the same image thus producing blinking on tab chaged (#1756) * Usability improvements for logout on vault timeout (#1781) * accountswitching fixes (#1784) * Fix for invalid PIN lock state when switching accounts (#1792) * fix for pin lock flow * named tuple values and updated async * clear send service cache on account switch (#1796) * Global theme and account removal (#1793) * Global theme and account removal * remove redundant call to hide account list overlay * cleanup and additional tweaks * add try/catch to remove account dialog flow Co-authored-by: Federico Maccaroni <fedemkr@gmail.com>
2022-02-23 18:40:17 +01:00
WebsiteIconsEnabled = !(await _stateService.GetDisableFaviconAsync()).GetValueOrDefault();
2019-03-29 17:52:57 +01:00
try
{
await LoadDataAsync();
if (ShowNoFolderCipherGroup && (NestedFolders?.Any() ?? false))
2019-05-01 18:28:49 +02:00
{
// Remove "No Folder" folder from folders group
NestedFolders = NestedFolders.GetRange(0, NestedFolders.Count - 1);
}
2019-04-19 22:45:16 +02:00
var uppercaseGroupNames = Device.RuntimePlatform == Device.iOS;
var hasFavorites = FavoriteCiphers?.Any() ?? false;
if (hasFavorites)
2019-03-29 17:52:57 +01:00
{
var favListItems = FavoriteCiphers.Select(c => new GroupingsPageListItem { Cipher = c }).ToList();
2019-04-22 23:08:37 +02:00
groupedItems.Add(new GroupingsPageListGroup(favListItems, AppResources.Favorites,
favListItems.Count, uppercaseGroupNames, true));
2019-04-19 22:45:16 +02:00
}
if (MainPage)
2019-05-01 17:31:00 +02:00
{
AddTotpGroupItem(groupedItems, uppercaseGroupNames);
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
2019-05-01 17:31:00 +02:00
groupedItems.Add(new GroupingsPageListGroup(
AppResources.Types, 4, uppercaseGroupNames, !hasFavorites)
2019-05-01 17:31:00 +02:00
{
2019-05-01 18:28:49 +02:00
new GroupingsPageListItem
{
Type = CipherType.Login,
ItemCount = (_typeCounts.ContainsKey(CipherType.Login) ?
_typeCounts[CipherType.Login] : 0).ToString("N0")
},
new GroupingsPageListItem
{
Type = CipherType.Card,
ItemCount = (_typeCounts.ContainsKey(CipherType.Card) ?
_typeCounts[CipherType.Card] : 0).ToString("N0")
},
new GroupingsPageListItem
{
Type = CipherType.Identity,
ItemCount = (_typeCounts.ContainsKey(CipherType.Identity) ?
_typeCounts[CipherType.Identity] : 0).ToString("N0")
},
new GroupingsPageListItem
{
Type = CipherType.SecureNote,
ItemCount = (_typeCounts.ContainsKey(CipherType.SecureNote) ?
_typeCounts[CipherType.SecureNote] : 0).ToString("N0")
},
2019-05-01 17:31:00 +02:00
});
}
if (NestedFolders?.Any() ?? false)
2019-04-19 22:45:16 +02:00
{
var folderListItems = NestedFolders.Select(f =>
{
var fId = f.Node.Id ?? "none";
return new GroupingsPageListItem
{
Folder = f.Node,
ItemCount = (_folderCounts.ContainsKey(fId) ? _folderCounts[fId] : 0).ToString("N0")
};
}).ToList();
2019-04-22 23:08:37 +02:00
groupedItems.Add(new GroupingsPageListGroup(folderListItems, AppResources.Folders,
folderListItems.Count, uppercaseGroupNames, !MainPage));
2019-04-19 22:45:16 +02:00
}
if (NestedCollections?.Any() ?? false)
2019-04-19 22:45:16 +02:00
{
var collectionListItems = NestedCollections.Select(c => new GroupingsPageListItem
{
Collection = c.Node,
ItemCount = (_collectionCounts.ContainsKey(c.Node.Id) ?
_collectionCounts[c.Node.Id] : 0).ToString("N0")
}).ToList();
2019-04-22 23:08:37 +02:00
groupedItems.Add(new GroupingsPageListGroup(collectionListItems, AppResources.Collections,
collectionListItems.Count, uppercaseGroupNames, !MainPage));
2019-04-19 22:45:16 +02:00
}
if (Ciphers?.Any() ?? false)
{
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
CreateCipherGroupedItems(groupedItems);
}
if (ShowTotp && (!TOTPCiphers?.Any() ?? false))
{
Page.Navigation.PopAsync();
return;
}
if (ShowNoFolderCipherGroup)
{
var noFolderCiphersListItems = NoFolderCiphers.Select(
c => new GroupingsPageListItem { Cipher = c }).ToList();
groupedItems.Add(new GroupingsPageListGroup(noFolderCiphersListItems, AppResources.FolderNone,
noFolderCiphersListItems.Count, uppercaseGroupNames, false));
}
// Ensure this is last in the list (appears at the bottom)
if (MainPage && !Deleted)
{
groupedItems.Add(new GroupingsPageListGroup(new List<GroupingsPageListItem>()
{
new GroupingsPageListItem()
{
IsTrash = true,
ItemCount = _deletedCount.ToString("N0")
}
}, AppResources.Trash, _deletedCount, uppercaseGroupNames, false));
}
2022-07-15 18:35:21 +02:00
// TODO: refactor this
if (Device.RuntimePlatform == Device.Android
||
GroupedItems.Any())
{
var items = new List<IGroupingsPageListItem>();
foreach (var itemGroup in groupedItems)
{
items.Add(new GroupingsPageHeaderListItem(itemGroup.Name, itemGroup.ItemCount));
items.AddRange(itemGroup);
}
if (Device.RuntimePlatform == Device.iOS)
{
// HACK: [PS-536] Fix to avoid blank list after back navigation on unlocking with previous page info
// because of update to XF v5.0.0.2401
GroupedItems.Clear();
}
GroupedItems.ReplaceRange(items);
}
else
{
// HACK: we need this on iOS, so that it doesn't crash when adding coming from an empty list
var first = true;
var items = new List<IGroupingsPageListItem>();
foreach (var itemGroup in groupedItems)
{
if (!first)
{
items.Add(new GroupingsPageHeaderListItem(itemGroup.Name, itemGroup.ItemCount));
}
else
{
first = false;
}
items.AddRange(itemGroup);
}
if (groupedItems.Any())
{
if (Device.RuntimePlatform == Device.iOS)
{
// HACK: [PS-536] Fix to avoid blank list after back navigation on unlocking with previous page info
// because of update to XF v5.0.0.2401
GroupedItems.Clear();
}
GroupedItems.ReplaceRange(new List<IGroupingsPageListItem> { new GroupingsPageHeaderListItem(groupedItems[0].Name, groupedItems[0].ItemCount) });
GroupedItems.AddRange(items);
}
else
{
GroupedItems.Clear();
}
}
2019-03-29 17:52:57 +01:00
}
finally
{
2019-05-29 04:57:59 +02:00
_doingLoad = false;
2019-04-19 22:45:16 +02:00
Loaded = true;
2019-04-25 05:28:41 +02:00
Loading = false;
2019-06-05 19:59:08 +02:00
ShowNoData = (MainPage && !HasCiphers) || !groupedItems.Any();
ShowList = !ShowNoData;
DisableRefreshing();
2019-04-19 22:45:16 +02:00
}
}
private void AddTotpGroupItem(List<GroupingsPageListGroup> groupedItems, bool uppercaseGroupNames)
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
{
if (TOTPCiphers?.Any() == true)
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
{
groupedItems.Insert(0, new GroupingsPageListGroup(
AppResources.Totp, 1, uppercaseGroupNames, false)
{
new GroupingsPageListItem
{
IsTotpCode = true,
Type = CipherType.Login,
ItemCount = TOTPCiphers.Count().ToString("N0")
}
});
}
}
private void CreateCipherGroupedItems(List<GroupingsPageListGroup> groupedItems)
{
var uppercaseGroupNames = Device.RuntimePlatform == Device.iOS;
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
_totpTickCts?.Cancel();
if (ShowTotp)
{
var ciphersListItems = TOTPCiphers.Select(c => new GroupingsPageTOTPListItem(c, true)).ToList();
groupedItems.Add(new GroupingsPageListGroup(ciphersListItems, AppResources.Items,
ciphersListItems.Count, uppercaseGroupNames, !MainPage && !groupedItems.Any()));
StartCiphersTotpTick(ciphersListItems);
}
else
{
var ciphersListItems = Ciphers.Where(c => c.IsDeleted == Deleted)
.Select(c => new GroupingsPageListItem { Cipher = c }).ToList();
groupedItems.Add(new GroupingsPageListGroup(ciphersListItems, AppResources.Items,
ciphersListItems.Count, uppercaseGroupNames, !MainPage && !groupedItems.Any()));
}
}
private void StartCiphersTotpTick(List<GroupingsPageTOTPListItem> ciphersListItems)
{
_totpTickCts?.Cancel();
_totpTickCts = new CancellationTokenSource();
_totpTickTask = new TimerTask(logger, () => ciphersListItems.ForEach(i => i.TotpTickAsync()), _totpTickCts).RunPeriodic();
}
public async Task StopCiphersTotpTick()
{
_totpTickCts?.Cancel();
if (_totpTickTask != null)
{
await _totpTickTask;
}
}
public void DisableRefreshing()
{
Refreshing = false;
SyncRefreshing = false;
}
protected override async Task OnVaultFilterSelectedAsync()
{
await LoadAsync();
}
2019-04-24 17:23:03 +02:00
public async Task SelectCipherAsync(CipherView cipher)
{
var page = new CipherDetailsPage(cipher.Id);
2019-04-24 17:23:03 +02:00
await Page.Navigation.PushModalAsync(new NavigationPage(page));
}
2019-05-01 17:31:00 +02:00
public async Task SelectTypeAsync(CipherType type)
2019-04-19 22:45:16 +02:00
{
string title = null;
switch (type)
2019-04-19 22:45:16 +02:00
{
case CipherType.Login:
title = AppResources.Logins;
break;
case CipherType.SecureNote:
title = AppResources.SecureNotes;
break;
case CipherType.Card:
title = AppResources.Cards;
break;
case CipherType.Identity:
title = AppResources.Identities;
break;
default:
break;
2019-04-19 22:45:16 +02:00
}
var page = new GroupingsPage(false, type, null, null, title, _vaultFilterSelection);
await Page.Navigation.PushAsync(page);
2019-04-19 22:45:16 +02:00
}
public async Task SelectFolderAsync(FolderView folder)
2019-04-19 22:45:16 +02:00
{
var page = new GroupingsPage(false, null, folder.Id ?? "none", null, folder.Name, _vaultFilterSelection);
await Page.Navigation.PushAsync(page);
}
public async Task SelectCollectionAsync(Core.Models.View.CollectionView collection)
{
var page = new GroupingsPage(false, null, null, collection.Id, collection.Name, _vaultFilterSelection);
await Page.Navigation.PushAsync(page);
2019-04-19 22:45:16 +02:00
}
2019-03-29 17:52:57 +01:00
public async Task SelectTrashAsync()
{
var page = new GroupingsPage(false, null, null, null, AppResources.Trash, _vaultFilterSelection, null,
true);
await Page.Navigation.PushAsync(page);
}
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
public async Task SelectTotpCodesAsync()
{
var page = new GroupingsPage(false, CipherType.Login, null, null, AppResources.VerificationCodes, _vaultFilterSelection, null,
false, true);
await Page.Navigation.PushAsync(page);
}
2019-05-30 06:29:00 +02:00
public async Task ExitAsync()
{
var confirmed = await _platformUtilsService.ShowDialogAsync(AppResources.ExitConfirmation,
AppResources.Exit, AppResources.Yes, AppResources.Cancel);
if (confirmed)
2019-05-30 06:29:00 +02:00
{
_messagingService.Send("exit");
}
}
public async Task SyncAsync()
{
if (Xamarin.Essentials.Connectivity.NetworkAccess == Xamarin.Essentials.NetworkAccess.None)
{
await _platformUtilsService.ShowDialogAsync(AppResources.InternetConnectionRequiredMessage,
AppResources.InternetConnectionRequiredTitle);
return;
}
2019-05-30 06:29:00 +02:00
await _deviceActionService.ShowLoadingAsync(AppResources.Syncing);
2019-10-15 17:05:56 +02:00
try
{
await _syncService.FullSyncAsync(false, true);
await _deviceActionService.HideLoadingAsync();
_platformUtilsService.ShowToast("success", null, AppResources.SyncingComplete);
}
catch
{
await _deviceActionService.HideLoadingAsync();
_platformUtilsService.ShowToast("error", null, AppResources.SyncingFailed);
}
2019-05-30 06:29:00 +02:00
}
private async Task LoadDataAsync()
2019-04-19 22:45:16 +02:00
{
var canAccessPremium = await _stateService.CanAccessPremiumAsync();
2019-04-25 05:28:41 +02:00
NoDataText = AppResources.NoItems;
_allCiphers = await GetAllCiphersAsync();
2019-06-05 06:29:49 +02:00
HasCiphers = _allCiphers.Any();
TOTPCiphers = _allCiphers.Where(c => c.IsDeleted == Deleted && c.Type == CipherType.Login && !string.IsNullOrEmpty(c.Login?.Totp) && (c.OrganizationUseTotp || canAccessPremium)).ToList();
2019-05-01 18:28:49 +02:00
FavoriteCiphers?.Clear();
NoFolderCiphers?.Clear();
_folderCounts.Clear();
_collectionCounts.Clear();
_typeCounts.Clear();
2019-06-05 06:29:49 +02:00
HasFolders = false;
2019-06-05 19:59:08 +02:00
HasCollections = false;
2019-05-07 04:35:42 +02:00
Filter = null;
_deletedCount = 0;
2019-05-01 18:28:49 +02:00
if (MainPage)
2019-04-19 22:45:16 +02:00
{
await FillFoldersAndCollectionsAsync();
NestedFolders = await _folderService.GetAllNestedAsync(Folders);
HasFolders = NestedFolders.Any(f => f.Node?.Id != null);
NestedCollections = Collections != null ? await _collectionService.GetAllNestedAsync(Collections) : null;
HasCollections = NestedCollections?.Any() ?? false;
}
else
{
if (Deleted)
{
Filter = c => c.IsDeleted;
NoDataText = AppResources.NoItemsTrash;
}
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
else if (ShowTotp)
{
Filter = c => c.Type == CipherType.Login && !c.IsDeleted && !string.IsNullOrEmpty(c.Login?.Totp);
}
else if (Type != null)
2019-04-19 22:45:16 +02:00
{
Filter = c => c.Type == Type.Value && !c.IsDeleted;
}
else if (FolderId != null)
{
2019-04-25 05:28:41 +02:00
NoDataText = AppResources.NoItemsFolder;
2019-04-30 15:55:28 +02:00
var folderId = FolderId == "none" ? null : FolderId;
if (folderId != null)
{
2019-04-30 15:55:28 +02:00
var folderNode = await _folderService.GetNestedAsync(folderId);
if (folderNode?.Node != null)
{
PageTitle = folderNode.Node.Name;
NestedFolders = (folderNode.Children?.Count ?? 0) > 0 ? folderNode.Children : null;
}
}
else
2019-04-19 22:45:16 +02:00
{
PageTitle = AppResources.FolderNone;
2019-04-19 22:45:16 +02:00
}
Filter = c => c.FolderId == folderId && !c.IsDeleted;
}
else if (CollectionId != null)
{
2019-04-25 05:28:41 +02:00
ShowAddCipherButton = false;
NoDataText = AppResources.NoItemsCollection;
var collectionNode = await _collectionService.GetNestedAsync(CollectionId);
if (collectionNode?.Node != null)
{
PageTitle = collectionNode.Node.Name;
NestedCollections = (collectionNode.Children?.Count ?? 0) > 0 ? collectionNode.Children : null;
}
Filter = c => c.CollectionIds?.Contains(CollectionId) ?? false && !c.IsDeleted;
}
else
{
PageTitle = AppResources.AllItems;
2019-04-19 22:45:16 +02:00
}
2019-05-07 04:35:42 +02:00
Ciphers = Filter != null ? _allCiphers.Where(Filter).ToList() : _allCiphers;
2019-04-19 22:45:16 +02:00
}
2019-05-01 18:28:49 +02:00
foreach (var c in _allCiphers)
2019-05-01 18:28:49 +02:00
{
if (MainPage)
2019-05-01 18:28:49 +02:00
{
if (c.IsDeleted)
{
_deletedCount++;
continue;
}
if (c.Favorite)
2019-05-01 18:28:49 +02:00
{
if (FavoriteCiphers == null)
2019-05-01 18:28:49 +02:00
{
FavoriteCiphers = new List<CipherView>();
}
FavoriteCiphers.Add(c);
}
if (c.FolderId == null)
2019-05-01 18:28:49 +02:00
{
if (NoFolderCiphers == null)
2019-05-01 18:28:49 +02:00
{
NoFolderCiphers = new List<CipherView>();
}
NoFolderCiphers.Add(c);
}
if (_typeCounts.ContainsKey(c.Type))
2019-05-01 18:28:49 +02:00
{
_typeCounts[c.Type] = _typeCounts[c.Type] + 1;
}
else
{
_typeCounts.Add(c.Type, 1);
}
}
if (c.IsDeleted)
{
continue;
}
2019-05-01 18:28:49 +02:00
var fId = c.FolderId ?? "none";
if (_folderCounts.ContainsKey(fId))
2019-05-01 18:28:49 +02:00
{
_folderCounts[fId] = _folderCounts[fId] + 1;
}
else
{
_folderCounts.Add(fId, 1);
}
if (c.CollectionIds != null)
2019-05-01 18:28:49 +02:00
{
foreach (var colId in c.CollectionIds)
2019-05-01 18:28:49 +02:00
{
if (_collectionCounts.ContainsKey(colId))
2019-05-01 18:28:49 +02:00
{
_collectionCounts[colId] = _collectionCounts[colId] + 1;
}
else
{
_collectionCounts.Add(colId, 1);
}
}
}
}
2019-03-29 04:52:33 +01:00
}
2019-04-30 17:27:53 +02:00
private async Task FillFoldersAndCollectionsAsync()
{
var orgId = GetVaultFilterOrgId();
var decFolders = await _folderService.GetAllDecryptedAsync();
var decCollections = await _collectionService.GetAllDecryptedAsync();
if (IsVaultFilterMyVault)
{
Folders = BuildFolders(decFolders);
Collections = null;
}
else if (IsVaultFilterOrgVault && !string.IsNullOrWhiteSpace(orgId))
{
Folders = BuildFolders(decFolders);
Collections = decCollections?.Where(c => c.OrganizationId == orgId).ToList();
}
else
{
Folders = decFolders;
Collections = decCollections;
}
}
private List<FolderView> BuildFolders(List<FolderView> decFolders)
{
var folders = decFolders.Where(f => _allCiphers.Any(c => c.FolderId == f.Id)).ToList();
return folders.Any() ? folders : null;
}
2019-03-29 04:52:33 +01:00
}
}