mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 09:58:27 +03:00
extension alert error when not logged in
This commit is contained in:
parent
580be02e2d
commit
ac0a4c3756
1 changed files with 22 additions and 1 deletions
|
@ -17,6 +17,8 @@ using MobileCoreServices;
|
||||||
using Plugin.Settings.Abstractions;
|
using Plugin.Settings.Abstractions;
|
||||||
using Plugin.Connectivity;
|
using Plugin.Connectivity;
|
||||||
using Plugin.Fingerprint;
|
using Plugin.Fingerprint;
|
||||||
|
using Bit.iOS.Core.Utilities;
|
||||||
|
using Bit.App.Resources;
|
||||||
|
|
||||||
namespace Bit.iOS.Extension
|
namespace Bit.iOS.Extension
|
||||||
{
|
{
|
||||||
|
@ -67,6 +69,17 @@ namespace Bit.iOS.Extension
|
||||||
{
|
{
|
||||||
base.ViewDidAppear(animated);
|
base.ViewDidAppear(animated);
|
||||||
|
|
||||||
|
var authService = Resolver.Resolve<IAuthService>();
|
||||||
|
if(!authService.IsAuthenticated)
|
||||||
|
{
|
||||||
|
var alert = Dialogs.CreateAlert(null, "You must log into the main bitwarden app before you can use the extension.", AppResources.Ok, (a) =>
|
||||||
|
{
|
||||||
|
CompleteRequest();
|
||||||
|
});
|
||||||
|
PresentViewController(alert, true, null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var lockService = Resolver.Resolve<ILockService>();
|
var lockService = Resolver.Resolve<ILockService>();
|
||||||
var lockType = lockService.GetLockType(false);
|
var lockType = lockService.GetLockType(false);
|
||||||
switch(lockType)
|
switch(lockType)
|
||||||
|
@ -86,6 +99,15 @@ namespace Bit.iOS.Extension
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CompleteRequest()
|
||||||
|
{
|
||||||
|
var resultsProvider = new NSItemProvider(null, UTType.PropertyList);
|
||||||
|
var resultsItem = new NSExtensionItem { Attachments = new NSItemProvider[] { resultsProvider } };
|
||||||
|
var returningItems = new NSExtensionItem[] { resultsItem };
|
||||||
|
|
||||||
|
ExtensionContext.CompleteRequest(returningItems, null);
|
||||||
|
}
|
||||||
|
|
||||||
public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender)
|
public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender)
|
||||||
{
|
{
|
||||||
var navController = segue.DestinationViewController as UINavigationController;
|
var navController = segue.DestinationViewController as UINavigationController;
|
||||||
|
@ -332,6 +354,5 @@ namespace Bit.iOS.Extension
|
||||||
|
|
||||||
return default(T);
|
return default(T);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue