mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 18:08:26 +03:00
resolving warnings for obsolete APIs
This commit is contained in:
parent
65438e837d
commit
24382b8607
45 changed files with 160 additions and 123 deletions
|
@ -124,7 +124,7 @@ namespace Bit.App
|
|||
|
||||
SetMainPageFromAutofill();
|
||||
|
||||
if(Device.OS == TargetPlatform.Android && !TopPageIsLock())
|
||||
if(Device.RuntimePlatform == Device.Android && !TopPageIsLock())
|
||||
{
|
||||
_lockService.UpdateLastActivity();
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ namespace Bit.App
|
|||
// Handle when your app resumes
|
||||
Debug.WriteLine("OnResume");
|
||||
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
await CheckLockAsync(false);
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ namespace Bit.App
|
|||
lockPinPage.PinControl.Entry.FocusWithDelay();
|
||||
}
|
||||
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
await Task.Run(() => FullSyncAsync()).ConfigureAwait(false);
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ namespace Bit.App
|
|||
|
||||
private void SetMainPageFromAutofill()
|
||||
{
|
||||
if(Device.OS == TargetPlatform.Android && !string.IsNullOrWhiteSpace(_uri))
|
||||
if(Device.RuntimePlatform == Device.Android && !string.IsNullOrWhiteSpace(_uri))
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
|
@ -386,7 +386,7 @@ namespace Bit.App
|
|||
Debug.WriteLine("====================================");
|
||||
|
||||
// This lookup NOT required for Windows platforms - the Culture will be automatically set
|
||||
if(Device.OS == TargetPlatform.iOS || Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
var ci = _localizeService.GetCurrentCultureInfo();
|
||||
AppResources.Culture = ci;
|
||||
|
|
|
@ -275,6 +275,7 @@
|
|||
<Compile Include="Pages\Vault\VaultEditLoginPage.cs" />
|
||||
<Compile Include="Pages\Vault\VaultListLoginsPage.cs" />
|
||||
<Compile Include="Services\PasswordGenerationService.cs" />
|
||||
<Compile Include="Utilities\Helpers.cs" />
|
||||
<Compile Include="Utilities\IdentityHttpClient.cs" />
|
||||
<Compile Include="Utilities\Extentions.cs" />
|
||||
<Compile Include="Utilities\ExtendedObservableCollection.cs" />
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Bit.App.Enums;
|
||||
using Bit.App.Utilities;
|
||||
using System;
|
||||
using Xamarin.Forms;
|
||||
|
||||
|
@ -10,7 +11,7 @@ namespace Bit.App.Controls
|
|||
BindableProperty.Create(nameof(Padding), typeof(Thickness), typeof(ExtendedButton), default(Thickness));
|
||||
public static readonly BindableProperty UppercaseProperty =
|
||||
BindableProperty.Create(nameof(Uppercase), typeof(bool), typeof(ExtendedButton),
|
||||
Device.OnPlatform(iOS: false, Android: true, WinPhone: false));
|
||||
Helpers.OnPlatform(iOS: false, Android: true, WinPhone: false));
|
||||
|
||||
public Thickness Padding
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Bit.App.Controls
|
|||
{
|
||||
public ExtendedEntry()
|
||||
{
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
PlaceholderColor = Color.FromHex("c7c7cd");
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace Bit.App.Controls
|
|||
{
|
||||
public ExtendedTextCell()
|
||||
{
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
TextColor = Color.Black;
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ namespace Bit.App.Controls
|
|||
VerticalOptions = LayoutOptions.CenterAndExpand
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
var deviceInfo = Resolver.Resolve<IDeviceInfoService>();
|
||||
if(useLabelAsPlaceholder)
|
||||
|
@ -125,7 +125,7 @@ namespace Bit.App.Controls
|
|||
Button = new ExtendedButton();
|
||||
imageStackLayout.Children.Add(Button);
|
||||
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
Button.Padding = new Thickness(0);
|
||||
Button.BackgroundColor = Color.Transparent;
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace Bit.App.Controls
|
|||
stackLayout.Children.Add(Label);
|
||||
stackLayout.Children.Add(Picker);
|
||||
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
stackLayout.Spacing = 0;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace Bit.App.Controls
|
|||
Grid.SetColumnSpan(Detail, 2);
|
||||
Grid.SetRowSpan(Button, 2);
|
||||
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
Label.TextColor = Color.Black;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace Bit.App.Controls
|
|||
LineBreakMode = LineBreakMode.TailTruncation
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
Value.TextColor = Color.Black;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ namespace Bit.App.Controls
|
|||
buttonStackLayout.Children.Add(Button2);
|
||||
}
|
||||
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
buttonStackLayout.Spacing = 5;
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using Bit.App.Utilities;
|
||||
using System;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Controls
|
||||
|
@ -13,7 +14,7 @@ namespace Bit.App.Controls
|
|||
{
|
||||
HorizontalTextAlignment = TextAlignment.Center,
|
||||
FontSize = 35,
|
||||
FontFamily = Device.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier")
|
||||
FontFamily = Helpers.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier")
|
||||
};
|
||||
|
||||
Entry = new ExtendedEntry
|
||||
|
@ -23,7 +24,7 @@ namespace Bit.App.Controls
|
|||
Margin = new Thickness(0, int.MaxValue, 0, 0)
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
Label.TextColor = Color.Black;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Xamarin.Forms;
|
||||
using Bit.App.Utilities;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Controls
|
||||
{
|
||||
|
@ -39,13 +40,13 @@ namespace Bit.App.Controls
|
|||
Orientation = StackOrientation.Horizontal,
|
||||
Children = { Label, StepperValueLabel, Stepper },
|
||||
Spacing = 15,
|
||||
Padding = Device.OnPlatform(
|
||||
Padding = Helpers.OnPlatform(
|
||||
iOS: new Thickness(15, 8),
|
||||
Android: new Thickness(15, 2),
|
||||
WinPhone: new Thickness(15, 8))
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
Label.TextColor = Color.Black;
|
||||
}
|
||||
|
|
|
@ -12,9 +12,9 @@ namespace Bit.App.Controls
|
|||
public VaultListViewCell(Action<VaultListPageModel.Login> moreClickedAction)
|
||||
{
|
||||
SetBinding(LoginParameterProperty, new Binding("."));
|
||||
Label.SetBinding<VaultListPageModel.Login>(Label.TextProperty, l => l.Name);
|
||||
Detail.SetBinding<VaultListPageModel.Login>(Label.TextProperty, l => l.Username);
|
||||
LabelIcon.SetBinding<VaultListPageModel.Login>(VisualElement.IsVisibleProperty, l => l.Shared);
|
||||
Label.SetBinding(Label.TextProperty, nameof(VaultListPageModel.Login.Name));
|
||||
Detail.SetBinding(Label.TextProperty, nameof(VaultListPageModel.Login.Username));
|
||||
LabelIcon.SetBinding(VisualElement.IsVisibleProperty, nameof(VaultListPageModel.Login.Shared));
|
||||
|
||||
Button.Image = "more";
|
||||
Button.Command = new Command(() => moreClickedAction?.Invoke(LoginParameter));
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Bit.App.Models.Api
|
|||
{
|
||||
Identifier = appIdService.AppId;
|
||||
Name = deviceInfoService.Model;
|
||||
Type = Device.OS == TargetPlatform.Android ? DeviceType.Android : DeviceType.iOS;
|
||||
Type = Device.RuntimePlatform == Device.Android ? DeviceType.Android : DeviceType.iOS;
|
||||
}
|
||||
|
||||
public DeviceType Type { get; set; }
|
||||
|
|
|
@ -13,7 +13,6 @@ namespace Bit.App.Models.Page
|
|||
private string _uri;
|
||||
private string _notes;
|
||||
private bool _revealPassword;
|
||||
private string _uriHost;
|
||||
|
||||
public VaultViewLoginPageModel() { }
|
||||
|
||||
|
@ -44,7 +43,7 @@ namespace Bit.App.Models.Page
|
|||
{
|
||||
get
|
||||
{
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
var length = Username?.Length ?? 0;
|
||||
|
||||
|
@ -79,7 +78,7 @@ namespace Bit.App.Models.Page
|
|||
{
|
||||
get
|
||||
{
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
var length = Password?.Length ?? 0;
|
||||
|
||||
|
@ -121,11 +120,6 @@ namespace Bit.App.Models.Page
|
|||
return null;
|
||||
}
|
||||
|
||||
if(_uriHost != null)
|
||||
{
|
||||
return _uriHost;
|
||||
}
|
||||
|
||||
Uri uri;
|
||||
if(!System.Uri.TryCreate(Uri, UriKind.Absolute, out uri))
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Bit.App.Pages
|
|||
|
||||
protected override bool OnBackButtonPressed()
|
||||
{
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
MessagingCenter.Send(Application.Current, "BackgroundApp");
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ using Xamarin.Forms;
|
|||
using XLabs.Ioc;
|
||||
using Bit.App.Controls;
|
||||
using System.Linq;
|
||||
using Bit.App.Utilities;
|
||||
|
||||
namespace Bit.App.Pages
|
||||
{
|
||||
|
@ -29,7 +30,7 @@ namespace Bit.App.Pages
|
|||
|
||||
public void Init()
|
||||
{
|
||||
var padding = Device.OnPlatform(
|
||||
var padding = Helpers.OnPlatform(
|
||||
iOS: new Thickness(15, 20),
|
||||
Android: new Thickness(15, 8),
|
||||
WinPhone: new Thickness(15, 20));
|
||||
|
@ -74,7 +75,7 @@ namespace Bit.App.Pages
|
|||
|
||||
var scrollView = new ScrollView { Content = stackLayout };
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
table.RowHeight = -1;
|
||||
table.EstimatedRowHeight = 70;
|
||||
|
|
|
@ -38,8 +38,8 @@ namespace Bit.App.Pages
|
|||
};
|
||||
|
||||
PinControl = new PinControl();
|
||||
PinControl.Label.SetBinding<PinPageModel>(Label.TextProperty, s => s.LabelText);
|
||||
PinControl.Entry.SetBinding<PinPageModel>(Entry.TextProperty, s => s.PIN);
|
||||
PinControl.Label.SetBinding(Label.TextProperty, nameof(PinPageModel.LabelText));
|
||||
PinControl.Entry.SetBinding(Entry.TextProperty, nameof(PinPageModel.PIN));
|
||||
|
||||
var logoutButton = new ExtendedButton
|
||||
{
|
||||
|
|
|
@ -8,6 +8,7 @@ using Acr.UserDialogs;
|
|||
using System.Threading.Tasks;
|
||||
using Plugin.Settings.Abstractions;
|
||||
using PushNotification.Plugin.Abstractions;
|
||||
using Bit.App.Utilities;
|
||||
|
||||
namespace Bit.App.Pages
|
||||
{
|
||||
|
@ -42,7 +43,7 @@ namespace Bit.App.Pages
|
|||
{
|
||||
MessagingCenter.Send(Application.Current, "ShowStatusBar", true);
|
||||
|
||||
var padding = Device.OnPlatform(
|
||||
var padding = Helpers.OnPlatform(
|
||||
iOS: new Thickness(15, 20),
|
||||
Android: new Thickness(15, 8),
|
||||
WinPhone: new Thickness(15, 20));
|
||||
|
@ -97,12 +98,12 @@ namespace Bit.App.Pages
|
|||
var layout = new StackLayout
|
||||
{
|
||||
Children = { table, forgotPasswordButton },
|
||||
Spacing = Device.OnPlatform(iOS: 0, Android: 10, WinPhone: 0)
|
||||
Spacing = Helpers.OnPlatform(iOS: 0, Android: 10, WinPhone: 0)
|
||||
};
|
||||
|
||||
var scrollView = new ScrollView { Content = layout };
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
table.RowHeight = -1;
|
||||
table.EstimatedRowHeight = 70;
|
||||
|
@ -197,7 +198,7 @@ namespace Bit.App.Pages
|
|||
|
||||
_googleAnalyticsService.TrackAppEvent("LoggedIn");
|
||||
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
_pushNotification.Register();
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ using Acr.UserDialogs;
|
|||
using System.Threading.Tasks;
|
||||
using PushNotification.Plugin.Abstractions;
|
||||
using Bit.App.Models;
|
||||
using Bit.App.Utilities;
|
||||
|
||||
namespace Bit.App.Pages
|
||||
{
|
||||
|
@ -42,7 +43,7 @@ namespace Bit.App.Pages
|
|||
|
||||
private void Init()
|
||||
{
|
||||
var padding = Device.OnPlatform(
|
||||
var padding = Helpers.OnPlatform(
|
||||
iOS: new Thickness(15, 20),
|
||||
Android: new Thickness(15, 8),
|
||||
WinPhone: new Thickness(15, 20));
|
||||
|
@ -97,7 +98,7 @@ namespace Bit.App.Pages
|
|||
|
||||
var scrollView = new ScrollView { Content = layout };
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
table.RowHeight = -1;
|
||||
table.EstimatedRowHeight = 70;
|
||||
|
@ -158,7 +159,7 @@ namespace Bit.App.Pages
|
|||
|
||||
_googleAnalyticsService.TrackAppEvent("LoggedIn From Two-step");
|
||||
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
_pushNotification.Register();
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ using Xamarin.Forms;
|
|||
using XLabs.Ioc;
|
||||
using Acr.UserDialogs;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.App.Utilities;
|
||||
|
||||
namespace Bit.App.Pages
|
||||
{
|
||||
|
@ -29,7 +30,7 @@ namespace Bit.App.Pages
|
|||
|
||||
private void Init()
|
||||
{
|
||||
var padding = Device.OnPlatform(
|
||||
var padding = Helpers.OnPlatform(
|
||||
iOS: new Thickness(15, 20),
|
||||
Android: new Thickness(15, 8),
|
||||
WinPhone: new Thickness(15, 20));
|
||||
|
@ -73,7 +74,7 @@ namespace Bit.App.Pages
|
|||
|
||||
var scrollView = new ScrollView { Content = layout };
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
table.RowHeight = -1;
|
||||
table.EstimatedRowHeight = 70;
|
||||
|
|
|
@ -8,6 +8,7 @@ using Xamarin.Forms;
|
|||
using XLabs.Ioc;
|
||||
using Acr.UserDialogs;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.App.Utilities;
|
||||
|
||||
namespace Bit.App.Pages
|
||||
{
|
||||
|
@ -43,7 +44,7 @@ namespace Bit.App.Pages
|
|||
{
|
||||
MessagingCenter.Send(Application.Current, "ShowStatusBar", true);
|
||||
|
||||
var padding = Device.OnPlatform(
|
||||
var padding = Helpers.OnPlatform(
|
||||
iOS: new Thickness(15, 20),
|
||||
Android: new Thickness(15, 8),
|
||||
WinPhone: new Thickness(15, 20));
|
||||
|
@ -121,7 +122,7 @@ namespace Bit.App.Pages
|
|||
await Register();
|
||||
}, ToolbarItemOrder.Default, 0);
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
table.RowHeight = table2.RowHeight = -1;
|
||||
table.EstimatedRowHeight = table2.EstimatedRowHeight = 70;
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace Bit.App.Pages
|
|||
}
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
table.RowHeight = -1;
|
||||
table.EstimatedRowHeight = 44;
|
||||
|
@ -78,7 +78,7 @@ namespace Bit.App.Pages
|
|||
Spacing = 0
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace Bit.App.Pages
|
|||
}
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
table.RowHeight = -1;
|
||||
table.EstimatedRowHeight = 70;
|
||||
|
@ -105,7 +105,7 @@ namespace Bit.App.Pages
|
|||
Title = AppResources.AddFolder;
|
||||
Content = table;
|
||||
ToolbarItems.Add(saveToolBarItem);
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using Bit.App.Controls;
|
||||
using Xamarin.Forms;
|
||||
using Bit.App.Resources;
|
||||
using Bit.App.Utilities;
|
||||
|
||||
namespace Bit.App.Pages
|
||||
{
|
||||
|
@ -37,7 +38,7 @@ Fingerprint by masterpage.com from the Noun Project")
|
|||
}
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
table.RowHeight = -1;
|
||||
table.EstimatedRowHeight = 100;
|
||||
|
@ -61,14 +62,14 @@ Fingerprint by masterpage.com from the Noun Project")
|
|||
var layout = new StackLayout
|
||||
{
|
||||
Children = { label },
|
||||
Padding = Device.OnPlatform(
|
||||
Padding = Helpers.OnPlatform(
|
||||
iOS: new Thickness(15, 20),
|
||||
Android: new Thickness(16, 20),
|
||||
WinPhone: new Thickness(15, 20)),
|
||||
BackgroundColor = Color.White
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
label.TextColor = Color.Black;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace Bit.App.Pages
|
|||
}
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
mainTable.RowHeight = -1;
|
||||
mainTable.EstimatedRowHeight = 70;
|
||||
|
@ -119,7 +119,7 @@ namespace Bit.App.Pages
|
|||
Title = AppResources.EditFolder;
|
||||
Content = mainTable;
|
||||
ToolbarItems.Add(saveToolBarItem);
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace Bit.App.Pages
|
|||
Spacing = 0
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
AutofillAlwaysCell = new ExtendedSwitchCell
|
||||
{
|
||||
|
@ -161,7 +161,7 @@ namespace Bit.App.Pages
|
|||
Content = StackLayout
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
analyticsTable.RowHeight = -1;
|
||||
analyticsTable.EstimatedRowHeight = 70;
|
||||
|
|
|
@ -102,7 +102,7 @@ namespace Bit.App.Pages
|
|||
Spacing = 0
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ namespace Bit.App.Pages
|
|||
VerticalOptions = LayoutOptions.Start;
|
||||
NoFooter = true;
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
RowHeight = -1;
|
||||
EstimatedRowHeight = 44;
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace Bit.App.Pages
|
|||
ItemTemplate = new DataTemplate(() => new SettingsFolderListViewCell(this))
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ namespace Bit.App.Pages
|
|||
{
|
||||
public SettingsFolderListViewCell(SettingsListFoldersPage page)
|
||||
{
|
||||
this.SetBinding<SettingsFolderPageModel>(TextProperty, s => s.Name);
|
||||
this.SetBinding(TextProperty, nameof(SettingsFolderPageModel.Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ using Acr.UserDialogs;
|
|||
using Plugin.Settings.Abstractions;
|
||||
using Plugin.Fingerprint.Abstractions;
|
||||
using PushNotification.Plugin.Abstractions;
|
||||
using Bit.App.Utilities;
|
||||
|
||||
namespace Bit.App.Pages
|
||||
{
|
||||
|
@ -81,7 +82,7 @@ namespace Bit.App.Pages
|
|||
|
||||
if(_fingerprint.IsAvailable)
|
||||
{
|
||||
var fingerprintName = Device.OnPlatform(iOS: AppResources.TouchID, Android: AppResources.Fingerprint,
|
||||
var fingerprintName = Helpers.OnPlatform(iOS: AppResources.TouchID, Android: AppResources.Fingerprint,
|
||||
WinPhone: AppResources.Fingerprint);
|
||||
FingerprintCell = new ExtendedSwitchCell
|
||||
{
|
||||
|
@ -151,7 +152,7 @@ namespace Bit.App.Pages
|
|||
HelpCell
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
RateCellLong = new LongDetailViewCell(AppResources.RateTheApp, AppResources.RateTheAppDescriptionAppStore);
|
||||
otherSection.Add(RateCellLong);
|
||||
|
@ -328,12 +329,12 @@ namespace Bit.App.Pages
|
|||
private void RateCell_Tapped(object sender, EventArgs e)
|
||||
{
|
||||
_googleAnalyticsService.TrackAppEvent("OpenedSetting", "RateApp");
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
Device.OpenUri(new Uri($"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews" +
|
||||
"?id=1137397744&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&type=Purple+Software"));
|
||||
}
|
||||
else if(Device.OS == TargetPlatform.Android)
|
||||
else if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
MessagingCenter.Send(Application.Current, "RateApp");
|
||||
}
|
||||
|
@ -484,7 +485,7 @@ namespace Bit.App.Pages
|
|||
Intent = TableIntent.Settings;
|
||||
HasUnevenRows = true;
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
RowHeight = -1;
|
||||
EstimatedRowHeight = 44;
|
||||
|
|
|
@ -42,8 +42,8 @@ namespace Bit.App.Pages
|
|||
};
|
||||
|
||||
PinControl = new PinControl();
|
||||
PinControl.Label.SetBinding<PinPageModel>(Label.TextProperty, s => s.LabelText);
|
||||
PinControl.Entry.SetBinding<PinPageModel>(Entry.TextProperty, s => s.PIN);
|
||||
PinControl.Label.SetBinding(Label.TextProperty, nameof(PinPageModel.LabelText));
|
||||
PinControl.Entry.SetBinding(Entry.TextProperty, nameof(PinPageModel.PIN));
|
||||
|
||||
var stackLayout = new StackLayout
|
||||
{
|
||||
|
@ -56,7 +56,7 @@ namespace Bit.App.Pages
|
|||
PinControl.Label.GestureRecognizers.Add(Tgr);
|
||||
instructionLabel.GestureRecognizers.Add(Tgr);
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace Bit.App.Pages
|
|||
Padding = new Thickness(15, 0)
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ namespace Bit.App.Pages
|
|||
|
||||
ScrollView = new ScrollView { Content = DisabledStackLayout };
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Close));
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace Bit.App.Pages
|
|||
VerticalOptions = LayoutOptions.FillAndExpand
|
||||
};
|
||||
|
||||
notStartedStackLayout.SetBinding<AppExtensionPageModel>(IsVisibleProperty, m => m.NotStarted);
|
||||
notStartedStackLayout.SetBinding(IsVisibleProperty, nameof(AppExtensionPageModel.NotStarted));
|
||||
|
||||
// Not Activated
|
||||
|
||||
|
@ -132,7 +132,7 @@ namespace Bit.App.Pages
|
|||
VerticalOptions = LayoutOptions.FillAndExpand
|
||||
};
|
||||
|
||||
notActivatedStackLayout.SetBinding<AppExtensionPageModel>(IsVisibleProperty, m => m.StartedAndNotActivated);
|
||||
notActivatedStackLayout.SetBinding(IsVisibleProperty, nameof(AppExtensionPageModel.StartedAndNotActivated));
|
||||
|
||||
// Activated
|
||||
|
||||
|
@ -197,7 +197,7 @@ namespace Bit.App.Pages
|
|||
Children = { activatedLabel, activatedSublabel, activatedImage, activatedButton, activatedButtonReenable }
|
||||
};
|
||||
|
||||
activatedStackLayout.SetBinding<AppExtensionPageModel>(IsVisibleProperty, m => m.StartedAndActivated);
|
||||
activatedStackLayout.SetBinding(IsVisibleProperty, nameof(AppExtensionPageModel.StartedAndActivated));
|
||||
|
||||
var stackLayout = new StackLayout
|
||||
{
|
||||
|
@ -205,7 +205,7 @@ namespace Bit.App.Pages
|
|||
VerticalOptions = LayoutOptions.FillAndExpand
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Close));
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace Bit.App.Pages
|
|||
|
||||
var section = new TableSection(" ") { GeneratorCell };
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
ExtensionCell = new ToolsViewCell(AppResources.BitwardenAppExtension,
|
||||
AppResources.BitwardenAppExtensionDescription, "upload");
|
||||
|
@ -68,7 +68,7 @@ namespace Bit.App.Pages
|
|||
}
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
table.RowHeight = -1;
|
||||
table.EstimatedRowHeight = 100;
|
||||
|
@ -163,7 +163,7 @@ namespace Bit.App.Pages
|
|||
Text = labelText
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
label.TextColor = Color.Black;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ using Bit.App.Resources;
|
|||
using Plugin.Settings.Abstractions;
|
||||
using Xamarin.Forms;
|
||||
using XLabs.Ioc;
|
||||
using Bit.App.Utilities;
|
||||
|
||||
namespace Bit.App.Pages
|
||||
{
|
||||
|
@ -48,14 +49,14 @@ namespace Bit.App.Pages
|
|||
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
|
||||
Margin = new Thickness(15, 40, 15, 40),
|
||||
HorizontalTextAlignment = TextAlignment.Center,
|
||||
FontFamily = Device.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier"),
|
||||
FontFamily = Helpers.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier"),
|
||||
LineBreakMode = LineBreakMode.TailTruncation,
|
||||
VerticalOptions = LayoutOptions.Start
|
||||
};
|
||||
|
||||
Tgr = new TapGestureRecognizer();
|
||||
Password.GestureRecognizers.Add(Tgr);
|
||||
Password.SetBinding<PasswordGeneratorPageModel>(Label.TextProperty, m => m.Password);
|
||||
Password.SetBinding(Label.TextProperty, nameof(PasswordGeneratorPageModel.Password));
|
||||
|
||||
SliderCell = new SliderViewCell(this, _passwordGenerationService, _settings);
|
||||
SettingsCell = new ExtendedTextCell { Text = AppResources.MoreSettings, ShowDisclousure = true };
|
||||
|
@ -86,7 +87,7 @@ namespace Bit.App.Pages
|
|||
}
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
table.RowHeight = -1;
|
||||
table.EstimatedRowHeight = 44;
|
||||
|
@ -248,21 +249,21 @@ namespace Bit.App.Pages
|
|||
Style = (Style)Application.Current.Resources["text-muted"]
|
||||
};
|
||||
|
||||
Value.SetBinding<PasswordGeneratorPageModel>(Label.TextProperty, m => m.Length);
|
||||
Value.SetBinding(Label.TextProperty, nameof(PasswordGeneratorPageModel.Length));
|
||||
|
||||
var stackLayout = new StackLayout
|
||||
{
|
||||
Orientation = StackOrientation.Horizontal,
|
||||
Spacing = 15,
|
||||
Children = { label, LengthSlider, Value },
|
||||
Padding = Device.OnPlatform(
|
||||
Padding = Helpers.OnPlatform(
|
||||
iOS: new Thickness(15, 8),
|
||||
Android: new Thickness(16, 10),
|
||||
WinPhone: new Thickness(15, 8))
|
||||
};
|
||||
|
||||
stackLayout.AdjustPaddingForDevice();
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
label.TextColor = Color.Black;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ namespace Bit.App.Pages
|
|||
}
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
table.RowHeight = -1;
|
||||
table.EstimatedRowHeight = 44;
|
||||
|
|
|
@ -10,6 +10,7 @@ using Plugin.Connectivity.Abstractions;
|
|||
using Xamarin.Forms;
|
||||
using XLabs.Ioc;
|
||||
using Plugin.Settings.Abstractions;
|
||||
using Bit.App.Utilities;
|
||||
|
||||
namespace Bit.App.Pages
|
||||
{
|
||||
|
@ -62,7 +63,7 @@ namespace Bit.App.Pages
|
|||
PasswordCell.Button.Image = "eye";
|
||||
PasswordCell.Entry.DisableAutocapitalize = true;
|
||||
PasswordCell.Entry.Autocorrect = false;
|
||||
PasswordCell.Entry.FontFamily = Device.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier");
|
||||
PasswordCell.Entry.FontFamily = Helpers.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier");
|
||||
|
||||
UsernameCell = new FormEntryCell(AppResources.Username, nextElement: PasswordCell.Entry);
|
||||
UsernameCell.Entry.DisableAutocapitalize = true;
|
||||
|
@ -124,12 +125,12 @@ namespace Bit.App.Pages
|
|||
}
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
table.RowHeight = -1;
|
||||
table.EstimatedRowHeight = 70;
|
||||
}
|
||||
else if(Device.OS == TargetPlatform.Android)
|
||||
else if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
PasswordCell.Button.WidthRequest = 40;
|
||||
}
|
||||
|
@ -200,7 +201,7 @@ namespace Bit.App.Pages
|
|||
Title = AppResources.AddLogin;
|
||||
Content = table;
|
||||
ToolbarItems.Add(saveToolBarItem);
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
|
||||
}
|
||||
|
@ -226,12 +227,12 @@ namespace Bit.App.Pages
|
|||
if(!_fromAutofill && !_settings.GetValueOrDefault(AddedLoginAlertKey, false))
|
||||
{
|
||||
_settings.AddOrUpdateValue(AddedLoginAlertKey, true);
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
DisplayAlert(AppResources.BitwardenAppExtension, AppResources.BitwardenAppExtensionAlert,
|
||||
AppResources.Ok);
|
||||
}
|
||||
else if(Device.OS == TargetPlatform.Android && !_appInfoService.AutofillServiceEnabled)
|
||||
else if(Device.RuntimePlatform == Device.Android && !_appInfoService.AutofillServiceEnabled)
|
||||
{
|
||||
DisplayAlert(AppResources.BitwardenAutofillService, AppResources.BitwardenAutofillServiceAlert,
|
||||
AppResources.Ok);
|
||||
|
|
|
@ -106,7 +106,7 @@ namespace Bit.App.Pages
|
|||
(VaultListPageModel.Login l) => MoreClickedAsync(l)))
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
ListView.RowHeight = -1;
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ namespace Bit.App.Pages
|
|||
VerticalTextAlignment = TextAlignment.Center
|
||||
};
|
||||
|
||||
label.SetBinding<VaultListPageModel.AutofillGrouping>(Label.TextProperty, s => s.Name);
|
||||
label.SetBinding(Label.TextProperty, nameof(VaultListPageModel.AutofillGrouping.Name));
|
||||
|
||||
var grid = new ContentView
|
||||
{
|
||||
|
|
|
@ -8,6 +8,7 @@ using Bit.App.Resources;
|
|||
using Plugin.Connectivity.Abstractions;
|
||||
using Xamarin.Forms;
|
||||
using XLabs.Ioc;
|
||||
using Bit.App.Utilities;
|
||||
|
||||
namespace Bit.App.Pages
|
||||
{
|
||||
|
@ -60,7 +61,7 @@ namespace Bit.App.Pages
|
|||
PasswordCell.Button.Image = "eye";
|
||||
PasswordCell.Entry.DisableAutocapitalize = true;
|
||||
PasswordCell.Entry.Autocorrect = false;
|
||||
PasswordCell.Entry.FontFamily = Device.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier");
|
||||
PasswordCell.Entry.FontFamily = Helpers.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier");
|
||||
|
||||
UsernameCell = new FormEntryCell(AppResources.Username, nextElement: PasswordCell.Entry);
|
||||
UsernameCell.Entry.Text = login.Username?.Decrypt(login.OrganizationId);
|
||||
|
@ -135,12 +136,12 @@ namespace Bit.App.Pages
|
|||
}
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
table.RowHeight = -1;
|
||||
table.EstimatedRowHeight = 70;
|
||||
}
|
||||
else if(Device.OS == TargetPlatform.Android)
|
||||
else if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
PasswordCell.Button.WidthRequest = 40;
|
||||
}
|
||||
|
@ -206,7 +207,7 @@ namespace Bit.App.Pages
|
|||
Title = AppResources.EditLogin;
|
||||
Content = table;
|
||||
ToolbarItems.Add(saveToolBarItem);
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace Bit.App.Pages
|
|||
(VaultListPageModel.Login l) => MoreClickedAsync(l)))
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
ListView.RowHeight = -1;
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ namespace Bit.App.Pages
|
|||
CancelButtonColor = Color.FromHex("3c8dbc")
|
||||
};
|
||||
// Bug with searchbar on android 7, ref https://bugzilla.xamarin.com/show_bug.cgi?id=43975
|
||||
if(Device.OS == TargetPlatform.Android && _deviceInfoService.Version >= 24)
|
||||
if(Device.RuntimePlatform == Device.Android && _deviceInfoService.Version >= 24)
|
||||
{
|
||||
Search.HeightRequest = 50;
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ namespace Bit.App.Pages
|
|||
_filterResultsCancellationTokenSource = FetchAndLoadVault();
|
||||
}
|
||||
|
||||
if(_connectivity.IsConnected && Device.OS == TargetPlatform.iOS && !_favorites)
|
||||
if(_connectivity.IsConnected && Device.RuntimePlatform == Device.iOS && !_favorites)
|
||||
{
|
||||
var pushPromptShow = _settings.GetValueOrDefault(Constants.PushInitialPromptShown, false);
|
||||
Action registerAction = () =>
|
||||
|
@ -512,7 +512,7 @@ namespace Bit.App.Pages
|
|||
VerticalTextAlignment = TextAlignment.Center
|
||||
};
|
||||
|
||||
label.SetBinding<VaultListPageModel.Folder>(Label.TextProperty, s => s.Name);
|
||||
label.SetBinding(Label.TextProperty, nameof(VaultListPageModel.Folder.Name));
|
||||
|
||||
var grid = new Grid
|
||||
{
|
||||
|
|
|
@ -7,6 +7,7 @@ using Bit.App.Resources;
|
|||
using Xamarin.Forms;
|
||||
using XLabs.Ioc;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.App.Utilities;
|
||||
|
||||
namespace Bit.App.Pages
|
||||
{
|
||||
|
@ -41,44 +42,44 @@ namespace Bit.App.Pages
|
|||
{
|
||||
EditItem = new EditLoginToolBarItem(this, _loginId);
|
||||
ToolbarItems.Add(EditItem);
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
ToolbarItems.Add(new DismissModalToolBarItem(this));
|
||||
}
|
||||
|
||||
// Name
|
||||
var nameCell = new LabeledValueCell(AppResources.Name);
|
||||
nameCell.Value.SetBinding<VaultViewLoginPageModel>(Label.TextProperty, s => s.Name);
|
||||
nameCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.Name));
|
||||
|
||||
// Username
|
||||
UsernameCell = new LabeledValueCell(AppResources.Username, button1Text: AppResources.Copy);
|
||||
UsernameCell.Value.SetBinding<VaultViewLoginPageModel>(Label.TextProperty, s => s.Username);
|
||||
UsernameCell.Value.SetBinding<VaultViewLoginPageModel>(Label.FontSizeProperty, s => s.UsernameFontSize);
|
||||
UsernameCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.Username));
|
||||
UsernameCell.Value.SetBinding(Label.FontSizeProperty, nameof(VaultViewLoginPageModel.UsernameFontSize));
|
||||
UsernameCell.Button1.Command = new Command(() => Copy(Model.Username, AppResources.Username));
|
||||
|
||||
// Password
|
||||
PasswordCell = new LabeledValueCell(AppResources.Password, button1Text: string.Empty,
|
||||
button2Text: AppResources.Copy);
|
||||
PasswordCell.Value.SetBinding<VaultViewLoginPageModel>(Label.TextProperty, s => s.MaskedPassword);
|
||||
PasswordCell.Value.SetBinding<VaultViewLoginPageModel>(Label.FontSizeProperty, s => s.PasswordFontSize);
|
||||
PasswordCell.Button1.SetBinding<VaultViewLoginPageModel>(Button.ImageProperty, s => s.ShowHideImage);
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
PasswordCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.MaskedPassword));
|
||||
PasswordCell.Value.SetBinding(Label.FontSizeProperty, nameof(VaultViewLoginPageModel.PasswordFontSize));
|
||||
PasswordCell.Value.SetBinding(Button.ImageProperty, nameof(VaultViewLoginPageModel.ShowHideImage));
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
PasswordCell.Button1.Margin = new Thickness(10, 0);
|
||||
}
|
||||
PasswordCell.Button1.Command = new Command(() => Model.RevealPassword = !Model.RevealPassword);
|
||||
PasswordCell.Button2.Command = new Command(() => Copy(Model.Password, AppResources.Password));
|
||||
PasswordCell.Value.FontFamily = Device.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier");
|
||||
PasswordCell.Value.FontFamily = Helpers.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier");
|
||||
|
||||
// URI
|
||||
UriCell = new LabeledValueCell(AppResources.Website, button1Text: AppResources.Launch);
|
||||
UriCell.Value.SetBinding<VaultViewLoginPageModel>(Label.TextProperty, s => s.UriHost);
|
||||
UriCell.Button1.SetBinding<VaultViewLoginPageModel>(IsVisibleProperty, s => s.ShowLaunch);
|
||||
UriCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.UriHost));
|
||||
UriCell.Value.SetBinding(IsVisibleProperty, nameof(VaultViewLoginPageModel.ShowLaunch));
|
||||
UriCell.Button1.Command = new Command(() => Device.OpenUri(new Uri(Model.Uri)));
|
||||
|
||||
// Notes
|
||||
NotesCell = new LabeledValueCell();
|
||||
NotesCell.Value.SetBinding<VaultViewLoginPageModel>(Label.TextProperty, s => s.Notes);
|
||||
NotesCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.Notes));
|
||||
NotesCell.Value.LineBreakMode = LineBreakMode.WordWrap;
|
||||
|
||||
LoginInformationSection = new TableSection(AppResources.LoginInformation)
|
||||
|
@ -104,12 +105,12 @@ namespace Bit.App.Pages
|
|||
}
|
||||
};
|
||||
|
||||
if(Device.OS == TargetPlatform.iOS)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
Table.RowHeight = -1;
|
||||
Table.EstimatedRowHeight = 70;
|
||||
}
|
||||
else if(Device.OS == TargetPlatform.Android)
|
||||
else if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
// NOTE: This is going to cause problems with i18n strings since various languages have difference string sizes
|
||||
PasswordCell.Button1.WidthRequest = 40;
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace Bit.App
|
|||
|
||||
public static void FocusWithDelay(this Entry entry, int delay = 1000)
|
||||
{
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ namespace Bit.App
|
|||
|
||||
public static void AdjustMarginsForDevice(this View view)
|
||||
{
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
var deviceInfo = Resolver.Resolve<IDeviceInfoService>();
|
||||
if(deviceInfo.Version < 21)
|
||||
|
@ -85,7 +85,7 @@ namespace Bit.App
|
|||
|
||||
public static void AdjustPaddingForDevice(this Layout view)
|
||||
{
|
||||
if(Device.OS == TargetPlatform.Android)
|
||||
if(Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
var deviceInfo = Resolver.Resolve<IDeviceInfoService>();
|
||||
if(deviceInfo.Scale == 1) // mdpi
|
||||
|
|
26
src/App/Utilities/Helpers.cs
Normal file
26
src/App/Utilities/Helpers.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Utilities
|
||||
{
|
||||
public static class Helpers
|
||||
{
|
||||
public static T OnPlatform<T>(T iOS = default(T), T Android = default(T),
|
||||
T WinPhone = default(T), T Windows = default(T))
|
||||
{
|
||||
switch(Device.RuntimePlatform)
|
||||
{
|
||||
case Device.iOS:
|
||||
return iOS;
|
||||
case Device.Android:
|
||||
return Android;
|
||||
case Device.WinPhone:
|
||||
return WinPhone;
|
||||
case Device.Windows:
|
||||
return Windows;
|
||||
default:
|
||||
throw new Exception("Unsupported platform.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -122,10 +122,10 @@
|
|||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\values\styles.xml" />
|
||||
<AndroidResource Include="Resources\xml\accessibilityservice.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\xml\accessibilityservice.xml" />
|
||||
<AndroidResource Include="Resources\values\styles.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<resources>
|
||||
<style name="BitwardenTheme.Splash" parent="BitwardenTheme.Base">
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
</style>
|
||||
<style name="BitwardenTheme" parent="BitwardenTheme.Base">
|
||||
</style>
|
||||
<style name="BitwardenTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="windowActionModeOverlay">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue