@@ -13,8 +13,10 @@ import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
1313import io.reactivex.rxjava3.disposables.Disposable
1414import java.util.concurrent.TimeUnit
1515import org.schabi.newpipe.MainActivity
16+ import org.schabi.newpipe.NewVersionWorker.Companion.enqueueNewVersionCheckingWork
1617import org.schabi.newpipe.R
1718import org.schabi.newpipe.ktx.animate
19+ import org.schabi.newpipe.util.ReleaseVersionUtil
1820import org.schabi.newpipe.util.external_communication.ShareUtils
1921
2022class ErrorPanelHelper (
@@ -39,6 +41,8 @@ class ErrorPanelHelper(
3941 errorPanelRoot.findViewById(R .id.error_retry_button)
4042 private val errorOpenInBrowserButton: Button =
4143 errorPanelRoot.findViewById(R .id.error_open_in_browser)
44+ private val errorCheckForUpdatesButton: Button =
45+ errorPanelRoot.findViewById(R .id.error_check_for_updates)
4246
4347 private var errorDisposable: Disposable ? = null
4448 private var retryShouldBeShown: Boolean = (onRetry != null )
@@ -60,6 +64,7 @@ class ErrorPanelHelper(
6064 errorActionButton.isVisible = false
6165 errorRetryButton.isVisible = false
6266 errorOpenInBrowserButton.isVisible = false
67+ errorCheckForUpdatesButton.isVisible = false
6368 }
6469
6570 fun showError (errorInfo : ErrorInfo ) {
@@ -78,6 +83,14 @@ class ErrorPanelHelper(
7883 showAndSetErrorButtonAction(R .string.error_snackbar_action) {
7984 ErrorUtil .openActivity(context, errorInfo)
8085 }
86+ if (ReleaseVersionUtil .isReleaseApk) {
87+ errorCheckForUpdatesButton.isVisible = true
88+ errorCheckForUpdatesButton.setOnClickListener {
89+ enqueueNewVersionCheckingWork(context, true )
90+ errorCheckForUpdatesButton.isEnabled = false
91+ errorCheckForUpdatesButton.isVisible = false
92+ }
93+ }
8194 }
8295
8396 if (errorInfo.isRetryable) {
0 commit comments