Tweak documentation and drop unused import

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2021-05-22 20:04:36 +05:30
parent a2741cd871
commit f66652cbc6
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
5 changed files with 6 additions and 15 deletions

View file

@ -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.

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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