feat(build): KMP → Android-only migration (Phase 1.2)

- Delete desktopApp/ and shared/ modules.
- Merge shared commonMain + androidMain + readerJvmMain sources into app/src/main/kotlin.
- Resolve expect/actual declarations by keeping android implementations.
- Remove project(':shared') dependency and KMP plugins from build files.
- Simplify settings.gradle.kts to single :app module; root project renamed BookReader.
- Remove JVM-only code (javax.imageio/ImageIO in SharedJvmBookLoader).
- Make LocalFolderSync helpers public for cross-package use in Android module.
- Baseline ':app:assembleOssDebug' passes (APK ~80 MB).
This commit is contained in:
Atte149 2026-06-24 10:36:09 +03:00
parent ab9a2dcfeb
commit 0d9439e8c3
323 changed files with 74 additions and 50598 deletions

View file

@ -217,8 +217,6 @@ kover {
//noinspection UseTomlInstead
dependencies {
implementation(project(":shared"))
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)

View file

@ -160,8 +160,6 @@ private fun ImportedFile.toImportedBookFile(): ImportedBookFile {
)
}
expect fun currentTimestamp(): Long
fun String.toFileType(): FileType {
return SharedFileCapabilities.fileTypeForName(this)
}

View file

@ -19,7 +19,10 @@ const val LOCAL_FOLDER_SYNC_DATA_DIR = "EpistemeSyncData"
const val LOCAL_FOLDER_ANNOTATION_SUFFIX = "_annotations"
const val LOCAL_FOLDER_SIDECAR_HASH_PREFIX = "book_"
internal expect fun localFolderSyncSha256ShortHex(value: String): String
fun localFolderSyncSha256ShortHex(value: String): String {
val bytes = java.security.MessageDigest.getInstance("SHA-256").digest(value.toByteArray())
return bytes.joinToString("") { "%02x".format(it) }.take(12)
}
fun localFolderSyncSidecarStem(bookId: String): String {
return LOCAL_FOLDER_SIDECAR_HASH_PREFIX + localFolderSyncSha256ShortHex(bookId)

View file

@ -0,0 +1,3 @@
package org.dueattendant149.bookreader.shared
fun currentTimestamp(): Long = System.currentTimeMillis()

View file

@ -0,0 +1,27 @@
package org.dueattendant149.bookreader.shared.reader
import android.util.Log
import org.dueattendant149.bookreader.BuildConfig
const val SharedReaderDiagnosticsProperty = "episteme.desktop.diagnostics"
const val SharedReaderDiagnosticsTagsProperty = "episteme.desktop.diagnostics.tags"
const val SharedEpubCutoffDiagnosticsTag = "EpistemeEpubCutoff"
val SharedReaderDiagnosticsEnabled: Boolean = BuildConfig.DEBUG
fun isSharedReaderDiagnosticTagEnabled(tag: String): Boolean {
if (!BuildConfig.DEBUG) return false
return tag == SharedEpubCutoffDiagnosticsTag ||
runCatching { Log.isLoggable(tag, Log.DEBUG) }.getOrDefault(false)
}
fun writeSharedReaderDiagnostic(tag: String, message: String) {
if (!BuildConfig.DEBUG) return
Log.d(tag, message)
}
inline fun logSharedReaderDiagnostic(tag: String, message: () -> String) {
if (SharedReaderDiagnosticsEnabled && isSharedReaderDiagnosticTagEnabled(tag)) {
writeSharedReaderDiagnostic(tag, message())
}
}

View file

@ -9,7 +9,7 @@ import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.layout.ContentScale
@Composable
internal actual fun LocalBookCoverImage(
internal fun LocalBookCoverImage(
path: String,
contentDescription: String?,
modifier: Modifier

View file

@ -2,6 +2,8 @@ package org.dueattendant149.bookreader.shared.ui
import androidx.compose.runtime.compositionLocalOf
import androidx.compose.runtime.Composable
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
@ -40,20 +42,32 @@ fun sharedReaderPopupWidth(
return (availableWidth * widthFraction.coerceIn(0f, 1f)).coerceIn(lowerBound, upperBound)
}
@Composable
internal expect fun SharedReaderModalLayer(
internal fun SharedReaderModalLayer(
onDismiss: () -> Unit,
level: SharedReaderModalLevel = SharedReaderModalLevel.Popup,
content: @Composable () -> Unit
)
) {
Dialog(
onDismissRequest = onDismiss,
properties = DialogProperties(usePlatformDefaultWidth = false)
) {
content()
}
}
internal expect fun sharedReaderModalLayerUsesSizedEdgeWindow(level: SharedReaderModalLevel): Boolean
internal fun sharedReaderModalLayerUsesSizedEdgeWindow(level: SharedReaderModalLevel): Boolean {
return false
}
@Composable
expect fun SharedReaderModalOwnerWindowProvider(
fun SharedReaderModalOwnerWindowProvider(
ownerWindow: Any?,
content: @Composable () -> Unit
)
) {
content()
}
@Composable
fun SharedReaderPopupLayer(

Some files were not shown because too many files have changed in this diff Show more