CreatePinActivity naming update and copy fixes.
parent
b29b3d0432
commit
e14861d79d
|
@ -124,7 +124,7 @@ public final class RegistrationLockDialog {
|
|||
dialog.dismiss();
|
||||
RegistrationLockReminders.scheduleReminder(context, true);
|
||||
|
||||
fragment.startActivityForResult(CreateKbsPinActivity.getIntentForPinUpdate(context), CreateKbsPinActivity.REQUEST_NEW_PIN);
|
||||
fragment.startActivityForResult(CreateKbsPinActivity.getIntentForPinChangeFromForgotPin(context), CreateKbsPinActivity.REQUEST_NEW_PIN);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -24,22 +24,22 @@ import org.thoughtcrime.securesms.util.SpanUtil;
|
|||
|
||||
public class ConfirmKbsPinFragment extends BaseKbsPinFragment<ConfirmKbsPinViewModel> {
|
||||
|
||||
private ConfirmKbsPinFragmentArgs args;
|
||||
private ConfirmKbsPinViewModel viewModel;
|
||||
|
||||
@Override
|
||||
protected void initializeViewStates() {
|
||||
args = ConfirmKbsPinFragmentArgs.fromBundle(requireArguments());
|
||||
ConfirmKbsPinFragmentArgs args = ConfirmKbsPinFragmentArgs.fromBundle(requireArguments());
|
||||
|
||||
if (args.getIsNewPin()) {
|
||||
initializeViewStatesForPinCreate();
|
||||
if (args.getIsPinChange()) {
|
||||
initializeViewStatesForPinChange();
|
||||
} else {
|
||||
initializeViewStatesForPinUpdate();
|
||||
initializeViewStatesForPinCreate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ConfirmKbsPinViewModel initializeViewModel() {
|
||||
ConfirmKbsPinFragmentArgs args = ConfirmKbsPinFragmentArgs.fromBundle(requireArguments());
|
||||
KbsPin userEntry = Preconditions.checkNotNull(args.getUserEntry());
|
||||
PinKeyboardType keyboard = args.getKeyboard();
|
||||
ConfirmKbsPinRepository repository = new ConfirmKbsPinRepository();
|
||||
|
@ -60,7 +60,7 @@ public class ConfirmKbsPinFragment extends BaseKbsPinFragment<ConfirmKbsPinViewM
|
|||
getLabel().setText("");
|
||||
}
|
||||
|
||||
private void initializeViewStatesForPinUpdate() {
|
||||
private void initializeViewStatesForPinChange() {
|
||||
getTitle().setText(R.string.CreateKbsPinFragment__create_a_new_pin);
|
||||
getDescription().setText(R.string.ConfirmKbsPinFragment__confirm_your_pin);
|
||||
getKeyboardToggle().setVisibility(View.INVISIBLE);
|
||||
|
|
|
@ -21,22 +21,37 @@ public class CreateKbsPinActivity extends BaseActionBarActivity {
|
|||
|
||||
public static final int REQUEST_NEW_PIN = 27698;
|
||||
|
||||
private static final String IS_NEW_PIN = "is_new_pin";
|
||||
|
||||
private final DynamicTheme dynamicTheme = new DynamicRegistrationTheme();
|
||||
|
||||
public static Intent getIntentForPinCreate(@NonNull Context context) {
|
||||
return getIntent(context, true);
|
||||
public static @NonNull Intent getIntentForPinCreate(@NonNull Context context) {
|
||||
CreateKbsPinFragmentArgs args = new CreateKbsPinFragmentArgs.Builder()
|
||||
.setIsForgotPin(false)
|
||||
.setIsPinChange(false)
|
||||
.build();
|
||||
|
||||
return getIntentWithArgs(context, args);
|
||||
}
|
||||
|
||||
public static Intent getIntentForPinUpdate(@NonNull Context context) {
|
||||
return getIntent(context, false);
|
||||
public static @NonNull Intent getIntentForPinChangeFromForgotPin(@NonNull Context context) {
|
||||
CreateKbsPinFragmentArgs args = new CreateKbsPinFragmentArgs.Builder()
|
||||
.setIsForgotPin(true)
|
||||
.setIsPinChange(true)
|
||||
.build();
|
||||
|
||||
return getIntentWithArgs(context, args);
|
||||
}
|
||||
|
||||
private static Intent getIntent(@NonNull Context context, boolean isNewPin) {
|
||||
Intent intent = new Intent(context, CreateKbsPinActivity.class);
|
||||
intent.putExtra(IS_NEW_PIN, isNewPin);
|
||||
return intent;
|
||||
public static @NonNull Intent getIntentForPinChangeFromSettings(@NonNull Context context) {
|
||||
CreateKbsPinFragmentArgs args = new CreateKbsPinFragmentArgs.Builder()
|
||||
.setIsForgotPin(false)
|
||||
.setIsPinChange(true)
|
||||
.build();
|
||||
|
||||
return getIntentWithArgs(context, args);
|
||||
}
|
||||
|
||||
private static @NonNull Intent getIntentWithArgs(@NonNull Context context, @NonNull CreateKbsPinFragmentArgs args) {
|
||||
return new Intent(context, CreateKbsPinActivity.class).putExtras(args.toBundle());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,25 +9,33 @@ import org.thoughtcrime.securesms.R;
|
|||
|
||||
public class CreateKbsPinFragment extends BaseKbsPinFragment<CreateKbsPinViewModel> {
|
||||
|
||||
private CreateKbsPinFragmentArgs args;
|
||||
private static final int PIN_LOCKOUT_DAYS = 7;
|
||||
|
||||
@Override
|
||||
protected void initializeViewStates() {
|
||||
args = CreateKbsPinFragmentArgs.fromBundle(requireArguments());
|
||||
CreateKbsPinFragmentArgs args = CreateKbsPinFragmentArgs.fromBundle(requireArguments());
|
||||
|
||||
if (args.getIsNewPin()) {
|
||||
initializeViewStatesForPinCreate();
|
||||
if (args.getIsPinChange()) {
|
||||
initializeViewStatesForPinChange(args.getIsForgotPin());
|
||||
} else {
|
||||
initializeViewStatesForPinUpdate();
|
||||
initializeViewStatesForPinCreate();
|
||||
}
|
||||
|
||||
getLabel().setText(getPinLengthRestrictionText(R.plurals.CreateKbsPinFragment__pin_must_be_at_least_digits));
|
||||
getConfirm().setEnabled(false);
|
||||
}
|
||||
|
||||
private void initializeViewStatesForPinUpdate() {
|
||||
private void initializeViewStatesForPinChange(boolean isForgotPin) {
|
||||
getTitle().setText(R.string.CreateKbsPinFragment__create_a_new_pin);
|
||||
getDescription().setText(R.string.CreateKbsPinFragment__because_youre_still_logged_in);
|
||||
|
||||
if (isForgotPin) {
|
||||
getDescription().setText(requireContext().getResources()
|
||||
.getQuantityString(R.plurals.CreateKbsPinFragment__you_can_choose_a_new_pin_because_this_device_is_registered,
|
||||
PIN_LOCKOUT_DAYS,
|
||||
PIN_LOCKOUT_DAYS));
|
||||
} else {
|
||||
getDescription().setText(R.string.CreateKbsPinFragment__pins_add_an_extra_layer_of_security);
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeViewStatesForPinCreate() {
|
||||
|
@ -37,9 +45,11 @@ public class CreateKbsPinFragment extends BaseKbsPinFragment<CreateKbsPinViewMod
|
|||
|
||||
@Override
|
||||
protected CreateKbsPinViewModel initializeViewModel() {
|
||||
CreateKbsPinViewModel viewModel = ViewModelProviders.of(this).get(CreateKbsPinViewModel.class);
|
||||
CreateKbsPinViewModel viewModel = ViewModelProviders.of(this).get(CreateKbsPinViewModel.class);
|
||||
CreateKbsPinFragmentArgs args = CreateKbsPinFragmentArgs.fromBundle(requireArguments());
|
||||
|
||||
viewModel.getNavigationEvents().observe(getViewLifecycleOwner(), e -> onConfirmPin(e.getUserEntry(), e.getKeyboard()));
|
||||
|
||||
viewModel.getNavigationEvents().observe(getViewLifecycleOwner(), e -> onConfirmPin(e.getUserEntry(), e.getKeyboard(), args.getIsPinChange()));
|
||||
viewModel.getKeyboard().observe(getViewLifecycleOwner(), k -> {
|
||||
getLabel().setText(getLabelText(k));
|
||||
getInput().getText().clear();
|
||||
|
@ -48,12 +58,12 @@ public class CreateKbsPinFragment extends BaseKbsPinFragment<CreateKbsPinViewMod
|
|||
return viewModel;
|
||||
}
|
||||
|
||||
private void onConfirmPin(@NonNull KbsPin userEntry, @NonNull PinKeyboardType keyboard) {
|
||||
private void onConfirmPin(@NonNull KbsPin userEntry, @NonNull PinKeyboardType keyboard, boolean isPinChange) {
|
||||
CreateKbsPinFragmentDirections.ActionConfirmPin action = CreateKbsPinFragmentDirections.actionConfirmPin();
|
||||
|
||||
action.setUserEntry(userEntry);
|
||||
action.setKeyboard(keyboard);
|
||||
action.setIsNewPin(args.getIsNewPin());
|
||||
action.setIsPinChange(isPinChange);
|
||||
|
||||
Navigation.findNavController(requireView()).navigate(action);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.thoughtcrime.securesms.lock.v2;
|
|||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -13,12 +12,10 @@ import android.widget.TextView;
|
|||
import androidx.activity.OnBackPressedCallback;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
|
||||
public final class KbsSplashFragment extends Fragment {
|
||||
|
||||
|
@ -45,7 +42,7 @@ public final class KbsSplashFragment extends Fragment {
|
|||
primaryAction.setOnClickListener(v -> onCreatePin());
|
||||
secondaryAction.setOnClickListener(v -> onLearnMore());
|
||||
|
||||
if (TextSecurePreferences.isV1RegistrationLockEnabled(requireContext())) {
|
||||
if (PinUtil.userHasPin(requireContext())) {
|
||||
setUpRegLockEnabled();
|
||||
} else {
|
||||
setUpRegLockDisabled();
|
||||
|
@ -74,7 +71,11 @@ public final class KbsSplashFragment extends Fragment {
|
|||
}
|
||||
|
||||
private void onCreatePin() {
|
||||
Navigation.findNavController(requireView()).navigate(KbsSplashFragmentDirections.actionCreateKbsPin());
|
||||
KbsSplashFragmentDirections.ActionCreateKbsPin action = KbsSplashFragmentDirections.actionCreateKbsPin();
|
||||
|
||||
action.setIsPinChange(PinUtil.userHasPin(requireContext()));
|
||||
|
||||
Navigation.findNavController(requireView()).navigate(action);
|
||||
}
|
||||
|
||||
private void onLearnMore() {
|
||||
|
|
|
@ -130,7 +130,7 @@ public final class Megaphones {
|
|||
return builder.setTitle(R.string.KbsMegaphone__introducing_pins)
|
||||
.setBody(R.string.KbsMegaphone__your_registration_lock_is_now_called_a_pin)
|
||||
.setButtonText(R.string.KbsMegaphone__update_pin, (megaphone, listener) -> {
|
||||
Intent intent = CreateKbsPinActivity.getIntentForPinUpdate(ApplicationDependencies.getApplication());
|
||||
Intent intent = CreateKbsPinActivity.getIntentForPinChangeFromSettings(ApplicationDependencies.getApplication());
|
||||
|
||||
listener.onMegaphoneNavigationRequested(intent, CreateKbsPinActivity.REQUEST_NEW_PIN);
|
||||
})
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.app.KeyguardManager;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
@ -182,7 +181,7 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment
|
|||
private class KbsPinUpdateListener implements Preference.OnPreferenceClickListener {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
startActivityForResult(CreateKbsPinActivity.getIntentForPinUpdate(requireContext()), CreateKbsPinActivity.REQUEST_NEW_PIN);
|
||||
startActivityForResult(CreateKbsPinActivity.getIntentForPinChangeFromSettings(requireContext()), CreateKbsPinActivity.REQUEST_NEW_PIN);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,13 +36,13 @@ public final class RegistrationCompleteFragment extends BaseRegistrationFragment
|
|||
|
||||
if (!isReregister()) {
|
||||
final Intent main = new Intent(activity, MainActivity.class);
|
||||
final Intent next = getRoutedIntent(activity, EditProfileActivity.class, main);
|
||||
final Intent next = chainIntents(new Intent(activity, EditProfileActivity.class), main);
|
||||
|
||||
next.putExtra(EditProfileActivity.SHOW_TOOLBAR, false);
|
||||
|
||||
Context context = requireContext();
|
||||
if (FeatureFlags.pinsForAll() && !PinUtil.userHasPin(context)) {
|
||||
activity.startActivity(getRoutedIntent(activity, CreateKbsPinActivity.class, next));
|
||||
activity.startActivity(chainIntents(CreateKbsPinActivity.getIntentForPinCreate(context), next));
|
||||
} else {
|
||||
activity.startActivity(next);
|
||||
}
|
||||
|
@ -52,9 +52,8 @@ public final class RegistrationCompleteFragment extends BaseRegistrationFragment
|
|||
ActivityNavigator.applyPopAnimationsToPendingTransition(activity);
|
||||
}
|
||||
|
||||
private static Intent getRoutedIntent(@NonNull Context context, Class<?> destination, @Nullable Intent nextIntent) {
|
||||
final Intent intent = new Intent(context, destination);
|
||||
if (nextIntent != null) intent.putExtra("next_intent", nextIntent);
|
||||
return intent;
|
||||
private static Intent chainIntents(@NonNull Intent sourceIntent, @Nullable Intent nextIntent) {
|
||||
if (nextIntent != null) sourceIntent.putExtra("next_intent", nextIntent);
|
||||
return sourceIntent;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,12 @@
|
|||
|
||||
<argument
|
||||
app:argType="boolean"
|
||||
android:name="is_new_pin"
|
||||
android:name="is_pin_change"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<argument
|
||||
app:argType="boolean"
|
||||
android:name="is_forgot_pin"
|
||||
android:defaultValue="false" />
|
||||
|
||||
</fragment>
|
||||
|
@ -34,7 +39,7 @@
|
|||
|
||||
<argument
|
||||
app:argType="boolean"
|
||||
android:name="is_new_pin"
|
||||
android:name="is_pin_change"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<argument
|
||||
|
|
|
@ -17,7 +17,14 @@
|
|||
app:enterAnim="@anim/nav_default_enter_anim"
|
||||
app:exitAnim="@anim/nav_default_exit_anim"
|
||||
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
|
||||
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
|
||||
app:popExitAnim="@anim/nav_default_pop_exit_anim" >
|
||||
|
||||
<argument
|
||||
app:argType="boolean"
|
||||
android:name="is_pin_change"
|
||||
android:defaultValue="false" />
|
||||
|
||||
</action>
|
||||
|
||||
</fragment>
|
||||
|
||||
|
|
|
@ -1698,7 +1698,10 @@
|
|||
<item quantity="other">PIN must be at least %1$d digits</item>
|
||||
</plurals>
|
||||
<string name="CreateKbsPinFragment__create_a_new_pin">Create a new PIN</string>
|
||||
<string name="CreateKbsPinFragment__because_youre_still_logged_in">Because you\'re still logged in, you can create a new PIN. When you\'re logged out, there is no way to recover your PIN.</string>
|
||||
<plurals name="CreateKbsPinFragment__you_can_choose_a_new_pin_because_this_device_is_registered">
|
||||
<item quantity="one">You can choose a new PIN because this device is registered. If you forget your PIN, you may need to wait %1$d day to register again.</item>
|
||||
<item quantity="other">You can choose a new PIN because this device is registered. If you forget your PIN, you may need to wait %1$d days to register again.</item>
|
||||
</plurals>
|
||||
<string name="CreateKbsPinFragment__create_your_pin">Create your PIN</string>
|
||||
<string name="CreateKbsPinFragment__pins_add_an_extra_layer_of_security">PINs add an extra layer of security to your account. It\'s important to remember this PIN, as it can\'t be recovered.</string>
|
||||
|
||||
|
@ -1715,7 +1718,7 @@
|
|||
<string name="KbsSplashFragment__introducing_pins">Introducing PINs</string>
|
||||
<string name="KbsSplashFragment__pins_add_another_level_of_security_to_your_account">PINs add another level of security to your account. Create one now.</string>
|
||||
<string name="KbsSplashFragment__learn_more">Learn More</string>
|
||||
<string name="KbsSplashFragment__learn_more_link">https://signal.org/blog/secure-value-recovery/</string>
|
||||
<string name="KbsSplashFragment__learn_more_link">https://support.signal.org/hc/en-us/articles/360007059792-Registration-Lock</string>
|
||||
<string name="KbsSplashFragment__registration_lock_equals_pin">Registration Lock = PIN</string>
|
||||
<string name="KbsSplashFragment__your_registration_lock_is_now_called_a_pin">Your Registration Lock is now called a PIN, and it does more. Update it now.</string>
|
||||
<string name="KbsSplashFragment__read_more_about_pins">Read more about PINs.</string>
|
||||
|
@ -1735,7 +1738,7 @@
|
|||
<string name="AccountLockedFragment__your_account_has_been_locked_to_protect_your_privacy">Your account has been locked to protect your privacy and security. After %1$d days of inactivity in your account you\'ll be able to re-register this phone number without needing your pin. All content will be deleted.</string>
|
||||
<string name="AccountLockedFragment__next">Next</string>
|
||||
<string name="AccountLockedFragment__learn_more">Learn More</string>
|
||||
<string name="AccountLockedFragment__learn_more_url">https://signal.org/blog/secure-value-recovery/</string>
|
||||
<string name="AccountLockedFragment__learn_more_url">https://support.signal.org/hc/en-us/articles/360007059792-Registration-Lock</string>
|
||||
|
||||
<!-- KbsLockFragment -->
|
||||
<string name="RegistrationLockFragment__enter_your_pin">Enter your PIN</string>
|
||||
|
|
Loading…
Reference in New Issue