From 04539af2a66668b6e85476d5cf318c9150ec4357 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Tue, 26 Apr 2022 17:21:17 +0200 Subject: [PATCH] Run dotnet format (#1738) --- src/App/Abstractions/IDeviceActionService.cs | 4 +- .../Abstractions/IPasswordRepromptService.cs | 2 +- .../IPushNotificationListenerService.cs | 4 +- src/App/App.xaml.cs | 10 +- .../AccountSwitchingOverlayView.xaml.cs | 2 +- .../AccountSwitchingOverlayViewModel.cs | 4 +- .../AccountViewCell/AccountViewCell.xaml.cs | 2 +- src/App/Controls/AvatarImageSource.cs | 4 +- src/App/Controls/ExtendedStepper.cs | 4 +- .../SendViewCell/SendViewCell.xaml.cs | 4 +- src/App/Effects/FabShadowEffect.cs | 4 +- .../Accounts/BaseChangePasswordViewModel.cs | 14 +-- .../Pages/Accounts/EnvironmentPage.xaml.cs | 6 +- .../Accounts/EnvironmentPageViewModel.cs | 6 +- src/App/Pages/Accounts/HintPageViewModel.cs | 4 +- src/App/Pages/Accounts/HomePage.xaml.cs | 6 +- src/App/Pages/Accounts/LockPageViewModel.cs | 2 +- src/App/Pages/Accounts/LoginPage.xaml.cs | 2 +- src/App/Pages/Accounts/LoginPageViewModel.cs | 2 +- src/App/Pages/Accounts/LoginSsoPage.xaml.cs | 10 +- .../Pages/Accounts/LoginSsoPageViewModel.cs | 12 +-- src/App/Pages/Accounts/RegisterPage.xaml.cs | 2 +- .../Pages/Accounts/RegisterPageViewModel.cs | 24 ++--- .../Accounts/SetPasswordPageViewModel.cs | 20 ++-- src/App/Pages/Accounts/TwoFactorPage.xaml.cs | 16 ++-- .../Pages/Accounts/TwoFactorPageViewModel.cs | 24 ++--- .../Accounts/UpdateTempPasswordPage.xaml.cs | 16 ++-- .../UpdateTempPasswordPageViewModel.cs | 18 ++-- .../Accounts/VerificationCodeViewModel.cs | 4 +- src/App/Pages/BaseContentPage.cs | 4 +- src/App/Pages/CaptchaProtectedViewModel.cs | 2 +- .../Generator/GeneratorHistoryPage.xaml.cs | 3 +- src/App/Pages/Generator/GeneratorPage.xaml.cs | 4 +- .../Pages/Generator/GeneratorPageViewModel.cs | 8 +- src/App/Pages/Send/SendAddEditPage.xaml.cs | 6 +- .../Pages/Send/SendAddEditPageViewModel.cs | 10 +- .../SendGroupingsPage.xaml.cs | 6 +- .../SendGroupingsPageHeaderListItem.cs | 2 +- .../SendGroupingsPageViewModel.cs | 2 +- src/App/Pages/Send/SendsPageViewModel.cs | 8 +- .../Settings/AutofillServicesPage.xaml.cs | 6 +- .../Settings/AutofillServicesPageViewModel.cs | 32 +++---- .../Settings/ExportVaultPageViewModel.cs | 6 +- .../Pages/Settings/ExtensionPageViewModel.cs | 4 +- .../Pages/Settings/FolderAddEditPage.xaml.cs | 4 +- .../Settings/FolderAddEditPageViewModel.cs | 4 +- src/App/Pages/Settings/FoldersPage.xaml.cs | 4 +- .../Pages/Settings/FoldersPageViewModel.cs | 8 +- .../Pages/Settings/OptionsPageViewModel.cs | 6 +- .../SettingsPage/SettingsPage.xaml.cs | 2 +- .../SettingsPage/SettingsPageViewModel.cs | 14 +-- src/App/Pages/Settings/SyncPageViewModel.cs | 4 +- src/App/Pages/TabsPage.cs | 4 +- src/App/Pages/Vault/AddEditPage.xaml.cs | 6 +- src/App/Pages/Vault/AddEditPageViewModel.cs | 12 +-- src/App/Pages/Vault/AttachmentsPage.xaml.cs | 4 +- .../Pages/Vault/AttachmentsPageViewModel.cs | 8 +- .../Pages/Vault/AutofillCiphersPage.xaml.cs | 14 +-- .../Vault/AutofillCiphersPageViewModel.cs | 12 +-- src/App/Pages/Vault/CiphersPage.xaml.cs | 8 +- src/App/Pages/Vault/CiphersPageViewModel.cs | 14 +-- .../Pages/Vault/CollectionsPageViewModel.cs | 8 +- .../Vault/GroupingsPage/GroupingsPage.xaml.cs | 4 +- .../Pages/Vault/PasswordHistoryPage.xaml.cs | 3 +- .../Vault/PasswordHistoryPageViewModel.cs | 6 +- src/App/Pages/Vault/SharePageViewModel.cs | 8 +- src/App/Pages/Vault/ViewPage.xaml.cs | 6 +- src/App/Pages/Vault/ViewPageViewModel.cs | 10 +- src/App/Services/MobileI18nService.cs | 6 +- .../Services/MobilePasswordRepromptService.cs | 4 +- .../Services/MobilePlatformUtilsService.cs | 2 +- src/App/Services/MobileStorageService.cs | 6 +- .../NoopPushNotificationListenerService.cs | 4 +- src/App/Services/PreferencesStorageService.cs | 8 +- .../PushNotificationListenerService.cs | 20 ++-- src/App/Services/SecureStorageService.cs | 4 +- src/App/Styles/Android.xaml.cs | 2 +- src/App/Styles/Black.xaml.cs | 2 +- src/App/Styles/Dark.xaml.cs | 2 +- src/App/Styles/Light.xaml.cs | 2 +- src/App/Styles/Nord.xaml.cs | 2 +- src/App/Styles/Variables.xaml.cs | 2 +- src/App/Styles/iOS.xaml.cs | 2 +- src/App/Utilities/AppHelpers.cs | 20 ++-- src/App/Utilities/I18nExtension.cs | 4 +- src/App/Utilities/PasswordFormatter.cs | 8 +- src/Core/Abstractions/IApiService.cs | 8 +- src/Core/Abstractions/IAuditService.cs | 2 +- src/Core/Abstractions/IBroadcasterService.cs | 6 +- src/Core/Abstractions/ICipherService.cs | 2 +- .../Abstractions/ICryptoFunctionService.cs | 4 +- src/Core/Abstractions/IEnvironmentService.cs | 2 +- src/Core/Abstractions/IExportService.cs | 2 +- src/Core/Abstractions/IFileUploadService.cs | 8 +- src/Core/Abstractions/IMessagingService.cs | 2 +- src/Core/Abstractions/INativeLogService.cs | 2 +- src/Core/Abstractions/IPolicyService.cs | 2 +- src/Core/Abstractions/ISendService.cs | 2 +- src/Core/Abstractions/ITotpService.cs | 2 +- src/Core/BitwardenIcons.cs | 2 +- src/Core/Constants.cs | 6 +- src/Core/Enums/ClientType.cs | 2 +- src/Core/Enums/HdkfAlgorithm.cs | 2 +- src/Core/Enums/LinkedIdType.cs | 7 +- src/Core/Enums/SendType.cs | 2 +- src/Core/Exceptions/ApiException.cs | 4 +- src/Core/Models/Api/SendFileApi.cs | 2 +- src/Core/Models/Api/SendTextApi.cs | 2 +- src/Core/Models/Data/CipherData.cs | 4 +- src/Core/Models/Data/EventData.cs | 4 +- src/Core/Models/Data/FolderData.cs | 4 +- src/Core/Models/Data/LoginData.cs | 4 +- src/Core/Models/Data/PasswordHistoryData.cs | 4 +- src/Core/Models/Data/Permissions.cs | 2 +- src/Core/Models/Data/SendData.cs | 4 +- src/Core/Models/Data/SendFileData.cs | 2 +- src/Core/Models/Data/SendTextData.cs | 2 +- src/Core/Models/Domain/Attachment.cs | 8 +- src/Core/Models/Domain/AuthResult.cs | 4 +- src/Core/Models/Domain/Card.cs | 6 +- src/Core/Models/Domain/Cipher.cs | 8 +- src/Core/Models/Domain/Collection.cs | 6 +- src/Core/Models/Domain/EncByteArray.cs | 2 +- src/Core/Models/Domain/EncString.cs | 6 +- src/Core/Models/Domain/Field.cs | 6 +- src/Core/Models/Domain/Folder.cs | 6 +- src/Core/Models/Domain/Identity.cs | 6 +- src/Core/Models/Domain/Login.cs | 6 +- src/Core/Models/Domain/LoginUri.cs | 6 +- src/Core/Models/Domain/PasswordHistory.cs | 6 +- src/Core/Models/Domain/Policy.cs | 2 +- .../Domain/ResetPasswordPolicyOptions.cs | 2 +- src/Core/Models/Domain/SecureNote.cs | 4 +- src/Core/Models/Domain/Send.cs | 2 +- src/Core/Models/Domain/SendFile.cs | 2 +- src/Core/Models/Domain/SendText.cs | 2 +- src/Core/Models/Domain/SymmetricCryptoKey.cs | 4 +- src/Core/Models/Export/CollectionWithId.cs | 2 +- .../Models/Request/CipherCreateRequest.cs | 4 +- src/Core/Models/Request/CipherRequest.cs | 8 +- src/Core/Models/Request/CipherShareRequest.cs | 4 +- src/Core/Models/Request/EventRequest.cs | 4 +- ...ationUserResetPasswordEnrollmentRequest.cs | 2 +- src/Core/Models/Request/SendRequest.cs | 4 +- src/Core/Models/Request/TokenRequest.cs | 6 +- .../Response/AttachmentUploadDataReponse.cs | 2 +- src/Core/Models/Response/CipherResponse.cs | 6 +- src/Core/Models/Response/ErrorResponse.cs | 4 +- .../Response/IdentityCaptchaResponse.cs | 4 +- src/Core/Models/Response/IdentityResponse.cs | 2 +- .../Response/IdentityTwoFactorResponse.cs | 4 +- .../Models/Response/NotificationResponse.cs | 4 +- .../OrganizationAutoEnrollStatusResponse.cs | 2 +- .../Response/OrganizationKeysResponse.cs | 2 +- src/Core/Models/Response/SendResponse.cs | 2 +- src/Core/Models/View/CardView.cs | 6 +- src/Core/Models/View/CipherView.cs | 6 +- src/Core/Models/View/FolderView.cs | 4 +- src/Core/Models/View/IdentityView.cs | 4 +- src/Core/Models/View/ItemView.cs | 2 +- src/Core/Models/View/LoginUriView.cs | 8 +- src/Core/Models/View/LoginView.cs | 6 +- src/Core/Models/View/PasswordHistoryView.cs | 6 +- src/Core/Models/View/SecureNoteView.cs | 4 +- src/Core/Models/View/SendFileView.cs | 2 +- src/Core/Models/View/SendTextView.cs | 2 +- src/Core/Models/View/SendView.cs | 2 +- src/Core/Services/ApiService.cs | 22 ++--- src/Core/Services/AppIdService.cs | 4 +- src/Core/Services/AuditService.cs | 8 +- src/Core/Services/AuthService.cs | 8 +- src/Core/Services/AzureFileUploadService.cs | 92 +++++++++---------- .../Services/BitwardenFileUploadService.cs | 2 +- src/Core/Services/BroadcasterService.cs | 6 +- src/Core/Services/CipherService.cs | 18 ++-- src/Core/Services/CollectionService.cs | 12 +-- src/Core/Services/ConsoleLogService.cs | 4 +- src/Core/Services/CryptoService.cs | 14 +-- src/Core/Services/EventService.cs | 10 +- src/Core/Services/FileUploadService.cs | 10 +- src/Core/Services/FolderService.cs | 12 +-- src/Core/Services/InMemoryStorageService.cs | 6 +- src/Core/Services/KeyConnectorService.cs | 2 +- src/Core/Services/LiteDbStorageService.cs | 6 +- src/Core/Services/OrganizationService.cs | 8 +- .../Services/PasswordGenerationService.cs | 22 ++--- src/Core/Services/PclCryptoFunctionService.cs | 8 +- src/Core/Services/PolicyService.cs | 2 +- src/Core/Services/SearchService.cs | 6 +- src/Core/Services/SendService.cs | 11 ++- src/Core/Services/SettingsService.cs | 6 +- src/Core/Services/StateMigrationService.cs | 2 +- src/Core/Services/StateService.cs | 8 +- src/Core/Services/SyncService.cs | 12 +-- src/Core/Services/TokenService.cs | 10 +- src/Core/Services/TotpService.cs | 6 +- src/Core/Services/VaultTimeoutService.cs | 23 +++-- src/Core/Utilities/CoreHelpers.cs | 8 +- src/Core/Utilities/ExtendedViewModel.cs | 2 +- src/Core/Utilities/ServiceContainer.cs | 24 ++--- store/google/Publisher/Program.cs | 10 +- .../Attributes/AutoSubDataAttribute.cs | 2 +- .../Attributes/CustomAutoDataAttribute.cs | 2 +- .../Attributes/InlineAutoSubDataAttribute.cs | 2 +- .../InlineCustomAutoDataAttribute.cs | 6 +- .../Attributes/InlineSutAutoDataAttribute.cs | 2 +- .../Attributes/SutAutoDataAttribute.cs | 2 +- test/Common/AutoFixture/FixtureExtensions.cs | 2 +- test/Common/AutoFixture/ISutProvider.cs | 2 +- test/Common/AutoFixture/SutProvider.cs | 6 +- .../AutoFixture/SutProviderCustomization.cs | 2 +- test/Common/TestHelper.cs | 6 +- .../Cipher/CipherCustomizations.cs | 2 +- .../Domain/SymmetricCryptoKeyCustomization.cs | 2 +- .../AutoFixture/Send/SendCustomizations.cs | 4 +- test/Core.Test/Models/Data/SendDataTests.cs | 2 +- test/Core.Test/Models/Domain/SendTests.cs | 12 +-- .../Models/Request/SendRequestTests.cs | 2 +- test/Core.Test/Services/CipherServiceTests.cs | 6 +- .../Services/CryptoFunctionServiceTests.cs | 12 +-- test/Core.Test/Services/SendServiceTests.cs | 22 ++--- test/Playground/Program.cs | 4 +- 222 files changed, 723 insertions(+), 706 deletions(-) diff --git a/src/App/Abstractions/IDeviceActionService.cs b/src/App/Abstractions/IDeviceActionService.cs index 350f791db..28eb7b712 100644 --- a/src/App/Abstractions/IDeviceActionService.cs +++ b/src/App/Abstractions/IDeviceActionService.cs @@ -1,6 +1,6 @@ -using Bit.Core.Enums; +using System.Threading.Tasks; +using Bit.Core.Enums; using Bit.Core.Models.View; -using System.Threading.Tasks; namespace Bit.App.Abstractions { diff --git a/src/App/Abstractions/IPasswordRepromptService.cs b/src/App/Abstractions/IPasswordRepromptService.cs index 6acd0ddd2..579d9ab44 100644 --- a/src/App/Abstractions/IPasswordRepromptService.cs +++ b/src/App/Abstractions/IPasswordRepromptService.cs @@ -7,7 +7,7 @@ namespace Bit.App.Abstractions string[] ProtectedFields { get; } Task ShowPasswordPromptAsync(); - + Task<(string password, bool valid)> ShowPasswordPromptAndGetItAsync(); Task Enabled(); diff --git a/src/App/Abstractions/IPushNotificationListenerService.cs b/src/App/Abstractions/IPushNotificationListenerService.cs index 65104a1c9..4a57c75a5 100644 --- a/src/App/Abstractions/IPushNotificationListenerService.cs +++ b/src/App/Abstractions/IPushNotificationListenerService.cs @@ -1,5 +1,5 @@ -using Newtonsoft.Json.Linq; -using System.Threading.Tasks; +using System.Threading.Tasks; +using Newtonsoft.Json.Linq; namespace Bit.App.Abstractions { diff --git a/src/App/App.xaml.cs b/src/App/App.xaml.cs index 8391cbf4b..bf6736836 100644 --- a/src/App/App.xaml.cs +++ b/src/App/App.xaml.cs @@ -1,15 +1,15 @@ -using Bit.App.Abstractions; +using System; +using System.Threading.Tasks; +using Bit.App.Abstractions; using Bit.App.Models; using Bit.App.Pages; using Bit.App.Resources; using Bit.App.Services; using Bit.App.Utilities; using Bit.Core.Abstractions; +using Bit.Core.Enums; using Bit.Core.Models.Data; using Bit.Core.Utilities; -using System; -using System.Threading.Tasks; -using Bit.Core.Enums; using Xamarin.Forms; using Xamarin.Forms.Xaml; @@ -318,7 +318,7 @@ namespace Bit.App Options.HideAccountSwitcher = await _stateService.GetActiveUserIdAsync() == null; Current.MainPage = new NavigationPage(new LoginPage(email, Options)); } - else if (await _vaultTimeoutService.IsLockedAsync() || + else if (await _vaultTimeoutService.IsLockedAsync() || await _vaultTimeoutService.ShouldLockAsync()) { Current.MainPage = new NavigationPage(new LockPage(Options)); diff --git a/src/App/Controls/AccountSwitchingOverlay/AccountSwitchingOverlayView.xaml.cs b/src/App/Controls/AccountSwitchingOverlay/AccountSwitchingOverlayView.xaml.cs index 33b07ec8e..8096f9e19 100644 --- a/src/App/Controls/AccountSwitchingOverlay/AccountSwitchingOverlayView.xaml.cs +++ b/src/App/Controls/AccountSwitchingOverlay/AccountSwitchingOverlayView.xaml.cs @@ -99,7 +99,7 @@ namespace Bit.App.Controls Opacity = 0; IsVisible = true; this.FadeTo(1, 100); - + if (Device.RuntimePlatform == Device.Android && MainFab != null) { // start fab fade-out diff --git a/src/App/Controls/AccountSwitchingOverlay/AccountSwitchingOverlayViewModel.cs b/src/App/Controls/AccountSwitchingOverlay/AccountSwitchingOverlayViewModel.cs index 496496035..3f789b4d1 100644 --- a/src/App/Controls/AccountSwitchingOverlay/AccountSwitchingOverlayViewModel.cs +++ b/src/App/Controls/AccountSwitchingOverlay/AccountSwitchingOverlayViewModel.cs @@ -22,11 +22,11 @@ namespace Bit.App.Controls { _stateService = stateService; _messagingService = messagingService; - + SelectAccountCommand = new AsyncCommand(SelectAccountAsync, onException: ex => logger.Exception(ex), allowsMultipleExecutions: false); - + LongPressAccountCommand = new AsyncCommand>(LongPressAccountAsync, onException: ex => logger.Exception(ex), allowsMultipleExecutions: false); diff --git a/src/App/Controls/AccountViewCell/AccountViewCell.xaml.cs b/src/App/Controls/AccountViewCell/AccountViewCell.xaml.cs index 3bf27bcb6..fa38816a5 100644 --- a/src/App/Controls/AccountViewCell/AccountViewCell.xaml.cs +++ b/src/App/Controls/AccountViewCell/AccountViewCell.xaml.cs @@ -1,5 +1,5 @@ +using System.Windows.Input; using Bit.Core.Models.View; -using System.Windows.Input; using Xamarin.Forms; namespace Bit.App.Controls diff --git a/src/App/Controls/AvatarImageSource.cs b/src/App/Controls/AvatarImageSource.cs index 19138c853..fd9a86308 100644 --- a/src/App/Controls/AvatarImageSource.cs +++ b/src/App/Controls/AvatarImageSource.cs @@ -112,13 +112,13 @@ namespace Bit.App.Controls private string GetFirstLetters(string data, int charCount) { - var parts = data.Split(); + var parts = data.Split(); if (parts.Length > 1 && charCount <= 2) { var text = ""; for (int i = 0; i < charCount; i++) { - text += parts[i].Substring(0,1); + text += parts[i].Substring(0, 1); } return text; } diff --git a/src/App/Controls/ExtendedStepper.cs b/src/App/Controls/ExtendedStepper.cs index 68191ae20..88103eed5 100644 --- a/src/App/Controls/ExtendedStepper.cs +++ b/src/App/Controls/ExtendedStepper.cs @@ -6,7 +6,7 @@ namespace Bit.App.Controls { public static readonly BindableProperty StepperBackgroundColorProperty = BindableProperty.Create( nameof(StepperBackgroundColor), typeof(Color), typeof(ExtendedStepper), Color.Default); - + public static readonly BindableProperty StepperForegroundColorProperty = BindableProperty.Create( nameof(StepperForegroundColor), typeof(Color), typeof(ExtendedStepper), Color.Default); @@ -15,7 +15,7 @@ namespace Bit.App.Controls get => (Color)GetValue(StepperBackgroundColorProperty); set => SetValue(StepperBackgroundColorProperty, value); } - + public Color StepperForegroundColor { get => (Color)GetValue(StepperForegroundColorProperty); diff --git a/src/App/Controls/SendViewCell/SendViewCell.xaml.cs b/src/App/Controls/SendViewCell/SendViewCell.xaml.cs index 0b01c1004..094ac4521 100644 --- a/src/App/Controls/SendViewCell/SendViewCell.xaml.cs +++ b/src/App/Controls/SendViewCell/SendViewCell.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using Bit.App.Abstractions; using Bit.Core.Models.View; using Bit.Core.Utilities; @@ -13,7 +13,7 @@ namespace Bit.App.Controls public static readonly BindableProperty ButtonCommandProperty = BindableProperty.Create( nameof(ButtonCommand), typeof(Command), typeof(SendViewCell)); - + public static readonly BindableProperty ShowOptionsProperty = BindableProperty.Create( nameof(ShowOptions), typeof(bool), typeof(SendViewCell), true, BindingMode.OneWay); diff --git a/src/App/Effects/FabShadowEffect.cs b/src/App/Effects/FabShadowEffect.cs index 3e75d85d9..1ee706891 100644 --- a/src/App/Effects/FabShadowEffect.cs +++ b/src/App/Effects/FabShadowEffect.cs @@ -4,8 +4,8 @@ namespace Bit.App.Effects { public class FabShadowEffect : RoutingEffect { - public FabShadowEffect() - : base("Bitwarden.FabShadowEffect") + public FabShadowEffect() + : base("Bitwarden.FabShadowEffect") { } } } diff --git a/src/App/Pages/Accounts/BaseChangePasswordViewModel.cs b/src/App/Pages/Accounts/BaseChangePasswordViewModel.cs index 9a6896428..96443341f 100644 --- a/src/App/Pages/Accounts/BaseChangePasswordViewModel.cs +++ b/src/App/Pages/Accounts/BaseChangePasswordViewModel.cs @@ -1,12 +1,12 @@ -using Bit.App.Resources; -using Bit.Core.Abstractions; -using Bit.Core.Utilities; -using System.Collections.Generic; +using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using Bit.App.Abstractions; +using Bit.App.Resources; +using Bit.Core.Abstractions; using Bit.Core.Models.Domain; +using Bit.Core.Utilities; using Xamarin.Essentials; namespace Bit.App.Pages @@ -66,7 +66,7 @@ namespace Bit.App.Pages get => _policy; set => SetProperty(ref _policy, value); } - + public string ShowPasswordIcon => ShowPassword ? "" : ""; public string MasterPassword { get; set; } public string ConfirmMasterPassword { get; set; } @@ -84,7 +84,7 @@ namespace Bit.App.Pages await CheckPasswordPolicy(); } } - + private async Task CheckPasswordPolicy() { Policy = await _policyService.GetMasterPasswordPolicyOptions(); @@ -166,7 +166,7 @@ namespace Bit.App.Pages AppResources.AnErrorHasOccurred, AppResources.Ok); return false; } - + return true; } diff --git a/src/App/Pages/Accounts/EnvironmentPage.xaml.cs b/src/App/Pages/Accounts/EnvironmentPage.xaml.cs index 1f631af71..b57d2f440 100644 --- a/src/App/Pages/Accounts/EnvironmentPage.xaml.cs +++ b/src/App/Pages/Accounts/EnvironmentPage.xaml.cs @@ -1,8 +1,8 @@ -using Bit.Core.Abstractions; -using Bit.Core.Utilities; -using System; +using System; using System.Threading.Tasks; using Bit.App.Resources; +using Bit.Core.Abstractions; +using Bit.Core.Utilities; using Xamarin.Forms; namespace Bit.App.Pages diff --git a/src/App/Pages/Accounts/EnvironmentPageViewModel.cs b/src/App/Pages/Accounts/EnvironmentPageViewModel.cs index c47491668..b25113c41 100644 --- a/src/App/Pages/Accounts/EnvironmentPageViewModel.cs +++ b/src/App/Pages/Accounts/EnvironmentPageViewModel.cs @@ -1,8 +1,8 @@ -using Bit.App.Resources; +using System; +using System.Threading.Tasks; +using Bit.App.Resources; using Bit.Core.Abstractions; using Bit.Core.Utilities; -using System; -using System.Threading.Tasks; using Xamarin.Forms; namespace Bit.App.Pages diff --git a/src/App/Pages/Accounts/HintPageViewModel.cs b/src/App/Pages/Accounts/HintPageViewModel.cs index cb316759f..b074012e8 100644 --- a/src/App/Pages/Accounts/HintPageViewModel.cs +++ b/src/App/Pages/Accounts/HintPageViewModel.cs @@ -1,9 +1,9 @@ -using Bit.App.Abstractions; +using System.Threading.Tasks; +using Bit.App.Abstractions; using Bit.App.Resources; using Bit.Core.Abstractions; using Bit.Core.Exceptions; using Bit.Core.Utilities; -using System.Threading.Tasks; using Xamarin.Forms; namespace Bit.App.Pages diff --git a/src/App/Pages/Accounts/HomePage.xaml.cs b/src/App/Pages/Accounts/HomePage.xaml.cs index 9963523c2..d63413216 100644 --- a/src/App/Pages/Accounts/HomePage.xaml.cs +++ b/src/App/Pages/Accounts/HomePage.xaml.cs @@ -87,7 +87,7 @@ namespace Bit.App.Pages { _logo.Source = !ThemeManager.UsingLightTheme ? "logo_white.png" : "logo.png"; } - + private void Cancel_Clicked(object sender, EventArgs e) { if (DoOnce()) @@ -117,7 +117,7 @@ namespace Bit.App.Pages _vm.StartRegisterAction(); } } - + private async Task StartRegisterAsync() { var page = new RegisterPage(this); @@ -145,7 +145,7 @@ namespace Bit.App.Pages _vm.StartEnvironmentAction(); } } - + private async Task StartEnvironmentAsync() { await _accountListOverlay.HideAsync(); diff --git a/src/App/Pages/Accounts/LockPageViewModel.cs b/src/App/Pages/Accounts/LockPageViewModel.cs index a4515c01b..727a59cf9 100644 --- a/src/App/Pages/Accounts/LockPageViewModel.cs +++ b/src/App/Pages/Accounts/LockPageViewModel.cs @@ -272,7 +272,7 @@ namespace Bit.App.Pages var key = await _cryptoService.MakeKeyAsync(MasterPassword, _email, kdf, kdfIterations); var storedKeyHash = await _cryptoService.GetKeyHashAsync(); var passwordValid = false; - + if (storedKeyHash != null) { passwordValid = await _cryptoService.CompareAndUpdateKeyHashAsync(MasterPassword, key); diff --git a/src/App/Pages/Accounts/LoginPage.xaml.cs b/src/App/Pages/Accounts/LoginPage.xaml.cs index e6acef02e..22e3f49e2 100644 --- a/src/App/Pages/Accounts/LoginPage.xaml.cs +++ b/src/App/Pages/Accounts/LoginPage.xaml.cs @@ -177,7 +177,7 @@ namespace Bit.App.Pages var previousPage = await AppHelpers.ClearPreviousPage(); Application.Current.MainPage = new TabsPage(_appOptions, previousPage); } - + private async Task UpdateTempPasswordAsync() { var page = new UpdateTempPasswordPage(); diff --git a/src/App/Pages/Accounts/LoginPageViewModel.cs b/src/App/Pages/Accounts/LoginPageViewModel.cs index 709d7cc80..a895e39a6 100644 --- a/src/App/Pages/Accounts/LoginPageViewModel.cs +++ b/src/App/Pages/Accounts/LoginPageViewModel.cs @@ -67,7 +67,7 @@ namespace Bit.App.Pages get => _showCancelButton; set => SetProperty(ref _showCancelButton, value); } - + public string Email { get => _email; diff --git a/src/App/Pages/Accounts/LoginSsoPage.xaml.cs b/src/App/Pages/Accounts/LoginSsoPage.xaml.cs index f89dfbaa7..5b7878e55 100644 --- a/src/App/Pages/Accounts/LoginSsoPage.xaml.cs +++ b/src/App/Pages/Accounts/LoginSsoPage.xaml.cs @@ -1,9 +1,9 @@ -using Bit.App.Models; +using System; +using System.Threading.Tasks; +using Bit.App.Models; +using Bit.App.Utilities; using Bit.Core.Abstractions; using Bit.Core.Utilities; -using System; -using System.Threading.Tasks; -using Bit.App.Utilities; using Xamarin.Forms; namespace Bit.App.Pages @@ -99,7 +99,7 @@ namespace Bit.App.Pages var page = new SetPasswordPage(_appOptions, _vm.OrgIdentifier); await Navigation.PushModalAsync(new NavigationPage(page)); } - + private async Task UpdateTempPasswordAsync() { var page = new UpdateTempPasswordPage(); diff --git a/src/App/Pages/Accounts/LoginSsoPageViewModel.cs b/src/App/Pages/Accounts/LoginSsoPageViewModel.cs index 4c7d34595..66145457a 100644 --- a/src/App/Pages/Accounts/LoginSsoPageViewModel.cs +++ b/src/App/Pages/Accounts/LoginSsoPageViewModel.cs @@ -1,13 +1,13 @@ -using Bit.App.Abstractions; -using Bit.App.Resources; -using Bit.Core.Abstractions; -using Bit.Core.Utilities; -using System; +using System; using System.Threading.Tasks; +using Bit.App.Abstractions; +using Bit.App.Resources; using Bit.App.Utilities; +using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Domain; +using Bit.Core.Utilities; using Xamarin.Essentials; using Xamarin.Forms; @@ -170,7 +170,7 @@ namespace Bit.App.Pages else if (response.ResetMasterPassword) { StartSetPasswordAction?.Invoke(); - } + } else if (response.ForcePasswordReset) { UpdateTempPasswordAction?.Invoke(); diff --git a/src/App/Pages/Accounts/RegisterPage.xaml.cs b/src/App/Pages/Accounts/RegisterPage.xaml.cs index 481ef8c74..7a98c9bab 100644 --- a/src/App/Pages/Accounts/RegisterPage.xaml.cs +++ b/src/App/Pages/Accounts/RegisterPage.xaml.cs @@ -55,7 +55,7 @@ namespace Bit.App.Pages await _vm.SubmitAsync(); } } - + private async Task RegistrationSuccessAsync(HomePage homePage) { if (homePage != null) diff --git a/src/App/Pages/Accounts/RegisterPageViewModel.cs b/src/App/Pages/Accounts/RegisterPageViewModel.cs index c27c8a79a..a8ddb16c4 100644 --- a/src/App/Pages/Accounts/RegisterPageViewModel.cs +++ b/src/App/Pages/Accounts/RegisterPageViewModel.cs @@ -1,14 +1,14 @@ -using Bit.App.Abstractions; +using System; +using System.Threading.Tasks; +using System.Windows.Input; +using Bit.App.Abstractions; using Bit.App.Resources; +using Bit.Core; using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Request; using Bit.Core.Utilities; -using System; -using System.Threading.Tasks; -using System.Windows.Input; -using Bit.Core; using Xamarin.Forms; namespace Bit.App.Pages @@ -39,7 +39,7 @@ namespace Bit.App.Pages SubmitCommand = new Command(async () => await SubmitAsync()); ShowTerms = !_platformUtilsService.IsSelfHost(); } - + public ICommand PoliciesClickCommand => new Command((url) => { _platformUtilsService.LaunchUri(url); @@ -54,20 +54,20 @@ namespace Bit.App.Pages nameof(ShowPasswordIcon) }); } - + public bool AcceptPolicies { get => _acceptPolicies; set => SetProperty(ref _acceptPolicies, value); } - + public Thickness SwitchMargin { - get => Device.RuntimePlatform == Device.Android - ? new Thickness(0, 0, 0, 0) + get => Device.RuntimePlatform == Device.Android + ? new Thickness(0, 0, 0, 0) : new Thickness(0, 0, 10, 0); } - + public bool ShowTerms { get; set; } public Command SubmitCommand { get; } public Command TogglePasswordCommand { get; } @@ -136,7 +136,7 @@ namespace Bit.App.Pages } // TODO: Password strength check? - + if (showLoading) { await _deviceActionService.ShowLoadingAsync(AppResources.CreatingAccount); diff --git a/src/App/Pages/Accounts/SetPasswordPageViewModel.cs b/src/App/Pages/Accounts/SetPasswordPageViewModel.cs index ca913d905..7be7177d3 100644 --- a/src/App/Pages/Accounts/SetPasswordPageViewModel.cs +++ b/src/App/Pages/Accounts/SetPasswordPageViewModel.cs @@ -1,17 +1,17 @@ -using Bit.App.Abstractions; -using Bit.App.Resources; -using Bit.Core.Abstractions; -using Bit.Core.Enums; -using Bit.Core.Exceptions; -using Bit.Core.Models.Request; -using Bit.Core.Utilities; -using System; +using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; +using Bit.App.Abstractions; +using Bit.App.Resources; using Bit.Core; +using Bit.Core.Abstractions; +using Bit.Core.Enums; +using Bit.Core.Exceptions; using Bit.Core.Models.Domain; +using Bit.Core.Models.Request; +using Bit.Core.Utilities; using Xamarin.Essentials; using Xamarin.Forms; @@ -63,7 +63,7 @@ namespace Bit.App.Pages get => _isPolicyInEffect; set => SetProperty(ref _isPolicyInEffect, value); } - + public bool ResetPasswordAutoEnroll { get => _resetPasswordAutoEnroll; @@ -220,7 +220,7 @@ namespace Bit.App.Pages // Enroll user await _apiService.PutOrganizationUserResetPasswordEnrollmentAsync(OrgId, userId, resetRequest); } - + await _deviceActionService.HideLoadingAsync(); SetPasswordSuccessAction?.Invoke(); } diff --git a/src/App/Pages/Accounts/TwoFactorPage.xaml.cs b/src/App/Pages/Accounts/TwoFactorPage.xaml.cs index e539f8026..208724e71 100644 --- a/src/App/Pages/Accounts/TwoFactorPage.xaml.cs +++ b/src/App/Pages/Accounts/TwoFactorPage.xaml.cs @@ -1,11 +1,11 @@ -using Bit.App.Controls; +using System; +using System.Threading.Tasks; +using Bit.App.Controls; using Bit.App.Models; using Bit.App.Resources; +using Bit.App.Utilities; using Bit.Core.Abstractions; using Bit.Core.Utilities; -using System; -using System.Threading.Tasks; -using Bit.App.Utilities; using Xamarin.Forms; namespace Bit.App.Pages @@ -47,7 +47,8 @@ namespace Bit.App.Pages if (Device.RuntimePlatform == Device.iOS) { ToolbarItems.Add(_moreItem); - } else + } + else { ToolbarItems.Add(_useAnotherTwoStepMethod); } @@ -92,7 +93,8 @@ namespace Bit.App.Pages if (_vm.TotpMethod) { RequestFocus(_totpEntry); - } else if (_vm.YubikeyMethod) + } + else if (_vm.YubikeyMethod) { RequestFocus(_yubikeyTokenEntry); } @@ -187,7 +189,7 @@ namespace Bit.App.Pages var page = new SetPasswordPage(_appOptions, _orgIdentifier); await Navigation.PushModalAsync(new NavigationPage(page)); } - + private async Task UpdateTempPasswordAsync() { var page = new UpdateTempPasswordPage(); diff --git a/src/App/Pages/Accounts/TwoFactorPageViewModel.cs b/src/App/Pages/Accounts/TwoFactorPageViewModel.cs index edba7a2de..15de50f51 100644 --- a/src/App/Pages/Accounts/TwoFactorPageViewModel.cs +++ b/src/App/Pages/Accounts/TwoFactorPageViewModel.cs @@ -1,16 +1,16 @@ -using Bit.App.Abstractions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Threading.Tasks; +using Bit.App.Abstractions; using Bit.App.Resources; +using Bit.App.Utilities; using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Request; using Bit.Core.Utilities; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Threading.Tasks; -using Bit.App.Utilities; using Newtonsoft.Json; using Xamarin.Essentials; using Xamarin.Forms; @@ -113,7 +113,7 @@ namespace Bit.App.Pages public Action StartSetPasswordAction { get; set; } public Action CloseAction { get; set; } public Action UpdateTempPasswordAction { get; set; } - + protected override II18nService i18nService => _i18nService; protected override IEnvironmentService environmentService => _environmentService; protected override IDeviceActionService deviceActionService => _deviceActionService; @@ -293,7 +293,7 @@ namespace Bit.App.Pages await _deviceActionService.ShowLoadingAsync(AppResources.Validating); } var result = await _authService.LogInTwoFactorAsync(SelectedProviderType.Value, Token, _captchaToken, Remember); - + if (result.CaptchaNeeded) { if (await HandleCaptchaAsync(result.CaptchaSiteKey)) @@ -304,12 +304,12 @@ namespace Bit.App.Pages return; } _captchaToken = null; - + var task = Task.Run(() => _syncService.FullSyncAsync(true)); await _deviceActionService.HideLoadingAsync(); _messagingService.Send("listenYubiKeyOTP", false); _broadcasterService.Unsubscribe(nameof(TwoFactorPage)); - + if (_authingWithSso && result.ResetMasterPassword) { StartSetPasswordAction?.Invoke(); @@ -317,7 +317,7 @@ namespace Bit.App.Pages else if (result.ForcePasswordReset) { UpdateTempPasswordAction?.Invoke(); - } + } else { TwoFactorAuthSuccessAction?.Invoke(); diff --git a/src/App/Pages/Accounts/UpdateTempPasswordPage.xaml.cs b/src/App/Pages/Accounts/UpdateTempPasswordPage.xaml.cs index 2e016606f..d814a854d 100644 --- a/src/App/Pages/Accounts/UpdateTempPasswordPage.xaml.cs +++ b/src/App/Pages/Accounts/UpdateTempPasswordPage.xaml.cs @@ -1,7 +1,7 @@ +using System; +using Bit.App.Resources; using Bit.Core.Abstractions; using Bit.Core.Utilities; -using System; -using Bit.App.Resources; using Xamarin.Forms; namespace Bit.App.Pages @@ -14,29 +14,29 @@ namespace Bit.App.Pages private readonly string _pageName; public UpdateTempPasswordPage() - { + { // Service Init _messagingService = ServiceContainer.Resolve("messagingService"); _platformUtilsService = ServiceContainer.Resolve("platformUtilsService"); - + // Binding InitializeComponent(); _pageName = string.Concat(nameof(UpdateTempPasswordPage), "_", DateTime.UtcNow.Ticks); _vm = BindingContext as UpdateTempPasswordPageViewModel; _vm.Page = this; SetActivityIndicator(); - + // Actions Declaration _vm.LogOutAction = () => { _messagingService.Send("logout"); }; _vm.UpdateTempPasswordSuccessAction = () => Device.BeginInvokeOnMainThread(UpdateTempPasswordSuccess); - + // Link fields that will be referenced in codebehind MasterPasswordEntry = _masterPassword; ConfirmMasterPasswordEntry = _confirmMasterPassword; - + // Return Types and Commands _masterPassword.ReturnType = ReturnType.Next; _masterPassword.ReturnCommand = new Command(() => _confirmMasterPassword.Focus()); @@ -77,7 +77,7 @@ namespace Bit.App.Pages } } } - + private void UpdateTempPasswordSuccess() { _messagingService.Send("logout"); diff --git a/src/App/Pages/Accounts/UpdateTempPasswordPageViewModel.cs b/src/App/Pages/Accounts/UpdateTempPasswordPageViewModel.cs index 42ea72f6a..918e40fdc 100644 --- a/src/App/Pages/Accounts/UpdateTempPasswordPageViewModel.cs +++ b/src/App/Pages/Accounts/UpdateTempPasswordPageViewModel.cs @@ -1,6 +1,6 @@ -using Bit.App.Resources; -using System; +using System; using System.Threading.Tasks; +using Bit.App.Resources; using Bit.Core.Exceptions; using Bit.Core.Models.Request; using Xamarin.Forms; @@ -16,7 +16,7 @@ namespace Bit.App.Pages ToggleConfirmPasswordCommand = new Command(ToggleConfirmPassword); SubmitCommand = new Command(async () => await SubmitAsync()); } - + public Command SubmitCommand { get; } public Command TogglePasswordCommand { get; } public Command ToggleConfirmPasswordCommand { get; } @@ -37,23 +37,23 @@ namespace Bit.App.Pages public async Task SubmitAsync() { - if (!await ValidateMasterPasswordAsync()) + if (!await ValidateMasterPasswordAsync()) { return; } - + // Retrieve details for key generation var kdf = await _stateService.GetKdfTypeAsync(); var kdfIterations = await _stateService.GetKdfIterationsAsync(); var email = await _stateService.GetEmailAsync(); - + // Create new key and hash new password var key = await _cryptoService.MakeKeyAsync(MasterPassword, email, kdf, kdfIterations); var masterPasswordHash = await _cryptoService.HashPasswordAsync(MasterPassword, key); - + // Create new encKey for the User var newEncKey = await _cryptoService.RemakeEncKeyAsync(key); - + // Create request var request = new UpdateTempPasswordRequest { @@ -61,7 +61,7 @@ namespace Bit.App.Pages NewMasterPasswordHash = masterPasswordHash, MasterPasswordHint = Hint }; - + // Initiate API action try { diff --git a/src/App/Pages/Accounts/VerificationCodeViewModel.cs b/src/App/Pages/Accounts/VerificationCodeViewModel.cs index 7f1c62bbb..7e1257cd7 100644 --- a/src/App/Pages/Accounts/VerificationCodeViewModel.cs +++ b/src/App/Pages/Accounts/VerificationCodeViewModel.cs @@ -36,7 +36,7 @@ namespace Bit.App.Pages _logger = ServiceContainer.Resolve("logger"); PageTitle = AppResources.VerificationCode; - + TogglePasswordCommand = new Command(TogglePassword); MainActionCommand = new AsyncCommand(MainActionAsync, allowsMultipleExecutions: false); RequestOTPCommand = new AsyncCommand(RequestOTPAsync, allowsMultipleExecutions: false); @@ -60,7 +60,7 @@ namespace Bit.App.Pages get => _mainActionText; set => SetProperty(ref _mainActionText, value); } - + public string SendCodeStatus { get => _sendCodeStatus; diff --git a/src/App/Pages/BaseContentPage.cs b/src/App/Pages/BaseContentPage.cs index 7d7fafb67..c6e5b6faf 100644 --- a/src/App/Pages/BaseContentPage.cs +++ b/src/App/Pages/BaseContentPage.cs @@ -35,12 +35,12 @@ namespace Bit.App.Pages protected async override void OnAppearing() { base.OnAppearing(); - + if (IsThemeDirty) { UpdateOnThemeChanged(); } - + await SaveActivityAsync(); } diff --git a/src/App/Pages/CaptchaProtectedViewModel.cs b/src/App/Pages/CaptchaProtectedViewModel.cs index d5d019dff..d31d338ae 100644 --- a/src/App/Pages/CaptchaProtectedViewModel.cs +++ b/src/App/Pages/CaptchaProtectedViewModel.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading.Tasks; using Bit.App.Abstractions; using Bit.App.Resources; diff --git a/src/App/Pages/Generator/GeneratorHistoryPage.xaml.cs b/src/App/Pages/Generator/GeneratorHistoryPage.xaml.cs index c4f75644c..e33b04dcb 100644 --- a/src/App/Pages/Generator/GeneratorHistoryPage.xaml.cs +++ b/src/App/Pages/Generator/GeneratorHistoryPage.xaml.cs @@ -31,7 +31,8 @@ namespace Bit.App.Pages { base.OnAppearing(); - await LoadOnAppearedAsync(_mainLayout, true, async () => { + await LoadOnAppearedAsync(_mainLayout, true, async () => + { await _vm.InitAsync(); }); } diff --git a/src/App/Pages/Generator/GeneratorPage.xaml.cs b/src/App/Pages/Generator/GeneratorPage.xaml.cs index d642e43b0..8d0e942af 100644 --- a/src/App/Pages/Generator/GeneratorPage.xaml.cs +++ b/src/App/Pages/Generator/GeneratorPage.xaml.cs @@ -12,7 +12,7 @@ namespace Bit.App.Pages public partial class GeneratorPage : BaseContentPage, IThemeDirtablePage { private readonly IBroadcasterService _broadcasterService; - + private GeneratorPageViewModel _vm; private readonly bool _fromTabPage; private readonly Action _selectAction; @@ -77,7 +77,7 @@ namespace Bit.App.Pages } }); } - + protected override void OnDisappearing() { base.OnDisappearing(); diff --git a/src/App/Pages/Generator/GeneratorPageViewModel.cs b/src/App/Pages/Generator/GeneratorPageViewModel.cs index dc54f67b7..1b694a83c 100644 --- a/src/App/Pages/Generator/GeneratorPageViewModel.cs +++ b/src/App/Pages/Generator/GeneratorPageViewModel.cs @@ -1,10 +1,10 @@ -using Bit.App.Resources; +using System.Collections.Generic; +using System.Threading.Tasks; +using Bit.App.Resources; using Bit.App.Utilities; using Bit.Core.Abstractions; using Bit.Core.Models.Domain; using Bit.Core.Utilities; -using System.Collections.Generic; -using System.Threading.Tasks; using Xamarin.Forms; namespace Bit.App.Pages @@ -225,7 +225,7 @@ namespace Bit.App.Pages } } } - + public PasswordGeneratorPolicyOptions EnforcedPolicyOptions { get => _enforcedPolicyOptions; diff --git a/src/App/Pages/Send/SendAddEditPage.xaml.cs b/src/App/Pages/Send/SendAddEditPage.xaml.cs index 0f4ba6f4e..85a52022d 100644 --- a/src/App/Pages/Send/SendAddEditPage.xaml.cs +++ b/src/App/Pages/Send/SendAddEditPage.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Threading.Tasks; using Bit.App.Models; @@ -337,10 +337,10 @@ namespace Bit.App.Pages _vm.IsAddFromShare = true; _vm.CopyInsteadOfShareAfterSaving = _appOptions.CopyInsteadOfShareAfterSaving; - + var name = _appOptions.CreateSend.Item2; _vm.Send.Name = name; - + var type = _appOptions.CreateSend.Item1; if (type == SendType.File) { diff --git a/src/App/Pages/Send/SendAddEditPageViewModel.cs b/src/App/Pages/Send/SendAddEditPageViewModel.cs index 78642e362..01d588170 100644 --- a/src/App/Pages/Send/SendAddEditPageViewModel.cs +++ b/src/App/Pages/Send/SendAddEditPageViewModel.cs @@ -40,7 +40,7 @@ namespace Bit.App.Pages private TimeSpan? _expirationTime; private bool _isOverridingPickers; private int? _maxAccessCount; - private string[] _additionalSendProperties = new [] + private string[] _additionalSendProperties = new[] { nameof(IsText), nameof(IsFile), @@ -209,7 +209,7 @@ namespace Bit.App.Pages { get => _showPassword; set => SetProperty(ref _showPassword, value, - additionalPropertyNames: new [] + additionalPropertyNames: new[] { nameof(ShowPasswordIcon) }); @@ -237,7 +237,7 @@ namespace Bit.App.Pages PageTitle = EditMode ? AppResources.EditSend : AppResources.AddSend; _canAccessPremium = await _stateService.CanAccessPremiumAsync(); _emailVerified = await _stateService.GetEmailVerifiedAsync(); - SendEnabled = ! await AppHelpers.IsSendDisabledByPolicyAsync(); + SendEnabled = !await AppHelpers.IsSendDisabledByPolicyAsync(); DisableHideEmail = await AppHelpers.IsHideEmailDisabledByPolicyAsync(); SendOptionsPolicyInEffect = SendEnabled && DisableHideEmail; } @@ -381,7 +381,7 @@ namespace Bit.App.Pages UpdateSendData(); - if (string.IsNullOrWhiteSpace(NewPassword)) + if (string.IsNullOrWhiteSpace(NewPassword)) { NewPassword = null; } @@ -521,7 +521,7 @@ namespace Bit.App.Pages { await _platformUtilsService.ShowDialogAsync(AppResources.SendFileEmailVerificationRequired); } - + if (IsAddFromShare && Device.RuntimePlatform == Device.Android) { _deviceActionService.CloseMainApp(); diff --git a/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPage.xaml.cs b/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPage.xaml.cs index 7bdf38b7a..183a832d8 100644 --- a/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPage.xaml.cs +++ b/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPage.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Threading.Tasks; using Bit.App.Controls; @@ -133,7 +133,7 @@ namespace Bit.App.Pages } } } - + private async void RowSelected(object sender, SelectionChangedEventArgs e) { ((ExtendedCollectionView)sender).SelectedItem = null; @@ -174,7 +174,7 @@ namespace Bit.App.Pages { await _vaultTimeoutService.LockAsync(true, true); } - + private void About_Clicked(object sender, EventArgs e) { _vm.ShowAbout(); diff --git a/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPageHeaderListItem.cs b/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPageHeaderListItem.cs index c8c7943be..43b35e669 100644 --- a/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPageHeaderListItem.cs +++ b/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPageHeaderListItem.cs @@ -9,6 +9,6 @@ } public string Title { get; } - public string ItemCount { get; } + public string ItemCount { get; } } } diff --git a/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPageViewModel.cs b/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPageViewModel.cs index 4c7e70c37..ada402713 100644 --- a/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPageViewModel.cs +++ b/src/App/Pages/Send/SendGroupingsPage/SendGroupingsPageViewModel.cs @@ -136,7 +136,7 @@ namespace Bit.App.Pages ShowNoData = false; Loading = true; ShowList = false; - SendEnabled = ! await AppHelpers.IsSendDisabledByPolicyAsync(); + SendEnabled = !await AppHelpers.IsSendDisabledByPolicyAsync(); var groupedSends = new List(); var page = Page as SendGroupingsPage; diff --git a/src/App/Pages/Send/SendsPageViewModel.cs b/src/App/Pages/Send/SendsPageViewModel.cs index 94b807459..5afe8e5cd 100644 --- a/src/App/Pages/Send/SendsPageViewModel.cs +++ b/src/App/Pages/Send/SendsPageViewModel.cs @@ -35,11 +35,11 @@ namespace Bit.App.Pages get => _sendEnabled; set => SetProperty(ref _sendEnabled, value); } - + public bool ShowNoData { get => _showNoData; - set => SetProperty(ref _showNoData, value, additionalPropertyNames: new [] + set => SetProperty(ref _showNoData, value, additionalPropertyNames: new[] { nameof(ShowSearchDirection) }); @@ -48,7 +48,7 @@ namespace Bit.App.Pages public bool ShowList { get => _showList; - set => SetProperty(ref _showList, value, additionalPropertyNames: new [] + set => SetProperty(ref _showList, value, additionalPropertyNames: new[] { nameof(ShowSearchDirection) }); @@ -58,7 +58,7 @@ namespace Bit.App.Pages public async Task InitAsync() { - SendEnabled = ! await AppHelpers.IsSendDisabledByPolicyAsync(); + SendEnabled = !await AppHelpers.IsSendDisabledByPolicyAsync(); if (!string.IsNullOrWhiteSpace((Page as SendsPage).SearchBar.Text)) { Search((Page as SendsPage).SearchBar.Text, 200); diff --git a/src/App/Pages/Settings/AutofillServicesPage.xaml.cs b/src/App/Pages/Settings/AutofillServicesPage.xaml.cs index 72719b784..906f2e617 100644 --- a/src/App/Pages/Settings/AutofillServicesPage.xaml.cs +++ b/src/App/Pages/Settings/AutofillServicesPage.xaml.cs @@ -49,12 +49,12 @@ namespace Bit.App.Pages _vm.ToggleAutofillService(); } } - + private void ToggleInlineAutofill(object sender, EventArgs e) { _vm.ToggleInlineAutofill(); } - + private void ToggleAccessibility(object sender, EventArgs e) { if (DoOnce()) @@ -62,7 +62,7 @@ namespace Bit.App.Pages _vm.ToggleAccessibility(); } } - + private void ToggleDrawOver(object sender, EventArgs e) { if (DoOnce()) diff --git a/src/App/Pages/Settings/AutofillServicesPageViewModel.cs b/src/App/Pages/Settings/AutofillServicesPageViewModel.cs index 52b3cf4c3..06720826f 100644 --- a/src/App/Pages/Settings/AutofillServicesPageViewModel.cs +++ b/src/App/Pages/Settings/AutofillServicesPageViewModel.cs @@ -12,7 +12,7 @@ namespace Bit.App.Pages private readonly IDeviceActionService _deviceActionService; private readonly IStateService _stateService; private readonly MobileI18nService _i18nService; - + private bool _autofillServiceToggled; private bool _inlineAutofillToggled; private bool _accessibilityToggled; @@ -26,9 +26,9 @@ namespace Bit.App.Pages _i18nService = ServiceContainer.Resolve("i18nService") as MobileI18nService; PageTitle = AppResources.AutofillServices; } - + #region Autofill Service - + public bool AutofillServiceVisible { get => _deviceActionService.SystemMajorVersion() >= 26; @@ -43,16 +43,16 @@ namespace Bit.App.Pages nameof(InlineAutofillEnabled) }); } - + #endregion - + #region Inline Autofill public bool InlineAutofillVisible { get => _deviceActionService.SystemMajorVersion() >= 30; } - + public bool InlineAutofillEnabled { get => AutofillServiceToggled; @@ -69,9 +69,9 @@ namespace Bit.App.Pages } } } - + #endregion - + #region Accessibility public string AccessibilityDescriptionLabel @@ -97,7 +97,7 @@ namespace Bit.App.Pages return _i18nService.T("AccessibilityDescription4"); } } - + public bool AccessibilityToggled { get => _accessibilityToggled; @@ -109,9 +109,9 @@ namespace Bit.App.Pages } #endregion - + #region Draw-Over - + public bool DrawOverVisible { get => _deviceActionService.SystemMajorVersion() >= 23; @@ -135,12 +135,12 @@ namespace Bit.App.Pages return _i18nService.T("DrawOverDescription3"); } } - + public bool DrawOverEnabled { get => AccessibilityToggled; } - + public bool DrawOverToggled { get => _drawOverToggled; @@ -148,7 +148,7 @@ namespace Bit.App.Pages } #endregion - + public async Task InitAsync() { InlineAutofillToggled = await _stateService.GetInlineAutofillEnabledAsync() ?? true; @@ -189,7 +189,7 @@ namespace Bit.App.Pages } _deviceActionService.OpenAccessibilityOverlayPermissionSettings(); } - + public void UpdateEnabled() { AutofillServiceToggled = @@ -197,7 +197,7 @@ namespace Bit.App.Pages AccessibilityToggled = _deviceActionService.AutofillAccessibilityServiceRunning(); DrawOverToggled = _deviceActionService.AutofillAccessibilityOverlayPermitted(); } - + private async Task UpdateInlineAutofillToggledAsync() { if (_inited) diff --git a/src/App/Pages/Settings/ExportVaultPageViewModel.cs b/src/App/Pages/Settings/ExportVaultPageViewModel.cs index de84447ba..63a05b261 100644 --- a/src/App/Pages/Settings/ExportVaultPageViewModel.cs +++ b/src/App/Pages/Settings/ExportVaultPageViewModel.cs @@ -4,11 +4,11 @@ using System.Text; using System.Threading.Tasks; using Bit.App.Abstractions; using Bit.App.Resources; +using Bit.Core; using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Utilities; -using Bit.Core; using Xamarin.Forms; namespace Bit.App.Pages @@ -77,7 +77,7 @@ namespace Bit.App.Pages InstructionText = _i18nService.T("ExportVaultMasterPasswordDescription"); SecretName = _i18nService.T("MasterPassword"); } - + UpdateWarning(); } @@ -109,7 +109,7 @@ namespace Bit.App.Pages { get => _showPassword; set => SetProperty(ref _showPassword, value, - additionalPropertyNames: new string[] {nameof(ShowPasswordIcon)}); + additionalPropertyNames: new string[] { nameof(ShowPasswordIcon) }); } public bool UseOTPVerification diff --git a/src/App/Pages/Settings/ExtensionPageViewModel.cs b/src/App/Pages/Settings/ExtensionPageViewModel.cs index 9427ca2f4..ea989be5d 100644 --- a/src/App/Pages/Settings/ExtensionPageViewModel.cs +++ b/src/App/Pages/Settings/ExtensionPageViewModel.cs @@ -1,7 +1,7 @@ -using Bit.App.Resources; +using System.Threading.Tasks; +using Bit.App.Resources; using Bit.Core.Abstractions; using Bit.Core.Utilities; -using System.Threading.Tasks; namespace Bit.App.Pages { diff --git a/src/App/Pages/Settings/FolderAddEditPage.xaml.cs b/src/App/Pages/Settings/FolderAddEditPage.xaml.cs index 958756e54..333dd1051 100644 --- a/src/App/Pages/Settings/FolderAddEditPage.xaml.cs +++ b/src/App/Pages/Settings/FolderAddEditPage.xaml.cs @@ -1,5 +1,5 @@ -using Bit.App.Resources; -using System.Collections.Generic; +using System.Collections.Generic; +using Bit.App.Resources; using Xamarin.Forms; namespace Bit.App.Pages diff --git a/src/App/Pages/Settings/FolderAddEditPageViewModel.cs b/src/App/Pages/Settings/FolderAddEditPageViewModel.cs index 33479ae68..08615a2f9 100644 --- a/src/App/Pages/Settings/FolderAddEditPageViewModel.cs +++ b/src/App/Pages/Settings/FolderAddEditPageViewModel.cs @@ -1,10 +1,10 @@ -using Bit.App.Abstractions; +using System.Threading.Tasks; +using Bit.App.Abstractions; using Bit.App.Resources; using Bit.Core.Abstractions; using Bit.Core.Exceptions; using Bit.Core.Models.View; using Bit.Core.Utilities; -using System.Threading.Tasks; using Xamarin.Forms; namespace Bit.App.Pages diff --git a/src/App/Pages/Settings/FoldersPage.xaml.cs b/src/App/Pages/Settings/FoldersPage.xaml.cs index 723302cff..353f6f74a 100644 --- a/src/App/Pages/Settings/FoldersPage.xaml.cs +++ b/src/App/Pages/Settings/FoldersPage.xaml.cs @@ -1,7 +1,7 @@ -using Bit.Core.Models.View; -using System; +using System; using System.Linq; using Bit.App.Controls; +using Bit.Core.Models.View; using Xamarin.Forms; namespace Bit.App.Pages diff --git a/src/App/Pages/Settings/FoldersPageViewModel.cs b/src/App/Pages/Settings/FoldersPageViewModel.cs index 8bdb8004f..6e348f3af 100644 --- a/src/App/Pages/Settings/FoldersPageViewModel.cs +++ b/src/App/Pages/Settings/FoldersPageViewModel.cs @@ -1,10 +1,10 @@ -using Bit.App.Resources; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Bit.App.Resources; using Bit.Core.Abstractions; using Bit.Core.Models.View; using Bit.Core.Utilities; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace Bit.App.Pages { diff --git a/src/App/Pages/Settings/OptionsPageViewModel.cs b/src/App/Pages/Settings/OptionsPageViewModel.cs index 4ce6d39c8..fc6137190 100644 --- a/src/App/Pages/Settings/OptionsPageViewModel.cs +++ b/src/App/Pages/Settings/OptionsPageViewModel.cs @@ -1,11 +1,11 @@ -using Bit.App.Resources; +using System.Collections.Generic; +using System.Threading.Tasks; +using Bit.App.Resources; using Bit.App.Utilities; using Bit.Core; using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Utilities; -using System.Collections.Generic; -using System.Threading.Tasks; using Xamarin.Forms; namespace Bit.App.Pages diff --git a/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml.cs b/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml.cs index 9d7fac2bf..8a798c11c 100644 --- a/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml.cs +++ b/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml.cs @@ -59,7 +59,7 @@ namespace Bit.App.Pages async void OnTimePickerPropertyChanged(object sender, PropertyChangedEventArgs args) { - var s = (TimePicker) sender; + var s = (TimePicker)sender; var time = s.Time.TotalMinutes; if (s.IsFocused && args.PropertyName == "Time") { diff --git a/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs b/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs index 48b67bf1f..06727300f 100644 --- a/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs +++ b/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs @@ -1,16 +1,16 @@ -using Bit.App.Abstractions; -using Bit.App.Resources; -using Bit.Core.Abstractions; -using Bit.Core.Utilities; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Bit.App.Abstractions; +using Bit.App.Resources; +using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Models.Domain; +using Bit.Core.Utilities; +using Xamarin.CommunityToolkit.ObjectModel; using Xamarin.Forms; using ZXing.Client.Result; -using Xamarin.CommunityToolkit.ObjectModel; namespace Bit.App.Pages { @@ -428,7 +428,7 @@ namespace Bit.App.Pages var securityItems = new List { new SettingsPageListItem { Name = AppResources.VaultTimeout, SubLabel = _vaultTimeoutDisplayValue }, - new SettingsPageListItem + new SettingsPageListItem { Name = AppResources.VaultTimeoutAction, SubLabel = _vaultTimeoutActionDisplayValue diff --git a/src/App/Pages/Settings/SyncPageViewModel.cs b/src/App/Pages/Settings/SyncPageViewModel.cs index 9cbfe52b6..7aade221b 100644 --- a/src/App/Pages/Settings/SyncPageViewModel.cs +++ b/src/App/Pages/Settings/SyncPageViewModel.cs @@ -1,9 +1,9 @@ -using Bit.App.Abstractions; +using System.Threading.Tasks; +using Bit.App.Abstractions; using Bit.App.Resources; using Bit.Core.Abstractions; using Bit.Core.Exceptions; using Bit.Core.Utilities; -using System.Threading.Tasks; namespace Bit.App.Pages { diff --git a/src/App/Pages/TabsPage.cs b/src/App/Pages/TabsPage.cs index d24442eee..015d75a60 100644 --- a/src/App/Pages/TabsPage.cs +++ b/src/App/Pages/TabsPage.cs @@ -12,7 +12,7 @@ namespace Bit.App.Pages { private readonly IMessagingService _messagingService; private readonly IKeyConnectorService _keyConnectorService; - + private NavigationPage _groupingsPage; private NavigationPage _sendGroupingsPage; private NavigationPage _generatorPage; @@ -93,7 +93,7 @@ namespace Bit.App.Pages { CurrentPage = _generatorPage; } - + public void ResetToSendPage() { CurrentPage = _sendGroupingsPage; diff --git a/src/App/Pages/Vault/AddEditPage.xaml.cs b/src/App/Pages/Vault/AddEditPage.xaml.cs index 796866d8b..3329de8dd 100644 --- a/src/App/Pages/Vault/AddEditPage.xaml.cs +++ b/src/App/Pages/Vault/AddEditPage.xaml.cs @@ -1,12 +1,12 @@ -using Bit.App.Abstractions; +using System.Collections.Generic; +using System.Threading.Tasks; +using Bit.App.Abstractions; using Bit.App.Models; using Bit.App.Resources; using Bit.App.Utilities; using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Utilities; -using System.Collections.Generic; -using System.Threading.Tasks; using Xamarin.Essentials; using Xamarin.Forms; using Xamarin.Forms.PlatformConfiguration; diff --git a/src/App/Pages/Vault/AddEditPageViewModel.cs b/src/App/Pages/Vault/AddEditPageViewModel.cs index 40fd047f5..5c4e9a77e 100644 --- a/src/App/Pages/Vault/AddEditPageViewModel.cs +++ b/src/App/Pages/Vault/AddEditPageViewModel.cs @@ -65,7 +65,7 @@ namespace Bit.App.Pages new KeyValuePair(UriMatchType.Exact, AppResources.Exact), new KeyValuePair(UriMatchType.Never, AppResources.Never) }; - + public AddEditPageViewModel() { _deviceActionService = ServiceContainer.Resolve("deviceActionService"); @@ -350,7 +350,7 @@ namespace Bit.App.Pages { Cipher.Name += " - " + AppResources.Clone; // If not allowing personal ownership, update cipher's org Id to prompt downstream changes - if (Cipher.OrganizationId == null && !AllowPersonal) + if (Cipher.OrganizationId == null && !AllowPersonal) { Cipher.OrganizationId = OrganizationId; } @@ -399,7 +399,7 @@ namespace Bit.App.Pages IdentityTitleOptions.FindIndex(k => k.Value == Cipher.Identity.Title); OwnershipSelectedIndex = string.IsNullOrWhiteSpace(Cipher.OrganizationId) ? 0 : OwnershipOptions.FindIndex(k => k.Value == Cipher.OrganizationId); - + // If the selected organization is on Index 0 and we've removed the personal option, force refresh if (!AllowPersonal && OwnershipSelectedIndex == 0) { @@ -451,11 +451,11 @@ namespace Bit.App.Pages AppResources.Ok); return false; } - + if ((!EditMode || CloneMode) && !AllowPersonal && string.IsNullOrWhiteSpace(Cipher.OrganizationId)) { await Page.DisplayAlert(AppResources.AnErrorHasOccurred, - AppResources.PersonalOwnershipSubmitError,AppResources.Ok); + AppResources.PersonalOwnershipSubmitError, AppResources.Ok); return false; } @@ -535,7 +535,7 @@ namespace Bit.App.Pages AppResources.AnErrorHasOccurred); } } - catch(Exception genex) + catch (Exception genex) { _logger.Exception(genex); await _deviceActionService.HideLoadingAsync(); diff --git a/src/App/Pages/Vault/AttachmentsPage.xaml.cs b/src/App/Pages/Vault/AttachmentsPage.xaml.cs index 4af1b9148..6e9391866 100644 --- a/src/App/Pages/Vault/AttachmentsPage.xaml.cs +++ b/src/App/Pages/Vault/AttachmentsPage.xaml.cs @@ -1,6 +1,6 @@ -using Bit.Core.Abstractions; +using System; +using Bit.Core.Abstractions; using Bit.Core.Utilities; -using System; using Xamarin.Forms; namespace Bit.App.Pages diff --git a/src/App/Pages/Vault/AttachmentsPageViewModel.cs b/src/App/Pages/Vault/AttachmentsPageViewModel.cs index c854f984b..9dc284b42 100644 --- a/src/App/Pages/Vault/AttachmentsPageViewModel.cs +++ b/src/App/Pages/Vault/AttachmentsPageViewModel.cs @@ -1,13 +1,13 @@ -using Bit.App.Abstractions; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Bit.App.Abstractions; using Bit.App.Resources; using Bit.Core.Abstractions; using Bit.Core.Exceptions; using Bit.Core.Models.Domain; using Bit.Core.Models.View; using Bit.Core.Utilities; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Xamarin.Forms; namespace Bit.App.Pages diff --git a/src/App/Pages/Vault/AutofillCiphersPage.xaml.cs b/src/App/Pages/Vault/AutofillCiphersPage.xaml.cs index 3c680aa05..aed80316f 100644 --- a/src/App/Pages/Vault/AutofillCiphersPage.xaml.cs +++ b/src/App/Pages/Vault/AutofillCiphersPage.xaml.cs @@ -1,12 +1,12 @@ -using Bit.App.Models; -using Bit.Core.Abstractions; -using Bit.Core.Enums; -using Bit.Core.Utilities; -using System; +using System; using System.Linq; using System.Threading.Tasks; using Bit.App.Controls; +using Bit.App.Models; using Bit.App.Utilities; +using Bit.Core.Abstractions; +using Bit.Core.Enums; +using Bit.Core.Utilities; using Xamarin.Forms; namespace Bit.App.Pages @@ -72,14 +72,14 @@ namespace Bit.App.Pages }); } }); - + await LoadOnAppearedAsync(_mainLayout, false, async () => { try { await _vm.LoadAsync(); } - catch (Exception e) when(e.Message.Contains("No key.")) + catch (Exception e) when (e.Message.Contains("No key.")) { await Task.Delay(1000); await _vm.LoadAsync(); diff --git a/src/App/Pages/Vault/AutofillCiphersPageViewModel.cs b/src/App/Pages/Vault/AutofillCiphersPageViewModel.cs index 77e0dea0a..80e9caf09 100644 --- a/src/App/Pages/Vault/AutofillCiphersPageViewModel.cs +++ b/src/App/Pages/Vault/AutofillCiphersPageViewModel.cs @@ -1,4 +1,8 @@ -using Bit.App.Abstractions; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Bit.App.Abstractions; +using Bit.App.Controls; using Bit.App.Models; using Bit.App.Resources; using Bit.App.Utilities; @@ -8,11 +12,7 @@ using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.View; using Bit.Core.Utilities; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Xamarin.CommunityToolkit.ObjectModel; -using Bit.App.Controls; using Xamarin.Forms; namespace Bit.App.Pages @@ -44,7 +44,7 @@ namespace Bit.App.Pages GroupedItems = new ObservableRangeCollection(); CipherOptionsCommand = new Command(CipherOptionsAsync); - + AccountSwitchingOverlayViewModel = new AccountSwitchingOverlayViewModel(_stateService, _messagingService, _logger) { AllowAddAccountRow = false diff --git a/src/App/Pages/Vault/CiphersPage.xaml.cs b/src/App/Pages/Vault/CiphersPage.xaml.cs index c730eb5ea..87987ea43 100644 --- a/src/App/Pages/Vault/CiphersPage.xaml.cs +++ b/src/App/Pages/Vault/CiphersPage.xaml.cs @@ -1,10 +1,10 @@ -using Bit.App.Abstractions; +using System; +using System.Linq; +using Bit.App.Abstractions; +using Bit.App.Controls; using Bit.App.Resources; using Bit.Core.Models.View; using Bit.Core.Utilities; -using System; -using System.Linq; -using Bit.App.Controls; using Xamarin.Forms; namespace Bit.App.Pages diff --git a/src/App/Pages/Vault/CiphersPageViewModel.cs b/src/App/Pages/Vault/CiphersPageViewModel.cs index 3406046dd..d9a5510e2 100644 --- a/src/App/Pages/Vault/CiphersPageViewModel.cs +++ b/src/App/Pages/Vault/CiphersPageViewModel.cs @@ -1,4 +1,9 @@ -using Bit.App.Abstractions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Bit.App.Abstractions; using Bit.App.Resources; using Bit.Core; using Bit.Core.Abstractions; @@ -6,11 +11,6 @@ using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.View; using Bit.Core.Utilities; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Xamarin.Forms; namespace Bit.App.Pages @@ -107,7 +107,7 @@ namespace Bit.App.Pages } try { - ciphers = await _searchService.SearchCiphersAsync(searchText, + ciphers = await _searchService.SearchCiphersAsync(searchText, Filter ?? (c => c.IsDeleted == Deleted), null, cts.Token); cts.Token.ThrowIfCancellationRequested(); } diff --git a/src/App/Pages/Vault/CollectionsPageViewModel.cs b/src/App/Pages/Vault/CollectionsPageViewModel.cs index e0b678de2..f58ab1a78 100644 --- a/src/App/Pages/Vault/CollectionsPageViewModel.cs +++ b/src/App/Pages/Vault/CollectionsPageViewModel.cs @@ -1,13 +1,13 @@ -using Bit.App.Abstractions; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Bit.App.Abstractions; using Bit.App.Resources; using Bit.Core.Abstractions; using Bit.Core.Exceptions; using Bit.Core.Models.Domain; using Bit.Core.Models.View; using Bit.Core.Utilities; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace Bit.App.Pages { diff --git a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs index 395dd8cf2..2861b03fb 100644 --- a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs +++ b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs @@ -27,7 +27,7 @@ namespace Bit.App.Pages private PreviousPageInfo _previousPage; public GroupingsPage(bool mainPage, CipherType? type = null, string folderId = null, - string collectionId = null, string pageTitle = null, PreviousPageInfo previousPage = null, + string collectionId = null, string pageTitle = null, PreviousPageInfo previousPage = null, bool deleted = false) { _pageName = string.Concat(nameof(GroupingsPage), "_", DateTime.UtcNow.Ticks); @@ -117,7 +117,7 @@ namespace Bit.App.Pages { await _vm.LoadAsync(); } - catch (Exception e) when(e.Message.Contains("No key.")) + catch (Exception e) when (e.Message.Contains("No key.")) { await Task.Delay(1000); await _vm.LoadAsync(); diff --git a/src/App/Pages/Vault/PasswordHistoryPage.xaml.cs b/src/App/Pages/Vault/PasswordHistoryPage.xaml.cs index ea444c3d6..27f271da3 100644 --- a/src/App/Pages/Vault/PasswordHistoryPage.xaml.cs +++ b/src/App/Pages/Vault/PasswordHistoryPage.xaml.cs @@ -23,7 +23,8 @@ namespace Bit.App.Pages protected override async void OnAppearing() { base.OnAppearing(); - await LoadOnAppearedAsync(_mainLayout, true, async () => { + await LoadOnAppearedAsync(_mainLayout, true, async () => + { await _vm.InitAsync(); }); } diff --git a/src/App/Pages/Vault/PasswordHistoryPageViewModel.cs b/src/App/Pages/Vault/PasswordHistoryPageViewModel.cs index 2dc086322..e25550604 100644 --- a/src/App/Pages/Vault/PasswordHistoryPageViewModel.cs +++ b/src/App/Pages/Vault/PasswordHistoryPageViewModel.cs @@ -1,9 +1,9 @@ -using Bit.App.Resources; +using System.Collections.Generic; +using System.Threading.Tasks; +using Bit.App.Resources; using Bit.Core.Abstractions; using Bit.Core.Models.View; using Bit.Core.Utilities; -using System.Collections.Generic; -using System.Threading.Tasks; using Xamarin.Forms; namespace Bit.App.Pages diff --git a/src/App/Pages/Vault/SharePageViewModel.cs b/src/App/Pages/Vault/SharePageViewModel.cs index 0c8d0fd9d..c7e3cfbb1 100644 --- a/src/App/Pages/Vault/SharePageViewModel.cs +++ b/src/App/Pages/Vault/SharePageViewModel.cs @@ -1,13 +1,13 @@ -using Bit.App.Abstractions; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Bit.App.Abstractions; using Bit.App.Resources; using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.View; using Bit.Core.Utilities; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace Bit.App.Pages { diff --git a/src/App/Pages/Vault/ViewPage.xaml.cs b/src/App/Pages/Vault/ViewPage.xaml.cs index 22e574e36..eb03551f1 100644 --- a/src/App/Pages/Vault/ViewPage.xaml.cs +++ b/src/App/Pages/Vault/ViewPage.xaml.cs @@ -1,9 +1,9 @@ using System; +using System.Collections.Generic; +using System.Threading.Tasks; using Bit.App.Resources; using Bit.Core.Abstractions; using Bit.Core.Utilities; -using System.Collections.Generic; -using System.Threading.Tasks; using Xamarin.Forms; namespace Bit.App.Pages @@ -216,7 +216,7 @@ namespace Bit.App.Pages return; } - var options = new List {AppResources.Attachments}; + var options = new List { AppResources.Attachments }; if (_vm.Cipher.OrganizationId == null) { options.Add(AppResources.Clone); diff --git a/src/App/Pages/Vault/ViewPageViewModel.cs b/src/App/Pages/Vault/ViewPageViewModel.cs index b47be00ab..9ad6f3b26 100644 --- a/src/App/Pages/Vault/ViewPageViewModel.cs +++ b/src/App/Pages/Vault/ViewPageViewModel.cs @@ -1,16 +1,16 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Bit.App.Abstractions; using Bit.App.Resources; using Bit.App.Utilities; +using Bit.Core; using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.View; using Bit.Core.Utilities; -using Bit.Core; using Xamarin.Forms; namespace Bit.App.Pages @@ -233,7 +233,7 @@ namespace Bit.App.Pages set { SetProperty(ref _totpLow, value); - Page.Resources["textTotp"] = ThemeManager.Resources()[value ? "text-danger" : "text-default"]; + Page.Resources["textTotp"] = ThemeManager.Resources()[value ? "text-danger" : "text-default"]; } } public bool IsDeleted => Cipher.IsDeleted; @@ -285,7 +285,7 @@ namespace Bit.App.Pages public async void TogglePassword() { - if (! await PromptPasswordAsync()) + if (!await PromptPasswordAsync()) { return; } @@ -613,7 +613,7 @@ namespace Bit.App.Pages _attachmentData = null; _attachmentFilename = null; } - + private async void CopyAsync(string id, string text = null) { if (_passwordRepromptService.ProtectedFields.Contains(id) && !await PromptPasswordAsync()) diff --git a/src/App/Services/MobileI18nService.cs b/src/App/Services/MobileI18nService.cs index 24c70fcf2..da86ee4fe 100644 --- a/src/App/Services/MobileI18nService.cs +++ b/src/App/Services/MobileI18nService.cs @@ -1,11 +1,11 @@ -using Bit.App.Resources; -using Bit.Core.Abstractions; -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.Reflection; using System.Resources; using System.Threading; +using Bit.App.Resources; +using Bit.Core.Abstractions; namespace Bit.App.Services { diff --git a/src/App/Services/MobilePasswordRepromptService.cs b/src/App/Services/MobilePasswordRepromptService.cs index 8f1b7a04c..28a8e5a86 100644 --- a/src/App/Services/MobilePasswordRepromptService.cs +++ b/src/App/Services/MobilePasswordRepromptService.cs @@ -1,8 +1,8 @@ -using System.Threading.Tasks; +using System; +using System.Threading.Tasks; using Bit.App.Abstractions; using Bit.App.Resources; using Bit.Core.Abstractions; -using System; using Bit.Core.Utilities; namespace Bit.App.Services diff --git a/src/App/Services/MobilePlatformUtilsService.cs b/src/App/Services/MobilePlatformUtilsService.cs index f4e98e250..6b424dc66 100644 --- a/src/App/Services/MobilePlatformUtilsService.cs +++ b/src/App/Services/MobilePlatformUtilsService.cs @@ -14,7 +14,7 @@ using Xamarin.Forms; namespace Bit.App.Services { public class MobilePlatformUtilsService : IPlatformUtilsService - { + { private static readonly Random _random = new Random(); private const int DialogPromiseExpiration = 600000; // 10 minutes diff --git a/src/App/Services/MobileStorageService.cs b/src/App/Services/MobileStorageService.cs index 11694bf77..723048604 100644 --- a/src/App/Services/MobileStorageService.cs +++ b/src/App/Services/MobileStorageService.cs @@ -1,8 +1,8 @@ -using Bit.Core; -using Bit.Core.Abstractions; -using System; +using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core; +using Bit.Core.Abstractions; namespace Bit.App.Services { diff --git a/src/App/Services/NoopPushNotificationListenerService.cs b/src/App/Services/NoopPushNotificationListenerService.cs index 7bb42b424..f15a258b5 100644 --- a/src/App/Services/NoopPushNotificationListenerService.cs +++ b/src/App/Services/NoopPushNotificationListenerService.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json.Linq; +using System.Threading.Tasks; using Bit.App.Abstractions; -using System.Threading.Tasks; +using Newtonsoft.Json.Linq; namespace Bit.App.Services { diff --git a/src/App/Services/PreferencesStorageService.cs b/src/App/Services/PreferencesStorageService.cs index ae0dc6609..1fdb72434 100644 --- a/src/App/Services/PreferencesStorageService.cs +++ b/src/App/Services/PreferencesStorageService.cs @@ -1,15 +1,15 @@ -using Bit.Core.Abstractions; +using System; +using System.Threading.Tasks; +using Bit.Core.Abstractions; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; -using System; -using System.Threading.Tasks; namespace Bit.App.Services { public class PreferencesStorageService : IStorageService { public static string KeyFormat = "bwPreferencesStorage:{0}"; - + private readonly string _sharedName; private readonly JsonSerializerSettings _jsonSettings = new JsonSerializerSettings { diff --git a/src/App/Services/PushNotificationListenerService.cs b/src/App/Services/PushNotificationListenerService.cs index 9c3154641..79521a7a5 100644 --- a/src/App/Services/PushNotificationListenerService.cs +++ b/src/App/Services/PushNotificationListenerService.cs @@ -1,17 +1,17 @@ -#if !FDROID +#if !FDROID +using System; using System.Diagnostics; +using System.Threading.Tasks; +using Bit.App.Abstractions; +using Bit.Core; +using Bit.Core.Abstractions; +using Bit.Core.Enums; +using Bit.Core.Exceptions; +using Bit.Core.Models.Response; +using Bit.Core.Utilities; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using Bit.App.Abstractions; -using System; using Xamarin.Forms; -using Bit.Core.Abstractions; -using Bit.Core.Utilities; -using System.Threading.Tasks; -using Bit.Core.Enums; -using Bit.Core; -using Bit.Core.Models.Response; -using Bit.Core.Exceptions; namespace Bit.App.Services { diff --git a/src/App/Services/SecureStorageService.cs b/src/App/Services/SecureStorageService.cs index 5655cc17e..1c1534b68 100644 --- a/src/App/Services/SecureStorageService.cs +++ b/src/App/Services/SecureStorageService.cs @@ -1,7 +1,7 @@ -using Bit.Core.Abstractions; +using System.Threading.Tasks; +using Bit.Core.Abstractions; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; -using System.Threading.Tasks; namespace Bit.App.Services { diff --git a/src/App/Styles/Android.xaml.cs b/src/App/Styles/Android.xaml.cs index 166079cef..a2e9ecfd3 100644 --- a/src/App/Styles/Android.xaml.cs +++ b/src/App/Styles/Android.xaml.cs @@ -9,4 +9,4 @@ namespace Bit.App.Styles InitializeComponent(); } } -} \ No newline at end of file +} diff --git a/src/App/Styles/Black.xaml.cs b/src/App/Styles/Black.xaml.cs index c13d1698f..b126f1bb5 100644 --- a/src/App/Styles/Black.xaml.cs +++ b/src/App/Styles/Black.xaml.cs @@ -9,4 +9,4 @@ namespace Bit.App.Styles InitializeComponent(); } } -} \ No newline at end of file +} diff --git a/src/App/Styles/Dark.xaml.cs b/src/App/Styles/Dark.xaml.cs index b0bf3d949..1a4113ab6 100644 --- a/src/App/Styles/Dark.xaml.cs +++ b/src/App/Styles/Dark.xaml.cs @@ -9,4 +9,4 @@ namespace Bit.App.Styles InitializeComponent(); } } -} \ No newline at end of file +} diff --git a/src/App/Styles/Light.xaml.cs b/src/App/Styles/Light.xaml.cs index f7defeec7..3ddad1482 100644 --- a/src/App/Styles/Light.xaml.cs +++ b/src/App/Styles/Light.xaml.cs @@ -9,4 +9,4 @@ namespace Bit.App.Styles InitializeComponent(); } } -} \ No newline at end of file +} diff --git a/src/App/Styles/Nord.xaml.cs b/src/App/Styles/Nord.xaml.cs index 3ec5209f5..6baf44c3b 100644 --- a/src/App/Styles/Nord.xaml.cs +++ b/src/App/Styles/Nord.xaml.cs @@ -9,4 +9,4 @@ namespace Bit.App.Styles InitializeComponent(); } } -} \ No newline at end of file +} diff --git a/src/App/Styles/Variables.xaml.cs b/src/App/Styles/Variables.xaml.cs index 214142bde..31582c54d 100644 --- a/src/App/Styles/Variables.xaml.cs +++ b/src/App/Styles/Variables.xaml.cs @@ -9,4 +9,4 @@ namespace Bit.App.Styles InitializeComponent(); } } -} \ No newline at end of file +} diff --git a/src/App/Styles/iOS.xaml.cs b/src/App/Styles/iOS.xaml.cs index 72d94ad44..a08433b33 100644 --- a/src/App/Styles/iOS.xaml.cs +++ b/src/App/Styles/iOS.xaml.cs @@ -9,4 +9,4 @@ namespace Bit.App.Styles InitializeComponent(); } } -} \ No newline at end of file +} diff --git a/src/App/Utilities/AppHelpers.cs b/src/App/Utilities/AppHelpers.cs index d795fcf98..454d77021 100644 --- a/src/App/Utilities/AppHelpers.cs +++ b/src/App/Utilities/AppHelpers.cs @@ -1,21 +1,21 @@ using System; -using System.Net; -using Bit.App.Abstractions; -using Bit.App.Pages; -using Bit.App.Resources; -using Bit.Core.Abstractions; -using Bit.Core.Models.View; -using Bit.Core.Utilities; using System.Collections.Generic; using System.Linq; +using System.Net; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; +using Bit.App.Abstractions; using Bit.App.Controls; using Bit.App.Models; +using Bit.App.Pages; +using Bit.App.Resources; +using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Data; +using Bit.Core.Models.View; +using Bit.Core.Utilities; using Newtonsoft.Json; using Xamarin.Essentials; using Xamarin.Forms; @@ -279,7 +279,7 @@ namespace Bit.App.Utilities Subject = send.Name }); } - + private static string GetSendUrl(SendView send) { var environmentService = ServiceContainer.Resolve("environmentService"); @@ -465,12 +465,12 @@ namespace Bit.App.Utilities public static async Task IncrementInvalidUnlockAttemptsAsync() { var stateService = ServiceContainer.Resolve("stateService"); - var invalidUnlockAttempts = await stateService.GetInvalidUnlockAttemptsAsync(); + var invalidUnlockAttempts = await stateService.GetInvalidUnlockAttemptsAsync(); invalidUnlockAttempts++; await stateService.SetInvalidUnlockAttemptsAsync(invalidUnlockAttempts); return invalidUnlockAttempts; } - + public static async Task ResetInvalidUnlockAttemptsAsync() { var stateService = ServiceContainer.Resolve("stateService"); diff --git a/src/App/Utilities/I18nExtension.cs b/src/App/Utilities/I18nExtension.cs index 0cb6ed224..b66040c75 100644 --- a/src/App/Utilities/I18nExtension.cs +++ b/src/App/Utilities/I18nExtension.cs @@ -1,6 +1,6 @@ -using Bit.Core.Abstractions; +using System; +using Bit.Core.Abstractions; using Bit.Core.Utilities; -using System; using Xamarin.Forms; using Xamarin.Forms.Xaml; diff --git a/src/App/Utilities/PasswordFormatter.cs b/src/App/Utilities/PasswordFormatter.cs index 8824985ed..a6f25e8ea 100644 --- a/src/App/Utilities/PasswordFormatter.cs +++ b/src/App/Utilities/PasswordFormatter.cs @@ -42,7 +42,7 @@ namespace Bit.App.Utilities { result += "
"; } - + // Start with an otherwise uncovered case so we will definitely enter the "something changed" // state. var currentType = CharType.None; @@ -72,7 +72,7 @@ namespace Bit.App.Utilities { result += ""; } - + currentType = charType; // Switch the color if it is not a normal text. Otherwise leave the @@ -110,13 +110,13 @@ namespace Bit.App.Utilities { result += ""; } - + // Close off iOS div if (Device.RuntimePlatform == Device.iOS) { result += "
"; } - + return result; } } diff --git a/src/Core/Abstractions/IApiService.cs b/src/Core/Abstractions/IApiService.cs index 782bbe5a2..48405d4e8 100644 --- a/src/Core/Abstractions/IApiService.cs +++ b/src/Core/Abstractions/IApiService.cs @@ -1,10 +1,10 @@ -using Bit.Core.Models.Domain; -using Bit.Core.Models.Request; -using Bit.Core.Models.Response; -using System; +using System; using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; +using Bit.Core.Models.Domain; +using Bit.Core.Models.Request; +using Bit.Core.Models.Response; namespace Bit.Core.Abstractions { diff --git a/src/Core/Abstractions/IAuditService.cs b/src/Core/Abstractions/IAuditService.cs index f28bb2e6f..047fb7dad 100644 --- a/src/Core/Abstractions/IAuditService.cs +++ b/src/Core/Abstractions/IAuditService.cs @@ -9,4 +9,4 @@ namespace Bit.Core.Abstractions Task> BreachedAccountsAsync(string username); Task PasswordLeakedAsync(string password); } -} \ No newline at end of file +} diff --git a/src/Core/Abstractions/IBroadcasterService.cs b/src/Core/Abstractions/IBroadcasterService.cs index afdf29f21..ac481b53d 100644 --- a/src/Core/Abstractions/IBroadcasterService.cs +++ b/src/Core/Abstractions/IBroadcasterService.cs @@ -1,5 +1,5 @@ -using Bit.Core.Models.Domain; -using System; +using System; +using Bit.Core.Models.Domain; namespace Bit.Core.Abstractions { @@ -9,4 +9,4 @@ namespace Bit.Core.Abstractions void Subscribe(string id, Action messageCallback); void Unsubscribe(string id); } -} \ No newline at end of file +} diff --git a/src/Core/Abstractions/ICipherService.cs b/src/Core/Abstractions/ICipherService.cs index f5902bf4a..60e4b722c 100644 --- a/src/Core/Abstractions/ICipherService.cs +++ b/src/Core/Abstractions/ICipherService.cs @@ -20,7 +20,7 @@ namespace Bit.Core.Abstractions Task EncryptAsync(CipherView model, SymmetricCryptoKey key = null, Cipher originalCipher = null); Task> GetAllAsync(); Task> GetAllDecryptedAsync(); - Task, List, List>> GetAllDecryptedByUrlAsync(string url, + Task, List, List>> GetAllDecryptedByUrlAsync(string url, List includeOtherTypes = null); Task> GetAllDecryptedForGroupingAsync(string groupingId, bool folder = true); Task> GetAllDecryptedForUrlAsync(string url); diff --git a/src/Core/Abstractions/ICryptoFunctionService.cs b/src/Core/Abstractions/ICryptoFunctionService.cs index 98e58bf48..14f8fdf6c 100644 --- a/src/Core/Abstractions/ICryptoFunctionService.cs +++ b/src/Core/Abstractions/ICryptoFunctionService.cs @@ -1,6 +1,6 @@ -using Bit.Core.Enums; -using System; +using System; using System.Threading.Tasks; +using Bit.Core.Enums; namespace Bit.Core.Abstractions { diff --git a/src/Core/Abstractions/IEnvironmentService.cs b/src/Core/Abstractions/IEnvironmentService.cs index 06e76959a..7469452b9 100644 --- a/src/Core/Abstractions/IEnvironmentService.cs +++ b/src/Core/Abstractions/IEnvironmentService.cs @@ -18,4 +18,4 @@ namespace Bit.Core.Abstractions Task SetUrlsAsync(EnvironmentUrlData urls); Task SetUrlsFromStorageAsync(); } -} \ No newline at end of file +} diff --git a/src/Core/Abstractions/IExportService.cs b/src/Core/Abstractions/IExportService.cs index 022500c12..e43f98644 100644 --- a/src/Core/Abstractions/IExportService.cs +++ b/src/Core/Abstractions/IExportService.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; namespace Bit.Core.Abstractions { diff --git a/src/Core/Abstractions/IFileUploadService.cs b/src/Core/Abstractions/IFileUploadService.cs index 689b3440f..75f566550 100644 --- a/src/Core/Abstractions/IFileUploadService.cs +++ b/src/Core/Abstractions/IFileUploadService.cs @@ -1,9 +1,11 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; using Bit.Core.Models.Domain; using Bit.Core.Models.Response; -namespace Bit.Core.Abstractions { - public interface IFileUploadService { +namespace Bit.Core.Abstractions +{ + public interface IFileUploadService + { Task UploadCipherAttachmentFileAsync(AttachmentUploadDataResponse uploadData, EncString fileName, EncByteArray encryptedFileData); Task UploadSendFileAsync(SendFileUploadDataResponse uploadData, EncString fileName, EncByteArray encryptedFileData); } diff --git a/src/Core/Abstractions/IMessagingService.cs b/src/Core/Abstractions/IMessagingService.cs index 08d631907..5fb5f987d 100644 --- a/src/Core/Abstractions/IMessagingService.cs +++ b/src/Core/Abstractions/IMessagingService.cs @@ -4,4 +4,4 @@ { void Send(string subscriber, object arg = null); } -} \ No newline at end of file +} diff --git a/src/Core/Abstractions/INativeLogService.cs b/src/Core/Abstractions/INativeLogService.cs index fdadcca37..c24a622ad 100644 --- a/src/Core/Abstractions/INativeLogService.cs +++ b/src/Core/Abstractions/INativeLogService.cs @@ -7,4 +7,4 @@ void Info(string message); void Warning(string message); } -} \ No newline at end of file +} diff --git a/src/Core/Abstractions/IPolicyService.cs b/src/Core/Abstractions/IPolicyService.cs index 2a2d3504a..d9dfb7263 100644 --- a/src/Core/Abstractions/IPolicyService.cs +++ b/src/Core/Abstractions/IPolicyService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Threading.Tasks; using Bit.Core.Enums; diff --git a/src/Core/Abstractions/ISendService.cs b/src/Core/Abstractions/ISendService.cs index 91aa2ccae..c6015fa24 100644 --- a/src/Core/Abstractions/ISendService.cs +++ b/src/Core/Abstractions/ISendService.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; using Bit.Core.Models.Data; using Bit.Core.Models.Domain; diff --git a/src/Core/Abstractions/ITotpService.cs b/src/Core/Abstractions/ITotpService.cs index 0de407e3e..e0aff3c2f 100644 --- a/src/Core/Abstractions/ITotpService.cs +++ b/src/Core/Abstractions/ITotpService.cs @@ -8,4 +8,4 @@ namespace Bit.Core.Abstractions int GetTimeInterval(string key); Task IsAutoCopyEnabledAsync(); } -} \ No newline at end of file +} diff --git a/src/Core/BitwardenIcons.cs b/src/Core/BitwardenIcons.cs index c659d9bea..c621e9091 100644 --- a/src/Core/BitwardenIcons.cs +++ b/src/Core/BitwardenIcons.cs @@ -1,4 +1,4 @@ -namespace Bit.Core +namespace Bit.Core { public static class BitwardenIcons { diff --git a/src/Core/Constants.cs b/src/Core/Constants.cs index cfdec4eee..996358876 100644 --- a/src/Core/Constants.cs +++ b/src/Core/Constants.cs @@ -31,12 +31,12 @@ public const int SelectFileRequestCode = 42; public const int SelectFilePermissionRequestCode = 43; public const int SaveFileRequestCode = 44; - + public static readonly string[] AndroidAllClearCipherCacheKeys = { ClearCiphersCacheKey }; - + public static readonly string[] iOSAllClearCipherCacheKeys = { ClearCiphersCacheKey, @@ -44,7 +44,7 @@ iOSExtensionClearCiphersCacheKey, iOSShareExtensionClearCiphersCacheKey }; - + public static string CiphersKey(string userId) => $"ciphers_{userId}"; public static string FoldersKey(string userId) => $"folders_{userId}"; public static string CollectionsKey(string userId) => $"collections_{userId}"; diff --git a/src/Core/Enums/ClientType.cs b/src/Core/Enums/ClientType.cs index f6d3fd9c2..9d5e4feab 100644 --- a/src/Core/Enums/ClientType.cs +++ b/src/Core/Enums/ClientType.cs @@ -1,6 +1,6 @@ namespace Bit.Core.Enums { - public enum ClientType: byte + public enum ClientType : byte { Web = 1, Browser = 2, diff --git a/src/Core/Enums/HdkfAlgorithm.cs b/src/Core/Enums/HdkfAlgorithm.cs index 5837a3fa3..0f2b32e17 100644 --- a/src/Core/Enums/HdkfAlgorithm.cs +++ b/src/Core/Enums/HdkfAlgorithm.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Enums +namespace Bit.Core.Enums { public enum HkdfAlgorithm : byte { diff --git a/src/Core/Enums/LinkedIdType.cs b/src/Core/Enums/LinkedIdType.cs index 32803868c..2ffd0acb5 100644 --- a/src/Core/Enums/LinkedIdType.cs +++ b/src/Core/Enums/LinkedIdType.cs @@ -1,6 +1,7 @@ -namespace Bit.Core.Enums { - - public enum LinkedIdType: int +namespace Bit.Core.Enums +{ + + public enum LinkedIdType : int { // Login Login_Username = 100, diff --git a/src/Core/Enums/SendType.cs b/src/Core/Enums/SendType.cs index f8f06f13d..fb447b2b5 100644 --- a/src/Core/Enums/SendType.cs +++ b/src/Core/Enums/SendType.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Enums +namespace Bit.Core.Enums { public enum SendType { diff --git a/src/Core/Exceptions/ApiException.cs b/src/Core/Exceptions/ApiException.cs index bf0aa9791..493900137 100644 --- a/src/Core/Exceptions/ApiException.cs +++ b/src/Core/Exceptions/ApiException.cs @@ -1,5 +1,5 @@ -using Bit.Core.Models.Response; -using System; +using System; +using Bit.Core.Models.Response; namespace Bit.Core.Exceptions { diff --git a/src/Core/Models/Api/SendFileApi.cs b/src/Core/Models/Api/SendFileApi.cs index ae7f01aea..345d9f215 100644 --- a/src/Core/Models/Api/SendFileApi.cs +++ b/src/Core/Models/Api/SendFileApi.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Models.Api +namespace Bit.Core.Models.Api { public class SendFileApi { diff --git a/src/Core/Models/Api/SendTextApi.cs b/src/Core/Models/Api/SendTextApi.cs index 9520031da..2b7b92429 100644 --- a/src/Core/Models/Api/SendTextApi.cs +++ b/src/Core/Models/Api/SendTextApi.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Models.Api +namespace Bit.Core.Models.Api { public class SendTextApi { diff --git a/src/Core/Models/Data/CipherData.cs b/src/Core/Models/Data/CipherData.cs index 50cb20133..c571771a7 100644 --- a/src/Core/Models/Data/CipherData.cs +++ b/src/Core/Models/Data/CipherData.cs @@ -1,8 +1,8 @@ -using Bit.Core.Models.Response; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; +using Bit.Core.Models.Response; namespace Bit.Core.Models.Data { diff --git a/src/Core/Models/Data/EventData.cs b/src/Core/Models/Data/EventData.cs index 49f0957f3..6a5007033 100644 --- a/src/Core/Models/Data/EventData.cs +++ b/src/Core/Models/Data/EventData.cs @@ -1,5 +1,5 @@ -using Bit.Core.Enums; -using System; +using System; +using Bit.Core.Enums; namespace Bit.Core.Models.Data { diff --git a/src/Core/Models/Data/FolderData.cs b/src/Core/Models/Data/FolderData.cs index 24a155a05..75e56d16e 100644 --- a/src/Core/Models/Data/FolderData.cs +++ b/src/Core/Models/Data/FolderData.cs @@ -1,5 +1,5 @@ -using Bit.Core.Models.Response; -using System; +using System; +using Bit.Core.Models.Response; namespace Bit.Core.Models.Data { diff --git a/src/Core/Models/Data/LoginData.cs b/src/Core/Models/Data/LoginData.cs index 7afff7e36..286c542ed 100644 --- a/src/Core/Models/Data/LoginData.cs +++ b/src/Core/Models/Data/LoginData.cs @@ -1,7 +1,7 @@ -using Bit.Core.Models.Api; -using System; +using System; using System.Collections.Generic; using System.Linq; +using Bit.Core.Models.Api; namespace Bit.Core.Models.Data { diff --git a/src/Core/Models/Data/PasswordHistoryData.cs b/src/Core/Models/Data/PasswordHistoryData.cs index 5d15bc0a7..9ade26ef2 100644 --- a/src/Core/Models/Data/PasswordHistoryData.cs +++ b/src/Core/Models/Data/PasswordHistoryData.cs @@ -1,5 +1,5 @@ -using Bit.Core.Models.Response; -using System; +using System; +using Bit.Core.Models.Response; namespace Bit.Core.Models.Data { diff --git a/src/Core/Models/Data/Permissions.cs b/src/Core/Models/Data/Permissions.cs index 4c6e7fe3a..c1b8278f2 100644 --- a/src/Core/Models/Data/Permissions.cs +++ b/src/Core/Models/Data/Permissions.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Models.Data +namespace Bit.Core.Models.Data { public class Permissions { diff --git a/src/Core/Models/Data/SendData.cs b/src/Core/Models/Data/SendData.cs index ce891b3cc..a4659c37f 100644 --- a/src/Core/Models/Data/SendData.cs +++ b/src/Core/Models/Data/SendData.cs @@ -1,4 +1,4 @@ -using System; +using System; using Bit.Core.Enums; using Bit.Core.Models.Response; @@ -38,7 +38,7 @@ namespace Bit.Core.Models.Data break; } } - + public string Id { get; set; } public string AccessId { get; set; } public string UserId { get; set; } diff --git a/src/Core/Models/Data/SendFileData.cs b/src/Core/Models/Data/SendFileData.cs index 65027d6a5..d596bde64 100644 --- a/src/Core/Models/Data/SendFileData.cs +++ b/src/Core/Models/Data/SendFileData.cs @@ -1,4 +1,4 @@ -using System.Drawing; +using System.Drawing; using Bit.Core.Models.Api; namespace Bit.Core.Models.Data diff --git a/src/Core/Models/Data/SendTextData.cs b/src/Core/Models/Data/SendTextData.cs index 2e83ca1a0..ae4f4abfc 100644 --- a/src/Core/Models/Data/SendTextData.cs +++ b/src/Core/Models/Data/SendTextData.cs @@ -1,4 +1,4 @@ -using System.Drawing; +using System.Drawing; using Bit.Core.Models.Api; namespace Bit.Core.Models.Data diff --git a/src/Core/Models/Domain/Attachment.cs b/src/Core/Models/Domain/Attachment.cs index b46f66a31..3e71d6107 100644 --- a/src/Core/Models/Domain/Attachment.cs +++ b/src/Core/Models/Domain/Attachment.cs @@ -1,9 +1,9 @@ -using Bit.Core.Abstractions; +using System.Collections.Generic; +using System.Threading.Tasks; +using Bit.Core.Abstractions; using Bit.Core.Models.Data; using Bit.Core.Models.View; using Bit.Core.Utilities; -using System.Collections.Generic; -using System.Threading.Tasks; namespace Bit.Core.Models.Domain { @@ -39,7 +39,7 @@ namespace Bit.Core.Models.Domain { "FileName" }, orgId); - + if (Key != null) { var cryptoService = ServiceContainer.Resolve("cryptoService"); diff --git a/src/Core/Models/Domain/AuthResult.cs b/src/Core/Models/Domain/AuthResult.cs index 404cea660..8e48c7da7 100644 --- a/src/Core/Models/Domain/AuthResult.cs +++ b/src/Core/Models/Domain/AuthResult.cs @@ -1,5 +1,5 @@ -using Bit.Core.Enums; -using System.Collections.Generic; +using System.Collections.Generic; +using Bit.Core.Enums; namespace Bit.Core.Models.Domain { diff --git a/src/Core/Models/Domain/Card.cs b/src/Core/Models/Domain/Card.cs index b8c96da02..8a7ffff23 100644 --- a/src/Core/Models/Domain/Card.cs +++ b/src/Core/Models/Domain/Card.cs @@ -1,7 +1,7 @@ -using Bit.Core.Models.Data; -using Bit.Core.Models.View; -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Models.Data; +using Bit.Core.Models.View; namespace Bit.Core.Models.Domain { diff --git a/src/Core/Models/Domain/Cipher.cs b/src/Core/Models/Domain/Cipher.cs index cf37b6c0b..d744f6a57 100644 --- a/src/Core/Models/Domain/Cipher.cs +++ b/src/Core/Models/Domain/Cipher.cs @@ -1,10 +1,10 @@ -using Bit.Core.Enums; -using Bit.Core.Models.Data; -using Bit.Core.Models.View; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Enums; +using Bit.Core.Models.Data; +using Bit.Core.Models.View; namespace Bit.Core.Models.Domain { diff --git a/src/Core/Models/Domain/Collection.cs b/src/Core/Models/Domain/Collection.cs index 4fd4d5551..da62c55e2 100644 --- a/src/Core/Models/Domain/Collection.cs +++ b/src/Core/Models/Domain/Collection.cs @@ -1,7 +1,7 @@ -using Bit.Core.Models.Data; -using Bit.Core.Models.View; -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Models.Data; +using Bit.Core.Models.View; namespace Bit.Core.Models.Domain { diff --git a/src/Core/Models/Domain/EncByteArray.cs b/src/Core/Models/Domain/EncByteArray.cs index a3214cad3..97814a7aa 100644 --- a/src/Core/Models/Domain/EncByteArray.cs +++ b/src/Core/Models/Domain/EncByteArray.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Models.Domain +namespace Bit.Core.Models.Domain { public class EncByteArray { diff --git a/src/Core/Models/Domain/EncString.cs b/src/Core/Models/Domain/EncString.cs index df4757b9e..2a86348a6 100644 --- a/src/Core/Models/Domain/EncString.cs +++ b/src/Core/Models/Domain/EncString.cs @@ -1,8 +1,8 @@ -using Bit.Core.Abstractions; +using System; +using System.Threading.Tasks; +using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Utilities; -using System; -using System.Threading.Tasks; namespace Bit.Core.Models.Domain { diff --git a/src/Core/Models/Domain/Field.cs b/src/Core/Models/Domain/Field.cs index 31f5d4340..cbfdcbca3 100644 --- a/src/Core/Models/Domain/Field.cs +++ b/src/Core/Models/Domain/Field.cs @@ -1,8 +1,8 @@ -using Bit.Core.Enums; +using System.Collections.Generic; +using System.Threading.Tasks; +using Bit.Core.Enums; using Bit.Core.Models.Data; using Bit.Core.Models.View; -using System.Collections.Generic; -using System.Threading.Tasks; namespace Bit.Core.Models.Domain { diff --git a/src/Core/Models/Domain/Folder.cs b/src/Core/Models/Domain/Folder.cs index 8b1b9429e..fe59ef5f0 100644 --- a/src/Core/Models/Domain/Folder.cs +++ b/src/Core/Models/Domain/Folder.cs @@ -1,8 +1,8 @@ -using Bit.Core.Models.Data; -using Bit.Core.Models.View; -using System; +using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Models.Data; +using Bit.Core.Models.View; namespace Bit.Core.Models.Domain { diff --git a/src/Core/Models/Domain/Identity.cs b/src/Core/Models/Domain/Identity.cs index edc5869cb..4a705dcb6 100644 --- a/src/Core/Models/Domain/Identity.cs +++ b/src/Core/Models/Domain/Identity.cs @@ -1,7 +1,7 @@ -using Bit.Core.Models.Data; -using Bit.Core.Models.View; -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Models.Data; +using Bit.Core.Models.View; namespace Bit.Core.Models.Domain { diff --git a/src/Core/Models/Domain/Login.cs b/src/Core/Models/Domain/Login.cs index abc9ead94..00c0ab07b 100644 --- a/src/Core/Models/Domain/Login.cs +++ b/src/Core/Models/Domain/Login.cs @@ -1,9 +1,9 @@ -using Bit.Core.Models.Data; -using Bit.Core.Models.View; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Models.Data; +using Bit.Core.Models.View; namespace Bit.Core.Models.Domain { diff --git a/src/Core/Models/Domain/LoginUri.cs b/src/Core/Models/Domain/LoginUri.cs index 7acba40b5..31747fd96 100644 --- a/src/Core/Models/Domain/LoginUri.cs +++ b/src/Core/Models/Domain/LoginUri.cs @@ -1,8 +1,8 @@ -using Bit.Core.Enums; +using System.Collections.Generic; +using System.Threading.Tasks; +using Bit.Core.Enums; using Bit.Core.Models.Data; using Bit.Core.Models.View; -using System.Collections.Generic; -using System.Threading.Tasks; namespace Bit.Core.Models.Domain { diff --git a/src/Core/Models/Domain/PasswordHistory.cs b/src/Core/Models/Domain/PasswordHistory.cs index b9d1e9ef0..6ae1ab1f1 100644 --- a/src/Core/Models/Domain/PasswordHistory.cs +++ b/src/Core/Models/Domain/PasswordHistory.cs @@ -1,8 +1,8 @@ -using Bit.Core.Models.Data; -using Bit.Core.Models.View; -using System; +using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Models.Data; +using Bit.Core.Models.View; namespace Bit.Core.Models.Domain { diff --git a/src/Core/Models/Domain/Policy.cs b/src/Core/Models/Domain/Policy.cs index 470c92855..a84b095d0 100644 --- a/src/Core/Models/Domain/Policy.cs +++ b/src/Core/Models/Domain/Policy.cs @@ -16,7 +16,7 @@ namespace Bit.Core.Models.Domain Data = obj.Data; Enabled = obj.Enabled; } - + public string Id { get; set; } public string OrganizationId { get; set; } public PolicyType Type { get; set; } diff --git a/src/Core/Models/Domain/ResetPasswordPolicyOptions.cs b/src/Core/Models/Domain/ResetPasswordPolicyOptions.cs index 1653aa774..4e9cebe2e 100644 --- a/src/Core/Models/Domain/ResetPasswordPolicyOptions.cs +++ b/src/Core/Models/Domain/ResetPasswordPolicyOptions.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Models.Domain +namespace Bit.Core.Models.Domain { public class ResetPasswordPolicyOptions { diff --git a/src/Core/Models/Domain/SecureNote.cs b/src/Core/Models/Domain/SecureNote.cs index 6d3afab4c..55817ab15 100644 --- a/src/Core/Models/Domain/SecureNote.cs +++ b/src/Core/Models/Domain/SecureNote.cs @@ -1,7 +1,7 @@ -using Bit.Core.Enums; +using System.Threading.Tasks; +using Bit.Core.Enums; using Bit.Core.Models.Data; using Bit.Core.Models.View; -using System.Threading.Tasks; namespace Bit.Core.Models.Domain { diff --git a/src/Core/Models/Domain/Send.cs b/src/Core/Models/Domain/Send.cs index 2c7761d41..4ecea0c15 100644 --- a/src/Core/Models/Domain/Send.cs +++ b/src/Core/Models/Domain/Send.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Threading.Tasks; using Bit.Core.Abstractions; diff --git a/src/Core/Models/Domain/SendFile.cs b/src/Core/Models/Domain/SendFile.cs index 77b24f3f6..cde9086d1 100644 --- a/src/Core/Models/Domain/SendFile.cs +++ b/src/Core/Models/Domain/SendFile.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; using Bit.Core.Models.Data; using Bit.Core.Models.View; diff --git a/src/Core/Models/Domain/SendText.cs b/src/Core/Models/Domain/SendText.cs index f7825343e..adff8251f 100644 --- a/src/Core/Models/Domain/SendText.cs +++ b/src/Core/Models/Domain/SendText.cs @@ -1,4 +1,4 @@ - + using System.Collections.Generic; using System.Threading.Tasks; using Bit.Core.Models.Data; diff --git a/src/Core/Models/Domain/SymmetricCryptoKey.cs b/src/Core/Models/Domain/SymmetricCryptoKey.cs index 820823b26..91bce7550 100644 --- a/src/Core/Models/Domain/SymmetricCryptoKey.cs +++ b/src/Core/Models/Domain/SymmetricCryptoKey.cs @@ -1,6 +1,6 @@ -using Bit.Core.Enums; -using System; +using System; using System.Linq; +using Bit.Core.Enums; namespace Bit.Core.Models.Domain { diff --git a/src/Core/Models/Export/CollectionWithId.cs b/src/Core/Models/Export/CollectionWithId.cs index 2b8af4dd2..01e80f250 100644 --- a/src/Core/Models/Export/CollectionWithId.cs +++ b/src/Core/Models/Export/CollectionWithId.cs @@ -10,7 +10,7 @@ namespace Bit.Core.Models.Export Id = obj.Id; } - public CollectionWithId(Domain.Collection obj): base(obj) + public CollectionWithId(Domain.Collection obj) : base(obj) { Id = obj.Id; } diff --git a/src/Core/Models/Request/CipherCreateRequest.cs b/src/Core/Models/Request/CipherCreateRequest.cs index aefb9b340..bee9b3c64 100644 --- a/src/Core/Models/Request/CipherCreateRequest.cs +++ b/src/Core/Models/Request/CipherCreateRequest.cs @@ -1,6 +1,6 @@ -using Bit.Core.Models.Domain; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; +using Bit.Core.Models.Domain; namespace Bit.Core.Models.Request { diff --git a/src/Core/Models/Request/CipherRequest.cs b/src/Core/Models/Request/CipherRequest.cs index ca00ee182..82c029751 100644 --- a/src/Core/Models/Request/CipherRequest.cs +++ b/src/Core/Models/Request/CipherRequest.cs @@ -1,9 +1,9 @@ -using Bit.Core.Enums; -using Bit.Core.Models.Api; -using Bit.Core.Models.Domain; +using System; using System.Collections.Generic; using System.Linq; -using System; +using Bit.Core.Enums; +using Bit.Core.Models.Api; +using Bit.Core.Models.Domain; namespace Bit.Core.Models.Request { diff --git a/src/Core/Models/Request/CipherShareRequest.cs b/src/Core/Models/Request/CipherShareRequest.cs index 4fb4f3761..89bfb6dc6 100644 --- a/src/Core/Models/Request/CipherShareRequest.cs +++ b/src/Core/Models/Request/CipherShareRequest.cs @@ -1,6 +1,6 @@ -using Bit.Core.Models.Domain; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; +using Bit.Core.Models.Domain; namespace Bit.Core.Models.Request { diff --git a/src/Core/Models/Request/EventRequest.cs b/src/Core/Models/Request/EventRequest.cs index d1c728287..da4124189 100644 --- a/src/Core/Models/Request/EventRequest.cs +++ b/src/Core/Models/Request/EventRequest.cs @@ -1,5 +1,5 @@ -using Bit.Core.Enums; -using System; +using System; +using Bit.Core.Enums; namespace Bit.Core.Models.Request { diff --git a/src/Core/Models/Request/OrganizationUserResetPasswordEnrollmentRequest.cs b/src/Core/Models/Request/OrganizationUserResetPasswordEnrollmentRequest.cs index b751a9a4f..267a425ec 100644 --- a/src/Core/Models/Request/OrganizationUserResetPasswordEnrollmentRequest.cs +++ b/src/Core/Models/Request/OrganizationUserResetPasswordEnrollmentRequest.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Models.Request +namespace Bit.Core.Models.Request { public class OrganizationUserResetPasswordEnrollmentRequest { diff --git a/src/Core/Models/Request/SendRequest.cs b/src/Core/Models/Request/SendRequest.cs index fb3d643a9..abd7323ec 100644 --- a/src/Core/Models/Request/SendRequest.cs +++ b/src/Core/Models/Request/SendRequest.cs @@ -1,4 +1,4 @@ -using System; +using System; using Bit.Core.Enums; using Bit.Core.Models.Api; using Bit.Core.Models.Domain; @@ -23,7 +23,7 @@ namespace Bit.Core.Models.Request public SendRequest(Send send, long? fileLength) { - Type = send.Type ; + Type = send.Type; FileLength = fileLength; Name = send.Name?.EncryptedString; Notes = send.Notes?.EncryptedString; diff --git a/src/Core/Models/Request/TokenRequest.cs b/src/Core/Models/Request/TokenRequest.cs index b982c2ea4..fe299e455 100644 --- a/src/Core/Models/Request/TokenRequest.cs +++ b/src/Core/Models/Request/TokenRequest.cs @@ -1,9 +1,9 @@ -using Bit.Core.Enums; -using Bit.Core.Utilities; -using System; +using System; using System.Collections.Generic; using System.Net.Http.Headers; using System.Text; +using Bit.Core.Enums; +using Bit.Core.Utilities; namespace Bit.Core.Models.Request { diff --git a/src/Core/Models/Response/AttachmentUploadDataReponse.cs b/src/Core/Models/Response/AttachmentUploadDataReponse.cs index 5f1a76c37..e26059d9f 100644 --- a/src/Core/Models/Response/AttachmentUploadDataReponse.cs +++ b/src/Core/Models/Response/AttachmentUploadDataReponse.cs @@ -1,4 +1,4 @@ -using Bit.Core.Enums; +using Bit.Core.Enums; namespace Bit.Core.Models.Response { diff --git a/src/Core/Models/Response/CipherResponse.cs b/src/Core/Models/Response/CipherResponse.cs index 684d5f82d..070d41eee 100644 --- a/src/Core/Models/Response/CipherResponse.cs +++ b/src/Core/Models/Response/CipherResponse.cs @@ -1,7 +1,7 @@ -using Bit.Core.Enums; -using Bit.Core.Models.Api; -using System; +using System; using System.Collections.Generic; +using Bit.Core.Enums; +using Bit.Core.Models.Api; namespace Bit.Core.Models.Response { diff --git a/src/Core/Models/Response/ErrorResponse.cs b/src/Core/Models/Response/ErrorResponse.cs index cd240e44c..71cde4317 100644 --- a/src/Core/Models/Response/ErrorResponse.cs +++ b/src/Core/Models/Response/ErrorResponse.cs @@ -1,8 +1,8 @@ -using Newtonsoft.Json.Linq; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Net; +using Newtonsoft.Json.Linq; namespace Bit.Core.Models.Response { diff --git a/src/Core/Models/Response/IdentityCaptchaResponse.cs b/src/Core/Models/Response/IdentityCaptchaResponse.cs index 018248b94..a5350e8da 100644 --- a/src/Core/Models/Response/IdentityCaptchaResponse.cs +++ b/src/Core/Models/Response/IdentityCaptchaResponse.cs @@ -1,6 +1,6 @@ -using Bit.Core.Enums; +using System.Collections.Generic; +using Bit.Core.Enums; using Newtonsoft.Json; -using System.Collections.Generic; namespace Bit.Core.Models.Response { diff --git a/src/Core/Models/Response/IdentityResponse.cs b/src/Core/Models/Response/IdentityResponse.cs index 6f693e571..cb843fd8d 100644 --- a/src/Core/Models/Response/IdentityResponse.cs +++ b/src/Core/Models/Response/IdentityResponse.cs @@ -1,4 +1,4 @@ -using System.Net; +using System.Net; using Newtonsoft.Json.Linq; namespace Bit.Core.Models.Response diff --git a/src/Core/Models/Response/IdentityTwoFactorResponse.cs b/src/Core/Models/Response/IdentityTwoFactorResponse.cs index 65b1f94b8..928bd4303 100644 --- a/src/Core/Models/Response/IdentityTwoFactorResponse.cs +++ b/src/Core/Models/Response/IdentityTwoFactorResponse.cs @@ -1,6 +1,6 @@ -using Bit.Core.Enums; +using System.Collections.Generic; +using Bit.Core.Enums; using Newtonsoft.Json; -using System.Collections.Generic; namespace Bit.Core.Models.Response { diff --git a/src/Core/Models/Response/NotificationResponse.cs b/src/Core/Models/Response/NotificationResponse.cs index 8e37b2673..c32812e46 100644 --- a/src/Core/Models/Response/NotificationResponse.cs +++ b/src/Core/Models/Response/NotificationResponse.cs @@ -1,6 +1,6 @@ -using Bit.Core.Enums; -using System; +using System; using System.Collections.Generic; +using Bit.Core.Enums; namespace Bit.Core.Models.Response { diff --git a/src/Core/Models/Response/OrganizationAutoEnrollStatusResponse.cs b/src/Core/Models/Response/OrganizationAutoEnrollStatusResponse.cs index c766a82ff..d354f8ae5 100644 --- a/src/Core/Models/Response/OrganizationAutoEnrollStatusResponse.cs +++ b/src/Core/Models/Response/OrganizationAutoEnrollStatusResponse.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Models.Response +namespace Bit.Core.Models.Response { public class OrganizationAutoEnrollStatusResponse { diff --git a/src/Core/Models/Response/OrganizationKeysResponse.cs b/src/Core/Models/Response/OrganizationKeysResponse.cs index 28d350f7b..1f9c7aac5 100644 --- a/src/Core/Models/Response/OrganizationKeysResponse.cs +++ b/src/Core/Models/Response/OrganizationKeysResponse.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Models.Response +namespace Bit.Core.Models.Response { public class OrganizationKeysResponse { diff --git a/src/Core/Models/Response/SendResponse.cs b/src/Core/Models/Response/SendResponse.cs index ca6a3bc84..89ee96598 100644 --- a/src/Core/Models/Response/SendResponse.cs +++ b/src/Core/Models/Response/SendResponse.cs @@ -1,4 +1,4 @@ -using System; +using System; using Bit.Core.Enums; using Bit.Core.Models.Api; diff --git a/src/Core/Models/View/CardView.cs b/src/Core/Models/View/CardView.cs index 421d0b712..6b88d01e3 100644 --- a/src/Core/Models/View/CardView.cs +++ b/src/Core/Models/View/CardView.cs @@ -1,7 +1,7 @@ -using Bit.Core.Models.Domain; -using Bit.Core.Enums; -using System.Collections.Generic; +using System.Collections.Generic; using System.Text.RegularExpressions; +using Bit.Core.Enums; +using Bit.Core.Models.Domain; namespace Bit.Core.Models.View { diff --git a/src/Core/Models/View/CipherView.cs b/src/Core/Models/View/CipherView.cs index 1d238f271..6bec74ee4 100644 --- a/src/Core/Models/View/CipherView.cs +++ b/src/Core/Models/View/CipherView.cs @@ -1,8 +1,8 @@ -using Bit.Core.Enums; -using Bit.Core.Models.Domain; -using System; +using System; using System.Collections.Generic; using System.Linq; +using Bit.Core.Enums; +using Bit.Core.Models.Domain; namespace Bit.Core.Models.View { diff --git a/src/Core/Models/View/FolderView.cs b/src/Core/Models/View/FolderView.cs index e09eea1d3..f20f91107 100644 --- a/src/Core/Models/View/FolderView.cs +++ b/src/Core/Models/View/FolderView.cs @@ -1,5 +1,5 @@ -using Bit.Core.Models.Domain; -using System; +using System; +using Bit.Core.Models.Domain; namespace Bit.Core.Models.View { diff --git a/src/Core/Models/View/IdentityView.cs b/src/Core/Models/View/IdentityView.cs index d4dae2922..b21a5b927 100644 --- a/src/Core/Models/View/IdentityView.cs +++ b/src/Core/Models/View/IdentityView.cs @@ -1,6 +1,6 @@ -using Bit.Core.Models.Domain; +using System.Collections.Generic; using Bit.Core.Enums; -using System.Collections.Generic; +using Bit.Core.Models.Domain; namespace Bit.Core.Models.View { diff --git a/src/Core/Models/View/ItemView.cs b/src/Core/Models/View/ItemView.cs index e0e6fba13..a264cf441 100644 --- a/src/Core/Models/View/ItemView.cs +++ b/src/Core/Models/View/ItemView.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Bit.Core.Enums; namespace Bit.Core.Models.View diff --git a/src/Core/Models/View/LoginUriView.cs b/src/Core/Models/View/LoginUriView.cs index 74440fbaa..62ca2dd39 100644 --- a/src/Core/Models/View/LoginUriView.cs +++ b/src/Core/Models/View/LoginUriView.cs @@ -1,9 +1,9 @@ -using Bit.Core.Enums; -using Bit.Core.Models.Domain; -using Bit.Core.Utilities; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; +using Bit.Core.Enums; +using Bit.Core.Models.Domain; +using Bit.Core.Utilities; namespace Bit.Core.Models.View { diff --git a/src/Core/Models/View/LoginView.cs b/src/Core/Models/View/LoginView.cs index 595c69928..850082115 100644 --- a/src/Core/Models/View/LoginView.cs +++ b/src/Core/Models/View/LoginView.cs @@ -1,8 +1,8 @@ -using Bit.Core.Models.Domain; -using Bit.Core.Enums; -using System; +using System; using System.Collections.Generic; using System.Linq; +using Bit.Core.Enums; +using Bit.Core.Models.Domain; namespace Bit.Core.Models.View { diff --git a/src/Core/Models/View/PasswordHistoryView.cs b/src/Core/Models/View/PasswordHistoryView.cs index 03d646730..0d3472f52 100644 --- a/src/Core/Models/View/PasswordHistoryView.cs +++ b/src/Core/Models/View/PasswordHistoryView.cs @@ -1,5 +1,5 @@ -using Bit.Core.Models.Domain; -using System; +using System; +using Bit.Core.Models.Domain; namespace Bit.Core.Models.View { @@ -11,7 +11,7 @@ namespace Bit.Core.Models.View { LastUsedDate = ph.LastUsedDate; } - + public string Password { get; set; } public DateTime LastUsedDate { get; set; } } diff --git a/src/Core/Models/View/SecureNoteView.cs b/src/Core/Models/View/SecureNoteView.cs index 67f3818df..88a02fcbe 100644 --- a/src/Core/Models/View/SecureNoteView.cs +++ b/src/Core/Models/View/SecureNoteView.cs @@ -1,6 +1,6 @@ -using Bit.Core.Enums; +using System.Collections.Generic; +using Bit.Core.Enums; using Bit.Core.Models.Domain; -using System.Collections.Generic; namespace Bit.Core.Models.View { diff --git a/src/Core/Models/View/SendFileView.cs b/src/Core/Models/View/SendFileView.cs index 840aa04af..3b1d20ac9 100644 --- a/src/Core/Models/View/SendFileView.cs +++ b/src/Core/Models/View/SendFileView.cs @@ -1,4 +1,4 @@ -using System.Dynamic; +using System.Dynamic; using Bit.Core.Models.Domain; namespace Bit.Core.Models.View diff --git a/src/Core/Models/View/SendTextView.cs b/src/Core/Models/View/SendTextView.cs index f61a8166c..2e391a452 100644 --- a/src/Core/Models/View/SendTextView.cs +++ b/src/Core/Models/View/SendTextView.cs @@ -1,4 +1,4 @@ -using Bit.Core.Models.Domain; +using Bit.Core.Models.Domain; namespace Bit.Core.Models.View { diff --git a/src/Core/Models/View/SendView.cs b/src/Core/Models/View/SendView.cs index dcc5264e9..259eea531 100644 --- a/src/Core/Models/View/SendView.cs +++ b/src/Core/Models/View/SendView.cs @@ -1,4 +1,4 @@ -using System; +using System; using Bit.Core.Enums; using Bit.Core.Models.Domain; using Bit.Core.Utilities; diff --git a/src/Core/Services/ApiService.cs b/src/Core/Services/ApiService.cs index 78853c233..fdd880c59 100644 --- a/src/Core/Services/ApiService.cs +++ b/src/Core/Services/ApiService.cs @@ -1,4 +1,10 @@ -using Bit.Core.Abstractions; +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Domain; @@ -7,12 +13,6 @@ using Bit.Core.Models.Response; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; -using System; -using System.Collections.Generic; -using System.Net; -using System.Net.Http; -using System.Text; -using System.Threading.Tasks; namespace Bit.Core.Services { @@ -202,7 +202,7 @@ namespace Bit.Core.Services { return SendAsync(HttpMethod.Delete, "/accounts", request, true, false); } - + public Task PostConvertToKeyConnector() { return SendAsync(HttpMethod.Post, "/accounts/convert-to-key-connector", null, true, false); @@ -438,9 +438,9 @@ namespace Bit.Core.Services } #endregion - + #region Organizations APIs - + public Task GetOrganizationKeysAsync(string id) { return SendAsync(HttpMethod.Get, $"/organizations/{id}/keys", null, true, true); @@ -556,7 +556,7 @@ namespace Bit.Core.Services requestMessage.Method = HttpMethod.Get; requestMessage.RequestUri = new Uri(string.Concat(IdentityBaseUrl, path)); requestMessage.Headers.Add("Accept", "application/json"); - + HttpResponseMessage response; try { diff --git a/src/Core/Services/AppIdService.cs b/src/Core/Services/AppIdService.cs index ada27d857..b95fd432f 100644 --- a/src/Core/Services/AppIdService.cs +++ b/src/Core/Services/AppIdService.cs @@ -1,6 +1,6 @@ -using Bit.Core.Abstractions; -using System; +using System; using System.Threading.Tasks; +using Bit.Core.Abstractions; namespace Bit.Core.Services { diff --git a/src/Core/Services/AuditService.cs b/src/Core/Services/AuditService.cs index 67d138672..d6543e9f3 100644 --- a/src/Core/Services/AuditService.cs +++ b/src/Core/Services/AuditService.cs @@ -1,11 +1,11 @@ -using Bit.Core.Abstractions; -using Bit.Core.Exceptions; -using Bit.Core.Models.Response; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Threading.Tasks; +using Bit.Core.Abstractions; +using Bit.Core.Exceptions; +using Bit.Core.Models.Response; namespace Bit.Core.Services { diff --git a/src/Core/Services/AuthService.cs b/src/Core/Services/AuthService.cs index 4d043f39b..3e6517f82 100644 --- a/src/Core/Services/AuthService.cs +++ b/src/Core/Services/AuthService.cs @@ -1,11 +1,11 @@ -using Bit.Core.Abstractions; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Domain; using Bit.Core.Models.Request; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; namespace Bit.Core.Services { diff --git a/src/Core/Services/AzureFileUploadService.cs b/src/Core/Services/AzureFileUploadService.cs index 9f39ed8b8..4d18c1246 100644 --- a/src/Core/Services/AzureFileUploadService.cs +++ b/src/Core/Services/AzureFileUploadService.cs @@ -80,63 +80,63 @@ namespace Bit.Core.Services throw new Exception($"Cannot upload file, exceeds maximum size of {blockSize * MAX_BLOCKS_PER_BLOB}"); } - while (blockIndex < numBlocks) - { - uri = await RenewUriIfNecessary(uri, renewalFunc); - var blockUriBuilder = new UriBuilder(uri); - var blockId = EncodeBlockId(blockIndex); - var blockParams = HttpUtility.ParseQueryString(blockUriBuilder.Query); - blockParams.Add("comp", "block"); - blockParams.Add("blockid", blockId); - blockUriBuilder.Query = blockParams.ToString(); - - using (var requestMessage = new HttpRequestMessage()) - { - requestMessage.Headers.Add("x-ms-date", DateTime.UtcNow.ToString("R")); - requestMessage.Headers.Add("x-ms-version", baseParams["sv"]); - requestMessage.Headers.Add("x-ms-blob-type", "BlockBlob"); - - requestMessage.Content = new ByteArrayContent(data.Buffer.Skip(blockIndex * blockSize).Take(blockSize).ToArray()); - requestMessage.Version = new Version(1, 0); - requestMessage.Method = HttpMethod.Put; - requestMessage.RequestUri = blockUriBuilder.Uri; - - var blockResponse = await _httpClient.SendAsync(requestMessage); - - if (blockResponse.StatusCode != HttpStatusCode.Created) - { - throw new Exception("Failed to create Azure block"); - } - } - - blocksStaged.Add(blockId); - blockIndex++; - } + while (blockIndex < numBlocks) + { + uri = await RenewUriIfNecessary(uri, renewalFunc); + var blockUriBuilder = new UriBuilder(uri); + var blockId = EncodeBlockId(blockIndex); + var blockParams = HttpUtility.ParseQueryString(blockUriBuilder.Query); + blockParams.Add("comp", "block"); + blockParams.Add("blockid", blockId); + blockUriBuilder.Query = blockParams.ToString(); using (var requestMessage = new HttpRequestMessage()) { - uri = await RenewUriIfNecessary(uri, renewalFunc); - var blockListXml = GenerateBlockListXml(blocksStaged); - var blockListUriBuilder = new UriBuilder(uri); - var blockListParams = HttpUtility.ParseQueryString(blockListUriBuilder.Query); - blockListParams.Add("comp", "blocklist"); - blockListUriBuilder.Query = blockListParams.ToString(); - requestMessage.Headers.Add("x-ms-date", DateTime.UtcNow.ToString("R")); requestMessage.Headers.Add("x-ms-version", baseParams["sv"]); + requestMessage.Headers.Add("x-ms-blob-type", "BlockBlob"); - requestMessage.Content = new StringContent(blockListXml); + requestMessage.Content = new ByteArrayContent(data.Buffer.Skip(blockIndex * blockSize).Take(blockSize).ToArray()); requestMessage.Version = new Version(1, 0); requestMessage.Method = HttpMethod.Put; - requestMessage.RequestUri = blockListUriBuilder.Uri; + requestMessage.RequestUri = blockUriBuilder.Uri; - var blockListResponse = await _httpClient.SendAsync(requestMessage); + var blockResponse = await _httpClient.SendAsync(requestMessage); - if (blockListResponse.StatusCode != HttpStatusCode.Created) + if (blockResponse.StatusCode != HttpStatusCode.Created) { - throw new Exception("Failed to PUT Azure block list"); + throw new Exception("Failed to create Azure block"); } } + + blocksStaged.Add(blockId); + blockIndex++; + } + + using (var requestMessage = new HttpRequestMessage()) + { + uri = await RenewUriIfNecessary(uri, renewalFunc); + var blockListXml = GenerateBlockListXml(blocksStaged); + var blockListUriBuilder = new UriBuilder(uri); + var blockListParams = HttpUtility.ParseQueryString(blockListUriBuilder.Query); + blockListParams.Add("comp", "blocklist"); + blockListUriBuilder.Query = blockListParams.ToString(); + + requestMessage.Headers.Add("x-ms-date", DateTime.UtcNow.ToString("R")); + requestMessage.Headers.Add("x-ms-version", baseParams["sv"]); + + requestMessage.Content = new StringContent(blockListXml); + requestMessage.Version = new Version(1, 0); + requestMessage.Method = HttpMethod.Put; + requestMessage.RequestUri = blockListUriBuilder.Uri; + + var blockListResponse = await _httpClient.SendAsync(requestMessage); + + if (blockListResponse.StatusCode != HttpStatusCode.Created) + { + throw new Exception("Failed to PUT Azure block list"); + } + } } private async Task RenewUriIfNecessary(string uri, Func> renewalFunc) @@ -153,7 +153,7 @@ namespace Bit.Core.Services private string GenerateBlockListXml(List blocksStaged) { var xml = new StringBuilder(""); - foreach(var blockId in blocksStaged) + foreach (var blockId in blocksStaged) { xml.Append($"{blockId}"); } @@ -180,7 +180,7 @@ namespace Bit.Core.Services maxSize = 104857600L; // 100 MiB } - return maxSize > MAX_MOBILE_BLOCK_SIZE ? (int)MAX_MOBILE_BLOCK_SIZE : (int) maxSize; + return maxSize > MAX_MOBILE_BLOCK_SIZE ? (int)MAX_MOBILE_BLOCK_SIZE : (int)maxSize; } private int CompareAzureVersions(string a, string b) diff --git a/src/Core/Services/BitwardenFileUploadService.cs b/src/Core/Services/BitwardenFileUploadService.cs index 52df1a179..88295c0a9 100644 --- a/src/Core/Services/BitwardenFileUploadService.cs +++ b/src/Core/Services/BitwardenFileUploadService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Net.Http; using System.Threading.Tasks; using Bit.Core.Models.Domain; diff --git a/src/Core/Services/BroadcasterService.cs b/src/Core/Services/BroadcasterService.cs index 09079fb33..553ec49c9 100644 --- a/src/Core/Services/BroadcasterService.cs +++ b/src/Core/Services/BroadcasterService.cs @@ -1,8 +1,8 @@ -using Bit.Core.Abstractions; -using Bit.Core.Models.Domain; -using System; +using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Abstractions; +using Bit.Core.Models.Domain; namespace Bit.App.Services { diff --git a/src/Core/Services/CipherService.cs b/src/Core/Services/CipherService.cs index e39f5cb6d..bf48e80d8 100644 --- a/src/Core/Services/CipherService.cs +++ b/src/Core/Services/CipherService.cs @@ -1,4 +1,11 @@ -using Bit.Core.Abstractions; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net.Http; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Data; @@ -7,13 +14,6 @@ using Bit.Core.Models.Request; using Bit.Core.Models.Response; using Bit.Core.Models.View; using Bit.Core.Utilities; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net.Http; -using System.Text.RegularExpressions; -using System.Threading.Tasks; namespace Bit.Core.Services { @@ -48,7 +48,7 @@ namespace Bit.Core.Services IStorageService storageService, II18nService i18nService, Func searchService, - string clearCipherCacheKey, + string clearCipherCacheKey, string[] allClearCipherCacheKeys) { _cryptoService = cryptoService; diff --git a/src/Core/Services/CollectionService.cs b/src/Core/Services/CollectionService.cs index ddd7cfb12..fe30159dc 100644 --- a/src/Core/Services/CollectionService.cs +++ b/src/Core/Services/CollectionService.cs @@ -1,13 +1,13 @@ -using Bit.Core.Abstractions; -using Bit.Core.Models.Data; -using Bit.Core.Models.Domain; -using Bit.Core.Models.View; -using Bit.Core.Utilities; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Threading.Tasks; +using Bit.Core.Abstractions; +using Bit.Core.Models.Data; +using Bit.Core.Models.Domain; +using Bit.Core.Models.View; +using Bit.Core.Utilities; namespace Bit.Core.Services { diff --git a/src/Core/Services/ConsoleLogService.cs b/src/Core/Services/ConsoleLogService.cs index 492891834..1814d48c6 100644 --- a/src/Core/Services/ConsoleLogService.cs +++ b/src/Core/Services/ConsoleLogService.cs @@ -1,5 +1,5 @@ -using Bit.Core.Abstractions; -using System; +using System; +using Bit.Core.Abstractions; namespace Bit.Core.Services { diff --git a/src/Core/Services/CryptoService.cs b/src/Core/Services/CryptoService.cs index 3b3318be7..5cd5312eb 100644 --- a/src/Core/Services/CryptoService.cs +++ b/src/Core/Services/CryptoService.cs @@ -1,13 +1,13 @@ -using Bit.Core.Abstractions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Numerics; +using System.Text; +using System.Threading.Tasks; +using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Models.Domain; using Bit.Core.Models.Response; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Numerics; using Bit.Core.Utilities; namespace Bit.Core.Services diff --git a/src/Core/Services/EventService.cs b/src/Core/Services/EventService.cs index 179c689c2..45f566f84 100644 --- a/src/Core/Services/EventService.cs +++ b/src/Core/Services/EventService.cs @@ -1,12 +1,12 @@ -using Bit.Core.Abstractions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Data; using Bit.Core.Models.Request; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace Bit.Core.Services { diff --git a/src/Core/Services/FileUploadService.cs b/src/Core/Services/FileUploadService.cs index 28856ed96..fbc04acd7 100644 --- a/src/Core/Services/FileUploadService.cs +++ b/src/Core/Services/FileUploadService.cs @@ -1,11 +1,12 @@ +using System; using System.Threading.Tasks; using Bit.Core.Abstractions; +using Bit.Core.Enums; using Bit.Core.Models.Domain; using Bit.Core.Models.Response; -using Bit.Core.Enums; -using System; -namespace Bit.Core.Services { +namespace Bit.Core.Services +{ public class FileUploadService : IFileUploadService { public FileUploadService(ApiService apiService) @@ -41,7 +42,8 @@ namespace Bit.Core.Services { default: throw new Exception($"Unkown file upload type: {uploadData.FileUploadType}"); } - } catch + } + catch { await _apiService.DeleteCipherAttachmentAsync(uploadData.CipherResponse.Id, uploadData.AttachmentId); throw; diff --git a/src/Core/Services/FolderService.cs b/src/Core/Services/FolderService.cs index fdc882476..e2ed35385 100644 --- a/src/Core/Services/FolderService.cs +++ b/src/Core/Services/FolderService.cs @@ -1,15 +1,15 @@ -using Bit.Core.Abstractions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Bit.Core.Abstractions; using Bit.Core.Models.Data; using Bit.Core.Models.Domain; using Bit.Core.Models.Request; using Bit.Core.Models.Response; using Bit.Core.Models.View; using Bit.Core.Utilities; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text.RegularExpressions; -using System.Threading.Tasks; namespace Bit.Core.Services { diff --git a/src/Core/Services/InMemoryStorageService.cs b/src/Core/Services/InMemoryStorageService.cs index fa15fc71b..164565dab 100644 --- a/src/Core/Services/InMemoryStorageService.cs +++ b/src/Core/Services/InMemoryStorageService.cs @@ -1,7 +1,7 @@ -using Bit.Core.Abstractions; -using Newtonsoft.Json; -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Abstractions; +using Newtonsoft.Json; namespace Bit.Core.Services { diff --git a/src/Core/Services/KeyConnectorService.cs b/src/Core/Services/KeyConnectorService.cs index ed8ae5acc..dbeb8cd06 100644 --- a/src/Core/Services/KeyConnectorService.cs +++ b/src/Core/Services/KeyConnectorService.cs @@ -36,7 +36,7 @@ namespace Bit.Core.Services catch (Exception e) { throw new Exception("Unable to reach Key Connector", e); - } + } } public async Task SetUsesKeyConnector(bool usesKeyConnector) diff --git a/src/Core/Services/LiteDbStorageService.cs b/src/Core/Services/LiteDbStorageService.cs index 35a450536..48f1325ba 100644 --- a/src/Core/Services/LiteDbStorageService.cs +++ b/src/Core/Services/LiteDbStorageService.cs @@ -1,9 +1,9 @@ -using Bit.Core.Abstractions; +using System.Linq; +using System.Threading.Tasks; +using Bit.Core.Abstractions; using LiteDB; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; -using System.Linq; -using System.Threading.Tasks; namespace Bit.Core.Services { diff --git a/src/Core/Services/OrganizationService.cs b/src/Core/Services/OrganizationService.cs index 131a9d03d..8f25c8076 100644 --- a/src/Core/Services/OrganizationService.cs +++ b/src/Core/Services/OrganizationService.cs @@ -1,9 +1,9 @@ -using Bit.Core.Abstractions; -using Bit.Core.Models.Data; -using Bit.Core.Models.Domain; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Abstractions; +using Bit.Core.Models.Data; +using Bit.Core.Models.Domain; namespace Bit.Core.Services { diff --git a/src/Core/Services/PasswordGenerationService.cs b/src/Core/Services/PasswordGenerationService.cs index cc776052d..1b35bb5c9 100644 --- a/src/Core/Services/PasswordGenerationService.cs +++ b/src/Core/Services/PasswordGenerationService.cs @@ -1,13 +1,13 @@ -using Bit.Core.Abstractions; -using Bit.Core.Models.Domain; -using Bit.Core.Utilities; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; +using Bit.Core.Abstractions; using Bit.Core.Enums; +using Bit.Core.Models.Domain; +using Bit.Core.Utilities; using Zxcvbn; namespace Bit.Core.Services @@ -384,7 +384,7 @@ namespace Bit.Core.Services { enforcedOptions.Capitalize = true; } - + var includeNumber = GetPolicyBool(currentPolicy, "includeNumber"); if (includeNumber != null && (bool)includeNumber) { @@ -420,7 +420,7 @@ namespace Bit.Core.Services } return null; } - + private string GetPolicyString(Policy policy, string key) { if (policy.Data.ContainsKey(key)) @@ -596,7 +596,7 @@ namespace Bit.Core.Services { options.WordSeparator = options.WordSeparator[0].ToString(); } - + SanitizePasswordLength(options, false); } @@ -683,13 +683,13 @@ namespace Bit.Core.Services if (options.Uppercase.GetValueOrDefault() && options.MinUppercase.GetValueOrDefault() <= 0) { minUppercaseCalc = 1; - } + } else if (!options.Uppercase.GetValueOrDefault()) { minUppercaseCalc = 0; } - if (options.Lowercase.GetValueOrDefault() && options.MinLowercase.GetValueOrDefault() <= 0) + if (options.Lowercase.GetValueOrDefault() && options.MinLowercase.GetValueOrDefault() <= 0) { minLowercaseCalc = 1; } @@ -701,7 +701,7 @@ namespace Bit.Core.Services if (options.Number.GetValueOrDefault() && options.MinNumber.GetValueOrDefault() <= 0) { minNumberCalc = 1; - } + } else if (!options.Number.GetValueOrDefault()) { minNumberCalc = 0; @@ -710,7 +710,7 @@ namespace Bit.Core.Services if (options.Special.GetValueOrDefault() && options.MinSpecial.GetValueOrDefault() <= 0) { minSpecialCalc = 1; - } + } else if (!options.Special.GetValueOrDefault()) { minSpecialCalc = 0; diff --git a/src/Core/Services/PclCryptoFunctionService.cs b/src/Core/Services/PclCryptoFunctionService.cs index 8299f8218..fa8e8693d 100644 --- a/src/Core/Services/PclCryptoFunctionService.cs +++ b/src/Core/Services/PclCryptoFunctionService.cs @@ -1,10 +1,10 @@ -using Bit.Core.Abstractions; -using Bit.Core.Enums; -using PCLCrypto; -using System; +using System; using System.Linq; using System.Text; using System.Threading.Tasks; +using Bit.Core.Abstractions; +using Bit.Core.Enums; +using PCLCrypto; using static PCLCrypto.WinRTCrypto; namespace Bit.Core.Services diff --git a/src/Core/Services/PolicyService.cs b/src/Core/Services/PolicyService.cs index e1c2b8c75..d81370870 100644 --- a/src/Core/Services/PolicyService.cs +++ b/src/Core/Services/PolicyService.cs @@ -24,7 +24,7 @@ namespace Bit.Core.Services _stateService = stateService; _organizationService = organizationService; } - + public void ClearCache() { _policyCache = null; diff --git a/src/Core/Services/SearchService.cs b/src/Core/Services/SearchService.cs index 689fbf59a..09610942e 100644 --- a/src/Core/Services/SearchService.cs +++ b/src/Core/Services/SearchService.cs @@ -1,10 +1,10 @@ -using Bit.Core.Abstractions; -using Bit.Core.Models.View; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; +using Bit.Core.Abstractions; +using Bit.Core.Models.View; namespace Bit.Core.Services { diff --git a/src/Core/Services/SendService.cs b/src/Core/Services/SendService.cs index 1ca9d4930..b59fad7e6 100644 --- a/src/Core/Services/SendService.cs +++ b/src/Core/Services/SendService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Net; @@ -200,7 +200,8 @@ namespace Bit.Core.Services response = await _apiService.PostSendAsync(request); break; case SendType.File: - try{ + try + { var uploadDataResponse = await _apiService.PostFileTypeSendAsync(request); response = uploadDataResponse.SendResponse; @@ -212,7 +213,8 @@ namespace Bit.Core.Services } catch { - if (response != default){ + if (response != default) + { await _apiService.DeleteSendAsync(response.Id); } throw; @@ -234,7 +236,8 @@ namespace Bit.Core.Services } [Obsolete("Mar 25 2021: This method has been deprecated in favor of direct uploads. This method still exists for backward compatibility with old server versions.")] - private async Task LegacyServerSendFileUpload(SendRequest request, Send send, EncByteArray encryptedFileData) { + private async Task LegacyServerSendFileUpload(SendRequest request, Send send, EncByteArray encryptedFileData) + { var fd = new MultipartFormDataContent($"--BWMobileFormBoundary{DateTime.UtcNow.Ticks}") { { new StringContent(JsonConvert.SerializeObject(request)), "model" }, diff --git a/src/Core/Services/SettingsService.cs b/src/Core/Services/SettingsService.cs index 14984bc72..8fc72cfec 100644 --- a/src/Core/Services/SettingsService.cs +++ b/src/Core/Services/SettingsService.cs @@ -1,7 +1,7 @@ -using Bit.Core.Abstractions; -using Newtonsoft.Json.Linq; -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Abstractions; +using Newtonsoft.Json.Linq; namespace Bit.Core.Services { diff --git a/src/Core/Services/StateMigrationService.cs b/src/Core/Services/StateMigrationService.cs index 209493d47..5574ad72f 100644 --- a/src/Core/Services/StateMigrationService.cs +++ b/src/Core/Services/StateMigrationService.cs @@ -63,7 +63,7 @@ namespace Bit.Core.Services private class V1Keys { internal const string EnvironmentUrlsKey = "environmentUrls"; - + } private async Task MigrateFrom1To2Async() diff --git a/src/Core/Services/StateService.cs b/src/Core/Services/StateService.cs index f26df9457..ea70d64e7 100644 --- a/src/Core/Services/StateService.cs +++ b/src/Core/Services/StateService.cs @@ -1,8 +1,8 @@ using System; -using Bit.Core.Abstractions; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Models.Data; using Bit.Core.Models.Domain; @@ -208,7 +208,7 @@ namespace Bit.Core.Services var key = Constants.BiometricUnlockKey(reconciledOptions.UserId); await SetValueAsync(key, value, reconciledOptions); } - + public async Task GetBiometricLockedAsync(string userId = null) { return (await GetAccountAsync( @@ -1419,7 +1419,7 @@ namespace Bit.Core.Services account.Settings.VaultTimeout = existingAccount.Settings.VaultTimeout; account.Settings.VaultTimeoutAction = existingAccount.Settings.VaultTimeoutAction; } - + // New account defaults if (account.Settings.VaultTimeout == null) { @@ -1431,7 +1431,7 @@ namespace Bit.Core.Services } await SetThemeAsync(currentTheme, account.Profile.UserId); await SetDisableFaviconAsync(currentDisableFavicons, account.Profile.UserId); - + state.Accounts[account.Profile.UserId] = account; await SaveStateToStorageAsync(state); diff --git a/src/Core/Services/SyncService.cs b/src/Core/Services/SyncService.cs index a7ce471ab..ba90d1da9 100644 --- a/src/Core/Services/SyncService.cs +++ b/src/Core/Services/SyncService.cs @@ -1,12 +1,12 @@ -using Bit.Core.Abstractions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Bit.Core.Abstractions; using Bit.Core.Exceptions; using Bit.Core.Models.Data; using Bit.Core.Models.Response; using Bit.Core.Utilities; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace Bit.Core.Services { @@ -378,7 +378,7 @@ namespace Bit.Core.Services private async Task SyncSendsAsync(string userId, List response) { - var sends = response?.ToDictionary(s => s.Id, s => new SendData(s, userId)) ?? + var sends = response?.ToDictionary(s => s.Id, s => new SendData(s, userId)) ?? new Dictionary(); await _sendService.ReplaceAsync(sends); } diff --git a/src/Core/Services/TokenService.cs b/src/Core/Services/TokenService.cs index dcf3ad17e..9edd32b22 100644 --- a/src/Core/Services/TokenService.cs +++ b/src/Core/Services/TokenService.cs @@ -1,11 +1,11 @@ -using Bit.Core.Abstractions; -using Bit.Core.Utilities; -using Newtonsoft.Json.Linq; -using System; +using System; +using System.Linq; using System.Text; using System.Threading.Tasks; -using System.Linq; +using Bit.Core.Abstractions; using Bit.Core.Enums; +using Bit.Core.Utilities; +using Newtonsoft.Json.Linq; namespace Bit.Core.Services { diff --git a/src/Core/Services/TotpService.cs b/src/Core/Services/TotpService.cs index 07c64285a..df74920d7 100644 --- a/src/Core/Services/TotpService.cs +++ b/src/Core/Services/TotpService.cs @@ -1,8 +1,8 @@ -using Bit.Core.Abstractions; +using System; +using System.Threading.Tasks; +using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Utilities; -using System; -using System.Threading.Tasks; namespace Bit.Core.Services { diff --git a/src/Core/Services/VaultTimeoutService.cs b/src/Core/Services/VaultTimeoutService.cs index df298ed8d..43adc7866 100644 --- a/src/Core/Services/VaultTimeoutService.cs +++ b/src/Core/Services/VaultTimeoutService.cs @@ -1,7 +1,7 @@ -using Bit.Core.Abstractions; -using System; +using System; using System.Linq; using System.Threading.Tasks; +using Bit.Core.Abstractions; using Bit.Core.Enums; namespace Bit.Core.Services @@ -165,7 +165,8 @@ namespace Bit.Core.Services userId = await _stateService.GetActiveUserIdAsync(); } - if (await _keyConnectorService.GetUsesKeyConnector()) { + if (await _keyConnectorService.GetUsesKeyConnector()) + { var (isPinProtected, isPinProtectedWithKey) = await IsPinLockSetAsync(userId); var pinLock = (isPinProtected && await _stateService.GetPinProtectedKeyAsync(userId) != null) || isPinProtectedWithKey; @@ -202,10 +203,10 @@ namespace Bit.Core.Services } _lockedCallback?.Invoke(new Tuple(userId, userInitiated)); } - + public async Task LogOutAsync(bool userInitiated = true, string userId = null) { - if(_loggedOutCallback != null) + if (_loggedOutCallback != null) { await _loggedOutCallback.Invoke(new Tuple(userId, userInitiated, false)); } @@ -238,10 +239,12 @@ namespace Bit.Core.Services await _stateService.SetProtectedPinAsync(null, userId); } - public async Task GetVaultTimeout(string userId = null) { + public async Task GetVaultTimeout(string userId = null) + { var vaultTimeout = await _stateService.GetVaultTimeoutAsync(userId); - if (await _policyService.PolicyAppliesToUser(PolicyType.MaximumVaultTimeout, null, userId)) { + if (await _policyService.PolicyAppliesToUser(PolicyType.MaximumVaultTimeout, null, userId)) + { var policy = (await _policyService.GetAll(PolicyType.MaximumVaultTimeout, userId)).First(); // Remove negative values, and ensure it's smaller than maximum allowed value according to policy var policyTimeout = _policyService.GetPolicyInt(policy, "minutes"); @@ -252,12 +255,14 @@ namespace Bit.Core.Services var timeout = vaultTimeout.HasValue ? Math.Min(vaultTimeout.Value, policyTimeout.Value) : policyTimeout.Value; - if (timeout < 0) { + if (timeout < 0) + { timeout = policyTimeout.Value; } // We really shouldn't need to set the value here, but multiple services relies on this value being correct. - if (vaultTimeout != timeout) { + if (vaultTimeout != timeout) + { await _stateService.SetVaultTimeoutAsync(timeout, userId); } diff --git a/src/Core/Utilities/CoreHelpers.cs b/src/Core/Utilities/CoreHelpers.cs index ca32ad0a9..f871c54ff 100644 --- a/src/Core/Utilities/CoreHelpers.cs +++ b/src/Core/Utilities/CoreHelpers.cs @@ -1,9 +1,9 @@ -using Bit.Core.Models.Domain; -using Newtonsoft.Json; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; +using Bit.Core.Models.Domain; +using Newtonsoft.Json; namespace Bit.Core.Utilities { @@ -194,7 +194,7 @@ namespace Bit.Core.Utilities } return JsonConvert.SerializeObject(obj, jsonSerializationSettings); } - + public static string SerializeJson(object obj, JsonSerializerSettings jsonSerializationSettings) { return JsonConvert.SerializeObject(obj, jsonSerializationSettings); diff --git a/src/Core/Utilities/ExtendedViewModel.cs b/src/Core/Utilities/ExtendedViewModel.cs index fd394ea34..ed586d453 100644 --- a/src/Core/Utilities/ExtendedViewModel.cs +++ b/src/Core/Utilities/ExtendedViewModel.cs @@ -10,7 +10,7 @@ namespace Bit.Core.Utilities public event PropertyChangedEventHandler PropertyChanged; protected bool SetProperty(ref T backingStore, T value, Action onChanged = null, - [CallerMemberName]string propertyName = "", string[] additionalPropertyNames = null) + [CallerMemberName] string propertyName = "", string[] additionalPropertyNames = null) { if (EqualityComparer.Default.Equals(backingStore, value)) { diff --git a/src/Core/Utilities/ServiceContainer.cs b/src/Core/Utilities/ServiceContainer.cs index 3d2087087..19450173b 100644 --- a/src/Core/Utilities/ServiceContainer.cs +++ b/src/Core/Utilities/ServiceContainer.cs @@ -1,8 +1,8 @@ -using Bit.Core.Abstractions; -using Bit.Core.Services; -using System; +using System; using System.Collections.Generic; using System.Threading.Tasks; +using Bit.Core.Abstractions; +using Bit.Core.Services; namespace Bit.Core.Utilities { @@ -11,7 +11,7 @@ namespace Bit.Core.Utilities public static Dictionary RegisteredServices { get; set; } = new Dictionary(); public static bool Inited { get; set; } - public static void Init(string customUserAgent = null, string clearCipherCacheKey = null, + public static void Init(string customUserAgent = null, string clearCipherCacheKey = null, string[] allClearCipherCacheKeys = null) { if (Inited) @@ -39,8 +39,8 @@ namespace Bit.Core.Utilities var organizationService = new OrganizationService(stateService); var settingsService = new SettingsService(stateService); var fileUploadService = new FileUploadService(apiService); - var cipherService = new CipherService(cryptoService, stateService, settingsService, apiService, - fileUploadService, storageService, i18nService, () => searchService, clearCipherCacheKey, + var cipherService = new CipherService(cryptoService, stateService, settingsService, apiService, + fileUploadService, storageService, i18nService, () => searchService, clearCipherCacheKey, allClearCipherCacheKeys); var folderService = new FolderService(cryptoService, stateService, apiService, i18nService, cipherService); var collectionService = new CollectionService(cryptoService, stateService, i18nService); @@ -52,18 +52,18 @@ namespace Bit.Core.Utilities organizationService); var vaultTimeoutService = new VaultTimeoutService(cryptoService, stateService, platformUtilsService, folderService, cipherService, collectionService, searchService, messagingService, tokenService, - policyService, keyConnectorService, + policyService, keyConnectorService, (extras) => { messagingService.Send("locked", extras); return Task.CompletedTask; - }, + }, (extras) => { messagingService.Send("logout", extras); return Task.CompletedTask; }); - var syncService = new SyncService(stateService, apiService, settingsService, folderService, cipherService, + var syncService = new SyncService(stateService, apiService, settingsService, folderService, cipherService, cryptoService, collectionService, organizationService, messagingService, policyService, sendService, keyConnectorService, (extras) => { @@ -73,14 +73,14 @@ namespace Bit.Core.Utilities var passwordGenerationService = new PasswordGenerationService(cryptoService, stateService, cryptoFunctionService, policyService); var totpService = new TotpService(stateService, cryptoFunctionService); - var authService = new AuthService(cryptoService, cryptoFunctionService, apiService, stateService, - tokenService, appIdService, i18nService, platformUtilsService, messagingService, vaultTimeoutService, + var authService = new AuthService(cryptoService, cryptoFunctionService, apiService, stateService, + tokenService, appIdService, i18nService, platformUtilsService, messagingService, vaultTimeoutService, keyConnectorService); var exportService = new ExportService(folderService, cipherService, cryptoService); var auditService = new AuditService(cryptoFunctionService, apiService); var environmentService = new EnvironmentService(apiService, stateService); var eventService = new EventService(apiService, stateService, organizationService, cipherService); - var userVerificationService = new UserVerificationService(apiService, platformUtilsService, i18nService, + var userVerificationService = new UserVerificationService(apiService, platformUtilsService, i18nService, cryptoService); Register("tokenService", tokenService); diff --git a/store/google/Publisher/Program.cs b/store/google/Publisher/Program.cs index 68cec9356..bbcb479bc 100644 --- a/store/google/Publisher/Program.cs +++ b/store/google/Publisher/Program.cs @@ -1,11 +1,11 @@ -using Google.Apis.AndroidPublisher.v3; -using Google.Apis.AndroidPublisher.v3.Data; -using Google.Apis.Auth.OAuth2; -using Google.Apis.Services; -using System; +using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; +using Google.Apis.AndroidPublisher.v3; +using Google.Apis.AndroidPublisher.v3.Data; +using Google.Apis.Auth.OAuth2; +using Google.Apis.Services; namespace Bit.Publisher { diff --git a/test/Common/AutoFixture/Attributes/AutoSubDataAttribute.cs b/test/Common/AutoFixture/Attributes/AutoSubDataAttribute.cs index fc4db5fe9..3e01d420e 100644 --- a/test/Common/AutoFixture/Attributes/AutoSubDataAttribute.cs +++ b/test/Common/AutoFixture/Attributes/AutoSubDataAttribute.cs @@ -1,4 +1,4 @@ -using AutoFixture.AutoNSubstitute; +using AutoFixture.AutoNSubstitute; namespace Bit.Test.Common.AutoFixture.Attributes { diff --git a/test/Common/AutoFixture/Attributes/CustomAutoDataAttribute.cs b/test/Common/AutoFixture/Attributes/CustomAutoDataAttribute.cs index cd2feebca..d6c5863b1 100644 --- a/test/Common/AutoFixture/Attributes/CustomAutoDataAttribute.cs +++ b/test/Common/AutoFixture/Attributes/CustomAutoDataAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using AutoFixture; using AutoFixture.Xunit2; diff --git a/test/Common/AutoFixture/Attributes/InlineAutoSubDataAttribute.cs b/test/Common/AutoFixture/Attributes/InlineAutoSubDataAttribute.cs index feccc4e76..b74f1ba02 100644 --- a/test/Common/AutoFixture/Attributes/InlineAutoSubDataAttribute.cs +++ b/test/Common/AutoFixture/Attributes/InlineAutoSubDataAttribute.cs @@ -1,4 +1,4 @@ -using AutoFixture.AutoNSubstitute; +using AutoFixture.AutoNSubstitute; namespace Bit.Test.Common.AutoFixture.Attributes { diff --git a/test/Common/AutoFixture/Attributes/InlineCustomAutoDataAttribute.cs b/test/Common/AutoFixture/Attributes/InlineCustomAutoDataAttribute.cs index d36f963a4..9a9a6730a 100644 --- a/test/Common/AutoFixture/Attributes/InlineCustomAutoDataAttribute.cs +++ b/test/Common/AutoFixture/Attributes/InlineCustomAutoDataAttribute.cs @@ -1,8 +1,8 @@ -using System; +using System; +using AutoFixture; +using AutoFixture.Xunit2; using Xunit; using Xunit.Sdk; -using AutoFixture.Xunit2; -using AutoFixture; namespace Bit.Test.Common.AutoFixture.Attributes { diff --git a/test/Common/AutoFixture/Attributes/InlineSutAutoDataAttribute.cs b/test/Common/AutoFixture/Attributes/InlineSutAutoDataAttribute.cs index 89eebad8c..cc04e062a 100644 --- a/test/Common/AutoFixture/Attributes/InlineSutAutoDataAttribute.cs +++ b/test/Common/AutoFixture/Attributes/InlineSutAutoDataAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using AutoFixture; diff --git a/test/Common/AutoFixture/Attributes/SutAutoDataAttribute.cs b/test/Common/AutoFixture/Attributes/SutAutoDataAttribute.cs index e7c06a88f..2a9545110 100644 --- a/test/Common/AutoFixture/Attributes/SutAutoDataAttribute.cs +++ b/test/Common/AutoFixture/Attributes/SutAutoDataAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; namespace Bit.Test.Common.AutoFixture.Attributes diff --git a/test/Common/AutoFixture/FixtureExtensions.cs b/test/Common/AutoFixture/FixtureExtensions.cs index a23eb7d0c..764a38c81 100644 --- a/test/Common/AutoFixture/FixtureExtensions.cs +++ b/test/Common/AutoFixture/FixtureExtensions.cs @@ -1,4 +1,4 @@ -using AutoFixture; +using AutoFixture; using AutoFixture.AutoNSubstitute; namespace Bit.Test.Common.AutoFixture diff --git a/test/Common/AutoFixture/ISutProvider.cs b/test/Common/AutoFixture/ISutProvider.cs index c72dc4a27..cbd8c6e6f 100644 --- a/test/Common/AutoFixture/ISutProvider.cs +++ b/test/Common/AutoFixture/ISutProvider.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace Bit.Test.Common.AutoFixture { diff --git a/test/Common/AutoFixture/SutProvider.cs b/test/Common/AutoFixture/SutProvider.cs index e3149afc6..989bc590d 100644 --- a/test/Common/AutoFixture/SutProvider.cs +++ b/test/Common/AutoFixture/SutProvider.cs @@ -1,9 +1,9 @@ -using System; +using System; using System.Collections.Generic; +using System.Linq; +using System.Reflection; using AutoFixture; using AutoFixture.Kernel; -using System.Reflection; -using System.Linq; namespace Bit.Test.Common.AutoFixture { diff --git a/test/Common/AutoFixture/SutProviderCustomization.cs b/test/Common/AutoFixture/SutProviderCustomization.cs index b5bc84d1d..c323ed4c5 100644 --- a/test/Common/AutoFixture/SutProviderCustomization.cs +++ b/test/Common/AutoFixture/SutProviderCustomization.cs @@ -1,4 +1,4 @@ -using System; +using System; using AutoFixture; using AutoFixture.Kernel; diff --git a/test/Common/TestHelper.cs b/test/Common/TestHelper.cs index 7ce60f325..c70373591 100644 --- a/test/Common/TestHelper.cs +++ b/test/Common/TestHelper.cs @@ -1,9 +1,9 @@ -using System.Reflection; +using System; using System.IO; using System.Linq; -using Xunit; -using System; +using System.Reflection; using Newtonsoft.Json; +using Xunit; namespace Bit.Test.Common { diff --git a/test/Core.Test/AutoFixture/Cipher/CipherCustomizations.cs b/test/Core.Test/AutoFixture/Cipher/CipherCustomizations.cs index 8f745ebea..6d4f47aad 100644 --- a/test/Core.Test/AutoFixture/Cipher/CipherCustomizations.cs +++ b/test/Core.Test/AutoFixture/Cipher/CipherCustomizations.cs @@ -1,4 +1,4 @@ -using System; +using System; using AutoFixture; using Bit.Core.Models.Domain; using Bit.Test.Common.AutoFixture; diff --git a/test/Core.Test/AutoFixture/Domain/SymmetricCryptoKeyCustomization.cs b/test/Core.Test/AutoFixture/Domain/SymmetricCryptoKeyCustomization.cs index 41355b86d..742171a1f 100644 --- a/test/Core.Test/AutoFixture/Domain/SymmetricCryptoKeyCustomization.cs +++ b/test/Core.Test/AutoFixture/Domain/SymmetricCryptoKeyCustomization.cs @@ -1,4 +1,4 @@ -using System; +using System; using AutoFixture; using Bit.Core.Models.Domain; using Bit.Core.Services; diff --git a/test/Core.Test/AutoFixture/Send/SendCustomizations.cs b/test/Core.Test/AutoFixture/Send/SendCustomizations.cs index 617ba8c8e..a18f9707a 100644 --- a/test/Core.Test/AutoFixture/Send/SendCustomizations.cs +++ b/test/Core.Test/AutoFixture/Send/SendCustomizations.cs @@ -1,11 +1,11 @@ -using AutoFixture; +using AutoFixture; +using Bit.Core.Enums; using Bit.Core.Models.Api; using Bit.Core.Models.Data; using Bit.Core.Models.Domain; using Bit.Core.Models.Request; using Bit.Core.Models.Response; using Bit.Core.Models.View; -using Bit.Core.Enums; namespace Bit.Core.Test.AutoFixture { diff --git a/test/Core.Test/Models/Data/SendDataTests.cs b/test/Core.Test/Models/Data/SendDataTests.cs index 06bb54b12..e456a6e00 100644 --- a/test/Core.Test/Models/Data/SendDataTests.cs +++ b/test/Core.Test/Models/Data/SendDataTests.cs @@ -1,4 +1,4 @@ -using Bit.Core.Models.Data; +using Bit.Core.Models.Data; using Bit.Core.Models.Response; using Bit.Core.Test.AutoFixture; using Bit.Test.Common; diff --git a/test/Core.Test/Models/Domain/SendTests.cs b/test/Core.Test/Models/Domain/SendTests.cs index ff9883829..b5d58c1e1 100644 --- a/test/Core.Test/Models/Domain/SendTests.cs +++ b/test/Core.Test/Models/Domain/SendTests.cs @@ -1,17 +1,17 @@ -using System; +using System; using System.Linq; -using Bit.Core.Models.Data; -using Bit.Core.Models.Domain; -using Bit.Test.Common; using System.Text; +using AutoFixture.AutoNSubstitute; using Bit.Core.Abstractions; using Bit.Core.Enums; +using Bit.Core.Models.Data; +using Bit.Core.Models.Domain; +using Bit.Core.Test.AutoFixture; using Bit.Core.Utilities; +using Bit.Test.Common; using Bit.Test.Common.AutoFixture.Attributes; using NSubstitute; using Xunit; -using Bit.Core.Test.AutoFixture; -using AutoFixture.AutoNSubstitute; namespace Bit.Core.Test.Models.Domain { diff --git a/test/Core.Test/Models/Request/SendRequestTests.cs b/test/Core.Test/Models/Request/SendRequestTests.cs index f2fa4d9bb..028dce25a 100644 --- a/test/Core.Test/Models/Request/SendRequestTests.cs +++ b/test/Core.Test/Models/Request/SendRequestTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using Bit.Core.Enums; using Bit.Core.Models.Domain; using Bit.Core.Models.Request; diff --git a/test/Core.Test/Services/CipherServiceTests.cs b/test/Core.Test/Services/CipherServiceTests.cs index cecda9bd9..494fa192c 100644 --- a/test/Core.Test/Services/CipherServiceTests.cs +++ b/test/Core.Test/Services/CipherServiceTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Net; using System.Net.Http; using System.Threading.Tasks; @@ -52,7 +52,7 @@ namespace Bit.Core.Test.Services .Returns(data); sutProvider.GetDependency().MakeEncKeyAsync(Arg.Any()).Returns(new Tuple(null, encKey)); sutProvider.GetDependency().PostCipherAttachmentAsync(cipher.Id, Arg.Any()) - .Throws(new ApiException(new ErrorResponse {StatusCode = statusCode})); + .Throws(new ApiException(new ErrorResponse { StatusCode = statusCode })); sutProvider.GetDependency().PostCipherAttachmentLegacyAsync(cipher.Id, Arg.Any()) .Returns(response); @@ -76,7 +76,7 @@ namespace Bit.Core.Test.Services sutProvider.GetDependency().PostCipherAttachmentAsync(cipher.Id, Arg.Any()) .Throws(expectedException); - var actualException = await Assert.ThrowsAsync(async () => + var actualException = await Assert.ThrowsAsync(async () => await sutProvider.Sut.SaveAttachmentRawWithServerAsync(cipher, fileName, data.Buffer)); Assert.Equal(expectedException.Error.StatusCode, actualException.Error.StatusCode); diff --git a/test/Core.Test/Services/CryptoFunctionServiceTests.cs b/test/Core.Test/Services/CryptoFunctionServiceTests.cs index b95335e17..eea1af98a 100644 --- a/test/Core.Test/Services/CryptoFunctionServiceTests.cs +++ b/test/Core.Test/Services/CryptoFunctionServiceTests.cs @@ -1,11 +1,11 @@ - + using System; -using System.Threading.Tasks; -using Xunit; -using Bit.Core.Services; -using Bit.Core.Enums; -using Bit.Test.Common.AutoFixture.Attributes; using System.Text; +using System.Threading.Tasks; +using Bit.Core.Enums; +using Bit.Core.Services; +using Bit.Test.Common.AutoFixture.Attributes; +using Xunit; namespace Bit.Core.Test.Services { diff --git a/test/Core.Test/Services/SendServiceTests.cs b/test/Core.Test/Services/SendServiceTests.cs index badf2c742..6038465d5 100644 --- a/test/Core.Test/Services/SendServiceTests.cs +++ b/test/Core.Test/Services/SendServiceTests.cs @@ -1,28 +1,28 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; +using System.Linq.Expressions; +using System.Net.Http; +using System.Text; using System.Threading.Tasks; using Bit.Core.Abstractions; +using Bit.Core.Enums; +using Bit.Core.Exceptions; using Bit.Core.Models.Data; using Bit.Core.Models.Domain; +using Bit.Core.Models.Request; using Bit.Core.Models.Response; +using Bit.Core.Models.View; using Bit.Core.Services; +using Bit.Core.Test.AutoFixture; using Bit.Core.Utilities; -using Bit.Core.Enums; using Bit.Test.Common; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using Newtonsoft.Json; using NSubstitute; -using Xunit; -using System.Text; -using System.Net.Http; -using Bit.Core.Models.Request; -using Bit.Core.Test.AutoFixture; -using System.Linq.Expressions; -using Bit.Core.Models.View; -using Bit.Core.Exceptions; using NSubstitute.ExceptionExtensions; +using Xunit; namespace Bit.Core.Test.Services { @@ -143,7 +143,7 @@ namespace Bit.Core.Test.Services { // TODO restore this once race condition is fixed or GHA can re-run jobs on individual platforms return; - + var sendDataDict = sendDatas.ToDictionary(d => d.Id, d => d); sutProvider.GetDependency().HasKeyAsync().Returns(true); ServiceContainer.Register("cryptoService", sutProvider.GetDependency()); diff --git a/test/Playground/Program.cs b/test/Playground/Program.cs index ca57eb5d2..c8e4708a7 100644 --- a/test/Playground/Program.cs +++ b/test/Playground/Program.cs @@ -1,6 +1,6 @@ -using Bit.Core.Services; -using System; +using System; using System.Threading.Tasks; +using Bit.Core.Services; namespace Bit.Playground {