Skip to content

Commit

Permalink
Make PINs work with password managers.
Browse files Browse the repository at this point in the history
  • Loading branch information
greyson-signal committed Apr 24, 2020
1 parent 9f033e6 commit 7db288b
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ dependencies {
implementation "androidx.camera:camera-camera2:1.0.0-beta01"
implementation "androidx.camera:camera-lifecycle:1.0.0-beta01"
implementation "androidx.concurrent:concurrent-futures:1.0.0"
implementation "androidx.autofill:autofill:1.0.0"

implementation('com.google.firebase:firebase-messaging:17.3.4') {
exclude group: 'com.google.firebase', module: 'firebase-core'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.autofill.HintConstants;
import androidx.core.app.DialogCompat;
import androidx.core.view.ViewCompat;

import com.google.android.material.textfield.TextInputLayout;

Expand Down Expand Up @@ -72,6 +74,7 @@ public static void show(@NonNull Context context, @NonNull Launcher launcher, @N
ServiceUtil.getInputMethodManager(pinEditText.getContext()).showSoftInput(pinEditText, 0);
}
});
ViewCompat.setAutofillHints(pinEditText, HintConstants.AUTOFILL_HINT_PASSWORD);

switch (SignalStore.pinValues().getKeyboardType()) {
case NUMERIC:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.autofill.AutofillManager;

import androidx.annotation.NonNull;
import androidx.annotation.RawRes;
import androidx.appcompat.app.AlertDialog;
import androidx.autofill.HintConstants;
import androidx.core.content.ContextCompat;
import androidx.core.view.ViewCompat;
import androidx.lifecycle.ViewModelProviders;

import com.airbnb.lottie.LottieAnimationView;
Expand Down Expand Up @@ -39,6 +42,7 @@ protected void initializeViewStates() {
} else {
initializeViewStatesForPinCreate();
}
ViewCompat.setAutofillHints(getInput(), HintConstants.AUTOFILL_HINT_NEW_PASSWORD);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package org.thoughtcrime.securesms.lock.v2;

import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.PluralsRes;
import androidx.autofill.HintConstants;
import androidx.core.view.ViewCompat;
import androidx.lifecycle.ViewModelProviders;
import androidx.navigation.Navigation;

Expand All @@ -21,6 +25,7 @@ protected void initializeViewStates() {

getLabel().setText(getPinLengthRestrictionText(R.plurals.CreateKbsPinFragment__pin_must_be_at_least_digits));
getConfirm().setEnabled(false);
ViewCompat.setAutofillHints(getInput(), HintConstants.AUTOFILL_HINT_NEW_PASSWORD);
}

private void initializeViewStatesForPinChange(boolean isForgotPin) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
import androidx.autofill.HintConstants;
import androidx.core.view.ViewCompat;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProviders;
import androidx.navigation.Navigation;
Expand Down Expand Up @@ -87,6 +89,7 @@ private void initViews(@NonNull View root) {
}
return false;
});
ViewCompat.setAutofillHints(pinEntry, HintConstants.AUTOFILL_HINT_PASSWORD);

enableAndFocusPinEntry();

Expand Down
3 changes: 3 additions & 0 deletions app/witness-verifications.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ dependencyVerification {
['androidx.asynclayoutinflater:asynclayoutinflater:1.0.0',
'f7eab60c57addd94bb06275832fe7600611beaaae1a1ec597c231956faf96c8b'],

['androidx.autofill:autofill:1.0.0',
'c9468f56e05006ea151a426c54957cd0799b8b83a579d2846dd22061f33e5ecd'],

['androidx.camera:camera-camera2:1.0.0-beta01',
'02e15ad76153d09adcd6631627960707a8786333a8276d05dcbefc2bfe4ef5a1'],

Expand Down

0 comments on commit 7db288b

Please sign in to comment.