Commit 702306a7 by Kim Peace

Merge branch 'communication/#43526-refactoring-offer' into 'communication/develop_43526_onuma'

Rearranged communication code

See merge request !187
parents 76b07967 e673a50a
......@@ -102,6 +102,7 @@ public interface ABookCommConstants {
String IS_ONLINE = "isOnline";
String IS_MOBILE = "isMobile";
String PLATFORM = "platform";
String COLLABORATION_TYPE = "collaborationType";
}
interface FLAG {
......
......@@ -144,20 +144,25 @@ public class ChatData {
}
public void updateMyInfoFromServer() throws NetworkDisconnectedException, AcmsException {
MyInfoJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getMyInfo(sid);
MyInfoJSON resultJson = AcmsClient
.getInstance(ABVEnvironment.getInstance().networkAdapter)
.getMyInfo(sid);
if (resultJson.shopMemberDto != null) {
communicationLogic.insertMyInfo(resultJson.shopMemberDto);
}
}
public void updateUserInfoFromServer(String shopMemberId) throws NetworkDisconnectedException, AcmsException {
MyInfoJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter)
MyInfoJSON resultJson = AcmsClient
.getInstance(ABVEnvironment.getInstance().networkAdapter)
.getNameCard(sid, shopMemberId);
communicationLogic.insertShopMember(resultJson.shopMemberDto);
}
public boolean insertFavoriteUser(String shopMemberId) throws NetworkDisconnectedException, AcmsException {
boolean result = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).insertFavoriteUser(sid,Integer.parseInt(shopMemberId));
boolean result = AcmsClient
.getInstance(ABVEnvironment.getInstance().networkAdapter)
.insertFavoriteUser(sid,Integer.parseInt(shopMemberId));
if (!result) { return false; }
List<Integer> shopMeberIds = new ArrayList<>();
shopMeberIds.add(Integer.parseInt(shopMemberId));
......@@ -166,7 +171,8 @@ public class ChatData {
}
public boolean deleteFavoriteUser(String shopMemberId) throws NetworkDisconnectedException, AcmsException {
boolean result = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter)
boolean result = AcmsClient
.getInstance(ABVEnvironment.getInstance().networkAdapter)
.deleteFavoriteUser(sid, Integer.parseInt(shopMemberId));
if (result) {
List<Integer> deleteFavoriteList = new ArrayList<Integer>();
......@@ -177,18 +183,23 @@ public class ChatData {
}
public boolean insertFavoriteGroup(String groupId) throws NetworkDisconnectedException, AcmsException {
boolean result = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter)
boolean result = AcmsClient
.getInstance(ABVEnvironment.getInstance().networkAdapter)
.insertFavoriteGroup(sid, Integer.parseInt(groupId));
return result;
}
public void updateUnreadCount() throws NetworkDisconnectedException, AcmsException {
UnreadCountJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getMessagesUnreadCount(sid, Integer.toString(roomId.intValue()));
UnreadCountJSON resultJson = AcmsClient
.getInstance(ABVEnvironment.getInstance().networkAdapter)
.getMessagesUnreadCount(sid, Integer.toString(roomId.intValue()));
communicationLogic.updateUnreadCount(resultJson.chatMessageDtoArrayList, Integer.toString(roomId.intValue()));
}
public void updateMessageFromMessageId(String messageId) throws NetworkDisconnectedException, AcmsException {
MessageInfoListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getMessages(sid, Integer.toString(roomId.intValue()), messageId, null);
MessageInfoListJSON resultJson = AcmsClient
.getInstance(ABVEnvironment.getInstance().networkAdapter)
.getMessages(sid, Integer.toString(roomId.intValue()), messageId, null);
for (ChatMessageDto chatMessageDto : resultJson.chatMessageDtoArrayList) {
chatMessageDto.chatRoomId = roomId.intValue();
}
......@@ -198,7 +209,9 @@ public class ChatData {
}
public void updateRoomList() throws NetworkDisconnectedException, AcmsException {
RoomListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getRoomList(sid);
RoomListJSON resultJson = AcmsClient
.getInstance(ABVEnvironment.getInstance().networkAdapter)
.getRoomList(sid);
communicationLogic.insertChatRoomList(resultJson.roomList);
}
......@@ -209,7 +222,9 @@ public class ChatData {
* @throws AcmsException
*/
public void changeRoomName(String changeRoomName) throws NetworkDisconnectedException, AcmsException {
ChangeRoomNameJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).changeRoomName(sid, changeRoomName, roomId.intValue());
ChangeRoomNameJSON resultJson = AcmsClient
.getInstance(ABVEnvironment.getInstance().networkAdapter)
.changeRoomName(sid, changeRoomName, roomId.intValue());
if (resultJson.status != 200) { return; }
communicationLogic.updateChatRoomName(changeRoomName, roomId.intValue());
......@@ -227,7 +242,9 @@ public class ChatData {
public void updateArchiveList() throws NetworkDisconnectedException, AcmsException {
SharedPreferences pref = context.getSharedPreferences(ABookCommConstants.TAG, Context.MODE_PRIVATE);
String updateDate = pref.getString(ABookCommConstants.KEY.ARCHIVE_UPDATED_DATE, ABookCommConstants.DEFAULT_CHECKSUM);
ArchiveListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getArchives(sid, updateDate);
ArchiveListJSON resultJson = AcmsClient
.getInstance(ABVEnvironment.getInstance().networkAdapter)
.getArchives(sid, updateDate);
communicationLogic.updateArchives(resultJson.archiveList);
if (StringUtil.isNullOrEmpty(resultJson.archiveLastUpdateDate)) { return; }
SharedPreferences.Editor editor = pref.edit();
......@@ -237,7 +254,9 @@ public class ChatData {
public void updateArchiveDetail(String archiveId) throws NetworkDisconnectedException, AcmsException {
ArchiveDto archiveDto = communicationLogic.getArchive(Integer.parseInt(archiveId));
RoomJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getRoom(sid, archiveDto.roomId.toString());
RoomJSON resultJson = AcmsClient
.getInstance(ABVEnvironment.getInstance().networkAdapter)
.getRoom(sid, archiveDto.roomId.toString());
archiveDto.roomName = resultJson.chatRoomDto.chatRoomName;
communicationLogic.updateArchiveDetial(archiveDto);
}
......@@ -276,12 +295,16 @@ public class ChatData {
finishAllCollaboration(sid, roomId.intValue());
}
private void updateFavoriteUser() throws NetworkDisconnectedException, AcmsException {
GetFavoriteUserJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getFavoriteUser(sid);
GetFavoriteUserJSON resultJson = AcmsClient
.getInstance(ABVEnvironment.getInstance().networkAdapter)
.getFavoriteUser(sid);
communicationLogic.updateFavoriteUser(resultJson.favoriteUserIds);
}
public void updateFavoriteGroup() throws NetworkDisconnectedException, AcmsException {
GetFavoriteGroupJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getFavoriteGroup(sid);
GetFavoriteGroupJSON resultJson = AcmsClient
.getInstance(ABVEnvironment.getInstance().networkAdapter)
.getFavoriteGroup(sid);
communicationLogic.updateFavoriteGroup(resultJson.favoriteGroupIds);
}
......@@ -294,12 +317,13 @@ public class ChatData {
updateFavoriteGroup();
}
public void updateGroupInfoFromServer() throws NetworkDisconnectedException, AcmsException {
ArrayList<String> checkSumList = new ArrayList<String>();
public void updateGroupInfoFromServer() throws NetworkDisconnectedException {
SharedPreferences pref = context.getSharedPreferences(ABookCommConstants.TAG, Context.MODE_PRIVATE);
String lastUpdatedDate = pref.getString(ABookCommConstants.KEY.GROUP_MEMBER_UPDATED_DATE, ABookCommConstants.DEFAULT_CHECKSUM);
try {
GroupListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getGroupInfo(sid, lastUpdatedDate);
GroupListJSON resultJson = AcmsClient
.getInstance(ABVEnvironment.getInstance().networkAdapter)
.getGroupInfo(sid, lastUpdatedDate);
if (CollectionUtil.isNotEmpty(resultJson.groupList)) {
communicationLogic.updateGroup(resultJson.groupList);
SharedPreferences.Editor editor = pref.edit();
......
package jp.agentec.abook.abv.ui.home.view;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Build;
import android.view.View;
......@@ -20,7 +21,7 @@ import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
public class ChatWebView extends WebView {
private ChatWebViewActivity chatActivity;
private final ChatWebViewActivity chatActivity;
private ChatData chatData;
public ChatWebView(Context context) {
......@@ -28,7 +29,8 @@ public class ChatWebView extends WebView {
chatActivity = (ChatWebViewActivity)context;
}
public void init(ChatData chatData) {
@SuppressLint("SetJavaScriptEnabled")
public void configue(ChatData chatData) {
setOverScrollMode(View.OVER_SCROLL_NEVER); //オーバースクロールしない。
setVerticalScrollBarEnabled(false); //スクロールバーを消す。
addJavascriptInterface(this, "android");
......@@ -121,7 +123,9 @@ public class ChatWebView extends WebView {
@JavascriptInterface
public void test() {
OperationRelatedContentActivity testact = ActivityHandlingHelper.getInstance().getActivity(OperationRelatedContentActivity.class);
OperationRelatedContentActivity testact = ActivityHandlingHelper
.getInstance()
.getActivity(OperationRelatedContentActivity.class);
testact.finish();
}
......@@ -141,7 +145,14 @@ public class ChatWebView extends WebView {
}
@JavascriptInterface
public void createChatRoom(String roomType, String userIdList, String encodedRoomName, String screenFlg, boolean isVoice) throws NetworkDisconnectedException, AcmsException {
public void createChatRoom(
String roomType,
String userIdList,
String encodedRoomName,
String screenFlg,
boolean isVoice)
throws NetworkDisconnectedException, AcmsException
{
chatActivity.createChatRoom(roomType, userIdList, encodedRoomName, screenFlg, isVoice);
}
......@@ -341,17 +352,23 @@ public class ChatWebView extends WebView {
}
@JavascriptInterface
public void joinCollaboration(String collaborationType, String meetingId) throws NetworkDisconnectedException, AcmsException {
public void joinCollaboration(String collaborationType, String meetingId)
throws NetworkDisconnectedException, AcmsException
{
chatActivity.joinCollaboration(collaborationType, meetingId);
}
@JavascriptInterface
public void joinChangedCollaboration(String collaborationType, String meetingId) throws NetworkDisconnectedException, AcmsException {
public void joinChangedCollaboration(String collaborationType, String meetingId)
throws NetworkDisconnectedException, AcmsException
{
chatData.joinChangedCollaboration(collaborationType, meetingId);
}
@JavascriptInterface
public void inviteCollaboration(String inviteUserIds, String collaborationType) throws NetworkDisconnectedException, AcmsException {
public void inviteCollaboration(String inviteUserIds, String collaborationType)
throws NetworkDisconnectedException, AcmsException
{
chatData.inviteCollaboration(inviteUserIds, collaborationType);
}
......@@ -400,7 +417,6 @@ public class ChatWebView extends WebView {
return chatData.getUserListByLoginId(loginIdList);
}
@JavascriptInterface
public int createContentView() {
return chatActivity.createContentView();
......@@ -442,7 +458,9 @@ public class ChatWebView extends WebView {
}
@JavascriptInterface
public void changeCollaboration(int changeCollaborationType, int meetingId) throws NetworkDisconnectedException, AcmsException {
public void changeCollaboration(int changeCollaborationType, int meetingId)
throws NetworkDisconnectedException, AcmsException
{
chatData.changeCollaboration(changeCollaborationType, meetingId);
}
......@@ -485,7 +503,9 @@ public class ChatWebView extends WebView {
}
@JavascriptInterface
public void updatePreMessage(String messageId) throws NetworkDisconnectedException, AcmsException {
public void updatePreMessage(String messageId)
throws NetworkDisconnectedException, AcmsException
{
chatData.updatePreMessage(messageId);
}
......@@ -522,4 +542,98 @@ public class ChatWebView extends WebView {
}
});
}
public void showAlert(String message) {
loadChatViewUrl("javascript:alert('" + message + "');");
}
public void extendHeartBeat() {
loadUrl("javascript:coview_api.HeartBeatUser(globalUserInfo.loginId);");
}
public void extendHeartBeatIfNeeded() {
if (getUrl() != null && getUrl().equals(ABookCommConstants.COLLABORATION_PAGE_URL)) {
extendHeartBeat();
}
}
public void hideNameCardInCollaboaration() {
loadUrl("javascript:$('#userNameCardInCollaboration').modal('hide');");
}
public void hideHostRequestModal() {
loadUrl("javascript:$('#hostRequestModal').modal('hide');");
}
public void leaveRoom() {
loadUrl("javascript:ReverseDelegate.leaveRoom()");
}
public void recordFinished() {
loadUrl("javascript:recordFinished()");
}
public void penOff() {
loadUrl("javascript:penOff();");
}
public void showLoadingIndicator() {
loadChatViewUrl("javascript:Common.showLoadingIndicator();");
}
public void dismissLoadingIndicator() {
loadUrl("javascript:Common.dismissLoadingIndicator()");
}
public void refreshForOffline() {
loadUrl("javascript:Common.refreshForOffline();");
}
public void refreshForOnline() {
loadUrl("javascript:Common.refreshForOnline();");
}
public void windowReload() {
loadUrl("javascript:window.location.reload();");
}
public void finishedVideoEncoding(String encodedFilePath) {
loadUrl("javascript:ChatMediaHandler.videoEncodeEnd('" +encodedFilePath + "')");
}
public void failedVideoEncoding() {
loadUrl("javascript:ChatMediaHandler.videoEncodeFail();)");
}
public void removePIPIndicator() {
loadUrl("javascript:$('.pip_indicator').removeClass('none');");
}
public void exitCollaboration() {
loadUrl("javascript:CoviewBridge.exitCollaboration();");
}
public void addPIPIndicator() {
loadUrl("javascript:$('.pip_indicator').addClass('none');");
}
public void addPIPButton() {
loadUrl("javascript:$('.start_pip_btn').addClass('none');");
}
public void socketCheck() {
loadUrl("javascript:CHAT_SOCKET.socketCheck();");
}
public void displayExistRoom(Integer chatRoomId) {
loadChatViewUrl(String.format("javascript:ReverseDelegate.displayExistRoom('%s');", chatRoomId.toString()));
}
public void startAudioCollaboration() {
loadChatViewUrl(String.format("javascript:Common.startCollaboration('%s');", ABookCommConstants.FLAG.COLLABORATION_TYPE.AUDIO ));
}
public void refreshContactScreen() {
loadChatViewUrl("javascript:Common.refreshContactScreen();");
}
}
package jp.agentec.abook.abv.ui.viewer.activity;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.provider.MediaStore;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
......@@ -16,45 +10,11 @@ import android.widget.ProgressBar;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON;
import jp.agentec.abook.abv.bl.acms.type.OperationType;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.Callback;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.exception.ABVExceptionCode;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ContentDao;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.ContentObjectLogLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.abook.abv.cl.util.ContentLogUtil;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVAuthenticatedActivity;
import jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.constant.ErrorCode;
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.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.common.util.PatternStringUtil;
import jp.agentec.abook.abv.ui.home.activity.ABookSettingActivity;
import jp.agentec.abook.abv.ui.home.helper.ABookCheckWebViewHelper;
import jp.agentec.abook.abv.ui.home.helper.ABookPermissionHelper;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.home.helper.ContentViewHelper;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.FileUtil;
public class CommunicationWebViewActivity extends ABVAuthenticatedActivity {
private static final String TAG = "CommunicationWebViewActivity";
......
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