mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-26 21:13:01 +00:00
fixed uninstallation
This commit is contained in:
parent
1bf16df452
commit
a5f71ed90e
1 changed files with 12 additions and 6 deletions
|
@ -70,9 +70,7 @@ open class Home : BaseFragment() {
|
|||
if (microgStatus!!) {
|
||||
val microgVer = pm.getPackageInfo("com.mgoogle.android.gms", 0).versionName
|
||||
microguninstallbtn.setOnClickListener {
|
||||
val uri = Uri.parse("com.mgoogle.android.gms")
|
||||
val uninstall = Intent(Intent.ACTION_DELETE, uri)
|
||||
startActivity(uninstall)
|
||||
uninstallApk("com.mgoogle.android.gms")
|
||||
}
|
||||
|
||||
microgsettingsbtn.setOnClickListener {
|
||||
|
@ -99,9 +97,7 @@ open class Home : BaseFragment() {
|
|||
if (vancedStatus!!) {
|
||||
val vancedVer = pm.getPackageInfo("com.vanced.android.youtube", 0).versionName
|
||||
vanceduninstallbtn.setOnClickListener {
|
||||
val uri = Uri.parse("com.vanced.android.youtube")
|
||||
val uninstall = Intent(Intent.ACTION_DELETE, uri)
|
||||
startActivity(uninstall)
|
||||
uninstallApk("com.vanced.android.youtube")
|
||||
}
|
||||
vancedVerText.text = vancedVer.toString()
|
||||
} else {
|
||||
|
@ -179,4 +175,14 @@ open class Home : BaseFragment() {
|
|||
)
|
||||
}
|
||||
|
||||
private fun uninstallApk(pkgUri: String) {
|
||||
try {
|
||||
val uri = Uri.parse("package:$pkgUri")
|
||||
val uninstall = Intent(Intent.ACTION_DELETE, uri)
|
||||
startActivity(uninstall)
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
Toast.makeText(requireContext(), "Failed to uninstall", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue