Clean up koin-android dependencies and upgrade koin
This commit is contained in:
parent
cfcf7b35ba
commit
ceac5fc5ce
12 changed files with 49 additions and 29 deletions
|
@ -31,7 +31,7 @@ android_app {
|
|||
"androidx.lifecycle_lifecycle-livedata-ktx",
|
||||
"androidx-constraintlayout_constraintlayout",
|
||||
"com.google.android.material_material",
|
||||
"seedvault-lib-koin-core",
|
||||
"seedvault-lib-koin-core", // did not manage to add this as transitive dependency
|
||||
"seedvault-lib-koin-android",
|
||||
"seedvault-lib-koin-androidx-viewmodel",
|
||||
"seedvault-lib-novacrypto-bip39",
|
||||
|
|
|
@ -113,14 +113,17 @@ def aospDeps = fileTree(include: [
|
|||
'libcore.jar'
|
||||
], dir: 'libs')
|
||||
|
||||
// We try to keep the dependencies in sync with what AOSP ships as Seedvault is meant to be built
|
||||
// with the AOSP build system and gradle builds are just for more pleasant development.
|
||||
// If the dependencies below are updated please make sure to update the
|
||||
// prebuilt libraries and Android.bp in the top `libs` folder to reflect that.
|
||||
// You can copy these libraries from ~/.gradle/caches/modules-2
|
||||
dependencies {
|
||||
compileOnly aospDeps
|
||||
|
||||
/**
|
||||
* Dependencies in AOSP
|
||||
*
|
||||
* We try to keep the dependencies in sync with what AOSP ships as Seedvault is meant to be built
|
||||
* with the AOSP build system and gradle builds are just for more pleasant development.
|
||||
* Using the AOSP versions in gradle builds allows us to spot issues early on.
|
||||
*/
|
||||
|
||||
//noinspection GradleDependency
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
|
||||
|
@ -153,18 +156,36 @@ dependencies {
|
|||
//noinspection GradleDependency
|
||||
implementation 'com.google.android.material:material:1.1.0-alpha05'
|
||||
|
||||
implementation 'io.github.novacrypto:BIP39:2019.01.27'
|
||||
implementation 'org.koin:koin-androidx-viewmodel:2.0.1'
|
||||
|
||||
//
|
||||
// Dependencies below do not concern the AOSP build
|
||||
//
|
||||
/**
|
||||
* External Dependencies
|
||||
*
|
||||
* If the dependencies below are updated,
|
||||
* please make sure to update the prebuilt libraries and the Android.bp files
|
||||
* in the top-level `libs` folder to reflect that.
|
||||
* You can copy these libraries from ~/.gradle/caches/modules-2
|
||||
*/
|
||||
|
||||
def koin_version = '2.1.1'
|
||||
implementation("org.koin:koin-android:$koin_version") {
|
||||
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib'
|
||||
}
|
||||
implementation("org.koin:koin-androidx-viewmodel:$koin_version") {
|
||||
exclude group: 'org.koin', module: 'koin-androidx-scope'
|
||||
exclude group: 'androidx.lifecycle'
|
||||
}
|
||||
|
||||
implementation 'io.github.novacrypto:BIP39:2019.01.27'
|
||||
|
||||
/**
|
||||
* Test Dependencies (do not concern the AOSP build)
|
||||
*/
|
||||
|
||||
lintChecks 'com.github.thirdegg:lint-rules:0.0.5-alpha'
|
||||
|
||||
def junit_version = "5.5.2" // careful, upgrading this can change a Cipher's IV size in tests!?
|
||||
def mockk_version = "1.10.0"
|
||||
testImplementation aospDeps // anything less fails tests run with gradlew
|
||||
testImplementation aospDeps // anything less than 'implementation' fails tests run with gradlew
|
||||
testImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
testImplementation('org.robolectric:robolectric:4.3.1') { // 4.4 has issue with non-idle Looper
|
||||
// https://github.com/robolectric/robolectric/issues/5245
|
||||
|
|
|
@ -18,7 +18,7 @@ import com.stevesoltys.seedvault.settings.FlashDrive
|
|||
import com.stevesoltys.seedvault.settings.SettingsManager
|
||||
import com.stevesoltys.seedvault.transport.requestBackup
|
||||
import com.stevesoltys.seedvault.ui.storage.AUTHORITY_STORAGE
|
||||
import org.koin.core.context.GlobalContext.get
|
||||
import org.koin.core.context.KoinContextHandler.get
|
||||
import java.util.concurrent.TimeUnit.HOURS
|
||||
|
||||
private val TAG = UsbIntentReceiver::class.java.simpleName
|
||||
|
@ -26,8 +26,8 @@ private val TAG = UsbIntentReceiver::class.java.simpleName
|
|||
class UsbIntentReceiver : UsbMonitor() {
|
||||
|
||||
// using KoinComponent would crash robolectric tests :(
|
||||
private val settingsManager: SettingsManager by lazy { get().koin.get<SettingsManager>() }
|
||||
private val metadataManager: MetadataManager by lazy { get().koin.get<MetadataManager>() }
|
||||
private val settingsManager: SettingsManager by lazy { get().get<SettingsManager>() }
|
||||
private val metadataManager: MetadataManager by lazy { get().get<MetadataManager>() }
|
||||
|
||||
override fun shouldMonitorStatus(context: Context, action: String, device: UsbDevice): Boolean {
|
||||
if (action != ACTION_USB_DEVICE_ATTACHED) return false
|
||||
|
|
|
@ -6,7 +6,7 @@ import android.content.Intent
|
|||
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
import androidx.core.net.toUri
|
||||
import com.stevesoltys.seedvault.ui.notification.BackupNotificationManager
|
||||
import org.koin.core.context.GlobalContext.get
|
||||
import org.koin.core.context.KoinContextHandler.get
|
||||
|
||||
internal const val ACTION_RESTORE_ERROR_UNINSTALL = "com.stevesoltys.seedvault.action.UNINSTALL"
|
||||
internal const val EXTRA_PACKAGE_NAME = "com.stevesoltys.seedvault.extra.PACKAGE_NAME"
|
||||
|
@ -15,7 +15,7 @@ internal const val REQUEST_CODE_UNINSTALL = 4576841
|
|||
class RestoreErrorBroadcastReceiver : BroadcastReceiver() {
|
||||
|
||||
// using KoinComponent would crash robolectric tests :(
|
||||
private val notificationManager: BackupNotificationManager by lazy { get().koin.get<BackupNotificationManager>() }
|
||||
private val notificationManager: BackupNotificationManager by lazy { get().get<BackupNotificationManager>() }
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
if (intent.action != ACTION_RESTORE_ERROR_UNINSTALL) return
|
||||
|
|
|
@ -17,7 +17,7 @@ import com.stevesoltys.seedvault.transport.backup.PackageService
|
|||
import com.stevesoltys.seedvault.ui.notification.BackupNotificationManager
|
||||
import com.stevesoltys.seedvault.ui.notification.NotificationBackupObserver
|
||||
import org.koin.core.KoinComponent
|
||||
import org.koin.core.context.GlobalContext.get
|
||||
import org.koin.core.context.KoinContextHandler.get
|
||||
import org.koin.core.inject
|
||||
|
||||
private val TAG = ConfigurableBackupTransportService::class.java.simpleName
|
||||
|
@ -56,17 +56,17 @@ class ConfigurableBackupTransportService : Service(), KoinComponent {
|
|||
|
||||
@WorkerThread
|
||||
fun requestBackup(context: Context) {
|
||||
val packageService: PackageService = get().koin.get()
|
||||
val packageService: PackageService = get().get()
|
||||
val packages = packageService.eligiblePackages
|
||||
val appTotals = packageService.expectedAppTotals
|
||||
|
||||
val observer = NotificationBackupObserver(context, packages.size, appTotals)
|
||||
val result = try {
|
||||
val backupManager: IBackupManager = get().koin.get()
|
||||
val backupManager: IBackupManager = get().get()
|
||||
backupManager.requestBackup(packages, observer, BackupMonitor(), 0)
|
||||
} catch (e: RemoteException) {
|
||||
Log.e(TAG, "Error during backup: ", e)
|
||||
val nm: BackupNotificationManager = get().koin.get()
|
||||
val nm: BackupNotificationManager = get().get()
|
||||
nm.onBackupError()
|
||||
}
|
||||
if (result == BackupManager.SUCCESS) {
|
||||
|
|
Binary file not shown.
|
@ -1,18 +1,17 @@
|
|||
java_import {
|
||||
name: "seedvault-lib-koin-core",
|
||||
host_supported: true,
|
||||
jars: ["koin-core-2.0.1.jar"],
|
||||
android_library_import {
|
||||
name: "seedvault-lib-koin-androidx-viewmodel",
|
||||
aars: ["koin-androidx-viewmodel-2.1.1.aar"],
|
||||
sdk_version: "current",
|
||||
}
|
||||
|
||||
android_library_import {
|
||||
name: "seedvault-lib-koin-android",
|
||||
aars: ["koin-android-2.0.1.aar"],
|
||||
aars: ["koin-android-2.1.1.aar"],
|
||||
sdk_version: "current",
|
||||
}
|
||||
|
||||
android_library_import {
|
||||
name: "seedvault-lib-koin-androidx-viewmodel",
|
||||
aars: ["koin-androidx-viewmodel-2.0.1.aar"],
|
||||
java_import {
|
||||
name: "seedvault-lib-koin-core",
|
||||
jars: ["koin-core-2.1.1.jar"],
|
||||
sdk_version: "current",
|
||||
}
|
BIN
libs/koin-android/koin-android-2.1.1.aar
Normal file
BIN
libs/koin-android/koin-android-2.1.1.aar
Normal file
Binary file not shown.
BIN
libs/koin-android/koin-androidx-viewmodel-2.1.1.aar
Normal file
BIN
libs/koin-android/koin-androidx-viewmodel-2.1.1.aar
Normal file
Binary file not shown.
BIN
libs/koin-android/koin-core-2.1.1.jar
Normal file
BIN
libs/koin-android/koin-core-2.1.1.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue