Commit 9602ed02 by onuma

#46980 通信処理をAcmsClientに移動。

parent 058b4364
...@@ -9,6 +9,7 @@ import java.util.ArrayList; ...@@ -9,6 +9,7 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Observer; import java.util.Observer;
import jp.agentec.abook.abv.bl.acms.client.json.AcmsBooleanResultJSON; import jp.agentec.abook.abv.bl.acms.client.json.AcmsBooleanResultJSON;
...@@ -45,6 +46,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.RoomListJSON; ...@@ -45,6 +46,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.RoomListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.SceneEntryJSON; import jp.agentec.abook.abv.bl.acms.client.json.SceneEntryJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ServerTimeZoneJSON; import jp.agentec.abook.abv.bl.acms.client.json.ServerTimeZoneJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ServiceOptionsJSON; import jp.agentec.abook.abv.bl.acms.client.json.ServiceOptionsJSON;
import jp.agentec.abook.abv.bl.acms.client.json.TermsOfUseJson;
import jp.agentec.abook.abv.bl.acms.client.json.UnreadCountJSON; import jp.agentec.abook.abv.bl.acms.client.json.UnreadCountJSON;
import jp.agentec.abook.abv.bl.acms.client.json.UserInviteResultJSON; import jp.agentec.abook.abv.bl.acms.client.json.UserInviteResultJSON;
import jp.agentec.abook.abv.bl.acms.client.json.WorkerGroupJSON; import jp.agentec.abook.abv.bl.acms.client.json.WorkerGroupJSON;
...@@ -1097,6 +1099,19 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -1097,6 +1099,19 @@ public class AcmsClient implements AcmsClientResponseListener {
HttpResponse response = send(AcmsApis.ApiDeleteProcess, params); HttpResponse response = send(AcmsApis.ApiDeleteProcess, params);
validateHttpResponse(response, AcmsApis.ApiGetPushMessages); validateHttpResponse(response, AcmsApis.ApiGetPushMessages);
} }
/**
* 利用規約に同意するかの文言を取得します
* @param url 取得するためのURL
* @return 文言を格納したJSON
*/
public TermsOfUseJson getTermsOfServiceText(String url) throws NetworkDisconnectedException, AcmsException {
String requestUrl = url + "?language=" + Locale.getDefault().getLanguage();
HttpResponse response = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).send(requestUrl, "", null);
return new TermsOfUseJson(response.httpResponseBody);
}
/**********************************************************************************************/ /**********************************************************************************************/
/** 以下、共用メソッド---------------------------------------------------------------------- **/ /** 以下、共用メソッド---------------------------------------------------------------------- **/
/**********************************************************************************************/ /**********************************************************************************************/
......
package jp.agentec.abook.abv.bl.logic; package jp.agentec.abook.abv.bl.logic;
import org.json.adf.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List; import java.util.List;
import java.util.Locale;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient; import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.TermsOfUseJson; import jp.agentec.abook.abv.bl.acms.client.json.TermsOfUseJson;
...@@ -25,8 +16,6 @@ import jp.agentec.abook.abv.bl.data.dao.AcmsDao; ...@@ -25,8 +16,6 @@ import jp.agentec.abook.abv.bl.data.dao.AcmsDao;
import jp.agentec.abook.abv.bl.data.dao.ServiceOptionDao; import jp.agentec.abook.abv.bl.data.dao.ServiceOptionDao;
import jp.agentec.abook.abv.bl.dto.AcmsDto; import jp.agentec.abook.abv.bl.dto.AcmsDto;
import jp.agentec.abook.abv.bl.dto.ServiceOptionDto; import jp.agentec.abook.abv.bl.dto.ServiceOptionDto;
import jp.agentec.adf.net.http.HttpRequestSender;
import jp.agentec.adf.net.http.HttpResponse;
import jp.agentec.adf.util.NumericUtil; import jp.agentec.adf.util.NumericUtil;
import jp.agentec.adf.util.StringUtil; import jp.agentec.adf.util.StringUtil;
...@@ -373,15 +362,9 @@ public class ContractLogic extends AbstractLogic { ...@@ -373,15 +362,9 @@ public class ContractLogic extends AbstractLogic {
* @return 取得した文字列(失敗したらnullが返る) * @return 取得した文字列(失敗したらnullが返る)
*/ */
public String getTermsOfServiceText(String url) { public String getTermsOfServiceText(String url) {
String requestUrl = url + "?language=" + Locale.getDefault().getLanguage();
try { try {
HttpResponse response = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).send(requestUrl, "", null); TermsOfUseJson response = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getTermsOfServiceText(url);
TermsOfUseJson resultJson = new TermsOfUseJson(response.httpResponseBody); return response.message;
return resultJson.message;
} catch (NetworkDisconnectedException e) {
Logger.e(TAG,"" + e);
} catch (AcmsException e) {
Logger.e(TAG,"" + e);
} catch (Exception e) { } catch (Exception e) {
Logger.e(TAG,"" + e); Logger.e(TAG,"" + e);
} }
......
...@@ -21,16 +21,6 @@ import android.widget.ImageButton; ...@@ -21,16 +21,6 @@ import android.widget.ImageButton;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import org.json.adf.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Locale;
import jp.agentec.abook.abv.bl.acms.client.json.CmsUrlJSON; import jp.agentec.abook.abv.bl.acms.client.json.CmsUrlJSON;
import jp.agentec.abook.abv.bl.acms.type.DeleteDataType; import jp.agentec.abook.abv.bl.acms.type.DeleteDataType;
import jp.agentec.abook.abv.bl.acms.type.LoginMode; import jp.agentec.abook.abv.bl.acms.type.LoginMode;
...@@ -57,7 +47,6 @@ import jp.agentec.abook.abv.bl.dto.MemberInfoDto; ...@@ -57,7 +47,6 @@ import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
import jp.agentec.abook.abv.bl.dto.PasswordLockInfoDto; import jp.agentec.abook.abv.bl.dto.PasswordLockInfoDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic; import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.CommunicationLogic; import jp.agentec.abook.abv.bl.logic.CommunicationLogic;
import jp.agentec.abook.abv.bl.logic.ContentLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic; import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic; import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic; import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic;
...@@ -73,9 +62,6 @@ import jp.agentec.abook.abv.ui.common.constant.ErrorMessage; ...@@ -73,9 +62,6 @@ import jp.agentec.abook.abv.ui.common.constant.ErrorMessage;
import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog; import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.helper.ABVViewUnbindHelper; import jp.agentec.abook.abv.ui.common.helper.ABVViewUnbindHelper;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil; import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.adf.net.http.HttpRequestSender;
import jp.agentec.adf.net.http.HttpResponse;
import jp.agentec.adf.util.NumericUtil;
import jp.agentec.adf.util.StringUtil; import jp.agentec.adf.util.StringUtil;
/** /**
...@@ -115,7 +101,6 @@ public class LoginActivity extends ABVLoginActivity { ...@@ -115,7 +101,6 @@ public class LoginActivity extends ABVLoginActivity {
private Button btnLoginOn; private Button btnLoginOn;
private Button btnDetail; private Button btnDetail;
private CheckBox chexBoxAgree; private CheckBox chexBoxAgree;
private String termsOfUseText = "";
private static String termsOfUseUrl = ABVEnvironment.getInstance().agree_to_terms_of_use_url; private static String termsOfUseUrl = ABVEnvironment.getInstance().agree_to_terms_of_use_url;
@Override @Override
...@@ -183,6 +168,12 @@ public class LoginActivity extends ABVLoginActivity { ...@@ -183,6 +168,12 @@ public class LoginActivity extends ABVLoginActivity {
// 非活性化したログインボタン // 非活性化したログインボタン
btnLoginOff = findViewById(R.id.btn_login_off); btnLoginOff = findViewById(R.id.btn_login_off);
btnLoginOff.setVisibility(View.VISIBLE); btnLoginOff.setVisibility(View.VISIBLE);
btnLoginOff.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
tryLogin();
}
});
// チェックボックス // チェックボックス
chexBoxAgree = findViewById(R.id.check_box_agree); chexBoxAgree = findViewById(R.id.check_box_agree);
...@@ -278,17 +269,17 @@ public class LoginActivity extends ABVLoginActivity { ...@@ -278,17 +269,17 @@ public class LoginActivity extends ABVLoginActivity {
@Override @Override
public void run() { public void run() {
// CMSより文言を取得し、ダイアログで表示する。 // CMSより文言を取得し、ダイアログで表示する。
ContractLogic logic = AbstractLogic.getLogic(ContractLogic.class); final String termsOfUseText = contractLogic.getTermsOfServiceText(termsOfUseUrl);
String language = Locale.getDefault().getLanguage();
termsOfUseText = logic.getTermsOfServiceText(termsOfUseUrl);
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
String title = getString(R.string.error);
String messageText = getString(R.string.err_gert_term_of_use_text); String messageText = getString(R.string.err_gert_term_of_use_text);
if (termsOfUseText != null) { if (termsOfUseText != null) {
title = getString(R.string.detail);
messageText = termsOfUseText; messageText = termsOfUseText;
} }
AlertDialogUtil.showAlertDialog(LoginActivity.this, getString(R.string.error), messageText, true, new DialogInterface.OnClickListener() { AlertDialogUtil.showAlertDialog(LoginActivity.this, title, messageText, true, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
dialog.dismiss(); dialog.dismiss();
......
Markdown is supported
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