diff --git a/backend/FwLite/FwLiteDesktop/FwLiteDesktopKernel.cs b/backend/FwLite/FwLiteDesktop/FwLiteDesktopKernel.cs index 280209106..447df394a 100644 --- a/backend/FwLite/FwLiteDesktop/FwLiteDesktopKernel.cs +++ b/backend/FwLite/FwLiteDesktop/FwLiteDesktopKernel.cs @@ -45,6 +45,11 @@ public static void AddFwLiteDesktopServices(this IServiceCollection services, #if ANDROID services.Configure(config => config.ParentActivityOrWindow = Platform.CurrentActivity); #endif + services.Configure(config => config.AfterLoginWebView = () => + { + var window = Application.Current?.Windows.FirstOrDefault(); + if (window is not null) Application.Current?.ActivateWindow(window); + }); var defaultDataPath = IsPortableApp ? Directory.GetCurrentDirectory() : FileSystem.AppDataDirectory; var baseDataPath = Path.GetFullPath(configuration.GetSection("FwLiteDesktop").GetValue("BaseDataDir") ?? diff --git a/backend/FwLite/FwLiteShared/Auth/AuthConfig.cs b/backend/FwLite/FwLiteShared/Auth/AuthConfig.cs index 2c20387b1..39f76c687 100644 --- a/backend/FwLite/FwLiteShared/Auth/AuthConfig.cs +++ b/backend/FwLite/FwLiteShared/Auth/AuthConfig.cs @@ -14,6 +14,7 @@ public class AuthConfig public bool SystemWebViewLogin { get; set; } = false; public object? ParentActivityOrWindow { get; set; } public LexboxServer DefaultServer => LexboxServers.First(); + public Action? AfterLoginWebView { get; set; } public LexboxServer GetServerByAuthority(string authority) { diff --git a/backend/FwLite/FwLiteShared/Auth/AuthService.cs b/backend/FwLite/FwLiteShared/Auth/AuthService.cs index 4cc5a5767..c30469cbd 100644 --- a/backend/FwLite/FwLiteShared/Auth/AuthService.cs +++ b/backend/FwLite/FwLiteShared/Auth/AuthService.cs @@ -25,6 +25,7 @@ public async Task SignInWebView(LexboxServer server) { var result = await clientFactory.GetClient(server).SignIn(string.Empty);//does nothing here if (!result.HandledBySystemWebView) throw new InvalidOperationException("Sign in not handled by system web view"); + options.Value.AfterLoginWebView?.Invoke(); } public async Task SignInWebApp(LexboxServer server, string returnUrl)