Skip to content

Commit

Permalink
Updated Zonda Exchange API.
Browse files Browse the repository at this point in the history
  • Loading branch information
hwki committed Sep 9, 2024
1 parent 0d5897c commit 7d1abf6
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 32 deletions.
14 changes: 7 additions & 7 deletions bitcoin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
applicationId "com.brentpanther.bitcoinwidget"
minSdk 23
targetSdk 34
versionCode 332
versionName "8.5.7"
versionCode 333
versionName "8.5.8"

}

Expand Down Expand Up @@ -62,20 +62,20 @@ ksp {
}

dependencies {
implementation platform('androidx.compose:compose-bom:2024.06.00')
implementation platform('androidx.compose:compose-bom:2024.09.00')

implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1'
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3'
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
implementation 'androidx.preference:preference-ktx:1.2.1'
implementation 'androidx.work:work-runtime:2.9.1'
implementation 'androidx.activity:activity-ktx:1.9.1'
implementation 'androidx.activity:activity-compose:1.9.1'
implementation 'androidx.activity:activity-ktx:1.9.2'
implementation 'androidx.activity:activity-compose:1.9.2'
implementation "androidx.compose.ui:ui"
implementation "androidx.compose.ui:ui-tooling-preview"
implementation 'androidx.compose.material:material'
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.8.4'
implementation 'androidx.navigation:navigation-compose:2.7.7'
implementation 'androidx.lifecycle:lifecycle-runtime-compose:2.8.5'
implementation 'androidx.navigation:navigation-compose:2.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'io.coil-kt:coil-compose:2.7.0'
implementation 'androidx.core:core-ktx:1.13.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ enum class Exchange(val exchangeName: String, shortName: String? = null) {
},
ZONDA("Zonda") {
override fun getValue(coin: String, currency: String): String? {
val url = "https://api.zonda.exchange/rest/trading/ticker/$coin-$currency"
val url = "https://api.zondacrypto.exchange/rest/trading/ticker/$coin-$currency"
return getJsonObject(url)["ticker"]?.jsonObject?.get("rate").asString
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.compose.LocalLifecycleOwner
import com.brentpanther.bitcoinwidget.BuildConfig
import com.brentpanther.bitcoinwidget.R
import com.brentpanther.bitcoinwidget.ui.theme.Highlight
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Card
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.LocalRippleConfiguration
import androidx.compose.material.Text
import androidx.compose.material.ripple.LocalRippleTheme
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.ContentScale
Expand All @@ -33,8 +33,9 @@ import com.brentpanther.bitcoinwidget.db.Widget
import com.brentpanther.bitcoinwidget.ui.BannersViewModel
import com.brentpanther.bitcoinwidget.ui.WarningBanner
import com.brentpanther.bitcoinwidget.ui.WidgetPreview
import com.brentpanther.bitcoinwidget.ui.theme.HighlightRippleTheme
import com.brentpanther.bitcoinwidget.ui.theme.MyRippleConfiguration

@OptIn(ExperimentalMaterialApi::class)
@Composable
fun WidgetList(
navController: NavController,
Expand Down Expand Up @@ -70,8 +71,8 @@ fun WidgetList(
LazyColumn(contentPadding = PaddingValues(top = 8.dp, bottom = 48.dp)) {
items(widgets, key = { it.widget.widgetId }) { item ->
val widget = item.widget
CompositionLocalProvider(LocalRippleTheme provides HighlightRippleTheme()) {
WidgetCard(navController, widget, fixedSize)
CompositionLocalProvider(LocalRippleConfiguration provides MyRippleConfiguration) {
WidgetCard(navController, widget, fixedSize)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@ import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.CircularProgressIndicator
import androidx.compose.material.Divider
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.Icon
import androidx.compose.material.IconButton
import androidx.compose.material.LocalRippleConfiguration
import androidx.compose.material.MaterialTheme
import androidx.compose.material.OutlinedTextField
import androidx.compose.material.Scaffold
import androidx.compose.material.ScaffoldState
import androidx.compose.material.Text
import androidx.compose.material.TopAppBar
import androidx.compose.material.rememberScaffoldState
import androidx.compose.material.ripple.LocalRippleTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
Expand Down Expand Up @@ -61,7 +62,7 @@ import coil.compose.AsyncImage
import com.brentpanther.bitcoinwidget.Coin
import com.brentpanther.bitcoinwidget.R
import com.brentpanther.bitcoinwidget.Theme
import com.brentpanther.bitcoinwidget.ui.theme.HighlightRippleTheme
import com.brentpanther.bitcoinwidget.ui.theme.MyRippleConfiguration
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch

Expand Down Expand Up @@ -235,14 +236,15 @@ fun CoinList(coins: List<CoinResponse>, paddingValues: PaddingValues, onClick: (
}
}

@OptIn(ExperimentalMaterialApi::class)
@Composable
private fun CoinRow(
onClick: (CoinResponse) -> Unit,
item: CoinResponse,
modifier: Modifier,
isNightMode: Boolean
) {
CompositionLocalProvider(LocalRippleTheme provides HighlightRippleTheme()) {
CompositionLocalProvider(LocalRippleConfiguration provides MyRippleConfiguration) {
Row(
Modifier
.clickable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.Card
import androidx.compose.material.ContentAlpha
import androidx.compose.material.Divider
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material.LocalRippleConfiguration
import androidx.compose.material.MaterialTheme
import androidx.compose.material.OutlinedTextField
import androidx.compose.material.ProvideTextStyle
Expand All @@ -37,7 +39,6 @@ import androidx.compose.material.Switch
import androidx.compose.material.SwitchDefaults
import androidx.compose.material.Text
import androidx.compose.material.TextButton
import androidx.compose.material.ripple.LocalRippleTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
Expand All @@ -53,10 +54,11 @@ import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import com.brentpanther.bitcoinwidget.ui.theme.HighlightRippleTheme
import com.brentpanther.bitcoinwidget.ui.theme.MyRippleConfiguration
import java.lang.Integer.max
import java.util.Locale

@OptIn(ExperimentalMaterialApi::class)
@Composable
fun Setting(
modifier: Modifier = Modifier,
Expand All @@ -65,7 +67,7 @@ fun Setting(
subtitle: @Composable (() -> Unit)? = null,
content: @Composable ((BoxScope).() -> Unit) = {}
) {
CompositionLocalProvider(LocalRippleTheme provides HighlightRippleTheme()) {
CompositionLocalProvider(LocalRippleConfiguration provides MyRippleConfiguration) {
Row(
modifier = modifier
.fillMaxWidth()
Expand Down Expand Up @@ -381,13 +383,14 @@ fun SettingsSlider(
}
}

@OptIn(ExperimentalMaterialApi::class)
@Composable
private fun RadioDialogItem(
item: String,
selected: Boolean,
onClick: () -> Unit
) {
CompositionLocalProvider(LocalRippleTheme provides HighlightRippleTheme()) {
CompositionLocalProvider(LocalRippleConfiguration provides MyRippleConfiguration) {
Row(
Modifier
.fillMaxWidth()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.brentpanther.bitcoinwidget.ui.theme

import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.MaterialTheme
import androidx.compose.material.RippleConfiguration
import androidx.compose.material.darkColors
import androidx.compose.material.lightColors
import androidx.compose.material.ripple.RippleAlpha
import androidx.compose.material.ripple.RippleTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color

Expand All @@ -24,14 +25,12 @@ private val lightColorPalette = lightColors(

)

class HighlightRippleTheme : RippleTheme {
@Composable
override fun defaultColor() = Highlight

@Composable
override fun rippleAlpha() = RippleAlpha(0.8f,0.8f,0.8f,0.8f)

}
@OptIn(ExperimentalMaterialApi::class)
val MyRippleConfiguration =
RippleConfiguration(
color = Highlight,
rippleAlpha = RippleAlpha(0.8f,0.8f,0.8f,0.8f)
)

@Composable
fun SimpleBitcoinWidgetTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) {
Expand Down
2 changes: 1 addition & 1 deletion bitcoin/src/main/res/raw/cryptowidgetcoins_v2.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bitcoin/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<item>ISO</item>
<item>NONE</item>
</string-array>
<string name="json_last_modified" translatable="false">Sun, 11 Aug 2024 19:22:27 GMT</string>
<string name="json_last_modified" translatable="false">Mon, 09 Sep 2024 13:12:38 GMT</string>
<string name="json_url" translatable="false">https://www.brentpanther.com/cryptowidgetcoins_v2.json</string>

<string name="error_restricted_battery_saver">Unable to refresh, Battery Saver is on</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ class GenerateSupportedCoinsJson {
}

private fun zonda(): List<String> {
return parseKeys("https://api.zonda.exchange/rest/trading/ticker", "$.items")
return parseKeys("https://api.zondacrypto.exchange/rest/trading/ticker", "$.items")
}

//endregion
Expand Down
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/changelogs/333.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated Zonda Exchange API.

0 comments on commit 7d1abf6

Please sign in to comment.