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

View File

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