Skip to content
Snippets Groups Projects
Commit bce6f996 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

account: support archiveHasPassword

Change-Id: I9a0374975d71253adb92b38cc229bb8e2d81fa9c
parent 21ac34c2
No related branches found
No related tags found
No related merge requests found
......@@ -59,6 +59,7 @@ import cx.ring.fragments.SecurityAccountFragment;
public class AccountEditionActivity extends AppCompatActivity implements AccountEditionView {
public static final String ACCOUNT_ID_KEY = AccountEditionActivity.class.getCanonicalName() + "accountid";
public static final String ACCOUNT_HAS_PASSWORD_KEY = AccountEditionActivity.class.getCanonicalName() + "hasPassword";
public static final String TAG = AccountEditionActivity.class.getSimpleName();
......
......@@ -146,14 +146,17 @@ public class RegisterNameDialog extends DialogFragment implements Observer<Servi
((RingApplication) getActivity().getApplication()).getRingInjectionComponent().inject(this);
String accountId = "";
boolean hasPassword = true;
Bundle args = getArguments();
if (args != null) {
accountId = args.getString(AccountEditionActivity.ACCOUNT_ID_KEY, accountId);
hasPassword = args.getBoolean(AccountEditionActivity.ACCOUNT_HAS_PASSWORD_KEY, true);
}
mUsernameTxt.setFilters(new InputFilter[]{new RegisteredNameFilter()});
mUsernameTextWatcher = new RegisteredNameTextWatcher(getActivity(), mAccountService, accountId, mUsernameTxtBox, mUsernameTxt);
mUsernameTxt.addTextChangedListener(mUsernameTextWatcher);
mPasswordTxtBox.setVisibility(hasPassword ? View.VISIBLE : View.GONE);
AlertDialog dialog = (AlertDialog) getDialog();
if (dialog != null) {
......
......@@ -56,6 +56,7 @@ import cx.ring.application.RingApplication;
import cx.ring.dependencyinjection.RingInjectionComponent;
import cx.ring.interfaces.BackHandlerInterface;
import cx.ring.model.Account;
import cx.ring.model.ConfigKey;
import cx.ring.mvp.BaseFragment;
import cx.ring.utils.KeyboardVisibilityManager;
import cx.ring.views.LinkNewDeviceLayout;
......@@ -126,6 +127,7 @@ public class RingAccountSummaryFragment extends BaseFragment<RingAccountSummaryP
*/
private DeviceAdapter mDeviceAdapter;
private ProgressDialog mWaitDialog;
private boolean mAccountHasPassword = true;
@Override
public void onResume() {
......@@ -201,6 +203,9 @@ public class RingAccountSummaryFragment extends BaseFragment<RingAccountSummaryP
Drawable wrapped = DrawableCompat.wrap(drawable);
DrawableCompat.setTint(wrapped, color);
mAccountStatus.setBackground(wrapped);
mAccountHasPassword = account.getDetailBoolean(ConfigKey.ARCHIVE_HAS_PASSWORD);
mPasswordLayout.setVisibility(mAccountHasPassword ? View.VISIBLE : View.GONE);
}
});
}
......@@ -232,7 +237,7 @@ public class RingAccountSummaryFragment extends BaseFragment<RingAccountSummaryP
private void showWizard() {
mLinkAccountView.setVisibility(View.VISIBLE);
mPasswordLayout.setVisibility(View.VISIBLE);
mPasswordLayout.setVisibility(mAccountHasPassword ? View.VISIBLE : View.GONE);
mEndBtn.setVisibility(View.GONE);
mStartBtn.setVisibility(View.VISIBLE);
mExportInfos.setText(R.string.account_link_export_info);
......@@ -331,6 +336,7 @@ public class RingAccountSummaryFragment extends BaseFragment<RingAccountSummaryP
public void showUsernameRegistrationPopup() {
Bundle args = new Bundle();
args.putString(AccountEditionActivity.ACCOUNT_ID_KEY, getArguments().getString(AccountEditionActivity.ACCOUNT_ID_KEY));
args.putBoolean(AccountEditionActivity.ACCOUNT_HAS_PASSWORD_KEY, mAccountHasPassword);
RegisterNameDialog registrationDialog = new RegisterNameDialog();
registrationDialog.setArguments(args);
registrationDialog.setListener(this);
......
......@@ -184,7 +184,7 @@ along with this program; if not, write to the Free Software
<string name="account_link_prompt_pin">Enter PIN</string>
<string name="account_new_button">Create a Ring account</string>
<string name="account_link_export_button">Link another device to this account</string>
<string name="account_link_export_info">To use this account on other devices, you must first expose it on Ring. This will generate a PIN code that you must enter on the new device to set up the account. The PIN is valid for 10 minutes. \n\nPlease provide your password to start:</string>
<string name="account_link_export_info">To use this account on other devices, you must first expose it on Ring. This will generate a PIN code that you must enter on the new device to set up the account. The PIN is valid for 10 minutes.</string>
<string name="account_start_export_button">Generate Pin</string>
<string name="account_end_export_button">close</string>
<string name="account_end_export_infos">Your Pin is:\n\n%%\n\nTo complete the process, you need to open Ring on the new device. Create a new account with \"Link this device to an account\". Your pin is valid for 10 minutes.</string>
......
......@@ -65,6 +65,7 @@ public enum ConfigKey {
VIDEO_PORT_MAX("Account.videoPortMax"),
PRESENCE_ENABLE("Account.presenceEnabled"),
ARCHIVE_PASSWORD("Account.archivePassword"),
ARCHIVE_HAS_PASSWORD("Account.archiveHasPassword"),
ARCHIVE_PIN("Account.archivePIN"),
DISPLAY_NAME("Account.displayName"),
ETH_ACCOUNT("ETH.account"),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment