diff options
11 files changed, 25 insertions, 32 deletions
diff --git a/app/src/main/java/dev/msfjarvis/aps/injection/password/PasswordModule.kt b/app/src/main/java/dev/msfjarvis/aps/injection/password/PasswordModule.kt deleted file mode 100644 index dd795d14..00000000 --- a/app/src/main/java/dev/msfjarvis/aps/injection/password/PasswordModule.kt +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved. - * SPDX-License-Identifier: GPL-3.0-only - */ - -package dev.msfjarvis.aps.injection.password - -import dagger.assisted.AssistedFactory -import dev.msfjarvis.aps.data.passfile.PasswordEntry -import kotlinx.coroutines.CoroutineScope - -@AssistedFactory -interface PasswordEntryFactory { - fun create(scope: CoroutineScope, bytes: ByteArray): PasswordEntry -} diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivity.kt b/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivity.kt index 67273110..282864e1 100644 --- a/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivity.kt +++ b/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivity.kt @@ -24,7 +24,7 @@ import com.github.michaelbull.result.onFailure import com.github.michaelbull.result.onSuccess import com.github.michaelbull.result.runCatching import dagger.hilt.android.AndroidEntryPoint -import dev.msfjarvis.aps.injection.password.PasswordEntryFactory +import dev.msfjarvis.aps.data.passfile.PasswordEntry import dev.msfjarvis.aps.util.autofill.AutofillPreferences import dev.msfjarvis.aps.util.autofill.AutofillResponseBuilder import dev.msfjarvis.aps.util.autofill.DirectoryStructure @@ -85,7 +85,7 @@ class AutofillDecryptActivity : AppCompatActivity() { } } - @Inject lateinit var passwordEntryFactory: PasswordEntryFactory + @Inject lateinit var passwordEntryFactory: PasswordEntry.Factory private val decryptInteractionRequiredAction = registerForActivityResult(StartIntentSenderForResult()) { result -> diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivityV2.kt b/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivityV2.kt index b1ad3156..5e722a54 100644 --- a/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivityV2.kt +++ b/app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivityV2.kt @@ -21,8 +21,8 @@ import com.github.michaelbull.result.onFailure import com.github.michaelbull.result.onSuccess import com.github.michaelbull.result.runCatching import dagger.hilt.android.AndroidEntryPoint +import dev.msfjarvis.aps.data.passfile.PasswordEntry import dev.msfjarvis.aps.injection.crypto.CryptoSet -import dev.msfjarvis.aps.injection.password.PasswordEntryFactory import dev.msfjarvis.aps.ui.crypto.DecryptActivityV2 import dev.msfjarvis.aps.util.autofill.AutofillPreferences import dev.msfjarvis.aps.util.autofill.AutofillResponseBuilder @@ -72,7 +72,7 @@ class AutofillDecryptActivityV2 : AppCompatActivity() { } } - @Inject lateinit var passwordEntryFactory: PasswordEntryFactory + @Inject lateinit var passwordEntryFactory: PasswordEntry.Factory @Inject lateinit var cryptos: CryptoSet private lateinit var directoryStructure: DirectoryStructure diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/DecryptActivity.kt b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/DecryptActivity.kt index 1e46dfda..b5f33012 100644 --- a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/DecryptActivity.kt +++ b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/DecryptActivity.kt @@ -19,7 +19,6 @@ import dev.msfjarvis.aps.R import dev.msfjarvis.aps.data.passfile.PasswordEntry import dev.msfjarvis.aps.data.password.FieldItem import dev.msfjarvis.aps.databinding.DecryptLayoutBinding -import dev.msfjarvis.aps.injection.password.PasswordEntryFactory import dev.msfjarvis.aps.ui.adapters.FieldItemAdapter import dev.msfjarvis.aps.util.extensions.unsafeLazy import dev.msfjarvis.aps.util.extensions.viewBinding @@ -45,7 +44,7 @@ import org.openintents.openpgp.IOpenPgpService2 class DecryptActivity : BasePgpActivity(), OpenPgpServiceConnection.OnBound { private val binding by viewBinding(DecryptLayoutBinding::inflate) - @Inject lateinit var passwordEntryFactory: PasswordEntryFactory + @Inject lateinit var passwordEntryFactory: PasswordEntry.Factory private val relativeParentPath by unsafeLazy { getParentPath(fullPath, repoPath) } private var passwordEntry: PasswordEntry? = null diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/DecryptActivityV2.kt b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/DecryptActivityV2.kt index 4b49632d..40a721af 100644 --- a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/DecryptActivityV2.kt +++ b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/DecryptActivityV2.kt @@ -16,7 +16,6 @@ import dev.msfjarvis.aps.data.passfile.PasswordEntry import dev.msfjarvis.aps.data.password.FieldItem import dev.msfjarvis.aps.databinding.DecryptLayoutBinding import dev.msfjarvis.aps.injection.crypto.CryptoSet -import dev.msfjarvis.aps.injection.password.PasswordEntryFactory import dev.msfjarvis.aps.ui.adapters.FieldItemAdapter import dev.msfjarvis.aps.util.extensions.unsafeLazy import dev.msfjarvis.aps.util.extensions.viewBinding @@ -36,7 +35,7 @@ import kotlinx.coroutines.withContext class DecryptActivityV2 : BasePgpActivity() { private val binding by viewBinding(DecryptLayoutBinding::inflate) - @Inject lateinit var passwordEntryFactory: PasswordEntryFactory + @Inject lateinit var passwordEntryFactory: PasswordEntry.Factory @Inject lateinit var cryptos: CryptoSet private val relativeParentPath by unsafeLazy { getParentPath(fullPath, repoPath) } diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivity.kt b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivity.kt index 947ee1ea..d10f4ef6 100644 --- a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivity.kt +++ b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivity.kt @@ -29,9 +29,9 @@ import com.google.zxing.integration.android.IntentIntegrator import com.google.zxing.integration.android.IntentIntegrator.QR_CODE import dagger.hilt.android.AndroidEntryPoint import dev.msfjarvis.aps.R +import dev.msfjarvis.aps.data.passfile.PasswordEntry import dev.msfjarvis.aps.data.repo.PasswordRepository import dev.msfjarvis.aps.databinding.PasswordCreationActivityBinding -import dev.msfjarvis.aps.injection.password.PasswordEntryFactory import dev.msfjarvis.aps.ui.dialogs.OtpImportDialogFragment import dev.msfjarvis.aps.ui.dialogs.PasswordGeneratorDialogFragment import dev.msfjarvis.aps.ui.dialogs.XkPasswordGeneratorDialogFragment @@ -65,7 +65,7 @@ import me.msfjarvis.openpgpktx.util.OpenPgpServiceConnection class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnBound { private val binding by viewBinding(PasswordCreationActivityBinding::inflate) - @Inject lateinit var passwordEntryFactory: PasswordEntryFactory + @Inject lateinit var passwordEntryFactory: PasswordEntry.Factory private val suggestedName by unsafeLazy { intent.getStringExtra(EXTRA_FILE_NAME) } private val suggestedPass by unsafeLazy { intent.getStringExtra(EXTRA_PASSWORD) } diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivityV2.kt b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivityV2.kt index 095ce53e..71793a40 100644 --- a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivityV2.kt +++ b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivityV2.kt @@ -26,9 +26,9 @@ import com.google.zxing.integration.android.IntentIntegrator import com.google.zxing.integration.android.IntentIntegrator.QR_CODE import dagger.hilt.android.AndroidEntryPoint import dev.msfjarvis.aps.R +import dev.msfjarvis.aps.data.passfile.PasswordEntry import dev.msfjarvis.aps.databinding.PasswordCreationActivityBinding import dev.msfjarvis.aps.injection.crypto.CryptoSet -import dev.msfjarvis.aps.injection.password.PasswordEntryFactory import dev.msfjarvis.aps.ui.dialogs.OtpImportDialogFragment import dev.msfjarvis.aps.ui.dialogs.PasswordGeneratorDialogFragment import dev.msfjarvis.aps.ui.dialogs.XkPasswordGeneratorDialogFragment @@ -58,7 +58,7 @@ import logcat.logcat class PasswordCreationActivityV2 : BasePgpActivity() { private val binding by viewBinding(PasswordCreationActivityBinding::inflate) - @Inject lateinit var passwordEntryFactory: PasswordEntryFactory + @Inject lateinit var passwordEntryFactory: PasswordEntry.Factory @Inject lateinit var cryptos: CryptoSet private val suggestedName by unsafeLazy { intent.getStringExtra(EXTRA_FILE_NAME) } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 48b0ff0e..6c4786e8 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -35,7 +35,7 @@ gradlePlugin { dependencies { implementation("com.android.tools.build:gradle:7.0.3") implementation("com.diffplug.spotless:spotless-plugin-gradle:5.16.0") - implementation("com.google.dagger:hilt-android-gradle-plugin:2.39.1") + implementation("com.google.dagger:hilt-android-gradle-plugin:2.40.1") implementation("com.squareup.okhttp3:okhttp:4.9.0") implementation("com.vanniktech:gradle-maven-publish-plugin:0.18.0") implementation("com.vdurmont:semver4j:3.1.0") diff --git a/format-common/api/format-common.api b/format-common/api/format-common.api index 88f5d330..d0caaf78 100644 --- a/format-common/api/format-common.api +++ b/format-common/api/format-common.api @@ -9,6 +9,10 @@ public final class dev/msfjarvis/aps/data/passfile/PasswordEntry { public final fun hasTotp ()Z } +public abstract interface class dev/msfjarvis/aps/data/passfile/PasswordEntry$Factory { + public abstract fun create (Lkotlinx/coroutines/CoroutineScope;[B)Ldev/msfjarvis/aps/data/passfile/PasswordEntry; +} + public class dev/msfjarvis/aps/util/time/UserClock : java/time/Clock { public fun <init> ()V public fun getZone ()Ljava/time/ZoneId; diff --git a/format-common/src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt b/format-common/src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt index efcc6078..408069a2 100644 --- a/format-common/src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt +++ b/format-common/src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt @@ -7,6 +7,7 @@ package dev.msfjarvis.aps.data.passfile import com.github.michaelbull.result.mapBoth import dagger.assisted.Assisted +import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject import dev.msfjarvis.aps.util.time.UserClock import dev.msfjarvis.aps.util.totp.Otp @@ -197,6 +198,11 @@ constructor( } } + @AssistedFactory + public interface Factory { + public fun create(scope: CoroutineScope, bytes: ByteArray): PasswordEntry + } + internal companion object { private const val EXTRA_CONTENT = "Extra Content" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 525b4a1d..af24329b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ compose = "1.1.0-beta02" composeSnapshot = "-" coroutines = "1.5.2" flowbinding = "1.2.0" -hilt = "2.39.1" +hilt = "2.40.1" kotlin = "1.5.31" lifecycle = "2.4.0" @@ -31,7 +31,7 @@ androidx-lifecycle-common = { module = "androidx.lifecycle:lifecycle-common", ve androidx-lifecycle-livedataKtx = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref="lifecycle" } androidx-lifecycle-viewmodelKtx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref="lifecycle" } androidx-lifecycle-viewmodel-compose = "androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha07" -androidx-material = "com.google.android.material:material:1.5.0-alpha05" +androidx-material = "com.google.android.material:material:1.5.0-beta01" androidx-preference = "androidx.preference:preference:1.2.0-alpha02" androidx-recyclerview = "androidx.recyclerview:recyclerview:1.3.0-alpha01" androidx-recyclerviewSelection = "androidx.recyclerview:recyclerview-selection:1.2.0-alpha01" @@ -75,7 +75,7 @@ thirdparty-jgit = "org.eclipse.jgit:org.eclipse.jgit:3.7.1.201504261725-r" thirdparty-kotlinResult = "com.michael-bull.kotlin-result:kotlin-result:1.1.13" thirdparty-leakcanary = "com.squareup.leakcanary:leakcanary-android:2.7" thirdparty-logcat = "com.squareup.logcat:logcat:0.1" -thirdparty-modernAndroidPrefs = "de.maxr1998:modernandroidpreferences:2.2.0" +thirdparty-modernAndroidPrefs = "de.maxr1998:modernandroidpreferences:2.2.1" thirdparty-pgpainless = "org.pgpainless:pgpainless-core:1.0.0-rc1" thirdparty-plumber = "com.squareup.leakcanary:plumber-android:2.7" thirdparty-sshj = "com.hierynomus:sshj:0.32.0" @@ -86,7 +86,7 @@ thirdparty-nonfree-googlePlayAuthApiPhone = "com.google.android.gms:play-service # Testing dependencies testing-junit = "junit:junit:4.13.2" testing-kotlintest-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" } -testing-robolectric = "org.robolectric:robolectric:4.6.1" +testing-robolectric = "org.robolectric:robolectric:4.7" testing-sharedPrefsMock = "com.github.android-password-store:shared-preferences-fake:2.0.0" androidx-testing-rules = { module = "androidx.test:rules", version.ref="androidx_test" } androidx-testing-runner = { module = "androidx.test:runner", version.ref="androidx_test" } |