1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-11 13:53:29 +00:00

picker SetUpdateMode for ios

This commit is contained in:
Kyle Spearrin
2019-06-24 17:32:24 -04:00
parent 4b4757d0e5
commit ea30373a09
7 changed files with 44 additions and 5 deletions

View File

@@ -62,6 +62,7 @@
Text="{u:I18n Type}" Text="{u:I18n Type}"
StyleClass="box-label" /> StyleClass="box-label" />
<Picker <Picker
x:Name="_typePicker"
ItemsSource="{Binding TypeOptions, Mode=OneTime}" ItemsSource="{Binding TypeOptions, Mode=OneTime}"
SelectedIndex="{Binding TypeSelectedIndex}" SelectedIndex="{Binding TypeSelectedIndex}"
StyleClass="box-value" /> StyleClass="box-value" />

View File

@@ -2,6 +2,8 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
namespace Bit.App.Pages namespace Bit.App.Pages
{ {
@@ -20,9 +22,10 @@ namespace Bit.App.Pages
_vm.Page = this; _vm.Page = this;
_fromTabPage = fromTabPage; _fromTabPage = fromTabPage;
_selectAction = selectAction; _selectAction = selectAction;
var isIos = Device.RuntimePlatform == Device.iOS;
if(selectAction != null) if(selectAction != null)
{ {
if(Device.RuntimePlatform == Device.iOS) if(isIos)
{ {
ToolbarItems.Add(_closeItem); ToolbarItems.Add(_closeItem);
} }
@@ -30,7 +33,7 @@ namespace Bit.App.Pages
} }
else else
{ {
if(Device.RuntimePlatform == Device.iOS) if(isIos)
{ {
ToolbarItems.Add(_moreItem); ToolbarItems.Add(_moreItem);
} }
@@ -39,6 +42,10 @@ namespace Bit.App.Pages
ToolbarItems.Add(_historyItem); ToolbarItems.Add(_historyItem);
} }
} }
if(isIos)
{
_typePicker.On<iOS>().SetUpdateMode(UpdateMode.WhenFinished);
}
} }
public async Task InitAsync() public async Task InitAsync()
@@ -86,7 +93,7 @@ namespace Bit.App.Pages
if(selection == AppResources.PasswordHistory) if(selection == AppResources.PasswordHistory)
{ {
var page = new GeneratorHistoryPage(); var page = new GeneratorHistoryPage();
await Navigation.PushModalAsync(new NavigationPage(page)); await Navigation.PushModalAsync(new Xamarin.Forms.NavigationPage(page));
} }
} }
@@ -98,7 +105,7 @@ namespace Bit.App.Pages
private async void History_Clicked(object sender, EventArgs e) private async void History_Clicked(object sender, EventArgs e)
{ {
var page = new GeneratorHistoryPage(); var page = new GeneratorHistoryPage();
await Navigation.PushModalAsync(new NavigationPage(page)); await Navigation.PushModalAsync(new Xamarin.Forms.NavigationPage(page));
} }
private async void LengthSlider_DragCompleted(object sender, EventArgs e) private async void LengthSlider_DragCompleted(object sender, EventArgs e)

View File

@@ -2,6 +2,8 @@
using Bit.App.Resources; using Bit.App.Resources;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Xamarin.Forms; using Xamarin.Forms;
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
namespace Bit.App.Pages namespace Bit.App.Pages
{ {
@@ -27,6 +29,12 @@ namespace Bit.App.Pages
_themeDescriptionLabel.Text = string.Concat(_themeDescriptionLabel.Text, " ", _themeDescriptionLabel.Text = string.Concat(_themeDescriptionLabel.Text, " ",
AppResources.RestartIsRequired); AppResources.RestartIsRequired);
} }
else
{
_themePicker.On<iOS>().SetUpdateMode(UpdateMode.WhenFinished);
_uriMatchPicker.On<iOS>().SetUpdateMode(UpdateMode.WhenFinished);
_clearClipboardPicker.On<iOS>().SetUpdateMode(UpdateMode.WhenFinished);
}
} }
protected async override void OnAppearing() protected async override void OnAppearing()

View File

@@ -297,6 +297,11 @@ namespace Bit.App.Pages
await Task.Delay(1000); await Task.Delay(1000);
} }
_messagingService.Send("updatedTheme", theme); _messagingService.Send("updatedTheme", theme);
if(Device.RuntimePlatform == Device.iOS)
{
await Task.Delay(500);
await _platformUtilsService.ShowDialogAsync(AppResources.ThemeAppliedOnRestart);
}
} }
} }

View File

@@ -1,4 +1,6 @@
using Xamarin.Forms; using Xamarin.Forms;
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
namespace Bit.App.Pages namespace Bit.App.Pages
{ {
@@ -17,6 +19,10 @@ namespace Bit.App.Pages
{ {
ToolbarItems.RemoveAt(0); ToolbarItems.RemoveAt(0);
} }
else
{
_organizationPicker.On<iOS>().SetUpdateMode(UpdateMode.WhenFinished);
}
_organizationPicker.ItemDisplayBinding = new Binding("Key"); _organizationPicker.ItemDisplayBinding = new Binding("Key");
} }

View File

@@ -19,7 +19,7 @@ namespace Bit.App.Resources {
// class via a tool like ResGen or Visual Studio. // class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen // To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project. // with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class AppResources { public class AppResources {
@@ -3498,6 +3498,15 @@ namespace Bit.App.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Your theme changes will apply when the app is restarted..
/// </summary>
public static string ThemeAppliedOnRestart {
get {
return ResourceManager.GetString("ThemeAppliedOnRestart", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Change the application&apos;s color theme.. /// Looks up a localized string similar to Change the application&apos;s color theme..
/// </summary> /// </summary>

View File

@@ -1556,4 +1556,7 @@
<data name="AutofillServiceNotEnabled" xml:space="preserve"> <data name="AutofillServiceNotEnabled" xml:space="preserve">
<value>Auto-fill makes it easy to securely access your Bitwarden vault from other websites and apps. It looks like you have not enabled an auto-fill service for Bitwarden. Enable auto-fill for Bitwarden from the "Settings" screen.</value> <value>Auto-fill makes it easy to securely access your Bitwarden vault from other websites and apps. It looks like you have not enabled an auto-fill service for Bitwarden. Enable auto-fill for Bitwarden from the "Settings" screen.</value>
</data> </data>
<data name="ThemeAppliedOnRestart" xml:space="preserve">
<value>Your theme changes will apply when the app is restarted.</value>
</data>
</root> </root>