adjustments
This commit is contained in:
parent
dc03af09ec
commit
fad94279a5
|
@ -6,6 +6,7 @@ import android.content.Intent
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.IBinder
|
import android.os.IBinder
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||||
import com.dezlum.codelabs.getjson.GetJson
|
import com.dezlum.codelabs.getjson.GetJson
|
||||||
import com.downloader.Error
|
import com.downloader.Error
|
||||||
import com.downloader.OnDownloadListener
|
import com.downloader.OnDownloadListener
|
||||||
|
@ -13,6 +14,7 @@ import com.downloader.OnStartOrResumeListener
|
||||||
import com.downloader.PRDownloader
|
import com.downloader.PRDownloader
|
||||||
import com.vanced.manager.R
|
import com.vanced.manager.R
|
||||||
import com.vanced.manager.core.installer.AppInstaller
|
import com.vanced.manager.core.installer.AppInstaller
|
||||||
|
import com.vanced.manager.ui.fragments.HomeFragment
|
||||||
import com.vanced.manager.utils.InternetTools.getFileNameFromUrl
|
import com.vanced.manager.utils.InternetTools.getFileNameFromUrl
|
||||||
import com.vanced.manager.utils.NotificationHelper
|
import com.vanced.manager.utils.NotificationHelper
|
||||||
import com.vanced.manager.utils.NotificationHelper.cancelNotif
|
import com.vanced.manager.utils.NotificationHelper.cancelNotif
|
||||||
|
@ -59,6 +61,9 @@ class MicrogDownloadService: Service() {
|
||||||
val intent = Intent(this@MicrogDownloadService, AppInstaller::class.java)
|
val intent = Intent(this@MicrogDownloadService, AppInstaller::class.java)
|
||||||
intent.putExtra("path", "${filesDir.path}/microg.apk")
|
intent.putExtra("path", "${filesDir.path}/microg.apk")
|
||||||
intent.putExtra("pkg", "com.mgoogle.android.gms")
|
intent.putExtra("pkg", "com.mgoogle.android.gms")
|
||||||
|
val mIntent = Intent(HomeFragment.MICROG_DOWNLOADED)
|
||||||
|
mIntent.action = HomeFragment.MICROG_DOWNLOADED
|
||||||
|
LocalBroadcastManager.getInstance(this@MicrogDownloadService).sendBroadcast(mIntent)
|
||||||
startService(intent)
|
startService(intent)
|
||||||
}
|
}
|
||||||
override fun onError(error: Error) {
|
override fun onError(error: Error) {
|
||||||
|
|
|
@ -65,7 +65,7 @@ open class Home : BaseFragment(), View.OnClickListener {
|
||||||
when (v?.id) {
|
when (v?.id) {
|
||||||
R.id.vanced_installbtn -> {
|
R.id.vanced_installbtn -> {
|
||||||
if (!isVancedDownloading!!) {
|
if (!isVancedDownloading!!) {
|
||||||
if (MiuiHelper.isMiui()) {
|
if (!MiuiHelper.isMiuiOptimisationsDisabled()) {
|
||||||
activity?.let {
|
activity?.let {
|
||||||
secondMiuiDialog(it)
|
secondMiuiDialog(it)
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ object DialogContainer {
|
||||||
AlertDialog.Builder(context)
|
AlertDialog.Builder(context)
|
||||||
.setTitle(context.resources.getString(R.string.welcome))
|
.setTitle(context.resources.getString(R.string.welcome))
|
||||||
.setMessage(context.resources.getString(R.string.security_context))
|
.setMessage(context.resources.getString(R.string.security_context))
|
||||||
|
.setCancelable(false)
|
||||||
.setPositiveButton(context.resources.getString(R.string.close)) { dialog, _ ->
|
.setPositiveButton(context.resources.getString(R.string.close)) { dialog, _ ->
|
||||||
run {
|
run {
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
|
|
|
@ -7,9 +7,9 @@ import java.io.InputStreamReader
|
||||||
|
|
||||||
object MiuiHelper {
|
object MiuiHelper {
|
||||||
|
|
||||||
fun isMiui(): Boolean {
|
fun isMiui(): Boolean = !TextUtils.isEmpty(getSystemProps("ro.miui.ui.version.name"))
|
||||||
return !TextUtils.isEmpty(getSystemProps("ro.miui.system.version.name"))
|
|
||||||
}
|
fun isMiuiOptimisationsDisabled(): Boolean = getSystemProps("persist.sys.miui_optimization") == "0"
|
||||||
|
|
||||||
private fun getSystemProps(propname: String): String? {
|
private fun getSystemProps(propname: String): String? {
|
||||||
val line: String
|
val line: String
|
||||||
|
|
|
@ -81,7 +81,7 @@
|
||||||
<string name="miui_one_title">Detected MiUI user!</string>
|
<string name="miui_one_title">Detected MiUI user!</string>
|
||||||
<string name="miui_one">Hey! Looks like you\'re a MiUI user. in order to properly use Vanced Manager, you will have to disable MiUI optimisations in developer settings\nIf you can\'t find such setting, it means that you are using a new version of ROM which does not need fixing anything.</string>
|
<string name="miui_one">Hey! Looks like you\'re a MiUI user. in order to properly use Vanced Manager, you will have to disable MiUI optimisations in developer settings\nIf you can\'t find such setting, it means that you are using a new version of ROM which does not need fixing anything.</string>
|
||||||
<string name="miui_two_title">I\'m gonna stop you right there!</string>
|
<string name="miui_two_title">I\'m gonna stop you right there!</string>
|
||||||
<string name="miui_two">I am once again asking you to disable MiUI optimisations if you have not already. K thx bai</string>
|
<string name="miui_two">Looks like you did NOT disable MiUI optimisations. Please disable it. K thx bai</string>
|
||||||
<string name="error">Error</string>
|
<string name="error">Error</string>
|
||||||
<string name="security_context">Please make sure you downloaded app from vanced.app, Vanced Discord server or GitHub</string>
|
<string name="security_context">Please make sure you downloaded app from vanced.app, Vanced Discord server or GitHub</string>
|
||||||
<string name="success">Success!</string>
|
<string name="success">Success!</string>
|
||||||
|
|
Loading…
Reference in New Issue