Skip to content
This repository was archived by the owner on Feb 21, 2026. It is now read-only.

Commit 9f10c0c

Browse files
Merge pull request #24 from ReneeVandervelde/21-api
Older / API 21 bugfixes
2 parents 11aeedb + 5bf054a commit 9f10c0c

5 files changed

Lines changed: 54 additions & 7 deletions

File tree

android-application/build.gradle.kts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,15 @@ android {
5858
signingConfigs.getByName("debug")
5959
}
6060

61-
isMinifyEnabled = false
61+
isMinifyEnabled = true
62+
isShrinkResources = true
63+
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
6264
}
6365
}
6466
compileOptions {
6567
targetCompatibility = JavaVersion.VERSION_1_8
6668
sourceCompatibility = JavaVersion.VERSION_1_8
69+
isCoreLibraryDesugaringEnabled = true
6770
}
6871
kotlinOptions {
6972
jvmTarget = "1.8"
@@ -127,4 +130,5 @@ dependencies {
127130
testImplementation(thirdParty.junit)
128131
testImplementation(kotlinLibraries.coroutines.test)
129132
testImplementation(kotlinLibraries.kotlin.test.core)
133+
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")
130134
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Kotlin
2+
-keepattributes InnerClasses # Needed for `getDeclaredClasses`.
3+
-keep public class kotlinx.serialization.* { public *; }
4+
-dontwarn kotlinx.serialization.**
5+
-keepnames class <1>$$serializer { # -keepnames suffices; class is kept when serializer() is kept.
6+
static <1>$$serializer INSTANCE;
7+
}
8+
9+
# Okhttp
10+
-keep public class org.bouncycastle.jsse.** { *; }
11+
-dontwarn org.bouncycastle.jsse.**
12+
-keep public class org.conscrypt.** { *; }
13+
-dontwarn org.conscrypt.**
14+
-keep public class org.openjsse.** { *; }
15+
-dontwarn org.openjsse.**
16+
17+
# Mapbox
18+
-keep class com.mapbox.android.telemetry.**
19+
-keep class com.mapbox.android.core.location.**
20+
-keep class android.arch.lifecycle.** { *; }
21+
-keep class com.mapbox.android.core.location.** { *; }
22+
-dontnote com.mapbox.mapboxsdk.**
23+
-dontnote com.mapbox.android.gestures.**
24+
-dontnote com.mapbox.mapboxsdk.plugins.**
25+
26+
-keep public class com.google.android.gms.* { public *; }
27+
-dontwarn com.google.android.gms.**

android-application/src/main/java/com/inkapplications/ack/android/ui/theme/AckTheme.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ object AckTheme {
5151
val colors
5252
@Composable
5353
@ReadOnlyComposable
54-
get() = if (isSystemInDarkTheme()) darkColors else lightColors
54+
get() = if (isSystemInDarkTheme() || Build.VERSION.SDK_INT < Build.VERSION_CODES.N) darkColors else lightColors
5555

5656
val spacing
5757
@Composable

android-extensions/src/main/java/com/inkapplications/android/extensions/ApplicationModule.kt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import android.location.LocationManager
1010
import androidx.preference.PreferenceManager
1111
import com.inkapplications.android.extensions.bluetooth.AndroidBluetoothAccess
1212
import com.inkapplications.android.extensions.bluetooth.BluetoothDeviceAccess
13+
import com.inkapplications.android.extensions.bluetooth.DummyBluetoothDeviceAccess
1314
import com.inkapplications.android.extensions.format.AndroidResourceDateTimeFormatter
1415
import com.inkapplications.android.extensions.format.DateTimeFormatter
1516
import com.inkapplications.android.extensions.location.AndroidLocationAccess
@@ -47,11 +48,13 @@ class ApplicationModule {
4748
@Reusable
4849
fun bluetoothAccess(
4950
context: Context,
50-
bluetooth: BluetoothAdapter,
51-
): BluetoothDeviceAccess = AndroidBluetoothAccess(
52-
context = context,
53-
bluetoothAdapter = bluetooth,
54-
)
51+
): BluetoothDeviceAccess {
52+
val bluetooth = BluetoothAdapter.getDefaultAdapter() ?: return DummyBluetoothDeviceAccess
53+
return AndroidBluetoothAccess(
54+
context = context,
55+
bluetoothAdapter = bluetooth,
56+
)
57+
}
5558
}
5659

5760
@Module

android-extensions/src/main/java/com/inkapplications/android/extensions/bluetooth/BluetoothDeviceAccess.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.inkapplications.android.extensions.bluetooth
33
import android.Manifest
44
import androidx.annotation.RequiresPermission
55
import kotlinx.coroutines.flow.Flow
6+
import kotlinx.coroutines.flow.flowOf
67
import java.io.InputStream
78
import java.io.OutputStream
89
import java.util.*
@@ -19,3 +20,15 @@ interface BluetoothDeviceAccess {
1920
)
2021
}
2122

23+
/**
24+
* No-op implementation of [BluetoothDeviceAccess].
25+
*/
26+
object DummyBluetoothDeviceAccess: BluetoothDeviceAccess {
27+
override val devices: Flow<List<BluetoothDeviceData>> = flowOf()
28+
29+
override suspend fun connect(
30+
device: BluetoothDeviceData,
31+
uuid: UUID,
32+
onConnect: suspend (InputStream, OutputStream) -> Unit,
33+
) = Unit
34+
}

0 commit comments

Comments
 (0)