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:
parent
ab9a2dcfeb
commit
0d9439e8c3
323 changed files with 74 additions and 50598 deletions
|
|
@ -217,8 +217,6 @@ kover {
|
||||||
//noinspection UseTomlInstead
|
//noinspection UseTomlInstead
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
implementation(project(":shared"))
|
|
||||||
|
|
||||||
implementation(libs.androidx.core.ktx)
|
implementation(libs.androidx.core.ktx)
|
||||||
implementation(libs.androidx.lifecycle.runtime.ktx)
|
implementation(libs.androidx.lifecycle.runtime.ktx)
|
||||||
implementation(libs.androidx.activity.compose)
|
implementation(libs.androidx.activity.compose)
|
||||||
|
|
|
||||||
|
|
@ -160,8 +160,6 @@ private fun ImportedFile.toImportedBookFile(): ImportedBookFile {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
expect fun currentTimestamp(): Long
|
|
||||||
|
|
||||||
fun String.toFileType(): FileType {
|
fun String.toFileType(): FileType {
|
||||||
return SharedFileCapabilities.fileTypeForName(this)
|
return SharedFileCapabilities.fileTypeForName(this)
|
||||||
}
|
}
|
||||||
|
|
@ -19,7 +19,10 @@ const val LOCAL_FOLDER_SYNC_DATA_DIR = "EpistemeSyncData"
|
||||||
const val LOCAL_FOLDER_ANNOTATION_SUFFIX = "_annotations"
|
const val LOCAL_FOLDER_ANNOTATION_SUFFIX = "_annotations"
|
||||||
const val LOCAL_FOLDER_SIDECAR_HASH_PREFIX = "book_"
|
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 {
|
fun localFolderSyncSidecarStem(bookId: String): String {
|
||||||
return LOCAL_FOLDER_SIDECAR_HASH_PREFIX + localFolderSyncSha256ShortHex(bookId)
|
return LOCAL_FOLDER_SIDECAR_HASH_PREFIX + localFolderSyncSha256ShortHex(bookId)
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
package org.dueattendant149.bookreader.shared
|
||||||
|
|
||||||
|
fun currentTimestamp(): Long = System.currentTimeMillis()
|
||||||
|
|
@ -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())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -9,7 +9,7 @@ import androidx.compose.ui.graphics.asImageBitmap
|
||||||
import androidx.compose.ui.layout.ContentScale
|
import androidx.compose.ui.layout.ContentScale
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
internal actual fun LocalBookCoverImage(
|
internal fun LocalBookCoverImage(
|
||||||
path: String,
|
path: String,
|
||||||
contentDescription: String?,
|
contentDescription: String?,
|
||||||
modifier: Modifier
|
modifier: Modifier
|
||||||
|
|
@ -2,6 +2,8 @@ package org.dueattendant149.bookreader.shared.ui
|
||||||
|
|
||||||
import androidx.compose.runtime.compositionLocalOf
|
import androidx.compose.runtime.compositionLocalOf
|
||||||
import androidx.compose.runtime.Composable
|
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
|
||||||
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)
|
return (availableWidth * widthFraction.coerceIn(0f, 1f)).coerceIn(lowerBound, upperBound)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
internal expect fun SharedReaderModalLayer(
|
internal fun SharedReaderModalLayer(
|
||||||
onDismiss: () -> Unit,
|
onDismiss: () -> Unit,
|
||||||
level: SharedReaderModalLevel = SharedReaderModalLevel.Popup,
|
level: SharedReaderModalLevel = SharedReaderModalLevel.Popup,
|
||||||
content: @Composable () -> Unit
|
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
|
@Composable
|
||||||
expect fun SharedReaderModalOwnerWindowProvider(
|
fun SharedReaderModalOwnerWindowProvider(
|
||||||
ownerWindow: Any?,
|
ownerWindow: Any?,
|
||||||
content: @Composable () -> Unit
|
content: @Composable () -> Unit
|
||||||
)
|
) {
|
||||||
|
content()
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SharedReaderPopupLayer(
|
fun SharedReaderPopupLayer(
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue