Skip to content
Snippets Groups Projects
Commit 0f89dade authored by Nicolas Pomepuy's avatar Nicolas Pomepuy Committed by Duncan McNamara
Browse files

Make the nightly auto update an opt-in feature

Fixes #3076
parent 4c9e2e27
No related branches found
No related tags found
1 merge request!1952Make the nightly auto update an opt-in feature
......@@ -626,6 +626,8 @@
<string name="install_nightly">Install the nightly version</string>
<string name="install_nightly_alert">Nightly builds are experimental versions updated everyday.\n\nExpect new features but also new bugs!</string>
<string name="nightly_version">Found version: %2$s - %1$s</string>
<string name="update_nightly_alert">You are running a nightly version. Would you like to periodically look for updates?</string>
<string name="update_nightly">Auto update</string>
<!-- Accessibility -->
......
......@@ -23,6 +23,7 @@ package org.videolan.vlc.gui
import android.annotation.SuppressLint
import android.annotation.TargetApi
import android.app.Activity
import android.app.AlertDialog
import android.content.Intent
import android.os.Build
import android.os.Bundle
......@@ -123,8 +124,20 @@ class MainActivity : ContentActivity(),
}
lifecycleScope.launch {
if (!BuildConfig.DEBUG) return@launch
AutoUpdate.clean(this@MainActivity.application)
if (!settings.getBoolean(KEY_SHOW_UPDATE, true)) return@launch
if (!settings.contains(KEY_SHOW_UPDATE)) {
AlertDialog.Builder(this@MainActivity)
.setTitle(resources.getString(R.string.update_nightly))
.setMessage(resources.getString(R.string.update_nightly_alert))
.setPositiveButton(R.string.yes){ _, _ ->
settings.putSingle(KEY_SHOW_UPDATE, true)
}
.setNegativeButton(R.string.no, null)
.show()
return@launch
}
AutoUpdate.checkUpdate(this@MainActivity.application) {url, date ->
val updateDialog = UpdateDialog().apply {
arguments = bundleOf(UPDATE_URL to url, UPDATE_DATE to date.time)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment