diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 578dc88..987347a 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -14,6 +14,11 @@ + + + + + get() = _notifyResposts private val _notifyFollows = MutableLiveData().apply { DefaultKeys.NOTIFY_FOLLOWS } val notifyFollows: LiveData get() = _notifyFollows + private val _externalSigner = MutableLiveData().apply { DefaultKeys.EXTERNAL_SIGNER } + val externalSigner: LiveData get() = _externalSigner fun init(context: Context) { val masterKey: MasterKey = @@ -82,6 +86,12 @@ object EncryptedStorage { _notifyMentions.value = sharedPreferences.getBoolean(PrefKeys.NOTIFY_MENTIONS, DefaultKeys.NOTIFY_MENTIONS) _notifyResposts.value = sharedPreferences.getBoolean(PrefKeys.NOTIFY_REPOSTS, DefaultKeys.NOTIFY_REPOSTS) _notifyFollows.value = sharedPreferences.getBoolean(PrefKeys.NOTIFY_FOLLOWS, DefaultKeys.NOTIFY_FOLLOWS) + _externalSigner.value = sharedPreferences.getString(PrefKeys.EXTERNAL_SIGNER, DefaultKeys.EXTERNAL_SIGNER) ?: DefaultKeys.EXTERNAL_SIGNER + } + + fun updateExternalSigner(newValue: String) { + sharedPreferences.edit().putString(PrefKeys.EXTERNAL_SIGNER, newValue).apply() + _externalSigner.value = newValue } fun updatePubKey(newValue: String) { diff --git a/app/src/main/java/com/koalasat/pokey/models/ExternalSigner.kt b/app/src/main/java/com/koalasat/pokey/models/ExternalSigner.kt index b741801..6873782 100644 --- a/app/src/main/java/com/koalasat/pokey/models/ExternalSigner.kt +++ b/app/src/main/java/com/koalasat/pokey/models/ExternalSigner.kt @@ -45,6 +45,9 @@ object ExternalSigner { val pubkey = split.first() if (split.first().isNotEmpty()) { EncryptedStorage.updatePubKey(pubkey) + if (split.size > 1) { + EncryptedStorage.updateExternalSigner(split[1]) + } startLauncher() } } @@ -98,7 +101,10 @@ object ExternalSigner { private fun startLauncher() { var pubKey = EncryptedStorage.pubKey.value if (pubKey == null) pubKey = "" - externalSignerLauncher = ExternalSignerLauncher(pubKey, signerPackageName = "") + var externalSignerPackage = EncryptedStorage.externalSigner.value + if (externalSignerPackage == null) externalSignerPackage = "" + if (pubKey.isEmpty()) externalSignerPackage = "" + externalSignerLauncher = ExternalSignerLauncher(pubKey, signerPackageName = externalSignerPackage) externalSignerLauncher.registerLauncher( launcher = { try {