-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from psuzn/multi-currency
multi currency support
- Loading branch information
Showing
29 changed files
with
1,535 additions
and
118 deletions.
There are no files selected for viewing
This file contains 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 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 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
5 changes: 5 additions & 0 deletions
5
shared/src/commonMain/kotlin/me/sujanpoudel/playdeals/common/Constants.kt
This file contains 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 |
---|---|---|
@@ -1,7 +1,12 @@ | ||
package me.sujanpoudel.playdeals.common | ||
|
||
import kotlin.time.Duration.Companion.hours | ||
|
||
object Constants { | ||
const val API_BASE_URL = "https://api.play-deals.contabo.sujanpoudel.me/api" | ||
const val ABOUT_ME_URL = "https://sujanpoudel.me" | ||
val DATABASE_NAME = "${BuildKonfig.PACKAGE_NAME}.db" | ||
|
||
val FOREX_REFRESH_DURATION = 5.hours | ||
const val BUNDLED_FOREX = "raw/forex.json" | ||
} |
This file contains 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 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 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
18 changes: 18 additions & 0 deletions
18
shared/src/commonMain/kotlin/me/sujanpoudel/playdeals/common/domain/entities/ForexEntity.kt
This file contains 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,18 @@ | ||
package me.sujanpoudel.playdeals.common.domain.entities | ||
|
||
import androidx.compose.runtime.Immutable | ||
import kotlinx.datetime.Instant | ||
|
||
@Immutable | ||
data class Forex( | ||
val timestamp: Instant, | ||
val rates: List<ForexRateEntity>, | ||
) | ||
|
||
@Immutable | ||
data class ForexRateEntity( | ||
val currency: String, | ||
val symbol: String, | ||
val name: String, | ||
val rate: Float, | ||
) |
29 changes: 29 additions & 0 deletions
29
shared/src/commonMain/kotlin/me/sujanpoudel/playdeals/common/domain/models/api/ForexModel.kt
This file contains 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,29 @@ | ||
package me.sujanpoudel.playdeals.common.domain.models.api | ||
|
||
import androidx.compose.runtime.Immutable | ||
import kotlinx.datetime.Instant | ||
import kotlinx.serialization.Serializable | ||
import me.sujanpoudel.playdeals.common.domain.entities.ForexRateEntity | ||
|
||
@Serializable | ||
@Immutable | ||
data class ForexModel( | ||
val timestamp: Instant, | ||
val rates: List<ForexRate>, | ||
) | ||
|
||
@Serializable | ||
@Immutable | ||
data class ForexRate( | ||
val currency: String, | ||
val symbol: String, | ||
val name: String, | ||
val rate: Float, | ||
) | ||
|
||
fun ForexRate.toEntity() = ForexRateEntity( | ||
currency = currency, | ||
symbol = symbol, | ||
name = name, | ||
rate = rate, | ||
) |
This file contains 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.