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

This commit is contained in:
Tim Schneeberger 2024-08-12 00:30:19 +02:00 committed by GitHub
parent 155b03c176
commit f7202e67cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 21 additions and 1 deletions

View File

@ -74,6 +74,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(
@ -86,6 +87,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>()
@ -313,6 +314,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

@ -464,6 +464,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>