Skip to content

Commit b5c0152

Browse files
authored
Dependency updates and upgrade for new target sdk (#259)
1 parent 226aa7d commit b5c0152

File tree

17 files changed

+119
-59
lines changed

17 files changed

+119
-59
lines changed

accessibility-toolbox/src/main/kotlin/io/snabble/accessibility/AccessibilityToolBox.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ class AccessibilityToolBox(private val target: View): AccessibilityDelegateCompa
128128
AccessibilityEvent.TYPE_VIEW_HOVER_EXIT, AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_START,
129129
AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_END, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED,
130130
AccessibilityEvent.TYPE_VIEW_SCROLLED, AccessibilityEvent.TYPE_VIEW_TEXT_SELECTION_CHANGED,
131-
AccessibilityEvent.TYPE_ANNOUNCEMENT, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED,
132131
AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED,
133132
AccessibilityEvent.TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
134133
AccessibilityEvent.TYPE_GESTURE_DETECTION_START, AccessibilityEvent.TYPE_GESTURE_DETECTION_END,
@@ -231,4 +230,4 @@ fun <T> Iterable<T>.forEachWindow(iterator: (last: T?, current: T, next: T?) ->
231230
}
232231
}
233232
}
234-
}
233+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package io.snabble.sdk
2+
3+
import android.os.Build
4+
import android.view.View
5+
import java.util.Locale
6+
7+
fun localeOf(language: String): Locale {
8+
return when {
9+
Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA -> Locale.of(language)
10+
else -> {
11+
@Suppress("DEPRECATION")
12+
Locale(language)
13+
}
14+
}
15+
}
16+
17+
fun localeOf(language: String, country: String): Locale {
18+
return when {
19+
Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA -> Locale.of(language, country)
20+
else -> {
21+
@Suppress("DEPRECATION")
22+
Locale(language, country)
23+
}
24+
}
25+
}
26+
27+
fun Thread.compatId(): Long {
28+
return when {
29+
Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA -> threadId()
30+
else -> {
31+
(@Suppress("DEPRECATION")
32+
id)
33+
}
34+
}
35+
}
36+
fun View.announceAccessibiltyEvent(event: String) {
37+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
38+
stateDescription = event
39+
} else {
40+
@Suppress("DEPRECATION")
41+
announceForAccessibility(event)
42+
}
43+
}

core/src/main/java/io/snabble/sdk/TermsOfService.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ data class TermsOfService(
1818
get() {
1919
val defaultLocale = Locale.getDefault()
2020
variants.forEach {
21-
if (Locale(it.language).language == defaultLocale.language) {
21+
if (localeOf(it.language).language == defaultLocale.language) {
2222
return Snabble.absoluteUrl(it.url)
2323
}
2424
}
@@ -75,4 +75,4 @@ data class TermsOfService(
7575
*/
7676
val href: String
7777
)
78-
}
78+
}

core/src/main/java/io/snabble/sdk/coupons/Coupons.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import com.google.gson.GsonBuilder
88
import io.snabble.sdk.MutableAccessibleLiveData
99
import io.snabble.sdk.Project
1010
import io.snabble.sdk.Snabble
11+
import io.snabble.sdk.compatId
1112
import okhttp3.Call
1213
import okhttp3.Callback
1314
import okhttp3.Request
@@ -97,7 +98,7 @@ class Coupons (
9798
@JvmName("setInternalProjectCoupons")
9899
@RestrictTo(RestrictTo.Scope.LIBRARY)
99100
internal fun setProjectCoupons(coupons: List<Coupon>) {
100-
if (Looper.getMainLooper().thread.id == Thread.currentThread().id) {
101+
if (Looper.getMainLooper().thread.compatId() == Thread.currentThread().compatId()) {
101102
value = coupons
102103
} else {
103104
postValue(coupons)

gradle/libs.versions.toml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
[versions]
2-
compileSdk = "35"
3-
targetSdk = "35"
2+
compileSdk = "36"
3+
targetSdk = "36"
44
minSdk = "21"
5-
gradlePlugin = "8.11.0"
6-
kotlin = "2.2.0"
7-
navigation = "2.9.1"
5+
gradlePlugin = "8.12.1"
6+
kotlin = "2.2.10"
7+
navigation = "2.9.3"
88
snabbleSdk = "0.69.6"
99
androidx-camera = "1.4.2"
10-
androidx-compose-ui = "1.8.3"
11-
com-squareup-okhttp3 = "4.12.0"
10+
androidx-compose-ui = "1.9.0"
11+
com-squareup-okhttp3 = "5.1.0"
1212
io-kotest = "5.9.1"
1313
dokka = "1.9.20"
14-
androidx-compose-material = "1.8.3"
15-
android-lifecycle = "2.9.1"
14+
androidx-compose-material = "1.9.0"
15+
android-lifecycle = "2.9.2"
1616
koin = "4.1.0"
1717

1818
[libraries]
@@ -26,7 +26,7 @@ androidx-camera-extension = { module = "androidx.camera:camera-extensions", vers
2626
androidx-camera-lifecycle = { module = "androidx.camera:camera-lifecycle", version.ref = "androidx-camera" }
2727
androidx-camera-view = { module = "androidx.camera:camera-view", version.ref = "androidx-camera" }
2828
androidx-cardview = "androidx.cardview:cardview:1.0.0"
29-
androidx-core-ktx = "androidx.core:core-ktx:1.16.0"
29+
androidx-core-ktx = "androidx.core:core-ktx:1.17.0"
3030
androidx-constraintlayout = "androidx.constraintlayout:constraintlayout:2.2.1"
3131
androidx-constraintlayoutCompose = "androidx.constraintlayout:constraintlayout-compose:1.1.1"
3232
# Compose previews won't work w/o this: https://issuetracker.google.com/issues/227767363
@@ -50,7 +50,7 @@ androidx-startupRuntime = "androidx.startup:startup-runtime:1.2.0"
5050
androidx-swiperefreshlayout = "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
5151
androidx-viewpager2 = "androidx.viewpager2:viewpager2:1.1.0"
5252
androidx-webkit = "androidx.webkit:webkit:1.14.0"
53-
apache-commonsLang3 = "org.apache.commons:commons-lang3:3.17.0"
53+
apache-commonsLang3 = "org.apache.commons:commons-lang3:3.18.0"
5454
caverock-androidsvgAar = "com.caverock:androidsvg-aar:1.4"
5555
compose-iconsExtended = { module = "androidx.compose.material:material-icons-extended", version = "1.7.8" }
5656
compose-navigation = { module = "androidx.navigation:navigation-compose", version.ref = "navigation" }
@@ -64,7 +64,7 @@ compose-uiTooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "
6464
compose-uiToolingPreview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "androidx-compose-ui" }
6565
compose-uiUtil = { module = "androidx.compose.ui:ui-util", version.ref = "androidx-compose-ui" }
6666
compose-uiViewBinding = { module = "androidx.compose.ui:ui-viewbinding", version.ref = "androidx-compose-ui" }
67-
commonsIo = "commons-io:commons-io:2.19.0"
67+
commonsIo = "commons-io:commons-io:2.20.0"
6868
datatrans-androidSdk = "ch.datatrans:android-sdk:3.7.0"
6969
desugarJdkLibsNio = "com.android.tools:desugar_jdk_libs_nio:2.1.5"
7070
glide-compose = "com.github.bumptech.glide:compose:1.0.0-beta01"
@@ -94,16 +94,16 @@ kotest-assertionsCore = { module = "io.kotest:kotest-assertions-core", version.r
9494
koltin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
9595
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
9696
kotlinx-serializationJson = "org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0"
97-
mockk = "io.mockk:mockk:1.14.4"
97+
mockk = "io.mockk:mockk:1.14.5"
9898
# @pin requires higher target
99-
mockito-kotlin = "org.mockito.kotlin:mockito-kotlin:5.4.0"
99+
mockito-kotlin = "org.mockito.kotlin:mockito-kotlin:6.0.0"
100100
roboletric = "org.robolectric:robolectric:4.15.1"
101101
roboletric-androidAll = "org.robolectric:android-all:13-robolectric-9030017"
102-
sebaslogen-resaca = "io.github.sebaslogen:resaca:4.4.8"
102+
sebaslogen-resaca = "io.github.sebaslogen:resaca:4.5.0"
103103
squareup-okhttp3-mockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "com-squareup-okhttp3" }
104-
test-espressoCore = "androidx.test.espresso:espresso-core:3.6.1"
105-
test-ext-junit = "androidx.test.ext:junit:1.2.1"
106-
test-runner = "androidx.test:runner:1.6.2"
104+
test-espressoCore = "androidx.test.espresso:espresso-core:3.7.0"
105+
test-ext-junit = "androidx.test.ext:junit:1.3.0"
106+
test-runner = "androidx.test:runner:1.7.0"
107107
# Classpath dependencies
108108
classpath-androidGradlePlugin = { module = "com.android.tools.build:gradle", version.ref = "gradlePlugin" }
109109
classpath-kotlinAndroidPlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }

gradle/wrapper/gradle-wrapper.jar

1.91 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
#
4-
# Copyright © 2015-2021 the original authors.
4+
# Copyright © 2015 the original authors.
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.
@@ -86,8 +86,7 @@ done
8686
# shellcheck disable=SC2034
8787
APP_BASE_NAME=${0##*/}
8888
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89-
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90-
' "$PWD" ) || exit
89+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
9190

9291
# Use the maximum available, or set MAX_FD != -1 to use that value.
9392
MAX_FD=maximum
@@ -115,7 +114,7 @@ case "$( uname )" in #(
115114
NONSTOP* ) nonstop=true ;;
116115
esac
117116

118-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
117+
CLASSPATH="\\\"\\\""
119118

120119

121120
# Determine the Java command to use to start the JVM.
@@ -206,15 +205,15 @@ fi
206205
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
207206

208207
# Collect all arguments for the java command:
209-
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
208+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
210209
# and any embedded shellness will be escaped.
211210
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
212211
# treated as '${Hostname}' itself on the command line.
213212

214213
set -- \
215214
"-Dorg.gradle.appname=$APP_BASE_NAME" \
216215
-classpath "$CLASSPATH" \
217-
org.gradle.wrapper.GradleWrapperMain \
216+
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
218217
"$@"
219218

220219
# Stop when "xargs" is not available.

gradlew.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ goto fail
7070
:execute
7171
@rem Setup the command line
7272

73-
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73+
set CLASSPATH=
7474

7575

7676
@rem Execute Gradle
77-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
77+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
7878

7979
:end
8080
@rem End local scope for the variables with windows NT shell

ui-toolkit/src/main/kotlin/io/snabble/sdk/screens/onboarding/ui/terms/RawHtmlFragment.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import android.webkit.WebViewClient
1313
import androidx.fragment.app.Fragment
1414
import io.snabble.sdk.ui.toolkit.R
1515
import io.snabble.sdk.utils.getColorByAttribute
16-
import okhttp3.internal.toHexString
16+
import androidx.core.net.toUri
1717

1818
/** Displays any given HTML in a [WebView] */
1919
abstract class RawHtmlFragment : Fragment() {
@@ -40,7 +40,7 @@ abstract class RawHtmlFragment : Fragment() {
4040

4141
@Deprecated("Legacy code for Android 5 & 6", replaceWith = ReplaceWith(""))
4242
override fun shouldOverrideUrlLoading(view: WebView?, url: String?) =
43-
shouldOverrideUrlLoading(Uri.parse(url.orEmpty()))
43+
shouldOverrideUrlLoading(url.orEmpty().toUri())
4444
}
4545

4646
showHtml(html)
@@ -91,5 +91,5 @@ abstract class RawHtmlFragment : Fragment() {
9191
}
9292

9393
private fun Fragment.openUrl(url: String) =
94-
startActivity(Intent(Intent.ACTION_VIEW).apply { data = Uri.parse(url) })
94+
startActivity(Intent(Intent.ACTION_VIEW).apply { data = url.toUri() })
9595
}

0 commit comments

Comments
 (0)