Remove APK when app is opened

This commit is contained in:
PabloG02 2023-01-26 14:42:53 +01:00
parent 1cc0b42720
commit d442be37b6
2 changed files with 7 additions and 6 deletions

View File

@ -66,12 +66,6 @@ class AppUpdater : BroadcastReceiver() {
downloadID = downloadManager.enqueue(request)
}
init {
if (File(SkylineApplication.instance.getPublicFilesDir().canonicalPath + "/skyline.apk").exists()) {
File(SkylineApplication.instance.getPublicFilesDir().canonicalPath + "/skyline.apk").delete()
}
}
companion object {
private const val baseUrl = "https://skyline-builds.alula.gay"
private const val branch = "ftx1"
@ -158,5 +152,11 @@ class AppUpdater : BroadcastReceiver() {
return null
}
}
fun removeApk(){
if (File(SkylineApplication.instance.getPublicFilesDir().canonicalPath + "/skyline.apk").exists()) {
File(SkylineApplication.instance.getPublicFilesDir().canonicalPath + "/skyline.apk").delete()
}
}
}
}

View File

@ -154,6 +154,7 @@ class MainActivity : AppCompatActivity() {
if (BuildConfig.FLAVOR == "edge") {
binding.checkUpdatesIcon.visibility = View.GONE
} else {
AppUpdater.removeApk()
AppUpdater.notifyUpdateBadge(context, binding.checkUpdatesIcon)
binding.checkUpdatesIcon.setOnClickListener {
AppUpdater.checkForUpdates(context)