PM-6552 Fix for App only showing Home (Login) Page after closed after opening Accessibility Settings (#3047)

This commit is contained in:
Dinis Vieira 2024-03-01 19:17:45 +00:00 committed by GitHub
parent 6f32afb919
commit 602627b5fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 0 deletions

View File

@ -108,6 +108,8 @@ namespace Bit.App
}
}
public bool HasNavigatedToAccessibilitySettings { get; set; }
protected override Window CreateWindow(IActivationState activationState)
{
//When executing from AutofillExternalActivity we don't have "Options" so we need to filter "manually"
@ -146,6 +148,18 @@ namespace Bit.App
_hasNavigatedToAutofillWindow = false;
}
// WORKAROUND: This workaround is similar to the one above (_hasNavigatedToAutofillWindow) related with Accessibility Services but this one specifically
// is due to trying to open the Accessibility Settings Page for enabled/disabling
if(HasNavigatedToAccessibilitySettings)
{
homePage.PerformNavigationOnAccountChangedOnLoad = true;
// this is needed because when coming back from AutofillWindow OnResume won't be called and we need this flag
// so that void Navigate(NavigationTarget navTarget, INavigationParams navParams) doesn't enqueue the navigation
// and it performs it directly.
_isResumed = true;
HasNavigatedToAccessibilitySettings = false;
}
//If we have an existing MainAppWindow we can use that one
var mainAppWindow = Windows.OfType<MainAppWindow>().FirstOrDefault();
if (mainAppWindow != null)

View File

@ -158,6 +158,11 @@ namespace Bit.App.Pages
await MainThread.InvokeOnMainThreadAsync(() => TriggerPropertyChanged(nameof(UseAccessibility)));
return;
}
#if ANDROID
// WORKAROUND: Set workaround property to avoid an issue when launching the app after being in Accessibility Settings. More Info on App.xaml.cs
((App)Application.Current).HasNavigatedToAccessibilitySettings = true;
#endif
_deviceActionService.OpenAccessibilitySettings();
}