diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2021-05-22 20:04:36 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2021-05-22 20:14:21 +0530 |
commit | f66652cbc60ec11773b1435aebd3636b1dc9f5e1 (patch) | |
tree | b4018795eddd4dcdd958e47bd62d4f0210f33367 /app | |
parent | a2741cd871d91758950848ef5ae123bbc5b1d6b7 (diff) |
Tweak documentation and drop unused import
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app')
5 files changed, 6 insertions, 15 deletions
diff --git a/app/src/main/java/dev/msfjarvis/aps/injection/context/ContextModule.kt b/app/src/main/java/dev/msfjarvis/aps/injection/context/ContextModule.kt index 0f1acac8..41e59bf9 100644 --- a/app/src/main/java/dev/msfjarvis/aps/injection/context/ContextModule.kt +++ b/app/src/main/java/dev/msfjarvis/aps/injection/context/ContextModule.kt @@ -12,9 +12,9 @@ import dagger.hilt.components.SingletonComponent class ContextModule { /** - * A method which provides the path of app-specific files directory. This is useful where we want - * to perform file operations but we do not want to depend on the [Context]. Injecting this in - * place of [Context] allows the method/class to be unit-tested without any mocks/fakes. + * We inject [Context.getFilesDir] to break the dependency on [Context], allowing tests to run on + * the JVM. The principle here is identical to why [dev.msfjarvis.aps.util.totp.TotpFinder] + * exists. * * @param context [ApplicationContext] * @return the path of app-specific files directory. diff --git a/app/src/main/java/dev/msfjarvis/aps/injection/context/FilesDirPath.kt b/app/src/main/java/dev/msfjarvis/aps/injection/context/FilesDirPath.kt index 8ab96f59..f6419354 100644 --- a/app/src/main/java/dev/msfjarvis/aps/injection/context/FilesDirPath.kt +++ b/app/src/main/java/dev/msfjarvis/aps/injection/context/FilesDirPath.kt @@ -1,11 +1,7 @@ package dev.msfjarvis.aps.injection.context import android.content.Context -import dev.msfjarvis.aps.util.settings.GitSettings import javax.inject.Qualifier -/** - * Qualifier for a string value that needs to be provided to the [GitSettings]. It points to - * `applicationContext.filesDir` and helps in removing the dependency on [Context]. - */ +/** Qualifies a [String] representing the absolute path of [Context.getFilesDir]. */ @Qualifier @Retention(AnnotationRetention.RUNTIME) annotation class FilesDirPath diff --git a/app/src/main/java/dev/msfjarvis/aps/injection/prefs/GitPreferences.kt b/app/src/main/java/dev/msfjarvis/aps/injection/prefs/GitPreferences.kt index 69de66f2..2947a64d 100644 --- a/app/src/main/java/dev/msfjarvis/aps/injection/prefs/GitPreferences.kt +++ b/app/src/main/java/dev/msfjarvis/aps/injection/prefs/GitPreferences.kt @@ -1,11 +1,9 @@ package dev.msfjarvis.aps.injection.prefs import android.content.SharedPreferences -import dev.msfjarvis.aps.util.settings.GitSettings import javax.inject.Qualifier /** - * Qualifier for a [SharedPreferences] that needs to be provided to the [GitSettings]. It provides a - * [SharedPreferences] with the file name "git_operation" which stores the git settings. + * Qualifies a [SharedPreferences] instance specifically used for encrypted Git-related settings. */ @Qualifier @Retention(AnnotationRetention.RUNTIME) annotation class GitPreferences diff --git a/app/src/main/java/dev/msfjarvis/aps/injection/prefs/ProxyPreferences.kt b/app/src/main/java/dev/msfjarvis/aps/injection/prefs/ProxyPreferences.kt index 67d6f4dc..5fa99140 100644 --- a/app/src/main/java/dev/msfjarvis/aps/injection/prefs/ProxyPreferences.kt +++ b/app/src/main/java/dev/msfjarvis/aps/injection/prefs/ProxyPreferences.kt @@ -1,11 +1,9 @@ package dev.msfjarvis.aps.injection.prefs import android.content.SharedPreferences -import dev.msfjarvis.aps.util.settings.GitSettings import javax.inject.Qualifier /** - * Qualifier for a [SharedPreferences] that needs to be provided to the [GitSettings]. It provides a - * [SharedPreferences] with the file name "http_proxy" which stores all the http proxy settings. + * Qualifies a [SharedPreferences] instance specifically used for encrypted proxy-related settings. */ @Qualifier @Retention(AnnotationRetention.RUNTIME) annotation class ProxyPreferences diff --git a/app/src/test/java/dev/msfjarvis/aps/util/settings/MigrationsTest.kt b/app/src/test/java/dev/msfjarvis/aps/util/settings/MigrationsTest.kt index 98b021b5..4e9f8b17 100644 --- a/app/src/test/java/dev/msfjarvis/aps/util/settings/MigrationsTest.kt +++ b/app/src/test/java/dev/msfjarvis/aps/util/settings/MigrationsTest.kt @@ -11,7 +11,6 @@ import android.content.SharedPreferences import androidx.core.content.edit import com.github.ivanshafran.sharedpreferencesmock.SPMockBuilder import dev.msfjarvis.aps.util.extensions.getString -import dev.msfjarvis.aps.util.extensions.sharedPrefs import org.junit.Assert.assertEquals import org.junit.Assert.assertFalse import org.junit.Assert.assertNull |