From 434329268a8410e817af1007165065e838c3f1fc Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 30 May 2021 02:29:43 +0530 Subject: BasePgpActivity: inject settings through Hilt Signed-off-by: Harsh Shandilya --- app/src/main/java/dev/msfjarvis/aps/ui/crypto/BasePgpActivity.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/BasePgpActivity.kt b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/BasePgpActivity.kt index 681025aa..ee753fe5 100644 --- a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/BasePgpActivity.kt +++ b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/BasePgpActivity.kt @@ -24,22 +24,25 @@ import com.github.michaelbull.result.getOr import com.github.michaelbull.result.runCatching import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.snackbar.Snackbar +import dagger.hilt.android.AndroidEntryPoint import dev.msfjarvis.aps.R +import dev.msfjarvis.aps.injection.prefs.SettingsPreferences import dev.msfjarvis.aps.util.extensions.OPENPGP_PROVIDER import dev.msfjarvis.aps.util.extensions.clipboard import dev.msfjarvis.aps.util.extensions.getString -import dev.msfjarvis.aps.util.extensions.sharedPrefs import dev.msfjarvis.aps.util.extensions.snackbar import dev.msfjarvis.aps.util.extensions.unsafeLazy import dev.msfjarvis.aps.util.services.ClipboardService import dev.msfjarvis.aps.util.settings.PreferenceKeys import java.io.File +import javax.inject.Inject import me.msfjarvis.openpgpktx.util.OpenPgpApi import me.msfjarvis.openpgpktx.util.OpenPgpServiceConnection import org.openintents.openpgp.IOpenPgpService2 import org.openintents.openpgp.OpenPgpError @Suppress("Registered") +@AndroidEntryPoint open class BasePgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound { /** Full path to the repository */ @@ -56,7 +59,7 @@ open class BasePgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBou val name: String by unsafeLazy { File(fullPath).nameWithoutExtension } /** [SharedPreferences] instance used by subclasses to persist settings */ - val settings: SharedPreferences by unsafeLazy { sharedPrefs } + @SettingsPreferences @Inject lateinit var settings: SharedPreferences /** * Handle to the [OpenPgpApi] instance that is used by subclasses to interface with OpenKeychain. -- cgit v1.2.3