Skip to content

Commit

Permalink
Added currency state UI
Browse files Browse the repository at this point in the history
  • Loading branch information
myofficework000 committed Mar 23, 2024
1 parent 363804b commit 7ab0281
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
package com.example.jetpack_compose_all_in_one.demos.currency_converter.presentation.intent

/**
* Sealed class representing intents related to currency operations.
*/
sealed class CurrencyIntent {

/**
* Intent representing a change in the input currency value.
*
* @property input The new input currency value.
*/
data class CurrencyInputChanged(val input: String): CurrencyIntent()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,32 @@ package com.example.jetpack_compose_all_in_one.demos.currency_converter.presenta

import com.example.jetpack_compose_all_in_one.demos.currency_converter.data.dto.CurrencyResponse

/**
* Sealed class representing various states related to currency operations.
*/
sealed class CurrencyState {

/**
* Represents the idle state, indicating no ongoing currency operation.
*/
object Idle: CurrencyState()

/**
* Represents the loading state, indicating an ongoing currency data retrieval operation.
*/
object Loading: CurrencyState()

/**
* Represents the success state, indicating successful retrieval of currency data.
*
* @property data The currency data retrieved successfully.
*/
data class Success(val data: CurrencyResponse) : CurrencyState()

/**
* Represents the error state, indicating a failure in currency data retrieval.
*
* @property error A string describing the error that occurred.
*/
data class Error(val error: String) : CurrencyState()
}
}

0 comments on commit 7ab0281

Please sign in to comment.