From 69b00d3782a1b65da2e0a818be4278cd24c8e4dd Mon Sep 17 00:00:00 2001 From: vvb2060 Date: Sat, 17 Apr 2021 17:32:07 +0800 Subject: [PATCH] Update dependencies Jcenter will sunset --- app/build.gradle.kts | 17 +++++++---------- .../com/topjohnwu/magisk/arch/BaseViewModel.kt | 2 +- .../java/com/topjohnwu/magisk/core/Receiver.kt | 2 +- .../topjohnwu/magisk/core/UpdateCheckService.kt | 4 ++-- .../topjohnwu/magisk/core/base/BaseActivity.kt | 1 + .../topjohnwu/magisk/core/base/BaseReceiver.kt | 2 +- .../topjohnwu/magisk/core/base/BaseService.kt | 2 +- .../magisk/core/download/BaseDownloader.kt | 4 ++-- .../com/topjohnwu/magisk/core/tasks/FlashZip.kt | 5 +++-- .../magisk/core/tasks/MagiskInstaller.kt | 8 ++------ .../magisk/core/utils/BiometricHelper.kt | 4 ++-- .../events/dialog/ManagerInstallDialog.kt | 4 ++-- .../magisk/events/dialog/MarkDownDialog.kt | 4 ++-- .../main/java/com/topjohnwu/magisk/ktx/XKoin.kt | 4 ++-- .../magisk/ui/install/InstallViewModel.kt | 2 +- .../magisk/ui/safetynet/CheckSafetyNetEvent.kt | 4 ++-- .../magisk/ui/settings/BaseSettingsItem.kt | 4 ++-- .../magisk/ui/settings/SettingsViewModel.kt | 2 +- build.gradle.kts | 8 +++----- buildSrc/build.gradle.kts | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 21 files changed, 40 insertions(+), 47 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index fc9aafbc0..9c3f275dd 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -16,20 +16,18 @@ kapt { javacOptions { option("-Xmaxerrs", 1000) } + arguments { + arg("room.incremental", "true") + } } android { defaultConfig { applicationId = "com.topjohnwu.magisk" vectorDrawables.useSupportLibrary = true - multiDexEnabled = true versionName = Config.version versionCode = Config.versionCode ndk.abiFilters("armeabi-v7a", "arm64-v8a", "x86", "x86_64") - - javaCompileOptions.annotationProcessorOptions.arguments( - mapOf("room.incremental" to "true") - ) } buildTypes { @@ -211,10 +209,9 @@ dependencies { implementation("com.github.topjohnwu.libsu:core:${vLibsu}") implementation("com.github.topjohnwu.libsu:io:${vLibsu}") - val vKoin = "2.1.6" - implementation("org.koin:koin-core:${vKoin}") - implementation("org.koin:koin-android:${vKoin}") - implementation("org.koin:koin-androidx-viewmodel:${vKoin}") + val vKoin = "2.2.2" + implementation("io.insert-koin:koin-android:${vKoin}") + implementation("io.insert-koin:koin-androidx-viewmodel:${vKoin}") val vRetrofit = "2.9.0" implementation("com.squareup.retrofit2:retrofit:${vRetrofit}") @@ -226,7 +223,7 @@ dependencies { implementation("com.squareup.okhttp3:logging-interceptor:${vOkHttp}") implementation("com.squareup.okhttp3:okhttp-dnsoverhttps:${vOkHttp}") - val vMoshi = "1.11.0" + val vMoshi = "1.12.0" implementation("com.squareup.moshi:moshi:${vMoshi}") kapt("com.squareup.moshi:moshi-kotlin-codegen:${vMoshi}") diff --git a/app/src/main/java/com/topjohnwu/magisk/arch/BaseViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/arch/BaseViewModel.kt index c4841a282..46c3c5bb3 100644 --- a/app/src/main/java/com/topjohnwu/magisk/arch/BaseViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/arch/BaseViewModel.kt @@ -19,7 +19,7 @@ import com.topjohnwu.magisk.events.* import com.topjohnwu.magisk.utils.ObservableHost import com.topjohnwu.magisk.utils.set import kotlinx.coroutines.Job -import org.koin.core.KoinComponent +import org.koin.core.component.KoinComponent abstract class BaseViewModel( initialState: State = State.LOADING diff --git a/app/src/main/java/com/topjohnwu/magisk/core/Receiver.kt b/app/src/main/java/com/topjohnwu/magisk/core/Receiver.kt index 257adb60d..758c44d27 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/Receiver.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/Receiver.kt @@ -5,11 +5,11 @@ import android.content.ContextWrapper import android.content.Intent import com.topjohnwu.magisk.core.base.BaseReceiver import com.topjohnwu.magisk.core.magiskdb.PolicyDao +import com.topjohnwu.magisk.ktx.inject import com.topjohnwu.magisk.view.Shortcuts import com.topjohnwu.superuser.Shell import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch -import org.koin.core.inject open class Receiver : BaseReceiver() { diff --git a/app/src/main/java/com/topjohnwu/magisk/core/UpdateCheckService.kt b/app/src/main/java/com/topjohnwu/magisk/core/UpdateCheckService.kt index 3abf5d5d8..824aaafa1 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/UpdateCheckService.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/UpdateCheckService.kt @@ -5,9 +5,9 @@ import android.content.Context import androidx.work.* import com.topjohnwu.magisk.BuildConfig import com.topjohnwu.magisk.data.repository.NetworkService +import com.topjohnwu.magisk.ktx.inject import com.topjohnwu.magisk.view.Notifications -import org.koin.core.KoinComponent -import org.koin.core.inject +import org.koin.core.component.KoinComponent import java.util.concurrent.TimeUnit class UpdateCheckService(context: Context, workerParams: WorkerParameters) diff --git a/app/src/main/java/com/topjohnwu/magisk/core/base/BaseActivity.kt b/app/src/main/java/com/topjohnwu/magisk/core/base/BaseActivity.kt index ed79c7aa4..c2099df0e 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/base/BaseActivity.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/base/BaseActivity.kt @@ -83,6 +83,7 @@ abstract class BaseActivity : AppCompatActivity() { override fun onRequestPermissionsResult( requestCode: Int, permissions: Array, grantResults: IntArray) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults) var success = true for (res in grantResults) { if (res != PackageManager.PERMISSION_GRANTED) { diff --git a/app/src/main/java/com/topjohnwu/magisk/core/base/BaseReceiver.kt b/app/src/main/java/com/topjohnwu/magisk/core/base/BaseReceiver.kt index cc544df31..e6fefd92e 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/base/BaseReceiver.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/base/BaseReceiver.kt @@ -5,7 +5,7 @@ import android.content.Context import android.content.ContextWrapper import android.content.Intent import com.topjohnwu.magisk.core.wrap -import org.koin.core.KoinComponent +import org.koin.core.component.KoinComponent abstract class BaseReceiver : BroadcastReceiver(), KoinComponent { diff --git a/app/src/main/java/com/topjohnwu/magisk/core/base/BaseService.kt b/app/src/main/java/com/topjohnwu/magisk/core/base/BaseService.kt index 869b22020..e6b674483 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/base/BaseService.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/base/BaseService.kt @@ -3,7 +3,7 @@ package com.topjohnwu.magisk.core.base import android.app.Service import android.content.Context import com.topjohnwu.magisk.core.wrap -import org.koin.core.KoinComponent +import org.koin.core.component.KoinComponent abstract class BaseService : Service(), KoinComponent { override fun attachBaseContext(base: Context) { diff --git a/app/src/main/java/com/topjohnwu/magisk/core/download/BaseDownloader.kt b/app/src/main/java/com/topjohnwu/magisk/core/download/BaseDownloader.kt index 803c3a019..91d90bd6d 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/download/BaseDownloader.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/download/BaseDownloader.kt @@ -10,14 +10,14 @@ import com.topjohnwu.magisk.core.ForegroundTracker import com.topjohnwu.magisk.core.base.BaseService import com.topjohnwu.magisk.core.utils.ProgressInputStream import com.topjohnwu.magisk.data.repository.NetworkService +import com.topjohnwu.magisk.ktx.inject import com.topjohnwu.magisk.view.Notifications import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.cancel import kotlinx.coroutines.launch import okhttp3.ResponseBody -import org.koin.android.ext.android.inject -import org.koin.core.KoinComponent +import org.koin.core.component.KoinComponent import timber.log.Timber import java.io.IOException import java.io.InputStream diff --git a/app/src/main/java/com/topjohnwu/magisk/core/tasks/FlashZip.kt b/app/src/main/java/com/topjohnwu/magisk/core/tasks/FlashZip.kt index f6e1dd3ed..cb97984c9 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/tasks/FlashZip.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/tasks/FlashZip.kt @@ -7,12 +7,13 @@ import com.topjohnwu.magisk.core.Const import com.topjohnwu.magisk.core.utils.MediaStoreUtils.displayName import com.topjohnwu.magisk.core.utils.MediaStoreUtils.inputStream import com.topjohnwu.magisk.core.utils.unzip +import com.topjohnwu.magisk.ktx.inject import com.topjohnwu.magisk.ktx.writeTo import com.topjohnwu.superuser.Shell import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext -import org.koin.core.KoinComponent -import org.koin.core.inject +import org.koin.core.component.KoinComponent + import timber.log.Timber import java.io.File import java.io.FileNotFoundException diff --git a/app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt b/app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt index 3d0bf45e7..04e6b4216 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt @@ -14,10 +14,7 @@ import com.topjohnwu.magisk.core.utils.MediaStoreUtils.inputStream import com.topjohnwu.magisk.core.utils.MediaStoreUtils.outputStream import com.topjohnwu.magisk.data.repository.NetworkService import com.topjohnwu.magisk.di.Protected -import com.topjohnwu.magisk.ktx.reboot -import com.topjohnwu.magisk.ktx.symlink -import com.topjohnwu.magisk.ktx.withStreams -import com.topjohnwu.magisk.ktx.writeTo +import com.topjohnwu.magisk.ktx.* import com.topjohnwu.magisk.utils.Utils import com.topjohnwu.signing.SignBoot import com.topjohnwu.superuser.Shell @@ -34,8 +31,7 @@ import org.kamranzafar.jtar.TarEntry import org.kamranzafar.jtar.TarHeader import org.kamranzafar.jtar.TarInputStream import org.kamranzafar.jtar.TarOutputStream -import org.koin.core.KoinComponent -import org.koin.core.inject +import org.koin.core.component.KoinComponent import timber.log.Timber import java.io.* import java.nio.ByteBuffer diff --git a/app/src/main/java/com/topjohnwu/magisk/core/utils/BiometricHelper.kt b/app/src/main/java/com/topjohnwu/magisk/core/utils/BiometricHelper.kt index 523d7319f..7a4abacf3 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/utils/BiometricHelper.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/utils/BiometricHelper.kt @@ -6,8 +6,8 @@ import androidx.core.content.ContextCompat import androidx.fragment.app.FragmentActivity import com.topjohnwu.magisk.R import com.topjohnwu.magisk.core.Config -import org.koin.core.KoinComponent -import org.koin.core.get +import com.topjohnwu.magisk.ktx.get +import org.koin.core.component.KoinComponent object BiometricHelper: KoinComponent { diff --git a/app/src/main/java/com/topjohnwu/magisk/events/dialog/ManagerInstallDialog.kt b/app/src/main/java/com/topjohnwu/magisk/events/dialog/ManagerInstallDialog.kt index 6e7063f74..36724c559 100644 --- a/app/src/main/java/com/topjohnwu/magisk/events/dialog/ManagerInstallDialog.kt +++ b/app/src/main/java/com/topjohnwu/magisk/events/dialog/ManagerInstallDialog.kt @@ -6,9 +6,9 @@ import com.topjohnwu.magisk.core.Info import com.topjohnwu.magisk.core.download.DownloadService import com.topjohnwu.magisk.core.download.Subject import com.topjohnwu.magisk.data.repository.NetworkService +import com.topjohnwu.magisk.ktx.get +import com.topjohnwu.magisk.ktx.inject import com.topjohnwu.magisk.view.MagiskDialog -import org.koin.core.get -import org.koin.core.inject import java.io.File class ManagerInstallDialog : MarkDownDialog() { diff --git a/app/src/main/java/com/topjohnwu/magisk/events/dialog/MarkDownDialog.kt b/app/src/main/java/com/topjohnwu/magisk/events/dialog/MarkDownDialog.kt index 56b95b40f..de4b8fcaa 100644 --- a/app/src/main/java/com/topjohnwu/magisk/events/dialog/MarkDownDialog.kt +++ b/app/src/main/java/com/topjohnwu/magisk/events/dialog/MarkDownDialog.kt @@ -6,13 +6,13 @@ import androidx.annotation.CallSuper import androidx.lifecycle.lifecycleScope import com.topjohnwu.magisk.R import com.topjohnwu.magisk.core.base.BaseActivity +import com.topjohnwu.magisk.ktx.inject import com.topjohnwu.magisk.view.MagiskDialog import io.noties.markwon.Markwon import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext -import org.koin.core.KoinComponent -import org.koin.core.inject +import org.koin.core.component.KoinComponent import timber.log.Timber import kotlin.coroutines.cancellation.CancellationException diff --git a/app/src/main/java/com/topjohnwu/magisk/ktx/XKoin.kt b/app/src/main/java/com/topjohnwu/magisk/ktx/XKoin.kt index a6f0a8246..fb1108431 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ktx/XKoin.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ktx/XKoin.kt @@ -1,10 +1,10 @@ package com.topjohnwu.magisk.ktx -import org.koin.core.context.KoinContextHandler +import org.koin.core.context.GlobalContext import org.koin.core.parameter.ParametersDefinition import org.koin.core.qualifier.Qualifier -fun getKoin() = KoinContextHandler.get() +fun getKoin() = GlobalContext.get() inline fun inject( qualifier: Qualifier? = null, diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt index 0902491bb..ee8ef100a 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt @@ -14,11 +14,11 @@ import com.topjohnwu.magisk.core.Info import com.topjohnwu.magisk.data.repository.NetworkService import com.topjohnwu.magisk.events.MagiskInstallFileEvent import com.topjohnwu.magisk.events.dialog.SecondSlotWarningDialog +import com.topjohnwu.magisk.ktx.get import com.topjohnwu.magisk.ui.flash.FlashFragment import com.topjohnwu.magisk.utils.set import com.topjohnwu.superuser.Shell import kotlinx.coroutines.launch -import org.koin.core.get import timber.log.Timber import java.io.File import java.io.IOException diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/safetynet/CheckSafetyNetEvent.kt b/app/src/main/java/com/topjohnwu/magisk/ui/safetynet/CheckSafetyNetEvent.kt index fc8e0d820..0d28ae096 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/safetynet/CheckSafetyNetEvent.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/safetynet/CheckSafetyNetEvent.kt @@ -14,6 +14,7 @@ import com.topjohnwu.magisk.core.Const import com.topjohnwu.magisk.data.repository.NetworkService import com.topjohnwu.magisk.ktx.createClassLoader import com.topjohnwu.magisk.ktx.reflectField +import com.topjohnwu.magisk.ktx.inject import com.topjohnwu.magisk.ktx.writeTo import com.topjohnwu.magisk.view.MagiskDialog import com.topjohnwu.signing.CryptoUtils @@ -26,8 +27,7 @@ import kotlinx.coroutines.withContext import org.bouncycastle.asn1.ASN1Encoding import org.bouncycastle.asn1.ASN1Primitive import org.bouncycastle.est.jcajce.JsseDefaultHostnameAuthorizer -import org.koin.core.KoinComponent -import org.koin.core.inject +import org.koin.core.component.KoinComponent import timber.log.Timber import java.io.ByteArrayInputStream import java.io.File diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/settings/BaseSettingsItem.kt b/app/src/main/java/com/topjohnwu/magisk/ui/settings/BaseSettingsItem.kt index c546e9c48..285f7ddf4 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/settings/BaseSettingsItem.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/settings/BaseSettingsItem.kt @@ -9,12 +9,12 @@ import androidx.databinding.Bindable import com.topjohnwu.magisk.BR import com.topjohnwu.magisk.R import com.topjohnwu.magisk.databinding.ObservableItem +import com.topjohnwu.magisk.ktx.get import com.topjohnwu.magisk.utils.TextHolder import com.topjohnwu.magisk.utils.asText import com.topjohnwu.magisk.utils.set import com.topjohnwu.magisk.view.MagiskDialog -import org.koin.core.KoinComponent -import org.koin.core.get +import org.koin.core.component.KoinComponent sealed class BaseSettingsItem : ObservableItem() { diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt index 948bb9910..4589d21ee 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt @@ -22,10 +22,10 @@ import com.topjohnwu.magisk.events.AddHomeIconEvent import com.topjohnwu.magisk.events.RecreateEvent import com.topjohnwu.magisk.events.dialog.BiometricEvent import com.topjohnwu.magisk.ktx.activity +import com.topjohnwu.magisk.ktx.get import com.topjohnwu.magisk.utils.Utils import com.topjohnwu.superuser.Shell import kotlinx.coroutines.launch -import org.koin.core.get class SettingsViewModel( private val repositoryDao: RepoDao diff --git a/build.gradle.kts b/build.gradle.kts index b4674f4ca..90cfacd03 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,8 +10,7 @@ plugins { buildscript { repositories { google() - jcenter() - maven { url = uri("https://kotlin.bintray.com/kotlinx") } + mavenCentral() } val vNav = "2.3.5" @@ -19,7 +18,7 @@ buildscript { dependencies { classpath("com.android.tools.build:gradle:4.1.3") - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.31") + classpath(kotlin("gradle-plugin", version = "1.4.32")) classpath("androidx.navigation:navigation-safe-args-gradle-plugin:${vNav}") // NOTE: Do not place your application dependencies here; they belong @@ -53,9 +52,8 @@ fun Task.applyOptimize() = doLast { subprojects { repositories { google() - jcenter() + mavenCentral() maven { url = uri("https://jitpack.io") } - maven { url = uri("http://oss.sonatype.org/content/repositories/snapshots") } } afterEvaluate { diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 4b90bc638..6379bae73 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -2,7 +2,7 @@ plugins { `kotlin-dsl` } repositories { - jcenter() + mavenCentral() } gradlePlugin { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 336a74c2a..80a809a26 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip