feat(migration): add option to only show entries with new chapters (jobobby04/TachiyomiSY#1238)

(cherry picked from commit f7202e67cc3452676f5e2532015741811cd505bb)
This commit is contained in:
Tim Schneeberger 2024-08-12 00:30:19 +02:00 committed by Cuong-Tran
parent a827601186
commit 8fe7dcb167
No known key found for this signature in database
GPG key ID: 733AA7624B9315C2
5 changed files with 21 additions and 1 deletions

View file

@ -76,6 +76,7 @@ class MigrationBottomSheetDialogState(private val onStartMigration: State<(extra
binding.skipStep.isChecked = preferences.skipPreMigration().get()
binding.HideNotFoundManga.isChecked = preferences.hideNotFoundMigration().get()
binding.OnlyShowUpdates.isChecked = preferences.showOnlyUpdatesMigration().get()
binding.skipStep.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
binding.root.context.toast(
@ -88,6 +89,7 @@ class MigrationBottomSheetDialogState(private val onStartMigration: State<(extra
binding.migrateBtn.setOnClickListener {
preferences.skipPreMigration().set(binding.skipStep.isChecked)
preferences.hideNotFoundMigration().set(binding.HideNotFoundManga.isChecked)
preferences.showOnlyUpdatesMigration().set(binding.OnlyShowUpdates.isChecked)
onStartMigration.value(
if (binding.useSmartSearch.isChecked && binding.extraSearchParamText.text.isNotBlank()) {
binding.extraSearchParamText.toString()

View file

@ -94,6 +94,7 @@ class MigrationListScreenModel(
val manualMigrations = MutableStateFlow(0)
val hideNotFound = preferences.hideNotFoundMigration().get()
val showOnlyUpdates = preferences.showOnlyUpdatesMigration().get()
val navigateOut = MutableSharedFlow<Unit>()
@ -318,6 +319,12 @@ class MigrationListScreenModel(
if (result == null && hideNotFound) {
removeManga(manga)
}
if (result != null && showOnlyUpdates &&
(getChapterInfo(result.id).latestChapter ?: 0.0) <= (manga.chapterInfo.latestChapter ?: 0.0)
) {
removeManga(manga)
}
sourceFinished()
}
}

View file

@ -207,11 +207,19 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="82dp"
android:paddingHorizontal="16.dp"
android:paddingVertical="16dp"
android:text="@string/hide_not_found_entries" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/Only_show_updates"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="82dp"
android:paddingHorizontal="16.dp"
android:paddingVertical="16dp"
android:text="@string/only_show_updated_entries" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -23,6 +23,8 @@ class UnsortedPreferences(
fun hideNotFoundMigration() = preferenceStore.getBoolean("hide_not_found_migration", false)
fun showOnlyUpdatesMigration() = preferenceStore.getBoolean("show_only_updates_migration", false)
fun isHentaiEnabled() = preferenceStore.getBoolean("eh_is_hentai_enabled", true)
fun enableExhentai() = preferenceStore.getBoolean(Preference.privateKey("enable_exhentai"), false)

View file

@ -463,6 +463,7 @@
<string name="use_first_source">Use first source with alternative</string>
<string name="skip_this_step_next_time">Skip this step next time</string>
<string name="hide_not_found_entries">Hide not found entries</string>
<string name="only_show_updated_entries">Only show entries with new chapters</string>
<string name="search_parameter">Search parameter (e.g. language:english)</string>
<string name="latest_">Latest: %1$s</string>
<string name="migrating_to">migrating to</string>