1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-12-26 16:57:59 +01:00

Redid a few thigns on extension page with messaging. Added reanable button. Updated refresh icon to orange

This commit is contained in:
Kyle Spearrin 2016-07-04 23:11:44 -04:00
parent b1592bfd96
commit 84326811dd
6 changed files with 32 additions and 20 deletions

View File

@ -58,8 +58,8 @@ namespace Bit.App.Pages
var notStartedButton = new Button
{
Text = "Enable App Extension",
Command = new Command(() => ActivateExtension()),
VerticalOptions = LayoutOptions.End,
Command = new Command(() => ShowExtension()),
VerticalOptions = LayoutOptions.EndAndExpand,
HorizontalOptions = LayoutOptions.Fill,
Style = (Style)Application.Current.Resources["btn-primary"]
};
@ -105,8 +105,8 @@ namespace Bit.App.Pages
var notActivatedButton = new Button
{
Text = "Enable App Extension",
Command = new Command(() => ActivateExtension()),
VerticalOptions = LayoutOptions.End,
Command = new Command(() => ShowExtension()),
VerticalOptions = LayoutOptions.EndAndExpand,
HorizontalOptions = LayoutOptions.Fill,
Style = (Style)Application.Current.Resources["btn-primary"]
};
@ -139,7 +139,8 @@ namespace Bit.App.Pages
VerticalOptions = LayoutOptions.Start,
HorizontalOptions = LayoutOptions.Center,
HorizontalTextAlignment = TextAlignment.Center,
LineBreakMode = LineBreakMode.WordWrap
LineBreakMode = LineBreakMode.WordWrap,
Margin = new Thickness(0, 10, 0, 0)
};
var activatedImage = new Image
@ -153,17 +154,26 @@ namespace Bit.App.Pages
{
Text = "See Supported Apps",
Command = new Command(() => Device.OpenUri(new Uri("https://bitwarden.com"))),
VerticalOptions = LayoutOptions.End,
VerticalOptions = LayoutOptions.EndAndExpand,
HorizontalOptions = LayoutOptions.Fill,
Style = (Style)Application.Current.Resources["btn-primary"]
};
var activatedButtonReenable = new Button
{
Text = "Re-enable App Extension",
Command = new Command(() => ShowExtension()),
VerticalOptions = LayoutOptions.End,
HorizontalOptions = LayoutOptions.Fill,
Style = (Style)Application.Current.Resources["btn-primaryAccent"]
};
var activatedStackLayout = new StackLayout
{
Orientation = StackOrientation.Vertical,
Spacing = 20,
Spacing = 10,
Padding = new Thickness(30, 40),
Children = { activatedLabel, activatedSublabel, activatedImage, activatedButton }
Children = { activatedLabel, activatedSublabel, activatedImage, activatedButton, activatedButtonReenable }
};
activatedStackLayout.SetBinding<AppExtensionPageModel>(IsVisibleProperty, m => m.StartedAndActivated);
@ -181,17 +191,20 @@ namespace Bit.App.Pages
Title = "App Extension";
Content = stackLayout;
BindingContext = Model;
MessagingCenter.Subscribe<Application, bool>(Application.Current, "EnabledAppExtension", (sender, enabled) =>
{
Model.Started = true;
Model.Activated = enabled;
});
}
private void ActivateExtension()
private void ShowExtension()
{
MessagingCenter.Send(Application.Current, "ShowAppExtension");
MessagingCenter.Send(Application.Current, "ShowAppExtension", this);
}
public void EnabledExtension(bool enabled)
{
Model.Started = true;
if(!Model.Activated && enabled)
{
Model.Activated = enabled;
}
}
}
}

View File

@ -65,7 +65,6 @@ namespace Bit.App.Pages
EnableScrolling = false,
Intent = TableIntent.Settings,
HasUnevenRows = true,
NoFooter = true,
Root = new TableRoot
{
new TableSection

View File

@ -23,6 +23,7 @@ using Bit.iOS.Core.Services;
using PushNotification.Plugin;
using Plugin.DeviceInfo;
using Plugin.Connectivity.Abstractions;
using Bit.App.Pages;
namespace Bit.iOS
{
@ -52,7 +53,7 @@ namespace Bit.iOS
UINavigationBar.Appearance.ShadowImage = new UIImage();
UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
MessagingCenter.Subscribe<Xamarin.Forms.Application>(Xamarin.Forms.Application.Current, "ShowAppExtension", (sender) =>
MessagingCenter.Subscribe<Xamarin.Forms.Application, ToolsExtensionPage>(Xamarin.Forms.Application.Current, "ShowAppExtension", (sender, page) =>
{
var itemProvider = new NSItemProvider(new NSDictionary(), "com.8bit.bitwarden.extension-setup");
var extensionItem = new NSExtensionItem();
@ -60,8 +61,7 @@ namespace Bit.iOS
var activityViewController = new UIActivityViewController(new NSExtensionItem[] { extensionItem }, null);
activityViewController.CompletionHandler = (activityType, completed) =>
{
MessagingCenter.Send(Xamarin.Forms.Application.Current, "EnabledAppExtension",
completed && activityType == "com.8bit.bitwarden.find-login-action-extension");
page.EnabledExtension(completed && activityType == "com.8bit.bitwarden.find-login-action-extension");
};
UIApplication.SharedApplication.KeyWindow.RootViewController.ModalViewController

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1017 B

After

Width:  |  Height:  |  Size: 1017 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB