-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* My Trades UI 1/3 * Buy/Sell UI - Dialog component - Exchange screen improvements - Offerbook UI - Basic * - CurrencyRepository; Dialog component; Improved CurrencyListScreen and OfferListScreen * - minor fixes: coil3 in .toml; Misc * - minor cleanups - removed dead code, updated TODO comments * - added translation keys/strings to CurrencyList/OfferList screens * - added translation keys/strings to CurrencyList/OfferList screens (missed staging the files) * - replace attach call with custom composable RememberPresenterLifecycle which handle both attach and unattach --------- Co-authored-by: Rodrigo Varela <[email protected]>
- Loading branch information
1 parent
e22db41
commit 3c8ce93
Showing
63 changed files
with
987 additions
and
161 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
18 changes: 18 additions & 0 deletions
18
...s/shared/domain/src/commonMain/kotlin/network/bisq/mobile/domain/data/model/Currencies.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 network.bisq.mobile.domain.data.model | ||
|
||
data class FiatCurrency( | ||
val flagImage: String, | ||
val name: String, | ||
val code: String, | ||
val offerCount: Number | ||
) | ||
|
||
class Currencies(val currencies: List<FiatCurrency> = listOf()): BaseModel() | ||
|
||
interface CurrenciesFactory { | ||
fun createCurrencies(): Currencies | ||
} | ||
|
||
class DefaultCurrenciesFactory : CurrenciesFactory { | ||
override fun createCurrencies() = Currencies() | ||
} |
26 changes: 26 additions & 0 deletions
26
...pps/shared/domain/src/commonMain/kotlin/network/bisq/mobile/domain/data/model/MyTrades.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,26 @@ | ||
package network.bisq.mobile.domain.data.model | ||
|
||
// TODO: Update later based on model class from bisq2 lib | ||
data class BisqOffer ( | ||
val id: String = "offer_283UANJD19A", | ||
val isBuy: Boolean = true, | ||
val amIMaker: Boolean = false, | ||
val price: Number = 97000, | ||
val currency: String = "USD", | ||
val fiatAmount: Number = 1000, //Should be a range | ||
val satsAmount: Number= 1030927, //Should be a range | ||
|
||
val partyName: String = "satoshi", | ||
val partyRatings: Double = 4.2, | ||
val partyDP: String = "", // Image URL | ||
) | ||
|
||
class MyTrades(val trades: List<BisqOffer> = listOf()): BaseModel() | ||
|
||
interface MyTradesFactory { | ||
fun createMyTrades(): MyTrades | ||
} | ||
|
||
class DefaultMyTradesFactory : MyTradesFactory { | ||
override fun createMyTrades() = MyTrades() | ||
} |
52 changes: 52 additions & 0 deletions
52
.../src/commonMain/kotlin/network/bisq/mobile/domain/data/repository/CurrenciesRepository.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,52 @@ | ||
package network.bisq.mobile.domain.data.repository | ||
|
||
import kotlinx.coroutines.runBlocking | ||
import network.bisq.mobile.domain.data.model.Currencies | ||
import network.bisq.mobile.domain.data.model.FiatCurrency | ||
|
||
// TODO: | ||
// androidNode will populate List<FiatCurrency> from bisq2 libs | ||
// xClients will populate List<FiatCurrency> via API | ||
open class CurrenciesRepository : SingleObjectRepository<Currencies>() { | ||
init { | ||
runBlocking { | ||
val currencies = Currencies( | ||
currencies = listOf( | ||
FiatCurrency( | ||
flagImage = "currency_aed.png", | ||
name = "United Arab Emirates Dirham", | ||
code = "aed", | ||
offerCount = 9 | ||
), | ||
FiatCurrency(flagImage = "currency_ars.png", name = "Argentine Peso", code = "ars", offerCount = 0), | ||
FiatCurrency( | ||
flagImage = "currency_aud.png", | ||
name = "Australian Dollar", | ||
code = "aud", | ||
offerCount = 12 | ||
), | ||
FiatCurrency(flagImage = "currency_eur.png", name = "Euro", code = "eur", offerCount = 66), | ||
FiatCurrency( | ||
flagImage = "currency_gbp.png", | ||
name = "British Pound Sterling", | ||
code = "gbp", | ||
offerCount = 3 | ||
), | ||
|
||
FiatCurrency(flagImage = "currency_jpy.png", name = "Japanese Yen", code = "jpy", offerCount = 2), | ||
|
||
FiatCurrency(flagImage = "currency_qar.png", name = "Qatari Rial", code = "qar", offerCount = 4), | ||
FiatCurrency(flagImage = "currency_sek.png", name = "Swedish Krona", code = "sek", offerCount = 18), | ||
FiatCurrency( | ||
flagImage = "currency_sgd.png", | ||
name = "Singapore Dollar", | ||
code = "sgd", | ||
offerCount = 16 | ||
), | ||
FiatCurrency(flagImage = "currency_usd.png", name = "US Dollar", code = "usd", offerCount = 62), | ||
) | ||
) | ||
create(currencies) | ||
} | ||
} | ||
} |
31 changes: 27 additions & 4 deletions
31
...d/domain/src/commonMain/kotlin/network/bisq/mobile/domain/data/repository/Repositories.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,13 +1,36 @@ | ||
package network.bisq.mobile.domain.data.repository | ||
|
||
import network.bisq.mobile.domain.data.model.BisqStats | ||
import network.bisq.mobile.domain.data.model.BtcPrice | ||
import network.bisq.mobile.domain.data.model.Greeting | ||
import network.bisq.mobile.domain.data.model.Settings | ||
import kotlinx.coroutines.runBlocking | ||
import network.bisq.mobile.domain.data.model.* | ||
|
||
// this way of definingsupports both platforms | ||
// add your repositories here and then in your DI module call this classes for instanciation | ||
open class GreetingRepository<T: Greeting>: SingleObjectRepository<T>() | ||
open class BisqStatsRepository: SingleObjectRepository<BisqStats>() | ||
open class BtcPriceRepository: SingleObjectRepository<BtcPrice>() | ||
open class SettingsRepository: SingleObjectRepository<Settings>() | ||
|
||
open class MyTradesRepository : SingleObjectRepository<MyTrades>() { | ||
init { | ||
runBlocking { | ||
val myTrades = MyTrades( | ||
trades = listOf( | ||
BisqOffer(id = "offer1", isBuy = true, price = 95000, currency = "USD"), | ||
BisqOffer(id = "offer2", isBuy = false, price = 96000, currency = "USD"), | ||
BisqOffer(id = "offer3", isBuy = true, price = 97000, currency = "USD"), | ||
BisqOffer(id = "offer4", isBuy = false, price = 98000, currency = "USD"), | ||
BisqOffer(id = "offer5", isBuy = true, price = 99000, currency = "USD"), | ||
BisqOffer(id = "offer1", isBuy = true, price = 95000, currency = "USD"), | ||
BisqOffer(id = "offer2", isBuy = false, price = 96000, currency = "USD"), | ||
BisqOffer(id = "offer3", isBuy = true, price = 97000, currency = "USD"), | ||
BisqOffer(id = "offer4", isBuy = false, price = 98000, currency = "USD"), | ||
BisqOffer(id = "offer5", isBuy = true, price = 99000, currency = "USD") | ||
) | ||
) | ||
|
||
create(myTrades) | ||
|
||
println("MyTradeRepo :: Created") | ||
} | ||
} | ||
} |
7 changes: 3 additions & 4 deletions
7
bisqapps/shared/domain/src/commonMain/kotlin/network/bisq/mobile/domain/di/DomainModule.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,15 +1,14 @@ | ||
package network.bisq.mobile.domain.di | ||
|
||
import network.bisq.mobile.domain.data.model.Greeting | ||
import network.bisq.mobile.domain.data.repository.BisqStatsRepository | ||
import network.bisq.mobile.domain.data.repository.BtcPriceRepository | ||
import network.bisq.mobile.domain.data.repository.GreetingRepository | ||
import network.bisq.mobile.domain.data.repository.SettingsRepository | ||
import network.bisq.mobile.domain.data.repository.* | ||
import org.koin.dsl.module | ||
|
||
val domainModule = module { | ||
single<GreetingRepository<Greeting>> { GreetingRepository() } | ||
single<BisqStatsRepository> { BisqStatsRepository() } | ||
single<BtcPriceRepository> { BtcPriceRepository() } | ||
single<SettingsRepository> { SettingsRepository() } | ||
single<MyTradesRepository> { MyTradesRepository() } | ||
single<CurrenciesRepository> { CurrenciesRepository() } | ||
} |
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
Binary file added
BIN
+2.3 KB
...s/shared/presentation/src/commonMain/composeResources/drawable/currency_aed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.11 KB
...s/shared/presentation/src/commonMain/composeResources/drawable/currency_ars.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.56 KB
...s/shared/presentation/src/commonMain/composeResources/drawable/currency_aud.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.1 KB
...s/shared/presentation/src/commonMain/composeResources/drawable/currency_eur.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-1.96 KB
.../shared/presentation/src/commonMain/composeResources/drawable/currency_euro.png
Binary file not shown.
Binary file added
BIN
+3.96 KB
...s/shared/presentation/src/commonMain/composeResources/drawable/currency_gbp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-2.3 KB
...s/shared/presentation/src/commonMain/composeResources/drawable/currency_gpb.png
Binary file not shown.
Binary file added
BIN
+3.15 KB
...s/shared/presentation/src/commonMain/composeResources/drawable/currency_jpy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.73 KB
...s/shared/presentation/src/commonMain/composeResources/drawable/currency_qar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.56 KB
...s/shared/presentation/src/commonMain/composeResources/drawable/currency_sek.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.4 KB
...s/shared/presentation/src/commonMain/composeResources/drawable/currency_sgd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.13 KB
(210%)
...s/shared/presentation/src/commonMain/composeResources/drawable/currency_usd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+230 Bytes
...ared/presentation/src/commonMain/composeResources/drawable/icon_right_arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+256 Bytes
...apps/shared/presentation/src/commonMain/composeResources/drawable/icon_star.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+29.2 KB
.../shared/presentation/src/commonMain/composeResources/drawable/img_no_trades.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.08 KB
...ps/shared/presentation/src/commonMain/composeResources/drawable/payment_ach.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.12 KB
...presentation/src/commonMain/composeResources/drawable/payment_bitcoin_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.65 KB
...esentation/src/commonMain/composeResources/drawable/payment_lightning_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+596 Bytes
...shared/presentation/src/commonMain/composeResources/drawable/payment_strike.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+503 Bytes
.../shared/presentation/src/commonMain/composeResources/drawable/payment_uspmo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.06 KB
.../shared/presentation/src/commonMain/composeResources/drawable/payment_venmo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+629 Bytes
...s/shared/presentation/src/commonMain/composeResources/drawable/payment_wise.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+447 Bytes
.../shared/presentation/src/commonMain/composeResources/drawable/payment_zelle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
53 changes: 34 additions & 19 deletions
53
...c/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/CurrencyProfileCard.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
32 changes: 32 additions & 0 deletions
32
...rc/commonMain/kotlin/network/bisq/mobile/presentation/ui/components/atoms/DynamicImage.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,32 @@ | ||
package network.bisq.mobile.presentation.ui.components.atoms | ||
|
||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
|
||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import bisqapps.shared.presentation.generated.resources.Res | ||
import bisqapps.shared.presentation.generated.resources.bisq_logo | ||
import bisqapps.shared.presentation.generated.resources.currency_aed | ||
import coil3.compose.AsyncImage | ||
import org.jetbrains.compose.resources.ExperimentalResourceApi | ||
import org.jetbrains.compose.resources.painterResource | ||
|
||
|
||
// The idea of this Composable is to load images at run time with a string path. | ||
// TODO: In case the image doesn't exist, it should be handled gracefully | ||
@OptIn(ExperimentalResourceApi::class) | ||
@Composable | ||
fun DynamicImage(path: String, contentDescription: String?, modifier: Modifier? = Modifier) { | ||
AsyncImage( | ||
model = Res.getUri(path), | ||
//model = Res.getUri("drawable/currency_usd.png"), | ||
//fallback = painterResource(Res.drawable.currency_aed), | ||
contentDescription = null, | ||
modifier = Modifier.size(36.dp), | ||
onError = { | ||
println("Error") | ||
} | ||
) | ||
} |
Oops, something went wrong.