Commit 2e1b3416 authored by Amirhossein Naghshzan's avatar Amirhossein Naghshzan
Browse files

TVAccountExport: check if account has password

Change-Id: I9f95a4891beaa919b8cbf4c10c9fef854dc6fd35
parent f808e9e4
...@@ -53,12 +53,16 @@ public class TVAccountExport extends JamiGuidedStepFragment<JamiAccountSummaryPr ...@@ -53,12 +53,16 @@ public class TVAccountExport extends JamiGuidedStepFragment<JamiAccountSummaryPr
implements JamiAccountSummaryView { implements JamiAccountSummaryView {
private static final long PASSWORD = 1L; private static final long PASSWORD = 1L;
private static final long ACTION = 2L;
private ProgressDialog mWaitDialog; private ProgressDialog mWaitDialog;
private String mIdAccount; private String mIdAccount;
private boolean mHasPassword;
public static TVAccountExport createInstance(String idAccount) { public static TVAccountExport createInstance(String idAccount, boolean hasPassword) {
TVAccountExport fragment = new TVAccountExport(); TVAccountExport fragment = new TVAccountExport();
fragment.mIdAccount = idAccount; fragment.mIdAccount = idAccount;
fragment.mHasPassword = hasPassword;
return fragment; return fragment;
} }
...@@ -82,7 +86,16 @@ public class TVAccountExport extends JamiGuidedStepFragment<JamiAccountSummaryPr ...@@ -82,7 +86,16 @@ public class TVAccountExport extends JamiGuidedStepFragment<JamiAccountSummaryPr
@Override @Override
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) { public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
addPasswordAction(getActivity(), actions, PASSWORD, getString(R.string.account_enter_password), "", ""); if (mHasPassword) {
addPasswordAction(getActivity(), actions, PASSWORD, getString(R.string.account_enter_password), "", "");
} else {
addAction(getContext(), actions, ACTION, R.string.account_start_export_button);
}
}
@Override
public void onGuidedActionClicked(GuidedAction action) {
presenter.startAccountExport("");
} }
@Override @Override
......
...@@ -418,8 +418,8 @@ public class MainFragment extends BaseBrowseFragment<MainPresenter> implements M ...@@ -418,8 +418,8 @@ public class MainFragment extends BaseBrowseFragment<MainPresenter> implements M
} }
@Override @Override
public void showExportDialog(String pAccountID) { public void showExportDialog(String pAccountID, boolean hasPassword) {
GuidedStepSupportFragment wizard = TVAccountExport.createInstance(pAccountID); GuidedStepSupportFragment wizard = TVAccountExport.createInstance(pAccountID, hasPassword);
GuidedStepSupportFragment.add(getParentFragmentManager(), wizard, R.id.main_browse_fragment); GuidedStepSupportFragment.add(getParentFragmentManager(), wizard, R.id.main_browse_fragment);
} }
......
...@@ -113,7 +113,7 @@ public class MainPresenter extends RootPresenter<MainView> { ...@@ -113,7 +113,7 @@ public class MainPresenter extends RootPresenter<MainView> {
} }
public void onExportClicked() { public void onExportClicked() {
getView().showExportDialog(mAccountService.getCurrentAccount().getAccountID()); getView().showExportDialog(mAccountService.getCurrentAccount().getAccountID(), mAccountService.getCurrentAccount().hasPassword());
} }
public void onLicenceClicked(int aboutType) { public void onLicenceClicked(int aboutType) {
......
...@@ -43,7 +43,7 @@ public interface MainView { ...@@ -43,7 +43,7 @@ public interface MainView {
void displayAccountInfos(HomeNavigationViewModel viewModel); void displayAccountInfos(HomeNavigationViewModel viewModel);
void updateModel(Account account); void updateModel(Account account);
void showExportDialog(String pAccountID); void showExportDialog(String pAccountID, boolean hasPassword);
void showProfileEditing(); void showProfileEditing();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment