fixed issue with enlang downloading

This commit is contained in:
X1nto 2020-06-22 00:05:48 +04:00
parent ff087362a7
commit f804344824
1 changed files with 15 additions and 9 deletions

View File

@ -19,7 +19,7 @@ class VancedDownloadService: Service() {
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
downloadSplits()
//stopSelf()
stopSelf()
return START_NOT_STICKY
}
@ -66,18 +66,13 @@ class VancedDownloadService: Service() {
"arch" -> downloadSplits("theme")
"theme" -> downloadSplits("lang")
"lang" -> {
if (lang == "en" || type == "enlang") {
val intent = Intent(HomeFragment.VANCED_DOWNLOADED)
intent.action = HomeFragment.VANCED_DOWNLOADED
LocalBroadcastManager.getInstance(this@VancedDownloadService).sendBroadcast(intent)
if (variant == "root")
launchRootInstaller()
else
launchInstaller()
if (lang == "en") {
prepareInstall(variant!!)
} else {
downloadSplits("enlang")
}
}
"enlang" -> prepareInstall(variant!!)
}
}
@ -90,6 +85,17 @@ class VancedDownloadService: Service() {
}
})
}
private fun prepareInstall(variant: String) {
val intent = Intent(HomeFragment.VANCED_DOWNLOADED)
intent.action = HomeFragment.VANCED_DOWNLOADED
LocalBroadcastManager.getInstance(this).sendBroadcast(intent)
if (variant == "root")
launchRootInstaller()
else
launchInstaller()
}
private fun launchInstaller() {
SplitInstaller.installSplitApk(this)
}