Commit 45177967 by Lee Munkyeong

ユーザ招待で同じルームがあればポップアップを表示

parent 9f112e63
...@@ -44,6 +44,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.RoomListJSON; ...@@ -44,6 +44,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.UserInviteResultJSON;
import jp.agentec.abook.abv.bl.acms.client.json.WorkerGroupJSON; import jp.agentec.abook.abv.bl.acms.client.json.WorkerGroupJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.AbstractAcmsLoginParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.AbstractAcmsLoginParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsContentParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsContentParameters;
...@@ -663,9 +664,10 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -663,9 +664,10 @@ public class AcmsClient implements AcmsClientResponseListener {
* @throws NetworkDisconnectedException * @throws NetworkDisconnectedException
* @throws AcmsException * @throws AcmsException
*/ */
public boolean inviteUsers(String sid, Integer roomId, String roomName, String userIds) throws NetworkDisconnectedException, AcmsException { public UserInviteResultJSON inviteUsers(String sid, Integer roomId, String roomName, String userIds) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetUser, new InviteUsersParameters(sid, AcmsApis.UserCmds.inviteUsers, roomId, roomName, userIds)); HttpResponse response = send(AcmsApis.ApigetUser, new InviteUsersParameters(sid, AcmsApis.UserCmds.inviteUsers, roomId, roomName, userIds));
return response.httpResponseCode == 200; UserInviteResultJSON json = new UserInviteResultJSON(response.httpResponseBody);
return json;
} }
/** /**
......
package jp.agentec.abook.abv.bl.acms.client.json;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
import java.util.ArrayList;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
public class UserInviteResultJSON extends AcmsCommonJSON {
public Integer roomId;
public UserInviteResultJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
if (!json.has(ABookCommConstants.KEY.BODY)) { return; }
JSONObject invateResultJson = json.getJSONObject(ABookCommConstants.KEY.BODY);
if (invateResultJson == null) { return; }
if (invateResultJson.has(ABookCommConstants.KEY.ROOM_ID)) {
roomId = invateResultJson.getInt(ABookCommConstants.KEY.ROOM_ID);
}
}
}
...@@ -61,6 +61,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.GroupListJSON; ...@@ -61,6 +61,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.GroupListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.MessageInfoListJSON; import jp.agentec.abook.abv.bl.acms.client.json.MessageInfoListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.MyInfoJSON; import jp.agentec.abook.abv.bl.acms.client.json.MyInfoJSON;
import jp.agentec.abook.abv.bl.acms.client.json.RoomListJSON; import jp.agentec.abook.abv.bl.acms.client.json.RoomListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.UserInviteResultJSON;
import jp.agentec.abook.abv.bl.common.ABVEnvironment; import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants; import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys; import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
...@@ -326,17 +327,30 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -326,17 +327,30 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
// #36128 // #36128
} else if (message.equals("Do you want to delete this room?")) { } else if (message.equals("Do you want to delete this room?")) {
message = getString(R.string.msg_chat_confirm_delete); message = getString(R.string.msg_chat_confirm_delete);
} else if (message.equals("error_already_exist_same_user")) {
message = getString(R.string.msg_error_already_exist_same_room);
} else { } else {
message = "Confirm ?"; message = "Confirm ?";
} }
ABookAlertDialog confirmAlert = AlertDialogUtil.createAlertDialog(ChatWebviewActivity.this, R.string.app_name); ABookAlertDialog confirmAlert = AlertDialogUtil.createAlertDialog(ChatWebviewActivity.this, R.string.app_name);
confirmAlert.setMessage(message); confirmAlert.setMessage(message);
if (message.equals(getString(R.string.msg_error_already_exist_same_room))) {
confirmAlert.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.move), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
result.confirm();
}
});
} else {
confirmAlert.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.confirm), new DialogInterface.OnClickListener() { confirmAlert.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.confirm), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
result.confirm(); result.confirm();
} }
}); });
}
confirmAlert.setButton(DialogInterface.BUTTON_NEGATIVE, getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() { confirmAlert.setButton(DialogInterface.BUTTON_NEGATIVE, getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
...@@ -857,8 +871,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -857,8 +871,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
@JavascriptInterface @JavascriptInterface
public void joinRoom(String joinRoomId, String joinRoomName) { public void joinRoom(String joinRoomId, String joinRoomName) {
ChatRoomDto chatRoom = communicationLogic.getChatRoom(Integer.parseInt(joinRoomId)); ChatRoomDto chatRoom = communicationLogic.getChatRoom(Integer.parseInt(joinRoomId));
roomId = Long.parseLong(joinRoomId); roomId = chatRoom.chatRoomId.longValue();
roomName = joinRoomName; roomName = chatRoom.chatRoomName;
roomType = chatRoom.type.toString(); roomType = chatRoom.type.toString();
beforeRoomType = chatRoom.type.toString(); beforeRoomType = chatRoom.type.toString();
mChatWebView.post(new Runnable() { mChatWebView.post(new Runnable() {
...@@ -883,8 +897,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -883,8 +897,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
@JavascriptInterface @JavascriptInterface
public void inviteUsers(String userIds) throws NetworkDisconnectedException, AcmsException { public void inviteUsers(String userIds) throws NetworkDisconnectedException, AcmsException {
boolean result = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).inviteUsers(sid, roomId.intValue(), roomName, userIds); final UserInviteResultJSON result = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).inviteUsers(sid, roomId.intValue(), roomName, userIds);
if (!result) { return; } if (result.roomId == null) {
communicationLogic.addUserInRoom(userIds, roomId.intValue()); communicationLogic.addUserInRoom(userIds, roomId.intValue());
mChatWebView.post(new Runnable() { mChatWebView.post(new Runnable() {
@Override @Override
...@@ -892,6 +906,14 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -892,6 +906,14 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
mChatWebView.loadUrl(CHAT_ROOM_PAGE_URL); mChatWebView.loadUrl(CHAT_ROOM_PAGE_URL);
} }
}); });
} else {
mChatWebView.post(new Runnable() {
@Override
public void run() {
mChatWebView.loadUrl(String.format("javascript:CHAT_UI.displayExistRoom('%s');", result.roomId.toString()));
}
});
}
} }
@JavascriptInterface @JavascriptInterface
......
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