mirror of
https://github.com/bitwarden/android.git
synced 2024-12-18 23:31:52 +03:00
Redid a few thigns on extension page with messaging. Added reanable button. Updated refresh icon to orange
This commit is contained in:
parent
b1592bfd96
commit
84326811dd
6 changed files with 32 additions and 20 deletions
|
@ -58,8 +58,8 @@ namespace Bit.App.Pages
|
||||||
var notStartedButton = new Button
|
var notStartedButton = new Button
|
||||||
{
|
{
|
||||||
Text = "Enable App Extension",
|
Text = "Enable App Extension",
|
||||||
Command = new Command(() => ActivateExtension()),
|
Command = new Command(() => ShowExtension()),
|
||||||
VerticalOptions = LayoutOptions.End,
|
VerticalOptions = LayoutOptions.EndAndExpand,
|
||||||
HorizontalOptions = LayoutOptions.Fill,
|
HorizontalOptions = LayoutOptions.Fill,
|
||||||
Style = (Style)Application.Current.Resources["btn-primary"]
|
Style = (Style)Application.Current.Resources["btn-primary"]
|
||||||
};
|
};
|
||||||
|
@ -105,8 +105,8 @@ namespace Bit.App.Pages
|
||||||
var notActivatedButton = new Button
|
var notActivatedButton = new Button
|
||||||
{
|
{
|
||||||
Text = "Enable App Extension",
|
Text = "Enable App Extension",
|
||||||
Command = new Command(() => ActivateExtension()),
|
Command = new Command(() => ShowExtension()),
|
||||||
VerticalOptions = LayoutOptions.End,
|
VerticalOptions = LayoutOptions.EndAndExpand,
|
||||||
HorizontalOptions = LayoutOptions.Fill,
|
HorizontalOptions = LayoutOptions.Fill,
|
||||||
Style = (Style)Application.Current.Resources["btn-primary"]
|
Style = (Style)Application.Current.Resources["btn-primary"]
|
||||||
};
|
};
|
||||||
|
@ -139,7 +139,8 @@ namespace Bit.App.Pages
|
||||||
VerticalOptions = LayoutOptions.Start,
|
VerticalOptions = LayoutOptions.Start,
|
||||||
HorizontalOptions = LayoutOptions.Center,
|
HorizontalOptions = LayoutOptions.Center,
|
||||||
HorizontalTextAlignment = TextAlignment.Center,
|
HorizontalTextAlignment = TextAlignment.Center,
|
||||||
LineBreakMode = LineBreakMode.WordWrap
|
LineBreakMode = LineBreakMode.WordWrap,
|
||||||
|
Margin = new Thickness(0, 10, 0, 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
var activatedImage = new Image
|
var activatedImage = new Image
|
||||||
|
@ -153,17 +154,26 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
Text = "See Supported Apps",
|
Text = "See Supported Apps",
|
||||||
Command = new Command(() => Device.OpenUri(new Uri("https://bitwarden.com"))),
|
Command = new Command(() => Device.OpenUri(new Uri("https://bitwarden.com"))),
|
||||||
VerticalOptions = LayoutOptions.End,
|
VerticalOptions = LayoutOptions.EndAndExpand,
|
||||||
HorizontalOptions = LayoutOptions.Fill,
|
HorizontalOptions = LayoutOptions.Fill,
|
||||||
Style = (Style)Application.Current.Resources["btn-primary"]
|
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
|
var activatedStackLayout = new StackLayout
|
||||||
{
|
{
|
||||||
Orientation = StackOrientation.Vertical,
|
Orientation = StackOrientation.Vertical,
|
||||||
Spacing = 20,
|
Spacing = 10,
|
||||||
Padding = new Thickness(30, 40),
|
Padding = new Thickness(30, 40),
|
||||||
Children = { activatedLabel, activatedSublabel, activatedImage, activatedButton }
|
Children = { activatedLabel, activatedSublabel, activatedImage, activatedButton, activatedButtonReenable }
|
||||||
};
|
};
|
||||||
|
|
||||||
activatedStackLayout.SetBinding<AppExtensionPageModel>(IsVisibleProperty, m => m.StartedAndActivated);
|
activatedStackLayout.SetBinding<AppExtensionPageModel>(IsVisibleProperty, m => m.StartedAndActivated);
|
||||||
|
@ -181,17 +191,20 @@ namespace Bit.App.Pages
|
||||||
Title = "App Extension";
|
Title = "App Extension";
|
||||||
Content = stackLayout;
|
Content = stackLayout;
|
||||||
BindingContext = Model;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,6 @@ namespace Bit.App.Pages
|
||||||
EnableScrolling = false,
|
EnableScrolling = false,
|
||||||
Intent = TableIntent.Settings,
|
Intent = TableIntent.Settings,
|
||||||
HasUnevenRows = true,
|
HasUnevenRows = true,
|
||||||
NoFooter = true,
|
|
||||||
Root = new TableRoot
|
Root = new TableRoot
|
||||||
{
|
{
|
||||||
new TableSection
|
new TableSection
|
||||||
|
|
|
@ -23,6 +23,7 @@ using Bit.iOS.Core.Services;
|
||||||
using PushNotification.Plugin;
|
using PushNotification.Plugin;
|
||||||
using Plugin.DeviceInfo;
|
using Plugin.DeviceInfo;
|
||||||
using Plugin.Connectivity.Abstractions;
|
using Plugin.Connectivity.Abstractions;
|
||||||
|
using Bit.App.Pages;
|
||||||
|
|
||||||
namespace Bit.iOS
|
namespace Bit.iOS
|
||||||
{
|
{
|
||||||
|
@ -52,7 +53,7 @@ namespace Bit.iOS
|
||||||
UINavigationBar.Appearance.ShadowImage = new UIImage();
|
UINavigationBar.Appearance.ShadowImage = new UIImage();
|
||||||
UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
|
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 itemProvider = new NSItemProvider(new NSDictionary(), "com.8bit.bitwarden.extension-setup");
|
||||||
var extensionItem = new NSExtensionItem();
|
var extensionItem = new NSExtensionItem();
|
||||||
|
@ -60,8 +61,7 @@ namespace Bit.iOS
|
||||||
var activityViewController = new UIActivityViewController(new NSExtensionItem[] { extensionItem }, null);
|
var activityViewController = new UIActivityViewController(new NSExtensionItem[] { extensionItem }, null);
|
||||||
activityViewController.CompletionHandler = (activityType, completed) =>
|
activityViewController.CompletionHandler = (activityType, completed) =>
|
||||||
{
|
{
|
||||||
MessagingCenter.Send(Xamarin.Forms.Application.Current, "EnabledAppExtension",
|
page.EnabledExtension(completed && activityType == "com.8bit.bitwarden.find-login-action-extension");
|
||||||
completed && activityType == "com.8bit.bitwarden.find-login-action-extension");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
UIApplication.SharedApplication.KeyWindow.RootViewController.ModalViewController
|
UIApplication.SharedApplication.KeyWindow.RootViewController.ModalViewController
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1,017 B After Width: | Height: | Size: 1,017 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 |
Loading…
Reference in a new issue