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

reset service container from extensions

This commit is contained in:
Kyle Spearrin 2019-07-02 20:45:54 -04:00
parent 43e15bf911
commit abb39df547
2 changed files with 9 additions and 9 deletions

View File

@ -99,6 +99,8 @@ namespace Bit.iOS.Autofill
public void CompleteRequest(string username = null, string password = null, string totp = null)
{
ServiceContainer.Reset();
if((_context?.Configuring ?? true) && string.IsNullOrWhiteSpace(password))
{
ExtensionContext?.CompleteExtensionConfigurationRequest();
@ -243,15 +245,15 @@ namespace Bit.iOS.Autofill
private void InitApp()
{
iOSCoreHelpers.AppearanceAdjustments();
if(ServiceContainer.RegisteredServices.Count > 0)
{
return;
ServiceContainer.Reset();
}
iOSCoreHelpers.RegisterLocalServices();
ServiceContainer.Init();
iOSCoreHelpers.RegisterHockeyApp();
iOSCoreHelpers.Bootstrap();
iOSCoreHelpers.AppearanceAdjustments();
}
}
}

View File

@ -176,15 +176,13 @@ namespace Bit.iOS.Extension
public void CompleteRequest(NSDictionary itemData)
{
ServiceContainer.Reset();
Debug.WriteLine("BW LOG, itemData: " + itemData);
var resultsProvider = new NSItemProvider(itemData, UTType.PropertyList);
var resultsItem = new NSExtensionItem { Attachments = new NSItemProvider[] { resultsProvider } };
var returningItems = new NSExtensionItem[] { resultsItem };
NSRunLoop.Main.BeginInvokeOnMainThread(() =>
{
ServiceContainer.Reset();
ExtensionContext?.CompleteRequest(returningItems, null);
});
NSRunLoop.Main.BeginInvokeOnMainThread(() => ExtensionContext?.CompleteRequest(returningItems, null));
}
private bool ProcessItemProvider(NSItemProvider itemProvider, string type, Action<NSDictionary> dictAction,
@ -375,15 +373,15 @@ namespace Bit.iOS.Extension
private void InitApp()
{
iOSCoreHelpers.AppearanceAdjustments();
if(ServiceContainer.RegisteredServices.Count > 0)
{
return;
ServiceContainer.Reset();
}
iOSCoreHelpers.RegisterLocalServices();
ServiceContainer.Init();
iOSCoreHelpers.RegisterHockeyApp();
iOSCoreHelpers.Bootstrap();
iOSCoreHelpers.AppearanceAdjustments();
}
private bool IsLocked()