Skip to content

Refactor: Centralize Google Sign-In config and improve social login UX#8

Open
rndevelo wants to merge 3 commits intodevelopfrom
rndev/Centralize-Google-Sign-In-config
Open

Refactor: Centralize Google Sign-In config and improve social login UX#8
rndevelo wants to merge 3 commits intodevelopfrom
rndev/Centralize-Google-Sign-In-config

Conversation

@rndevelo
Copy link
Copy Markdown
Collaborator

This commit refactors how Google Sign-In is configured by centralizing it within the Koin dependency graph, and improves the user experience for social logins by adding distinct loading states for each provider.

Core Architecture & Configuration:

  • Centralized GoogleSignInConfig: The GoogleSignInConfig is no longer passed via a LoginLibraryConfig wrapper. Instead, it's provided directly to initLoginKoin and injected into the Koin dependency graph, making it available throughout the library.
  • Simplified Koin Initialization: The initLoginKoin function is simplified to accept googleSignInConfig directly, streamlining the library's setup in both Android and iOS app modules.
  • Domain Model Relocation: The GoogleSignInConfig class has been moved from the config package to domain/model to better align with the project's architecture.

UI/UX Improvements:

  • Provider-Specific Loading States:
    • The LoginUiState now uses a loadingProvider: String? property instead of a generic isLoading: Boolean. This allows the UI to show a loading indicator on the specific social login button that was clicked (e.g., "google", "phone") or on the email sign-in button ("email").
    • The DefaultSocialButton and its implementations (GoogleSocialButton, PhoneSocialButton) have been updated to accept an isLoading state, displaying a CircularProgressIndicator when active.
    • Other buttons on the screen are disabled when any login process is active, preventing concurrent actions.
  • Refactored Social Login Section:
    • The SocialLoginButtonsSection now receives the loadingProvider state to correctly render the loading status for each button.
    • The old, more complex SocialLoginButtons.kt file has been removed in favor of a cleaner implementation in DefaultSocialButton.kt.

Other Changes:

  • Session Refresh: The ProfileViewModel now calls authRepository.refreshSession() instead of the removed getCurrentSession() to fetch user data, ensuring the session is up-to-date.
  • Code Cleanup: Removed the now-redundant getCurrentSession() method from AuthRepository and its implementation.
  • Android Manifest: Added the INTERNET permission to the composeApp manifest, which was missing.

This commit refactors how Google Sign-In is configured by centralizing it within the Koin dependency graph, and improves the user experience for social logins by adding distinct loading states for each provider.

### Core Architecture & Configuration:
- **Centralized `GoogleSignInConfig`**: The `GoogleSignInConfig` is no longer passed via a `LoginLibraryConfig` wrapper. Instead, it's provided directly to `initLoginKoin` and injected into the Koin dependency graph, making it available throughout the library.
- **Simplified Koin Initialization**: The `initLoginKoin` function is simplified to accept `googleSignInConfig` directly, streamlining the library's setup in both Android and iOS app modules.
- **Domain Model Relocation**: The `GoogleSignInConfig` class has been moved from the `config` package to `domain/model` to better align with the project's architecture.

### UI/UX Improvements:
- **Provider-Specific Loading States**:
    - The `LoginUiState` now uses a `loadingProvider: String?` property instead of a generic `isLoading: Boolean`. This allows the UI to show a loading indicator on the specific social login button that was clicked (e.g., "google", "phone") or on the email sign-in button ("email").
    - The `DefaultSocialButton` and its implementations (`GoogleSocialButton`, `PhoneSocialButton`) have been updated to accept an `isLoading` state, displaying a `CircularProgressIndicator` when active.
    - Other buttons on the screen are disabled when any login process is active, preventing concurrent actions.
- **Refactored Social Login Section**:
    - The `SocialLoginButtonsSection` now receives the `loadingProvider` state to correctly render the loading status for each button.
    - The old, more complex `SocialLoginButtons.kt` file has been removed in favor of a cleaner implementation in `DefaultSocialButton.kt`.

### Other Changes:
- **Session Refresh**: The `ProfileViewModel` now calls `authRepository.refreshSession()` instead of the removed `getCurrentSession()` to fetch user data, ensuring the session is up-to-date.
- **Code Cleanup**: Removed the now-redundant `getCurrentSession()` method from `AuthRepository` and its implementation.
- **Android Manifest**: Added the `INTERNET` permission to the `composeApp` manifest, which was missing.
@rndevelo rndevelo self-assigned this Jan 25, 2026
@rndevelo rndevelo added the enhancement New feature or request label Jan 25, 2026
This commit introduces the `actual` implementation of `GoogleAuthProvider` for the iOS source set. While the full integration with the Google Sign-In SDK for iOS is pending, this provides the necessary class structure to satisfy multiplatform requirements.

- **iOS Implementation**: Added `GoogleAuthProvider` in `iosMain`, implementing the `AuthProvider` interface for the `IdentityProvider.Google` type.
- **Placeholder Logic**: The `signIn` method currently returns an `AuthError.OperationNotAllowed` failure, and `signOut` returns `AuthResult.SignOutSuccess` as placeholders for the native SDK integration.
This commit removes the `GoogleSignInConfig` data class from the `domain/model` package. This configuration object, which previously held `webClientId` and `iosClientId` for Google Sign-In, is no longer required in this location.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant