-
Notifications
You must be signed in to change notification settings - Fork 771
refactor: auth module with loading animation #2957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
1 change: 1 addition & 0 deletions
1
core/ui/src/commonMain/composeResources/files/loading_animation.json
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
64 changes: 64 additions & 0 deletions
64
core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/ScreenUiState.kt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| /* | ||
| * Copyright 2025 Mifos Initiative | ||
| * | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
| * | ||
| * See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md | ||
| */ | ||
| package org.mifos.mobile.core.ui.utils | ||
|
|
||
| import org.jetbrains.compose.resources.StringResource | ||
|
|
||
| /** | ||
| * A sealed interface representing the different types of full-screen UI states | ||
| * that can be used across various screens in an application. | ||
| * | ||
| * This generic state model provides a consistent way to handle common UI states | ||
| * such as loading, errors, and success, which helps to standardize UI logic | ||
| * and reduce boilerplate in ViewModels and UI layers. | ||
| */ | ||
| sealed interface ScreenUiState { | ||
| /** * Represents a full-screen loading state. | ||
| * * Use this state when the entire screen is busy fetching initial data, | ||
| * and a loading indicator (e.g., a progress bar) should be displayed | ||
| * over the whole screen. | ||
| */ | ||
| data object Loading : ScreenUiState | ||
|
|
||
| /** * Represents an empty state where no data is available to display. | ||
| * * This state is typically used when a data fetch operation is successful | ||
| * but returns an empty list or collection. The UI should show a message | ||
| * or a graphic indicating that there is no content. | ||
| */ | ||
| data object Empty : ScreenUiState | ||
|
|
||
| /** | ||
| * Represents a full-screen error state with a user-facing message. | ||
| * * This state should be used when an unrecoverable error occurs, and the | ||
| * entire screen needs to show an error message. | ||
| * | ||
| * @property message The [StringResource] for the error message to be displayed. | ||
| */ | ||
| data class Error(val message: StringResource) : ScreenUiState | ||
|
|
||
| /** * Represents a successful state where content can be displayed. | ||
| * * This is the final state after a successful data fetch or operation. | ||
| * The UI can now display the main content of the screen. | ||
| */ | ||
| data object Success : ScreenUiState | ||
|
|
||
| /** * Represents a state where there is a network connectivity issue. | ||
| * * This state is useful for displaying a dedicated UI screen or a message | ||
| * indicating that the device is offline or has lost its connection. | ||
| */ | ||
| data object Network : ScreenUiState | ||
|
|
||
| /** * Represents a state where an overlay loading spinner should be shown. | ||
| * * Use this state when a background operation is in progress (e.g., a form | ||
| * submission or a data refresh), but the existing content of the screen | ||
| * should remain visible underneath a loading indicator. | ||
| */ | ||
| // data object OverlayLoading : ScreenUiState | ||
| } |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.