WIP: ios loggin
Some checks failed
Build Docker Images / test (push) Failing after 27s
Build Docker Images / build-and-push (push) Successful in 1m49s

This commit is contained in:
2025-11-23 15:17:54 +01:00
parent 951855074f
commit 8077826c46
7 changed files with 288 additions and 4 deletions

View File

@@ -5,6 +5,7 @@
@inject IConfiguration Configuration
@inject AuthService AuthService
@inject NavigationManager NavigationManager
@inject IGoogleAuthService? GoogleAuthService
<MudCard Class="login-card" Elevation="8">
<MudCardContent Class="pa-8 d-flex flex-column align-center">
@@ -50,7 +51,17 @@
if (firstRender)
{
_instance = this;
await InitializeGoogleSignIn();
// Only initialize JavaScript Google SDK if we're NOT using platform-specific auth (i.e., web)
if (GoogleAuthService == null)
{
await InitializeGoogleSignIn();
}
else
{
Console.WriteLine("📱 Using platform-specific Google auth service");
_isInitialized = true;
}
}
}
@@ -90,10 +101,33 @@
_errorMessage = string.Empty;
StateHasChanged();
await JS.InvokeVoidAsync("requestGoogleSignIn");
// Use platform-specific auth if available (mobile), otherwise use JavaScript (web)
if (GoogleAuthService != null)
{
Console.WriteLine("📱 Using mobile Google auth");
var success = await GoogleAuthService.SignInAsync();
if (success)
{
Console.WriteLine("✅ Mobile auth successful, navigating...");
NavigationManager.NavigateTo("/dashboard", replace: true);
}
else
{
_errorMessage = "Login failed. Please try again";
_isLoading = false;
StateHasChanged();
}
}
else
{
Console.WriteLine("🌐 Using web JavaScript Google auth");
await JS.InvokeVoidAsync("requestGoogleSignIn");
}
}
catch (Exception ex)
{
Console.Error.WriteLine($"❌ HandleGoogleSignIn error: {ex.Message}");
_errorMessage = "Login error. Please try again";
_isLoading = false;
StateHasChanged();