mirror of
https://github.com/bitwarden/mobile
synced 2025-12-20 02:03:49 +00:00
Changed all C# control flow block statements to include space between keyword and open paren (#800)
This commit is contained in:
@@ -19,99 +19,99 @@ namespace Bit.App.Utilities
|
||||
var platformUtilsService = ServiceContainer.Resolve<IPlatformUtilsService>("platformUtilsService");
|
||||
var eventService = ServiceContainer.Resolve<IEventService>("eventService");
|
||||
var options = new List<string> { AppResources.View, AppResources.Edit };
|
||||
if(cipher.Type == Core.Enums.CipherType.Login)
|
||||
if (cipher.Type == Core.Enums.CipherType.Login)
|
||||
{
|
||||
if(!string.IsNullOrWhiteSpace(cipher.Login.Username))
|
||||
if (!string.IsNullOrWhiteSpace(cipher.Login.Username))
|
||||
{
|
||||
options.Add(AppResources.CopyUsername);
|
||||
}
|
||||
if(!string.IsNullOrWhiteSpace(cipher.Login.Password))
|
||||
if (!string.IsNullOrWhiteSpace(cipher.Login.Password))
|
||||
{
|
||||
options.Add(AppResources.CopyPassword);
|
||||
}
|
||||
if(!string.IsNullOrWhiteSpace(cipher.Login.Totp))
|
||||
if (!string.IsNullOrWhiteSpace(cipher.Login.Totp))
|
||||
{
|
||||
var userService = ServiceContainer.Resolve<IUserService>("userService");
|
||||
var canAccessPremium = await userService.CanAccessPremiumAsync();
|
||||
if(canAccessPremium || cipher.OrganizationUseTotp)
|
||||
if (canAccessPremium || cipher.OrganizationUseTotp)
|
||||
{
|
||||
options.Add(AppResources.CopyTotp);
|
||||
}
|
||||
}
|
||||
if(cipher.Login.CanLaunch)
|
||||
if (cipher.Login.CanLaunch)
|
||||
{
|
||||
options.Add(AppResources.Launch);
|
||||
}
|
||||
}
|
||||
else if(cipher.Type == Core.Enums.CipherType.Card)
|
||||
else if (cipher.Type == Core.Enums.CipherType.Card)
|
||||
{
|
||||
if(!string.IsNullOrWhiteSpace(cipher.Card.Number))
|
||||
if (!string.IsNullOrWhiteSpace(cipher.Card.Number))
|
||||
{
|
||||
options.Add(AppResources.CopyNumber);
|
||||
}
|
||||
if(!string.IsNullOrWhiteSpace(cipher.Card.Code))
|
||||
if (!string.IsNullOrWhiteSpace(cipher.Card.Code))
|
||||
{
|
||||
options.Add(AppResources.CopySecurityCode);
|
||||
}
|
||||
}
|
||||
else if(cipher.Type == Core.Enums.CipherType.SecureNote)
|
||||
else if (cipher.Type == Core.Enums.CipherType.SecureNote)
|
||||
{
|
||||
if(!string.IsNullOrWhiteSpace(cipher.Notes))
|
||||
if (!string.IsNullOrWhiteSpace(cipher.Notes))
|
||||
{
|
||||
options.Add(AppResources.CopyNotes);
|
||||
}
|
||||
}
|
||||
var selection = await page.DisplayActionSheet(cipher.Name, AppResources.Cancel, null, options.ToArray());
|
||||
if(selection == AppResources.View)
|
||||
if (selection == AppResources.View)
|
||||
{
|
||||
await page.Navigation.PushModalAsync(new NavigationPage(new ViewPage(cipher.Id)));
|
||||
}
|
||||
else if(selection == AppResources.Edit)
|
||||
else if (selection == AppResources.Edit)
|
||||
{
|
||||
await page.Navigation.PushModalAsync(new NavigationPage(new AddEditPage(cipher.Id)));
|
||||
}
|
||||
else if(selection == AppResources.CopyUsername)
|
||||
else if (selection == AppResources.CopyUsername)
|
||||
{
|
||||
await platformUtilsService.CopyToClipboardAsync(cipher.Login.Username);
|
||||
platformUtilsService.ShowToast("info", null,
|
||||
string.Format(AppResources.ValueHasBeenCopied, AppResources.Username));
|
||||
}
|
||||
else if(selection == AppResources.CopyPassword)
|
||||
else if (selection == AppResources.CopyPassword)
|
||||
{
|
||||
await platformUtilsService.CopyToClipboardAsync(cipher.Login.Password);
|
||||
platformUtilsService.ShowToast("info", null,
|
||||
string.Format(AppResources.ValueHasBeenCopied, AppResources.Password));
|
||||
var task = eventService.CollectAsync(Core.Enums.EventType.Cipher_ClientCopiedPassword, cipher.Id);
|
||||
}
|
||||
else if(selection == AppResources.CopyTotp)
|
||||
else if (selection == AppResources.CopyTotp)
|
||||
{
|
||||
var totpService = ServiceContainer.Resolve<ITotpService>("totpService");
|
||||
var totp = await totpService.GetCodeAsync(cipher.Login.Totp);
|
||||
if(!string.IsNullOrWhiteSpace(totp))
|
||||
if (!string.IsNullOrWhiteSpace(totp))
|
||||
{
|
||||
await platformUtilsService.CopyToClipboardAsync(totp);
|
||||
platformUtilsService.ShowToast("info", null,
|
||||
string.Format(AppResources.ValueHasBeenCopied, AppResources.VerificationCodeTotp));
|
||||
}
|
||||
}
|
||||
else if(selection == AppResources.Launch)
|
||||
else if (selection == AppResources.Launch)
|
||||
{
|
||||
platformUtilsService.LaunchUri(cipher.Login.LaunchUri);
|
||||
}
|
||||
else if(selection == AppResources.CopyNumber)
|
||||
else if (selection == AppResources.CopyNumber)
|
||||
{
|
||||
await platformUtilsService.CopyToClipboardAsync(cipher.Card.Number);
|
||||
platformUtilsService.ShowToast("info", null,
|
||||
string.Format(AppResources.ValueHasBeenCopied, AppResources.Number));
|
||||
}
|
||||
else if(selection == AppResources.CopySecurityCode)
|
||||
else if (selection == AppResources.CopySecurityCode)
|
||||
{
|
||||
await platformUtilsService.CopyToClipboardAsync(cipher.Card.Code);
|
||||
platformUtilsService.ShowToast("info", null,
|
||||
string.Format(AppResources.ValueHasBeenCopied, AppResources.SecurityCode));
|
||||
var task = eventService.CollectAsync(Core.Enums.EventType.Cipher_ClientCopiedCardCode, cipher.Id);
|
||||
}
|
||||
else if(selection == AppResources.CopyNotes)
|
||||
else if (selection == AppResources.CopyNotes)
|
||||
{
|
||||
await platformUtilsService.CopyToClipboardAsync(cipher.Notes);
|
||||
platformUtilsService.ShowToast("info", null,
|
||||
@@ -125,21 +125,21 @@ namespace Bit.App.Utilities
|
||||
{
|
||||
var currentBuild = deviceActionService.GetBuildNumber();
|
||||
var lastBuild = await storageService.GetAsync<string>(Constants.LastBuildKey);
|
||||
if(lastBuild == null)
|
||||
if (lastBuild == null)
|
||||
{
|
||||
// Installed
|
||||
var currentLock = await storageService.GetAsync<int?>(Constants.LockOptionKey);
|
||||
if(currentLock == null)
|
||||
if (currentLock == null)
|
||||
{
|
||||
await storageService.SaveAsync(Constants.LockOptionKey, 15);
|
||||
}
|
||||
}
|
||||
else if(lastBuild != currentBuild)
|
||||
else if (lastBuild != currentBuild)
|
||||
{
|
||||
// Updated
|
||||
var tasks = Task.Run(() => syncService.FullSyncAsync(true));
|
||||
}
|
||||
if(lastBuild != currentBuild)
|
||||
if (lastBuild != currentBuild)
|
||||
{
|
||||
await storageService.SaveAsync(Constants.LastBuildKey, currentBuild);
|
||||
return true;
|
||||
@@ -149,18 +149,18 @@ namespace Bit.App.Utilities
|
||||
|
||||
public static async Task SetPreconfiguredSettingsAsync(IDictionary<string, string> configSettings)
|
||||
{
|
||||
if(configSettings?.Any() ?? true)
|
||||
if (configSettings?.Any() ?? true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
foreach(var setting in configSettings)
|
||||
foreach (var setting in configSettings)
|
||||
{
|
||||
switch(setting.Key)
|
||||
switch (setting.Key)
|
||||
{
|
||||
case "baseEnvironmentUrl":
|
||||
var environmentService = ServiceContainer.Resolve<IEnvironmentService>("environmentService");
|
||||
var settingValue = string.IsNullOrWhiteSpace(setting.Value) ? null : setting.Value;
|
||||
if(environmentService.BaseUrl != settingValue)
|
||||
if (environmentService.BaseUrl != settingValue)
|
||||
{
|
||||
await environmentService.SetUrlsAsync(new Core.Models.Data.EnvironmentUrlData
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user