aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2021-05-30 11:28:46 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2021-05-30 11:43:57 +0530
commit7f7c0e7cb1c63ea62d8385a3df2373a52aa0eb8f (patch)
tree7d269a06390022d250dc1879e3add47b4c6f16c0 /app
parent5e9a91a3b821e356f74f1728372a58220c49069c (diff)
app: replace getEncryptedProxyPrefs with injection
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/ui/proxy/ProxySelectorActivity.kt6
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/util/extensions/AndroidExtensions.kt3
2 files changed, 3 insertions, 6 deletions
diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/proxy/ProxySelectorActivity.kt b/app/src/main/java/dev/msfjarvis/aps/ui/proxy/ProxySelectorActivity.kt
index 90aea7ae..b69267cf 100644
--- a/app/src/main/java/dev/msfjarvis/aps/ui/proxy/ProxySelectorActivity.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/ui/proxy/ProxySelectorActivity.kt
@@ -5,6 +5,7 @@
package dev.msfjarvis.aps.ui.proxy
+import android.content.SharedPreferences
import android.os.Bundle
import android.os.Handler
import android.os.Looper
@@ -16,9 +17,8 @@ import androidx.core.widget.doOnTextChanged
import dagger.hilt.android.AndroidEntryPoint
import dev.msfjarvis.aps.R
import dev.msfjarvis.aps.databinding.ActivityProxySelectorBinding
-import dev.msfjarvis.aps.util.extensions.getEncryptedProxyPrefs
+import dev.msfjarvis.aps.injection.prefs.ProxyPreferences
import dev.msfjarvis.aps.util.extensions.getString
-import dev.msfjarvis.aps.util.extensions.unsafeLazy
import dev.msfjarvis.aps.util.extensions.viewBinding
import dev.msfjarvis.aps.util.proxy.ProxyUtils
import dev.msfjarvis.aps.util.settings.GitSettings
@@ -32,10 +32,10 @@ private val WEB_ADDRESS_REGEX = Patterns.WEB_URL.toRegex()
class ProxySelectorActivity : AppCompatActivity() {
@Inject lateinit var gitSettings: GitSettings
+ @ProxyPreferences @Inject lateinit var proxyPrefs: SharedPreferences
@Inject lateinit var proxyUtils: ProxyUtils
private val binding by viewBinding(ActivityProxySelectorBinding::inflate)
- private val proxyPrefs by unsafeLazy { applicationContext.getEncryptedProxyPrefs() }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
diff --git a/app/src/main/java/dev/msfjarvis/aps/util/extensions/AndroidExtensions.kt b/app/src/main/java/dev/msfjarvis/aps/util/extensions/AndroidExtensions.kt
index 29554127..ae175433 100644
--- a/app/src/main/java/dev/msfjarvis/aps/util/extensions/AndroidExtensions.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/util/extensions/AndroidExtensions.kt
@@ -63,9 +63,6 @@ val Context.clipboard
/** Wrapper for [getEncryptedPrefs] to avoid open-coding the file name at each call site */
fun Context.getEncryptedGitPrefs() = getEncryptedPrefs("git_operation")
-/** Wrapper for [getEncryptedPrefs] to get the encrypted preference set for the HTTP proxy. */
-fun Context.getEncryptedProxyPrefs() = getEncryptedPrefs("http_proxy")
-
/** Get an instance of [EncryptedSharedPreferences] with the given [fileName] */
private fun Context.getEncryptedPrefs(fileName: String): SharedPreferences {
val masterKeyAlias =