mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-05 02:15:04 +00:00
fixed build
This commit is contained in:
parent
77921e92fd
commit
d239528c15
2 changed files with 3 additions and 24 deletions
|
@ -5,12 +5,9 @@ import android.content.Context
|
|||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.dezlum.codelabs.getjson.GetJson
|
||||
import com.vanced.manager.core.base.BaseActivity
|
||||
import com.vanced.manager.ui.core.ThemedActivity
|
||||
import com.vanced.manager.ui.dialogs.DialogContainer.showSecurityDialog
|
||||
import com.vanced.manager.ui.dialogs.DialogContainer.statementFalse
|
||||
import zlc.season.rxdownload4.file
|
||||
|
||||
// This activity will NOT be used in manifest
|
||||
// since MainActivity will extend it
|
||||
|
@ -31,12 +28,6 @@ open class Main: ThemedActivity() {
|
|||
firstStart -> showSecurityDialog(this)
|
||||
!falseStatement -> statementFalse(this)
|
||||
isUpgrading -> {
|
||||
val apkUrl = GetJson().AsJSONObject("https://x1nto.github.io/VancedFiles/manager.json")
|
||||
val dwnldUrl = apkUrl.get("url").asString
|
||||
|
||||
if (dwnldUrl.file().exists())
|
||||
dwnldUrl.file().delete()
|
||||
|
||||
prefs.edit().putBoolean("isUpgrading", false).apply()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,29 +5,17 @@ import android.content.Intent
|
|||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import androidx.core.content.FileProvider
|
||||
import com.dezlum.codelabs.getjson.GetJson
|
||||
import com.vanced.manager.core.base.BaseFragment
|
||||
import zlc.season.rxdownload4.file
|
||||
import zlc.season.rxdownload4.task.Task
|
||||
import zlc.season.rxdownload4.utils.getFileNameFromUrl
|
||||
import java.io.File
|
||||
|
||||
object MicrogInstaller {
|
||||
|
||||
fun installMicrog(activity: Activity) {
|
||||
val apkUrl = GetJson().AsJSONObject("https://x1nto.github.io/VancedFiles/microg.json")
|
||||
val dwnldUrl = apkUrl.get("url").asString
|
||||
val task = activity.filesDir?.path?.let {
|
||||
Task(
|
||||
url = dwnldUrl,
|
||||
saveName = getFileNameFromUrl(dwnldUrl),
|
||||
savePath = it
|
||||
)
|
||||
}
|
||||
val pn = activity.packageName
|
||||
val apk = task?.file()
|
||||
val apk = File(activity.filesDir.path, "microg.apk")
|
||||
val uri =
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
activity.let { FileProvider.getUriForFile(it, "$pn.provider", apk!!) }
|
||||
activity.let { FileProvider.getUriForFile(it, "$pn.provider", apk) }
|
||||
} else
|
||||
Uri.fromFile(apk)
|
||||
val mIntent = Intent(Intent.ACTION_VIEW)
|
||||
|
|
Loading…
Reference in a new issue