Skip to content

Commit

Permalink
First code review corrections 1/2
Browse files Browse the repository at this point in the history
  • Loading branch information
nostrbuddha committed Nov 13, 2024
1 parent a8d4a66 commit 7542a3a
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 40 deletions.
14 changes: 8 additions & 6 deletions bisqapps/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
agp = "8.5.0"
android-compileSdk = "34"
android-targetSdk = "34"
android-minSdk = "28"
android-minSdk = "24"
android-node-minSdk = "31"
androidx-activityCompose = "1.9.2"
androidx-appcompat = "1.7.0"
Expand All @@ -20,8 +20,10 @@ kotlin = "2.0.20"
kotlinx = "1.9.0"
kermit = "2.0.4"
buildconfig = "5.5.0"
navigationCompose = "2.7.0-alpha07"
protobuf = "0.9.4"
protoblite = "4.28.2"
ksp = "2.0.20-1.0.25"

chimp-jsocks-lib = { strictly = '567e1cd6' }
chimp-jtorctl-lib = { strictly = '9b5ba203' }
Expand All @@ -45,8 +47,7 @@ grpc = { strictly = '1.61.0' }
i2p-lib = { strictly = '1.8.0' }
i2p-v2 = { strictly = '2.4.0' }
jackson-lib = { strictly = '2.17.2' }
ktorClientCore = "3.0.0"
lyricist = "2.0.20-1.0.25"
lyricist = "1.7.0"

[libraries]
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
Expand All @@ -65,10 +66,10 @@ androidx-activity-compose = { module = "androidx.activity:activity-compose", ver
androidx-lifecycle-viewmodel = { group = "org.jetbrains.androidx.lifecycle", name = "lifecycle-viewmodel", version.ref = "androidx-lifecycle" }
androidx-lifecycle-runtime-compose = { group = "org.jetbrains.androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "androidx-lifecycle" }

ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktorClientCore" }
logging-kermit = { group = "co.touchlab", name = "kermit", version.ref = "kermit" }
lyricist = { module = "cafe.adriel.lyricist:lyricist", version.ref = "lyricist" }

lyricist = { module = "cafe.adriel.lyricist:lyricist", version.ref = "lyricist" }
navigation-compose = { module = "org.jetbrains.androidx.navigation:navigation-compose", version.ref = "navigationCompose" }
protobuf-lite = { group ="com.google.protobuf", name = "protobuf-javalite", version.ref = "protoblite"}
protobuf-gradle-plugin = { module = 'com.google.protobuf:protobuf-gradle-plugin', version.ref = 'protobuf' }
protoc = { module = "com.google.protobuf:protoc", version.ref = "protoblite" }
Expand Down Expand Up @@ -143,4 +144,5 @@ jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
buildconfig = { id = "com.github.gmazzo.buildconfig", version.ref = "buildconfig" }
protobuf = { id = "com.google.protobuf", version.ref = "protobuf" }
protobuf = { id = "com.google.protobuf", version.ref = "protobuf" }
ksp = { id = "com.google.devtools.ksp", version.ref="ksp" }
8 changes: 1 addition & 7 deletions bisqapps/shared/domain/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,7 @@ kotlin {
//put your multiplatform dependencies here

// Coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")

// Ktor client for HTTP requests
implementation("io.ktor:ktor-client-core:3.0.0")
implementation("io.ktor:ktor-client-cio:3.0.0") // Replace with the appropriate engine for your platform
implementation("io.ktor:ktor-client-content-negotiation:3.0.0")
implementation("io.ktor:ktor-serialization-kotlinx-json:3.0.0")
implementation(libs.kotlinx.coroutines)
}
commonTest.dependencies {
implementation(libs.kotlin.test)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
import io.ktor.client.*
import io.ktor.client.call.*
import io.ktor.client.request.*
import io.ktor.client.statement.*
import io.ktor.client.plugins.contentnegotiation.*
import io.ktor.serialization.kotlinx.json.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.IO
import kotlinx.coroutines.withContext
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json


class PriceRepository {

suspend fun fetchBtcPrice(): String = "$70,000"
fun getValue() = "$70,000"

/*
// Ktor client setup with ContentNegotiation plugin
private val client = HttpClient {
install(ContentNegotiation) {
json(Json { ignoreUnknownKeys = true }) // Configures JSON serialization
}
}
*/

/**
* Fetches the current BTC price in USD from CoinGecko API.
*/
/*
suspend fun fetchBtcPrice(): String {
println("fetchBtcPrice()")
return withContext(Dispatchers.IO) {
Expand All @@ -39,16 +35,6 @@ class PriceRepository {
}
}
}
*/

fun getValue() = "$70,000"
}

@Serializable
data class CoinGeckoResponse(
val bitcoin: BitcoinPrice
)

@Serializable
data class BitcoinPrice(
val usd: Double
)
}
6 changes: 3 additions & 3 deletions bisqapps/shared/presentation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.compose.compiler)
alias(libs.plugins.buildconfig)
id("com.google.devtools.ksp") version "2.0.20-1.0.25"
alias(libs.plugins.ksp)
}

dependencies {
Expand Down Expand Up @@ -89,8 +89,8 @@ kotlin {
implementation(libs.logging.kermit)
implementation(libs.kotlinx.coroutines)

implementation("org.jetbrains.androidx.navigation:navigation-compose:2.7.0-alpha07")
implementation("cafe.adriel.lyricist:lyricist:1.7.0")
implementation(libs.navigation.compose)
implementation(libs.lyricist)

}
val commonTest by getting {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,43 @@
package network.bisq.mobile.presentation.i18n

/**
* An object that holds locale codes used for the application’s supported languages.
*
* Currently, this object supports English (`EN`) as the default language and French ('FR') only for testing.
* Additional languages can be added in the future.
*
* ## Usage
* ### Locales.kt
* Defines all the supported languages
*
* ### Strigs.kt
* A class that defines variable for all text resources used in the app.
* TODO: This is going to be an insanely huge file. Look for ways to modularize it (for later)
*
* ### {Lang}Strings.kt
* One file for each language. Assigns actual text for each variable in that specific language.
*
* ### Actual usage:
* 1. Each view should be enclosed by `ProviderStrings`. This is now done at top level in App.kt
*
* val lyricist = rememberStrings()
* ProvideStrings(lyricist) {}
*
* 2. And current language can be changed anytime by doing
*
* lyricist.languageTag = Locales.FR
*
* 3. In the views, string resources can be accessed by
*
* LocalStrings.current.{stringResourceName}
*
*
* ## References:
* For more detailed usage, please refer lyricist documentation @
* https://github.com/adrielcafe/lyricist/
* https://github.com/adrielcafe/lyricist/tree/main/sample-multiplatform/src/commonMain/kotlin/cafe/adriel/lyricist/sample/multiplatform (sample project)
*/
object Locales {
const val EN = "en"
const val FR = "fr"
}
}

0 comments on commit 7542a3a

Please sign in to comment.