minor improvemments on autofill-redirect

This commit is contained in:
Dinis Vieira 2023-12-15 13:48:34 +00:00
parent 8b3c6ab35f
commit 3c87d4db1c
No known key found for this signature in database
GPG key ID: 9389160FF6C295F3
2 changed files with 10 additions and 10 deletions

View file

@ -81,7 +81,7 @@ namespace Bit.App
public void SetOptions(AppOptions appOptions)
{
Options = appOptions;
Options = appOptions ?? new AppOptions();
}
protected override Window CreateWindow(IActivationState activationState)
@ -93,25 +93,25 @@ namespace Bit.App
{
return new Window(new NavigationPage()); //No actual page needed. Only used for auto-filling the fields directly (externally)
}
else if (Options.FromAutofillFramework || Options.Uri != null || Options.OtpData != null || Options.CreateSend != null) //"Internal" Autofill and Uri/Otp/CreateSend
if (Options != null && (Options.FromAutofillFramework || Options.Uri != null || Options.OtpData != null || Options.CreateSend != null)) //"Internal" Autofill and Uri/Otp/CreateSend
{
_autofillWindow = new Window(new NavigationPage(new AndroidExtSplashPage(Options)));
CurrentWindow = _autofillWindow;
return CurrentWindow;
}
else if(CurrentWindow != null)
if(CurrentWindow != null)
{
//TODO: This likely crashes if we try to have two apps side-by-side on Android
//TODO: Question: In these scenarios should a new Window be created or can the same one be reused?
CurrentWindow = _mainWindow;
return CurrentWindow;
}
else
{
_mainWindow = new Window(new NavigationPage(new HomePage(Options)));
CurrentWindow = _mainWindow;
return CurrentWindow;
}
_mainWindow = new Window(new NavigationPage(new HomePage(Options)));
CurrentWindow = _mainWindow;
return CurrentWindow;
}
#elif IOS
public new static Page MainPage

View file

@ -16,7 +16,7 @@ public partial class AndroidExtSplashPage : ContentPage
public AndroidExtSplashPage(AppOptions appOptions)
{
InitializeComponent();
_appOptions = appOptions;
_appOptions = appOptions ?? new AppOptions();
_conditionedAwaiterManager = ServiceContainer.Resolve<IConditionedAwaiterManager>();
_vaultTimeoutService = ServiceContainer.Resolve<IVaultTimeoutService>("vaultTimeoutService");
_stateService = ServiceContainer.Resolve<IStateService>();