mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 14:31:50 +01:00
Show prompt for first time tapping update all for extensions
This commit is contained in:
parent
31d16f421a
commit
3e3e6ee19f
@ -424,6 +424,8 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun incognitoMode() = flowPrefs.getBoolean(Keys.incognitoMode, false)
|
||||
|
||||
fun hasPromptedBeforeUpdateAll() = flowPrefs.getBoolean("has_prompted_update_all", false)
|
||||
|
||||
fun filterChapterByRead() = flowPrefs.getInt(Keys.defaultChapterFilterByRead, Manga.SHOW_ALL)
|
||||
|
||||
fun filterChapterByDownloaded() = flowPrefs.getInt(Keys.defaultChapterFilterByDownloaded, Manga.SHOW_ALL)
|
||||
|
@ -41,7 +41,7 @@ typealias ExtensionIntallInfo = Pair<InstallStep, PackageInstaller.SessionInfo?>
|
||||
class ExtensionBottomPresenter(
|
||||
private val bottomSheet: ExtensionBottomSheet,
|
||||
private val extensionManager: ExtensionManager = Injekt.get(),
|
||||
private val preferences: PreferencesHelper = Injekt.get()
|
||||
val preferences: PreferencesHelper = Injekt.get()
|
||||
) : BaseCoroutinePresenter(), ExtensionsChangedListener {
|
||||
|
||||
private var extensions = emptyList<ExtensionItem>()
|
||||
|
@ -7,6 +7,7 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||
@ -202,6 +203,21 @@ class ExtensionBottomSheet @JvmOverloads constructor(context: Context, attrs: At
|
||||
}
|
||||
|
||||
override fun onUpdateAllClicked(position: Int) {
|
||||
if (!presenter.preferences.hasPromptedBeforeUpdateAll().get()) {
|
||||
MaterialDialog(controller.activity!!)
|
||||
.title(R.string.update_all)
|
||||
.message(R.string.some_extensions_may_prompt)
|
||||
.positiveButton(android.R.string.ok) {
|
||||
presenter.preferences.hasPromptedBeforeUpdateAll().set(true)
|
||||
updateAllExtensions(position)
|
||||
}
|
||||
.show()
|
||||
} else {
|
||||
updateAllExtensions(position)
|
||||
}
|
||||
}
|
||||
|
||||
fun updateAllExtensions(position: Int) {
|
||||
val header = (extAdapter?.getSectionHeader(position)) as? ExtensionGroupItem ?: return
|
||||
val items = extAdapter?.getSectionItemPositions(header)
|
||||
items?.forEach {
|
||||
|
@ -313,6 +313,7 @@
|
||||
<string name="_must_be_enabled_first">%1$s must be enabled first</string>
|
||||
<string name="could_not_install_extension">Could not install extension</string>
|
||||
<string name="update_all">Update all</string>
|
||||
<string name="some_extensions_may_prompt">Some extensions may still prompt to be installed first.</string>
|
||||
<string name="updating_extensions">Updating extensions</string>
|
||||
<plurals name="_updates_pending">
|
||||
<item quantity="one">%d update pending</item>
|
||||
@ -984,5 +985,6 @@
|
||||
<string name="use_default">Use default</string>
|
||||
<string name="view_all_errors">View all errors</string>
|
||||
<string name="view_chapters">View chapters</string>
|
||||
<string name="warning">Warning</string>
|
||||
<string name="wifi">Wi-Fi</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user