Only show self-update option if sideloaded

This commit is contained in:
Corewala 2022-06-20 11:37:33 -04:00
parent 6d4dbbda94
commit c23b3efb70
3 changed files with 7 additions and 7 deletions

View File

@ -4,6 +4,7 @@ import android.app.Activity.RESULT_OK
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.content.pm.PackageManager
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.net.Uri
@ -92,16 +93,17 @@ class SettingsFragment: PreferenceFragmentCompat(), Preference.OnPreferenceChang
appCategory.addPreference(searchPreference)
//Updates ---------------------------------------------
val aboutUpdater = Preference(context)
aboutUpdater.summary = getString(R.string.self_update_summary)
aboutUpdater.isPersistent = false
aboutUpdater.isSelectable = false
appCategory.addPreference(aboutUpdater)
val sideloadedHashCode = -899861527
val isSideloaded = context.packageManager.getPackageInfo(
context.packageName,
PackageManager.GET_SIGNATURES
).signatures[0].hashCode() == sideloadedHashCode
val checkForUpdates = SwitchPreferenceCompat(context)
checkForUpdates.setDefaultValue(false)
checkForUpdates.key = "check_for_updates"
checkForUpdates.title = getString(R.string.check_for_updates)
checkForUpdates.isVisible = isSideloaded
appCategory.addPreference(checkForUpdates)
//Certificates

View File

@ -79,7 +79,6 @@
<string name="cert_unloaded">Certificat dechargé</string>
<string name="set_home_capsule">Choisir comme capsule d\'accueil</string>
<string name="check_for_updates">Vérifier pour des mises à jour</string>
<string name="self_update_summary">L\'instalation automatique des mises à jour ne fonctionne que si Bourane est installée manuellement.</string>
<string name="new_version_available">Nouvelle version disponible</string>
<string name="no_internet">Aucun accès internet</string>
<string name="retry">Réessayer</string>

View File

@ -79,7 +79,6 @@
<string name="cert_unloaded">Certificate unloaded</string>
<string name="set_home_capsule">Set home capsule</string>
<string name="check_for_updates">Check for updates</string>
<string name="self_update_summary">Automatic update installation will only work if Buran is sideloaded.</string>
<string name="new_version_available">New version available</string>
<string name="no_internet">No internet access</string>
<string name="retry">Retry</string>