Commit 12f71e36 by Kang Donghun

協業中ユーザー招待機能追加実装

parent bc84c3d7
...@@ -71,6 +71,7 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.GetMessagesParameters; ...@@ -71,6 +71,7 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.GetMessagesParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetNameCardParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.GetNameCardParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetOperationDataParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.GetOperationDataParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetTaskFileParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.GetTaskFileParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.InviteCollaborationParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.InviteUsersParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.InviteUsersParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.JoinCollaborationParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.JoinCollaborationParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.NewAppStoreLoginParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.NewAppStoreLoginParameters;
...@@ -801,6 +802,23 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -801,6 +802,23 @@ public class AcmsClient implements AcmsClientResponseListener {
} }
/** /**
* 協業内ユーザー招待
*
* @param sid
* @param roomId
* @param roomName
* @param inveitedUserIds
* @return
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public ArchiveDetailJSON inviteCollaboration(String sid, Integer roomId, String roomName, String inveitedUserIds, String collaborationType) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetCollaboration, new InviteCollaborationParameters(sid, AcmsApis.CollaborationCmds.invite, roomId, roomName, inveitedUserIds, collaborationType));
ArchiveDetailJSON json = new ArchiveDetailJSON(response.httpResponseBody);
return json;
}
/**
* 作業報告データ送信 * 作業報告データ送信
* @param sid * @param sid
* @param operationId * @param operationId
......
package jp.agentec.abook.abv.bl.acms.client.parameters;
import jp.agentec.adf.net.http.HttpParameterObject;
public class InviteCollaborationParameters extends HttpParameterObject {
/**
* セッションID
* @since 1.0.0
*/
private String sid;
private String cmd;
private Integer roomId;
private String roomName;
private String inviteUserIds;
private String collaborationType;
/**
* {@link InviteCollaborationParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @param cmd Apiリクエストに必要なコマンド(ABOOK COMM専用)。
* @param roomId 協業を開始したルームIDです。(ABOOK COMM専用)。
* @param roomName 協業を開始したルームNAMEです。(ABOOK COMM専用)。
* @param inviteUserIds 協業に招待されたユーザーIDです。(ABOOK COMM専用)。
* @since 1.0.0
*/
public InviteCollaborationParameters(String sid, String cmd, Integer roomId, String roomName, String inviteUserIds, String collaborationType) {
this.sid = sid;
this.cmd = cmd;
this.roomId = roomId;
this.roomName = roomName;
this.inviteUserIds = inviteUserIds;
this.collaborationType = collaborationType;
}
/**
* セッションIDを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getSid() {
return sid;
}
/**
* コマンドを返します。
* @return Apiリクエストに必要なコマンドです。
* @since 1.0.0
*/
public String getCmd() {
return cmd;
}
/**
* RoomIdを返します。
* @return 協業を開始したルームIDです。
* @since 1.0.0
*/
public Integer getRoomId() {
return roomId;
}
/**
* RoomNameを返します。
* @return 協業を開始したルームNAMEです。
* @since 1.0.0
*/
public String getRoomName() {
return roomName;
}
/**
* InviteUserIdsを返します。
* @return 協業に招待されたユーザーIDです。
* @since 1.0.0
*/
public String getInviteUserIds() {
return inviteUserIds;
}
/**
* collaborationTypeを返します。
* @return 協業タイプです。
* @since 1.0.0
*/
public String getCollaborationType() {
return collaborationType;
}
}
...@@ -212,6 +212,7 @@ public class AcmsApis { ...@@ -212,6 +212,7 @@ public class AcmsApis {
public static final String start = "1"; public static final String start = "1";
public static final String join = "2"; public static final String join = "2";
public static final String finish = "3"; public static final String finish = "3";
public static final String invite = "4";
} }
// download // download
......
...@@ -125,6 +125,7 @@ public interface ABookCommConstants { ...@@ -125,6 +125,7 @@ public interface ABookCommConstants {
interface COLLABORATION_JOIN_FLG { interface COLLABORATION_JOIN_FLG {
Integer CREATE = 0; Integer CREATE = 0;
Integer JOIN = 1; Integer JOIN = 1;
Integer INVITE = 2;
} }
interface ROOM_VIEW_FLAG { interface ROOM_VIEW_FLAG {
......
...@@ -1480,7 +1480,7 @@ ...@@ -1480,7 +1480,7 @@
<string name="msg_error_chat_room_sc_forbidden">認証に失敗しました。再度ログインが必要です。</string> <string name="msg_error_chat_room_sc_forbidden">認証に失敗しました。再度ログインが必要です。</string>
<string name="msg_error_already_exist_same_room">同じルームが既に存在します。</string> <string name="msg_error_already_exist_same_room">同じルームが既に存在します。</string>
<string name="msg_confirm_send_host_change">ホスト権限を渡しますか?</string> <string name="msg_confirm_send_host_change">ホスト権限を渡しますか?</string>
<string name="msg_invite_collaboration">協業に招待されました。</string>
<!-- 連続作業 --> <!-- 連続作業 -->
<string name="msg_error_all_process_delete">全削除の送信に失敗しました。</string> <string name="msg_error_all_process_delete">全削除の送信に失敗しました。</string>
......
...@@ -1487,4 +1487,5 @@ ...@@ -1487,4 +1487,5 @@
<string name="msg_error_all_process_delete">모두 삭제 송신에 실패하였습니다.</string> <string name="msg_error_all_process_delete">모두 삭제 송신에 실패하였습니다.</string>
<string name="msg_error_already_exist_same_room">동일한 채팅방이 이미 존재합니다.</string> <string name="msg_error_already_exist_same_room">동일한 채팅방이 이미 존재합니다.</string>
<string name="msg_confirm_send_host_change">방장 권한을 전달 받으시겠습니까?</string> <string name="msg_confirm_send_host_change">방장 권한을 전달 받으시겠습니까?</string>
<string name="msg_invite_collaboration">협업에 초대되셨습니다.</string>
</resources> </resources>
\ No newline at end of file
...@@ -1484,4 +1484,5 @@ ...@@ -1484,4 +1484,5 @@
<string name="msg_error_all_process_delete">Failed to send all deletes.</string> <string name="msg_error_all_process_delete">Failed to send all deletes.</string>
<string name="msg_error_already_exist_same_room">Already exist same room.</string> <string name="msg_error_already_exist_same_room">Already exist same room.</string>
<string name="msg_confirm_send_host_change">Do you want to receive host permissions?</string> <string name="msg_confirm_send_host_change">Do you want to receive host permissions?</string>
<string name="msg_invite_collaboration">You are invited to collaboration.</string>
</resources> </resources>
...@@ -33,6 +33,7 @@ public class ABVFcmListenerService extends FirebaseMessagingService { ...@@ -33,6 +33,7 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
private static final String TAG = "ABVFcmListenerService"; private static final String TAG = "ABVFcmListenerService";
private NotificationManager mNotificationManager; private NotificationManager mNotificationManager;
private static int mNotificationConnect = 0; private static int mNotificationConnect = 0;
private final String INVITE_COLLABORATION = "inviteCollaboration";
@Override @Override
public void onCreate() { public void onCreate() {
...@@ -94,6 +95,21 @@ public class ABVFcmListenerService extends FirebaseMessagingService { ...@@ -94,6 +95,21 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
if (AppUtil.isAppForground(this)) { if (AppUtil.isAppForground(this)) {
msg.put(AppDefType.PushMessageKey.message, pushMsg); msg.put(AppDefType.PushMessageKey.message, pushMsg);
} }
if (pushMsg.contains(INVITE_COLLABORATION)) {
String[] inviteMessage = pushMsg.split("<::split>");
tempMsg = getString(R.string.msg_invite_collaboration);
Intent pushMsgDialog = new Intent(ABVFcmListenerService.this, ShowPushMessageDailogActivity.class);
pushMsgDialog.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
pushMsgDialog.putExtra(AppDefType.PushMessageKey.message, tempMsg);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomId, roomId); // Room Id
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.roomName, roomName); // Room Name
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendLoginId, pushSendLoginId); // sendLoginId
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.pushSendDate, pushSendDate);
pushMsgDialog.putExtra(AppDefType.ChatPushMessageKey.collaborationType, inviteMessage[1]);
startActivity(pushMsgDialog);
return;
}
} }
if (AppUtil.isAppForground(this)) { if (AppUtil.isAppForground(this)) {
......
...@@ -123,6 +123,7 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity { ...@@ -123,6 +123,7 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity {
String roomName = extras.getString(AppDefType.ChatPushMessageKey.roomName); String roomName = extras.getString(AppDefType.ChatPushMessageKey.roomName);
String pushSendLoginId = extras.getString(AppDefType.ChatPushMessageKey.pushSendLoginId); String pushSendLoginId = extras.getString(AppDefType.ChatPushMessageKey.pushSendLoginId);
long pushSendDate = extras.getLong(AppDefType.ChatPushMessageKey.pushSendDate); long pushSendDate = extras.getLong(AppDefType.ChatPushMessageKey.pushSendDate);
String collaborationType = extras.getString(AppDefType.ChatPushMessageKey.collaborationType);
if (roomId > 0 && !StringUtil.isNullOrEmpty(roomName)) { if (roomId > 0 && !StringUtil.isNullOrEmpty(roomName)) {
List<PushMessageDto> pushMessageDtoList = AbstractLogic.getLogic(PushMessageLogic.class).getAllPushMessageList(); List<PushMessageDto> pushMessageDtoList = AbstractLogic.getLogic(PushMessageLogic.class).getAllPushMessageList();
...@@ -138,8 +139,11 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity { ...@@ -138,8 +139,11 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity {
Logger.d("tempDate","date : " + tempDate); Logger.d("tempDate","date : " + tempDate);
} }
if (!StringUtil.isNullOrEmpty(collaborationType)) {
ActivityHandlingHelper.getInstance().startChatWebviewActivity(roomId, roomName); ActivityHandlingHelper.getInstance().startChatWebviewActivityWithCollaboration(roomId, roomName, collaborationType);
} else {
ActivityHandlingHelper.getInstance().startChatWebviewActivity(roomId, roomName);
}
} }
} }
finish(); finish();
......
...@@ -141,5 +141,6 @@ public interface AppDefType { ...@@ -141,5 +141,6 @@ public interface AppDefType {
String roomName = "roomName"; String roomName = "roomName";
String pushSendLoginId = "pushSendLoginId"; String pushSendLoginId = "pushSendLoginId";
String pushSendDate = "pushSendDate"; String pushSendDate = "pushSendDate";
String collaborationType = "collaborationType";
} }
} }
...@@ -132,6 +132,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -132,6 +132,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
private boolean isOnline; private boolean isOnline;
private Long roomId; private Long roomId;
private String roomType; private String roomType;
private String collaborationType;
private String groupId; private String groupId;
private String beforeRoomType; private String beforeRoomType;
private Integer shopMemberId; private Integer shopMemberId;
...@@ -177,6 +178,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -177,6 +178,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
roomName = intent.getStringExtra("roomName"); roomName = intent.getStringExtra("roomName");
loginId = intent.getStringExtra("loginId"); loginId = intent.getStringExtra("loginId");
shopName = intent.getStringExtra("shopName"); shopName = intent.getStringExtra("shopName");
collaborationType = intent.getStringExtra("collaborationType");
isOnline = false; isOnline = false;
} }
...@@ -271,9 +273,21 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -271,9 +273,21 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
e.printStackTrace(); e.printStackTrace();
} }
Integer integerRoomId = Integer.parseInt(roomId.toString()); Integer integerRoomId = Integer.parseInt(roomId.toString());
roomType = communicationLogic.getChatRoom(integerRoomId).type.toString(); if (StringUtil.isNullOrEmpty(collaborationType)) {
String parameterData = "sid=" + sid + "&loginId=" + loginId + "&shopName=" + shopName + "&roomId=" + roomId + "&roomName=" + roomName + fixedParam; roomType = communicationLogic.getChatRoom(integerRoomId).type.toString();
mChatWebView.postUrl(CHAT_ROOM_PAGE_URL, parameterData.getBytes()); String parameterData = "sid=" + sid + "&loginId=" + loginId + "&shopName=" + shopName + "&roomId=" + roomId + "&roomName=" + roomName + fixedParam;
mChatWebView.postUrl(CHAT_ROOM_PAGE_URL, parameterData.getBytes());
} else {
collaborationJoinFlg = ABookCommConstants.FLAG.COLLABORATION_JOIN_FLG.INVITE;
try {
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).joinCollaboration(sid, roomId.intValue());
} catch (NetworkDisconnectedException e) {
e.printStackTrace();
} catch (AcmsException e) {
e.printStackTrace();
}
moveCollaborationScreen(Integer.parseInt(collaborationType));
}
} else { // Chat } else { // Chat
if (lastRoomName.length() > 0 && lastRoomId.length() > 0) { if (lastRoomName.length() > 0 && lastRoomId.length() > 0) {
String parameterData = "sid=" + sid + "&loginId=" + loginId + "&shopName=" + shopName + "&roomId=" + lastRoomId + "&roomName=" + lastRoomName + fixedParam; String parameterData = "sid=" + sid + "&loginId=" + loginId + "&shopName=" + shopName + "&roomId=" + lastRoomId + "&roomName=" + lastRoomName + fixedParam;
...@@ -841,6 +855,16 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -841,6 +855,16 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
} }
@JavascriptInterface @JavascriptInterface
public void openCommunicationHome() {
mChatWebView.post(new Runnable() {
@Override
public void run() {
mChatWebView.loadUrl(CHAT_PAGE_URL);
}
});
}
@JavascriptInterface
public void openSetting() { public void openSetting() {
mChatWebView.post(new Runnable() { mChatWebView.post(new Runnable() {
@Override @Override
...@@ -1336,6 +1360,11 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -1336,6 +1360,11 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
} }
@JavascriptInterface @JavascriptInterface
public void inviteCollaboration(String inviteUserIds, String collaborationType) throws NetworkDisconnectedException, AcmsException {
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).inviteCollaboration(sid, roomId.intValue(), roomName, inviteUserIds, collaborationType);
}
@JavascriptInterface
public void startCollaboration(String collaborationType) { public void startCollaboration(String collaborationType) {
collaborationJoinFlg = ABookCommConstants.FLAG.COLLABORATION_JOIN_FLG.CREATE; collaborationJoinFlg = ABookCommConstants.FLAG.COLLABORATION_JOIN_FLG.CREATE;
moveCollaborationScreen(Integer.parseInt(collaborationType)); moveCollaborationScreen(Integer.parseInt(collaborationType));
...@@ -1347,6 +1376,11 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -1347,6 +1376,11 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
} }
@JavascriptInterface @JavascriptInterface
public String getCollaborationType() {
return collaborationType;
}
@JavascriptInterface
public String getToMoveGroupId() { public String getToMoveGroupId() {
return groupId; return groupId;
} }
......
...@@ -1907,4 +1907,44 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve ...@@ -1907,4 +1907,44 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
this.previousOfSettingActivity = null; this.previousOfSettingActivity = null;
this.previousOfSettingActivity2 = activity; this.previousOfSettingActivity2 = activity;
} }
public void startChatWebviewActivityWithCollaboration(Long roomId, String roomName, String collaborationType) {
String className = ChatWebviewActivity.class.getName();
boolean isNormalSize = (mContext.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL;
Intent intent = new Intent();
intent.putExtra("chatWebviewUrl",ABVEnvironment.getInstance().acmsAddress + ABVDataCache.getInstance().getUrlPath() + "/chatapi/chat/");
String sid = ABVDataCache.getInstance().getMemberInfo().sid;
intent.putExtra("sid", sid);
String loginId = ABVDataCache.getInstance().getMemberInfo().loginId;
String shopName = ABVDataCache.getInstance().getUrlPath();
intent.putExtra("loginId", loginId);
intent.putExtra("collaborationType", collaborationType);
intent.putExtra("shopName", shopName);
intent.putExtra("roomId", roomId);
intent.putExtra("roomName", roomName);
intent.setClassName(mContext.getPackageName(), className);
Activity activity2 = null;
if (!currentActivityStack.isEmpty()) {
int size = currentActivityStack.size();
for(int i = size-1; i >= 0; i--) {
ABVAuthenticatedActivity activity = currentActivityStack.elementAt(i);
if (activity instanceof ChatWebviewActivity) {
activity2 = (ChatWebviewActivity) activity;
}
}
}
if (activity2 != null) {
activity2.finish();
activity2.startActivity(intent);
} else {
Activity activity = getCurrentActivity();
if (activity != null) {
activity.startActivity(intent);
}
}
}
} }
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