Improve android autofill settings open, bump version (#846)

This commit is contained in:
Leendert de Borst
2025-05-30 15:35:41 +02:00
parent f313950112
commit f271040ff4
2 changed files with 10 additions and 3 deletions

View File

@@ -93,8 +93,8 @@ android {
applicationId 'net.aliasvault.app'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "0.17.0"
versionCode 2
versionName "0.18.0"
}
signingConfigs {
debug {

View File

@@ -496,8 +496,15 @@ class NativeVaultManager(reactContext: ReactApplicationContext) :
@ReactMethod
override fun openAutofillSettingsPage(promise: Promise) {
try {
// Note: we add a 2 to the packageUri on purpose because if we don't,
// when the user has configured AliasVault as the autofill service already
// this action won't open the settings anymore, making the button in the UI
// become broken and not do anything anymore. This is not good UX so instead
// we append a "2" so Android will always open the page as it does not equal
// the actual chosen option.
val packageUri = "package:${reactApplicationContext.packageName}2".toUri()
val autofillIntent = Intent(Settings.ACTION_REQUEST_SET_AUTOFILL_SERVICE).apply {
data = "package:${reactApplicationContext.packageName}".toUri()
data = packageUri
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}