Skip to content

Commit a915b06

Browse files
authored
Migrate :bridge:synchronization, :core:ktx and :core:theme to KMP (#929)
**Background** Right now we can't move forward with the new transport API without migrating to KMP **Changes** - Migrate `:bridge:synchronization:ui` to KMP - Migrate `:bridge:synchronization:api` to KMP - Migrate `:core:ktx` to KMP - Migrate `:core:theme` to KMP - Remove parcelize from almost all modules and add `:core:kmpparcelizable` **Test plan** Try build app
1 parent 5345398 commit a915b06

File tree

140 files changed

+496
-477
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+496
-477
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Attention: don't forget to add the flag for F-Droid before release
1414
- [Refactor] Replace Ktorfit with Ktor requests in remote-controls
1515
- [Refactor] Migrate :core:preference to KMP
1616
- [Refactor] Migrate :bridge:connection:* to KMP
17+
- [Refactor] Migrate :bridge:synchronization, :core:ktx and :core:theme to KMP
1718
- [Refactor] Remove ktorfit
1819
- [FIX] Distinct fap items by id in paging sources
1920
- [FIX] Battery level charge
Lines changed: 3 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,11 @@
1-
import com.android.build.gradle.BaseExtension
2-
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
3-
41
plugins {
5-
id("org.jetbrains.kotlin.multiplatform")
2+
id("flipper.multiplatform")
63
id("org.jetbrains.compose")
74
id("org.jetbrains.kotlin.plugin.compose")
8-
id("com.android.library")
9-
id("flipper.lint")
10-
}
11-
12-
configure<BaseExtension> {
13-
commonAndroid(project)
145
}
156

167
kotlin {
17-
androidTarget {
18-
compilerOptions {
19-
jvmTarget = JvmTarget.JVM_1_8
20-
}
21-
}
22-
jvm("desktop")
23-
248
sourceSets {
25-
val commonMain by getting
26-
27-
/**
28-
* We shouldn't create sources, which is named as original targets sourcesets.
29-
*
30-
* As an example - jvm() target will create sourceSet jvmMain - and we would have conflicts
31-
* with our create jvmMain sourceSet
32-
*
33-
* This is the reason to name it `jvmSharedMain`
34-
*/
35-
val jvmSharedMain by creating {
36-
dependsOn(commonMain)
37-
}
38-
39-
val androidMain by getting {
40-
dependsOn(jvmSharedMain)
41-
}
42-
43-
val desktopMain by getting {
44-
dependsOn(jvmSharedMain)
45-
}
46-
479
androidMain.dependencies {
4810
implementation(libs.compose.tooling)
4911
}
@@ -53,26 +15,11 @@ kotlin {
5315
implementation(compose.material)
5416
implementation(compose.ui)
5517
implementation(compose.components.resources)
18+
implementation(compose.components.uiToolingPreview)
5619
}
20+
val desktopMain by getting
5721
desktopMain.dependencies {
5822
implementation(compose.desktop.currentOs)
5923
}
60-
61-
// Testing
62-
val commonTest by getting
63-
64-
val jvmSharedTest by creating {
65-
dependsOn(commonTest)
66-
}
67-
68-
@Suppress("UnusedPrivateProperty")
69-
val androidUnitTest by getting {
70-
dependsOn(jvmSharedTest)
71-
}
72-
73-
@Suppress("UnusedPrivateProperty")
74-
val desktopTest by getting {
75-
dependsOn(jvmSharedTest)
76-
}
7724
}
7825
}

components/archive/api/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
id("flipper.android-compose")
3-
id("kotlin-parcelize")
3+
44
id("kotlinx-serialization")
55
}
66

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
package com.flipperdevices.archive.model
22

3-
import android.os.Parcelable
43
import androidx.compose.runtime.Immutable
54
import com.flipperdevices.bridge.dao.api.model.FlipperKeyType
6-
import kotlinx.parcelize.Parcelize
75
import kotlinx.serialization.Serializable
86

97
@Serializable
108
@Immutable
11-
sealed class CategoryType : Parcelable {
12-
@Parcelize
9+
sealed class CategoryType {
1310
@Serializable
1411
data class ByFileType(
1512
val fileType: FlipperKeyType
1613
) : CategoryType()
1714

18-
@Parcelize
1915
@Serializable
20-
object Deleted : CategoryType()
16+
data object Deleted : CategoryType()
2117
}

components/archive/impl/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
id("flipper.android-compose")
3-
id("kotlin-parcelize")
3+
44
id("flipper.anvil")
55
id("kotlinx-serialization")
66
}
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
package com.flipperdevices.archive.impl.model
22

3-
import android.os.Parcelable
43
import androidx.annotation.DrawableRes
54
import com.flipperdevices.archive.model.CategoryType
6-
import kotlinx.parcelize.Parcelize
75

8-
@Parcelize
96
data class CategoryItem(
107
@DrawableRes val iconId: Int?,
118
val title: String,
129
val count: Int?,
1310
val categoryType: CategoryType
14-
) : Parcelable
11+
)

components/archive/impl/src/main/java/com/flipperdevices/archive/impl/viewmodel/CategoryViewModel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import com.flipperdevices.archive.model.CategoryType
77
import com.flipperdevices.bridge.dao.api.delegates.key.DeleteKeyApi
88
import com.flipperdevices.bridge.dao.api.delegates.key.SimpleKeyApi
99
import com.flipperdevices.bridge.dao.api.model.FlipperKeyType
10+
import com.flipperdevices.bridge.dao.api.model.icon
1011
import com.flipperdevices.core.ui.lifecycle.DecomposeViewModel
1112
import kotlinx.collections.immutable.PersistentList
1213
import kotlinx.collections.immutable.persistentListOf

components/bridge/api/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
plugins {
22
id("flipper.android-lib")
3-
id("kotlin-parcelize")
43
}
54

65
android.namespace = "com.flipperdevices.bridge.api"

components/bridge/api/src/main/java/com/flipperdevices/bridge/api/scanner/DiscoveredBluetoothDevice.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ package com.flipperdevices.bridge.api.scanner
33
import android.annotation.SuppressLint
44
import android.bluetooth.BluetoothDevice
55
import android.os.ParcelUuid
6-
import android.os.Parcelable
7-
import kotlinx.parcelize.Parcelize
86
import no.nordicsemi.android.support.v18.scanner.ScanResult
97
import java.util.UUID
108

11-
@Parcelize
129
data class DiscoveredBluetoothDevice(
1310
val device: BluetoothDevice,
1411
private var lastScanResult: ScanResult? = null,
@@ -17,7 +14,7 @@ data class DiscoveredBluetoothDevice(
1714
private var previousRssi: Int,
1815
private var highestRssiInternal: Int = Byte.MIN_VALUE.toInt(),
1916
private var servicesResult: List<ParcelUuid>? = null
20-
) : Parcelable {
17+
) {
2118
// Wrapper for data variables
2219
val address: String get() = device.address
2320
val scanResult: ScanResult? get() = lastScanResult
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
plugins {
2-
id("flipper.android-compose")
2+
id("flipper.multiplatform-compose")
3+
id("flipper.multiplatform-dependencies")
34
id("kotlinx-serialization")
45
id("kotlin-parcelize")
56
}
67

78
android.namespace = "com.flipperdevices.bridge.dao.api"
89

9-
dependencies {
10+
compose.resources {
11+
publicResClass = true
12+
}
13+
14+
commonDependencies {
15+
implementation(projects.components.core.kmpparcelize)
1016
implementation(projects.components.core.ui.theme)
11-
implementation(projects.components.core.ui.res)
1217
implementation(projects.components.core.ktx)
1318

1419
implementation(libs.kotlin.coroutines)
1520
implementation(libs.kotlin.serialization.json)
1621
implementation(libs.kotlin.immutable.collections)
22+
}
1723

18-
implementation(libs.compose.ui)
24+
androidDependencies {
25+
implementation(projects.components.core.ui.res)
1926
}

0 commit comments

Comments
 (0)