Skip to content

Commit

Permalink
[fix|build] Fix an issue that unable to export more than 1000 sticker…
Browse files Browse the repository at this point in the history
…s at once; update dependencies
  • Loading branch information
SkyD666 committed Sep 5, 2024
1 parent 665c341 commit fddd6b1
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 37 deletions.
49 changes: 23 additions & 26 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ android {
minSdk = 24
targetSdk = 34
versionCode = 67
versionName = "2.3-alpha04"
versionName = "2.3-alpha05"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down Expand Up @@ -142,49 +142,46 @@ tasks.withType(KotlinCompile::class.java).configureEach {
}

dependencies {
val md3Version: String by rootProject.extra
val mlkitRecognitionVersion: String by rootProject.extra
val roomVersion: String by rootProject.extra
implementation("androidx.core:core-ktx:1.13.1")
implementation("androidx.compose.ui:ui:1.6.8")
implementation("androidx.compose.material3:material3:$md3Version")
implementation("androidx.compose.material3:material3-window-size-class:$md3Version")
implementation("androidx.compose.material:material:1.6.8")
implementation("androidx.compose.material:material-icons-extended:1.6.8")
implementation("androidx.compose.ui:ui-tooling-preview:1.6.8")
implementation("androidx.compose.ui:ui:1.7.0")
implementation("androidx.compose.material3:material3:1.3.0")
implementation("androidx.compose.material3:material3-window-size-class:1.3.0")
implementation("androidx.compose.material:material:1.7.0")
implementation("androidx.compose.material:material-icons-extended:1.7.0")
implementation("androidx.compose.ui:ui-tooling-preview:1.7.0")
implementation("com.google.android.material:material:1.12.0")
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.8.4")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.4")
implementation("androidx.activity:activity-compose:1.9.1")
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.8.5")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.5")
implementation("androidx.activity:activity-compose:1.9.2")
implementation("androidx.palette:palette-ktx:1.0.0")
implementation("com.google.dagger:hilt-android:2.52")
ksp("com.google.dagger:hilt-android-compiler:2.52")
implementation("androidx.hilt:hilt-navigation-compose:1.2.0")
implementation("androidx.navigation:navigation-compose:2.7.7")
implementation("androidx.navigation:navigation-compose:2.8.0")
implementation("androidx.security:security-crypto:1.1.0-alpha06")
implementation("com.google.accompanist:accompanist-drawablepainter:0.34.0")
implementation("com.google.accompanist:accompanist-drawablepainter:0.36.0")
implementation("io.coil-kt:coil-compose:2.7.0")
implementation("io.coil-kt:coil-gif:2.7.0")
implementation("io.coil-kt:coil-svg:2.7.0")
implementation("androidx.profileinstaller:profileinstaller:1.3.1")
implementation("androidx.core:core-splashscreen:1.0.1")
implementation("androidx.room:room-runtime:$roomVersion")
implementation("androidx.room:room-ktx:$roomVersion")
ksp("androidx.room:room-compiler:$roomVersion")
implementation("androidx.room:room-runtime:2.6.1")
implementation("androidx.room:room-ktx:2.6.1")
ksp("androidx.room:room-compiler:2.6.1")
implementation("com.github.thegrizzlylabs:sardine-android:0.8")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.2")
implementation("com.materialkolor:material-kolor:1.7.0")
implementation("androidx.datastore:datastore-preferences:1.1.1")
implementation("com.airbnb.android:lottie-compose:6.5.0")
implementation("com.airbnb.android:lottie-compose:6.5.2")

implementation("com.squareup.retrofit2:retrofit:2.11.0")
implementation("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0")

// Google ML Kit
implementation("com.google.mlkit:text-recognition:$mlkitRecognitionVersion")
implementation("com.google.mlkit:text-recognition-chinese:$mlkitRecognitionVersion")
implementation("com.google.mlkit:text-recognition-japanese:$mlkitRecognitionVersion")
implementation("com.google.mlkit:text-recognition-korean:$mlkitRecognitionVersion")
implementation("com.google.mlkit:text-recognition:16.0.1")
implementation("com.google.mlkit:text-recognition-chinese:16.0.1")
implementation("com.google.mlkit:text-recognition-japanese:16.0.1")
implementation("com.google.mlkit:text-recognition-korean:16.0.1")
implementation("com.google.mlkit:image-labeling-custom:17.0.3")
implementation("com.google.mlkit:segmentation-selfie:16.0.0-beta6")

Expand All @@ -194,6 +191,6 @@ dependencies {

implementation("com.github.penfeizhou.android.animation:apng:3.0.1")

debugImplementation("androidx.compose.ui:ui-tooling:1.6.8")
debugImplementation("androidx.compose.ui:ui-test-manifest:1.6.8")
debugImplementation("androidx.compose.ui:ui-tooling:1.7.0")
debugImplementation("androidx.compose.ui:ui-test-manifest:1.7.0")
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,29 @@ class ImportExportFilesRepository @Inject constructor(
excludeShareCount: Boolean = false,
excludeCreateTime: Boolean = false,
excludeModifyTime: Boolean = false,
exportStickers: Collection<String>? = null,
exportStickers: List<String>? = null,
): Flow<ImportExportInfo> {
return flowOnIo {
val startTime = System.currentTimeMillis()
val allStickerWithTagsList = if (exportStickers == null) {
stickerDao.getAllStickerWithTagsList()
} else {
stickerDao.getAllStickerWithTagsList(exportStickers)
// https://stackoverflow.com/questions/7106016/too-many-sql-variables-error-in-django-with-sqlite3
// SQLite: To prevent excessive memory allocations,
// the maximum value of a host parameter number is SQLITE_MAX_VARIABLE_NUMBER,
// which defaults to 999
mutableListOf<StickerWithTags>().apply {
for (i in exportStickers.indices step 900) {
addAll(
stickerDao.getAllStickerWithTagsList(
exportStickers.subList(
fromIndex = i,
toIndex = minOf(i + 900, exportStickers.size),
)
)
)
}
}
}
val totalCount = allStickerWithTagsList.size
var currentCount = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ sealed interface ExportFilesIntent : MviIntent {
val excludeShareCount: Boolean = false,
val excludeCreateTime: Boolean = false,
val excludeModifyTime: Boolean = false,
val exportStickers: Collection<String>? = null,
val exportStickers: List<String>? = null,
) : ExportFilesIntent
}
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ fun ExportFilesScreen(
},
dismissButton = {
TextButton(onClick = { openExportDialog = null }) {
Text(text = stringResource(id = R.string.cancel))
Text(text = stringResource(id = R.string.dialog_ok))
}
}
)
Expand Down
7 changes: 0 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
buildscript {
extra.apply {
set("md3Version", "1.2.1")
set("mlkitRecognitionVersion", "16.0.1")
set("roomVersion", "2.6.1")
}
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.5.2" apply false
Expand Down

0 comments on commit fddd6b1

Please sign in to comment.