Feat/102 implement authentication and onboarding logic#103
Merged
MarcelMilka merged 11 commits intoApr 4, 2026
Conversation
- Create a new Android library module `auth` with namespace `eu.project.auth`. - Configure `build.gradle.kts` with `compileSdk` 36, `minSdk` 26, and Java 11 compatibility. - Add dependencies for Hilt (using KSP), AppCompat, Material, and the internal `:common` module. - Register the `:auth` module in `settings.gradle.kts`. - Add standard ProGuard and gitignore configurations for the new module.
- Add `AuthnManager` and `AuthnManagerImpl` to handle Google authentication and session management via Supabase. - Implement `GoogleCredentialManager` using Android's `CredentialManager` to retrieve Google ID tokens. - Add `NonceGenerator` to create raw and SHA-256 hashed nonces for secure authentication. - Configure `SupabaseClient` with authentication support using GoTrue/Auth. - Add required dependencies for Ktor, Supabase BOM, AndroidX Credentials, and Google ID to `libs.versions.toml` and `auth/build.gradle.kts`. - Enable `buildConfig` and define `GOOGLE_WEB_CLIENT_ID`, `SUPABASE_DATABASE_URL`, and `SUPABASE_PUBLISHABLE_KEY` fields in the `auth` module. - Define data classes for `RawNonce`, `HashedNonce`, `NonceSet`, `GoogleIdToken`, and `AccessToken`.
- Create `User` data class with `id` (UUID) and `email` fields. - Add `getUser()` method to the `AuthnManager` interface to retrieve the current session user. - Implement `getUser()` in `AuthnManagerImpl` by mapping Supabase current user data to the `User` model. - Add UUID parsing and validation logic when retrieving the user ID from the authentication client.
- Create `ApplicationViewModel` to handle session restoration and determine the initial navigation route using `AuthnManager`. - Introduce `ApplicationStartupState` sealed class to represent `Pending` and `Ready` states. - Update `MainActivity` to keep the splash screen visible until the startup state is `Ready`. - Modify `ApplicationScaffold` to accept a `startRoute` and configure navigation graphs for `Authenticated`, `Unauthenticated`, and `InitializationError` destinations. - Expand `Navigation` sealed class with nested `Authenticated` and `Unauthenticated` route structures. - Add unit tests for `ApplicationViewModel` covering signed-in, signed-out, and initialization error scenarios.
- Create a new Android library module `feature:authenticate` with namespace `eu.project.authenticate`. - Configure `build.gradle.kts` with `compileSdk` 36, `minSdk` 26, Java 11 compatibility, and Compose support. - Add dependencies for Hilt (via KSP), Jetpack Compose, Navigation, and Kotlin Serialization. - Include internal project dependencies for `:ui`, `:common`, and `:auth`. - Register the `:feature:authenticate` module in `settings.gradle.kts`. - Add standard ProGuard and gitignore configurations for the new module.
- Create `SignInWithGoogleResult` sealed interface to represent Success, Canceled, and Unknown failure states. - Update `AuthnManager` interface and `AuthnManagerImpl` to handle the Google Sign-In flow internally using `GoogleCredentialManager` and `NonceGenerator`. - Refactor `signInWithGoogle` to no longer require external parameters, returning a `SignInWithGoogleResult` instead. - Update `AuthModule` to inject `GoogleCredentialManager` into `AuthnManagerImpl`.
- Add `ContentHolder` component to provide a consistent background and fullscreen container for screen content. - Add `SplitContent` component to divide the screen into two equal vertically weighted sections with customizable arrangements. - Add `LoadingContent` component utilizing `SplitContent` to display a loading indicator and supporting text. - Integrate testing tags and theme styling across all new components.
- Implement `WelcomeScreenViewModel` using Hilt, managing state via `MutableStateFlow` and handling the `ClickContinueWithGoogle` intent. - Integrate `AuthnManager` for Google Sign-In and `CrashlyticsManager` for error reporting within the ViewModel. - Add comprehensive unit tests for `WelcomeScreenViewModel` using MockK, Turbine, and `kotlinx-coroutines-test`. - Update `feature/authenticate/build.gradle.kts` with testing dependencies for MockK, Turbine, and Coroutines.
- Implement `WelcomeScreenViewModel` using Hilt, managing state via `MutableStateFlow` and handling the `ClickContinueWithGoogle` intent. - Integrate `AuthnManager` for Google Sign-In and `CrashlyticsManager` for error reporting within the ViewModel. - Add comprehensive unit tests for `WelcomeScreenViewModel` using MockK, Turbine, and `kotlinx-coroutines-test`. - Update `feature/authenticate/build.gradle.kts` with testing dependencies for MockK, Turbine, and Coroutines.
- Move `HomeScreen` from the root `Navigation` object to `Navigation.Authenticated`. - Update the `scaffold` module to include the `:feature:authenticate` dependency. - Replace placeholder navigation blocks in `ApplicationScaffold.kt` with `welcomeImpl` and `homeImpl` extensions. - Rename `welcomeScreenImpl` to `welcomeImpl` and update its corresponding file name. - Update `popUpTo` references in `SavedWordsImpl.kt` and `ExportWordsImpl.kt` to point to the new `Navigation.Authenticated.HomeScreen` route. - Remove unused imports and redundant composable declarations in `ApplicationScaffold.kt`.
- Replace `UnconfinedTestDispatcher` with `StandardTestDispatcher` as the default dispatcher in `MainDispatcherRule`. - Update imports in `WelcomeScreenViewModelTest.kt` to reflect the change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.