Commit 76b07967 by onuma

削除されたJavaScript呼び出しを削除。SQL文修正。未使用のメソッド削除。

parent 0f2c5b21
......@@ -165,4 +165,6 @@ public interface ABookCommConstants {
String CHAT_ROOM_PAGE_URL = "file:///android_asset/chat/public_new/chat_room.html";
String COLLABORATION_PAGE_URL = "file:///android_asset/chat/public_new/collaboration.html";
String DEFAULT_CHECKSUM = "0000000000";
String PLATFORM_NAME = "android";
}
......@@ -68,9 +68,9 @@ public class ChatGroupDao extends AbstractCommunicationDao {
sql.append(" ELSE mygroup.group_name ");
sql.append(" END AS group_path_list ");
sql.append(" FROM m_chat_group mygroup ");
sql.append(" LEFT JOIN m_chat_group parentgroup on mygroup.parent_group_id = parentgroup.group_id ");
sql.append(" LEFT JOIN m_chat_group grandparentgroup on parentgroup.parent_group_id = grandparentgroup.group_id ");
sql.append(" WHERE mygroup.group_id IN (select group_id from m_shop_member sm INNER JOIN r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id WHERE sm.self_flg = 1)");
sql.append(" LEFT JOIN m_chat_group parentgroup ON mygroup.parent_group_id = parentgroup.group_id ");
sql.append(" LEFT JOIN m_chat_group grandparentgroup ON parentgroup.parent_group_id = grandparentgroup.group_id ");
sql.append(" WHERE mygroup.group_id IN (SELECT group_id FROM m_shop_member sm INNER JOIN r_shop_member_group rmg ON sm.shop_member_id = rmg.shop_member_id WHERE sm.self_flg = 1)");
return rawQueryGetStringList(sql.toString(), null);
}
......@@ -82,11 +82,11 @@ public class ChatGroupDao extends AbstractCommunicationDao {
sql.append(" ELSE usergroup.group_name ");
sql.append(" END AS group_path, usergroup.group_id ");
sql.append(" FROM m_chat_group usergroup ");
sql.append(" LEFT JOIN m_chat_group parentgroup on usergroup.parent_group_id = parentgroup.group_id ");
sql.append(" LEFT JOIN m_chat_group parentgroup ON usergroup.parent_group_id = parentgroup.group_id ");
sql.append(" LEFT JOIN m_chat_group grandparentgroup ON parentgroup.parent_group_id = grandparentgroup.group_id ");
sql.append(" WHERE usergroup.group_id IN ");
sql.append(" (SELECT group_id ");
sql.append(" FROM m_shop_member sm INNER JOIN r_shop_member_group rsmg on sm.shop_member_id = rsmg.shop_member_id ");
sql.append(" FROM m_shop_member sm INNER JOIN r_shop_member_group rsmg ON sm.shop_member_id = rsmg.shop_member_id ");
sql.append(" WHERE sm.shop_member_id = ? ) ");
return rawQueryGetDtoList(sql.toString(), new String[] { "" + shopMemberId}, ChatGroupDto.class);
}
......@@ -156,11 +156,11 @@ public class ChatGroupDao extends AbstractCommunicationDao {
}
public ChatGroupDto getGroup(int groupId) {
return rawQueryGetDto("SELECT * from m_chat_group WHERE group_id = " + groupId, null, ChatGroupDto.class);
return rawQueryGetDto("SELECT * FROM m_chat_group WHERE group_id = " + groupId, null, ChatGroupDto.class);
}
public List<ChatGroupDto> getFavoriteGroup() {
return rawQueryGetDtoList("SELECT * from m_chat_group WHERE favorite_register_date IS NOT NULL ORDER BY favorite_register_date ", null, ChatGroupDto.class);
return rawQueryGetDtoList("SELECT * FROM m_chat_group WHERE favorite_register_date IS NOT NULL ORDER BY favorite_register_date ", null, ChatGroupDto.class);
}
public List<ChatGroupDto> getGroupByName(String[] keywords) {
......@@ -190,7 +190,7 @@ public class ChatGroupDao extends AbstractCommunicationDao {
sql.append(" SELECT 1 rownum, group_id, group_name, parent_group_id FROM m_chat_group WHERE group_id = ? ");
sql.append(" UNION ALL ");
sql.append(" SELECT rownum+1 rownum, parent.group_id, parent.group_name, parent.parent_group_id ");
sql.append(" FROM group_loop inner JOIN m_chat_group parent on parent.group_id = group_loop.parent_group_id ");
sql.append(" FROM group_loop inner JOIN m_chat_group parent ON parent.group_id = group_loop.parent_group_id ");
sql.append(" ) ");
sql.append(" SELECT * FROM group_loop ORDER BY group_loop.rownum DESC ");
......@@ -209,7 +209,7 @@ public class ChatGroupDao extends AbstractCommunicationDao {
}
public ChatGroupDto getParentGroup(Integer childGroupId) {
return rawQueryGetDto("SELECT parent.* from m_chat_group parent INNER JOIN m_chat_group child on child.parent_group_id = parent.group_id WHERE child.group_id = ?", new String[]{""+ childGroupId}, ChatGroupDto.class);
return rawQueryGetDto("SELECT parent.* FROM m_chat_group parent INNER JOIN m_chat_group child ON child.parent_group_id = parent.group_id WHERE child.group_id = ?", new String[]{""+ childGroupId}, ChatGroupDto.class);
}
public boolean isExistParent(int baseId) {
......@@ -217,7 +217,7 @@ public class ChatGroupDao extends AbstractCommunicationDao {
}
public List<ChatGroupDto> getMyGroups() {
return rawQueryGetDtoList("SELECT * FROM m_chat_group WHERE group_id IN (SELECT group_id from m_shop_member sm INNER JOIN r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id WHERE sm.self_flg = 1) ORDER BY group_name ASC", null, ChatGroupDto.class);
return rawQueryGetDtoList("SELECT * FROM m_chat_group WHERE group_id IN (SELECT group_id FROM m_shop_member sm INNER JOIN r_shop_member_group rmg ON sm.shop_member_id = rmg.shop_member_id WHERE sm.self_flg = 1) ORDER BY group_name ASC", null, ChatGroupDto.class);
}
public void insertGroupList(List<ChatGroupDto> groupList) {
......
......@@ -205,15 +205,15 @@ public class ChatMessageDao extends AbstractCommunicationDao {
}
public boolean updateChatMessage(ChatMessageDto dto) {
long count = update("UPDATE t_chat_message set chat_room_id=?, shop_member_id=?, login_id=?,message=?, message_type=?, image_name=?, download_file_name=?, save_path=?, insert_date=?, unread_count WHERE chat_message_id=?", dto.getUpdateValues());
long count = update("UPDATE t_chat_message SET chat_room_id=?, shop_member_id=?, login_id=?,message=?, message_type=?, image_name=?, download_file_name=?, save_path=?, insert_date=?, unread_count WHERE chat_message_id=?", dto.getUpdateValues());
return count > 0;
}
public void updatUnreadCount(List<ChatMessageDto> messageDtoList, String roomId) {
beginTransaction();
update("UPDATE t_chat_message set unread_count = 0 WHERE chat_room_id=?", new String[]{"" + roomId});
update("UPDATE t_chat_message SET unread_count = 0 WHERE chat_room_id=?", new String[]{"" + roomId});
for (ChatMessageDto messageDto : messageDtoList) {
update("UPDATE t_chat_message set unread_count = ? WHERE chat_message_id=?", new String[]{"" + messageDto.unreadCount, "" + messageDto.chatMessageId});
update("UPDATE t_chat_message SET unread_count = ? WHERE chat_message_id=?", new String[]{"" + messageDto.unreadCount, "" + messageDto.chatMessageId});
}
commit();
}
......
......@@ -253,7 +253,7 @@ public class ShopMemberDao extends AbstractCommunicationDao {
sql.append(" m_shop_member AS sm ");
sql.append(" INNER JOIN r_shop_member_group AS rsmg ");
sql.append(" ON sm.shop_member_id = rsmg.shop_member_id ");
sql.append("WHERE rsmg.group_id IN (SELECT group_id FROM m_shop_member sm INNER JOIN r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id WHERE sm.self_flg = 1) ");
sql.append("WHERE rsmg.group_id IN (SELECT group_id FROM m_shop_member sm INNER JOIN r_shop_member_group rmg ON sm.shop_member_id = rmg.shop_member_id WHERE sm.self_flg = 1) ");
sql.append(" AND sm.self_flg != 1 ");
ArrayList<String> whereSqlList = new ArrayList<String>();
for (String keyword : keywords) {
......
......@@ -48,7 +48,6 @@ public class ChatData {
private String beforeRoomType;
public Integer joinMeetingId;
private boolean isMobile;
// 0:協業生成, 1:協業参加
private Integer collaborationJoinFlg = 0;
private String languageCode;
......@@ -214,7 +213,6 @@ public class ChatData {
if (resultJson.status != 200) { return; }
communicationLogic.updateChatRoomName(changeRoomName, roomId.intValue());
//joinRoom(roomId.toString(), changeRoomName);
}
public void joinRoom(String joinRoomId, String joinRoomName) {
......@@ -247,37 +245,47 @@ public class ChatData {
public void joinCollaboration(String collaborationType, String meetingId) throws NetworkDisconnectedException, AcmsException {
joinMeetingId = Integer.parseInt(meetingId);
collaborationJoinFlg = ABookCommConstants.FLAG.COLLABORATION_JOIN_FLG.JOIN;
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).joinCollaboration(sid, roomId.intValue());
AcmsClient.
getInstance(ABVEnvironment.getInstance().networkAdapter).
joinCollaboration(sid, roomId.intValue());
}
public void joinChangedCollaboration(String collaborationType, String meetingId) throws NetworkDisconnectedException, AcmsException {
joinMeetingId = Integer.parseInt(meetingId);
collaborationJoinFlg = ABookCommConstants.FLAG.COLLABORATION_JOIN_FLG.JOIN;
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).joinCollaboration(sid, roomId.intValue());
AcmsClient.
getInstance(ABVEnvironment.getInstance().networkAdapter).
joinCollaboration(sid, roomId.intValue());
}
public void inviteCollaboration(String inviteUserIds, String collaborationType) throws NetworkDisconnectedException, AcmsException {
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).inviteCollaboration(sid, roomId.intValue(), roomName, inviteUserIds, collaborationType);
AcmsClient.
getInstance(ABVEnvironment.getInstance().networkAdapter).
inviteCollaboration(sid, roomId.intValue(), roomName, inviteUserIds, collaborationType);
}
public void finishCollaboration() throws NetworkDisconnectedException, AcmsException {
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).finishCollaboration(sid, roomId.intValue());
AcmsClient.
getInstance(ABVEnvironment.getInstance().networkAdapter).
finishCollaboration(sid, roomId.intValue());
}
public void finishAllCollaboration() throws NetworkDisconnectedException, AcmsException {
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).finishAllCollaboration(sid, roomId.intValue());
AcmsClient.
getInstance(ABVEnvironment.getInstance().networkAdapter).
finishAllCollaboration(sid, roomId.intValue());
}
private void updateFavoriteUser() throws NetworkDisconnectedException, AcmsException {
GetFavoriteUserJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getFavoriteUser(sid);
communicationLogic.updateFavoriteUser(resultJson.favoriteUserIds);
}
private void updateFavoriteGroup() throws NetworkDisconnectedException, AcmsException {
public void updateFavoriteGroup() throws NetworkDisconnectedException, AcmsException {
GetFavoriteGroupJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getFavoriteGroup(sid);
communicationLogic.updateFavoriteGroup(resultJson.favoriteGroupIds);
}
private void updateAllGroupInfo() throws NetworkDisconnectedException, AcmsException {
public void updateAllGroupInfo() throws NetworkDisconnectedException, AcmsException {
updateGroupInfoFromServer();
}
......@@ -304,7 +312,9 @@ public class ChatData {
}
public void changeCollaboration(int changeCollaborationType, int meetingId) throws NetworkDisconnectedException, AcmsException {
AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).changeCollaboration(sid, roomId.intValue(), changeCollaborationType, meetingId);
AcmsClient.
getInstance(ABVEnvironment.getInstance().networkAdapter).
changeCollaboration(sid, roomId.intValue(), changeCollaborationType, meetingId);
}
public void updatePreMessage(String messageId) throws NetworkDisconnectedException, AcmsException {
......@@ -378,7 +388,7 @@ public class ChatData {
public String getDeviceInfo() {
JSONObject jsonObj = new JSONObject();
jsonObj.put(ABookCommConstants.KEY.IS_MOBILE, isMobile);
jsonObj.put(ABookCommConstants.KEY.PLATFORM, "android");
jsonObj.put(ABookCommConstants.KEY.PLATFORM, ABookCommConstants.PLATFORM_NAME);
return jsonObj.toString();
}
......
......@@ -196,8 +196,8 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
public void run() {
try {
chatData.updateMyInfoFromServer();
updateAllGroupInfo();
updateFavoriteInfo();
chatData.updateAllGroupInfo();
chatData.updateFavoriteInfo();
chatData.shopMemberId = communicationLogic.getMyShopMemberDto().shopMemberId;
runOnUiThread(new Runnable() {
@Override
......@@ -361,11 +361,10 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
mChatWebView.loadUrl("javascript:ReverseDelegate.leaveRoom()");
finish();
} else if (tempMessage.equals(getString(R.string.msg_error_chat_join))) {
getLogin();
finish();
} else if (tempMessage.equals(getString(R.string.msg_invalid_parameters))) {
if (chatData.roomId != null) {
mChatWebView.loadUrl(String.format("javascript:Common.joinRoom('%s', '%s');", chatData.roomId.toString(), chatData.roomName.toString()));
joinRoom(chatData.roomId.toString(), chatData.roomName);
} else {
mChatWebView.loadUrl(ABookCommConstants.CHAT_PAGE_URL);
}
......@@ -629,40 +628,6 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
return filenameWithoutExtension;
}
public void getLogin() {
// ローカルの言語を確認する
chatData.setLanguageCode(ActivityHandlingHelper.getInstance().getLocaleFileName());
// 最後のチャットのルーム名
String lastRoomName = PreferenceUtil.getUserPref(getApplicationContext(), AppDefType.UserPrefKey.CHAT_LAST_ROOMNAME, "");
// 最後のチャットのルーム
String lastRoomId = PreferenceUtil.getUserPref(getApplicationContext(), AppDefType.UserPrefKey.CHAT_LAST_ROOMID, "");
if (chatData.roomId != 0 && chatData.roomName != null) {
// 最後のチャットのルーム名
PreferenceUtil.putUserPref(getApplicationContext(), AppDefType.UserPrefKey.CHAT_LAST_ROOMNAME, chatData.roomName);
// 最後のチャットのルーム
PreferenceUtil.putUserPref(getApplicationContext(), AppDefType.UserPrefKey.CHAT_LAST_ROOMID, String.valueOf(chatData.roomId));
mChatWebView.loadUrl(String.format("javascript:getLoginParameter('%s', '%s', '%s', '%s', '%s', '%s', '%s');", chatData.sid, chatData.loginId, chatData.shopName, chatData.roomId, chatData.roomName, chatData.getLanguageCode(), chatData.shopMemberId));
} else {
if (lastRoomName.length() > 0 && lastRoomId.length() > 0) {
mChatWebView.loadUrl(String.format("javascript:getLoginParameter('%s', '%s', '%s', '%s', '%s', '%s', '%s');", chatData.sid, chatData.loginId, chatData.shopName, lastRoomId, lastRoomName, chatData.getLanguageCode(), chatData.shopMemberId));
} else {
mChatWebView.loadUrl(String.format("javascript:getLoginParameter('%s', '%s', '%s', undefined, undefined, '%s', '%s');", chatData.sid, chatData.loginId, chatData.shopName, chatData.getLanguageCode(), chatData.shopMemberId));
}
}
}
public void getQueryParam() {
String chatServerUrl = ABVEnvironment.getInstance().websocketServerHttpUrl;
chatServerUrl= chatServerUrl.substring(0, chatServerUrl.length() - 3);
String cmsServerUrl = ABVEnvironment.getInstance().acmsAddress+ ABVDataCache.getInstance().getUrlPath();
chatData.setChatServerUrl(chatServerUrl);
chatData.setCmsServerUrl(cmsServerUrl);
mChatWebView.loadUrl(String.format("javascript:getGlobalParam('%s', '%s', '%s', '%s', '%s');", chatServerUrl, cmsServerUrl, "android", true, chatData.getIsOnline()));
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
......@@ -827,7 +792,6 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
}
}
meetingManager.close();
//handlingHelper.saveMeetingInfo(null, null, null, false);
activityHandlingHelper.saveMeetingInfo(null, null, null, false);
}
......@@ -882,20 +846,6 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
communicationLogic.updateFavoriteUser(resultJson.favoriteUserIds);
}
private void updateFavoriteGroup() throws NetworkDisconnectedException, AcmsException {
GetFavoriteGroupJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getFavoriteGroup(chatData.sid);
communicationLogic.updateFavoriteGroup(resultJson.favoriteGroupIds);
}
private void updateAllGroupInfo() throws NetworkDisconnectedException, AcmsException {
chatData.updateGroupInfoFromServer();
}
public void updateFavoriteInfo() throws NetworkDisconnectedException, AcmsException {
updateFavoriteUser();
updateFavoriteGroup();
}
@Override
public void onPictureInPictureModeChanged (boolean isInPictureInPictureMode, Configuration newConfig) {
isPIP = isInPictureInPictureMode;
......@@ -903,7 +853,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
mChatWebView.loadUrl("javascript:$('.pip_indicator').removeClass('none');");
} else {
if (isStop) {
mChatWebView.loadUrl("javascript:Coview_exitCollaboration();");
mChatWebView.loadUrl("javascript:CoviewBridge.exitCollaboration();");
Intent intent = new Intent();
Activity currentActivity = ActivityHandlingHelper.getInstance().getCurrentActivity();
intent.setClass(currentActivity, OperationListActivity.class);
......@@ -1063,7 +1013,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
chatData.roomName = chatRoomName;
mChatWebView.loadChatViewUrl(String.format("javascript:Common.startCollaboration('%s');", ABookCommConstants.FLAG.COLLABORATION_TYPE.AUDIO));
} else {
mChatWebView.loadChatViewUrl(String.format("javascript:Common.joinRoom('%s', '%s');", chatRoomId, chatRoomName));
joinRoom(chatRoomId.toString(), chatRoomName);
}
}
......@@ -1083,13 +1033,11 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
mChatWebView.loadChatViewUrl(ABookCommConstants.CHAT_PAGE_URL);
}
public void inviteUsers(String userIds, boolean isCollaboration) throws NetworkDisconnectedException, AcmsException {
public void inviteUsers(String userIds) throws NetworkDisconnectedException, AcmsException {
final UserInviteResultJSON result = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).inviteUsers(chatData.sid, chatData.roomId.intValue(), chatData.roomName, userIds);
if (result.roomId == null) {
communicationLogic.addUserInRoom(userIds, chatData.roomId.intValue());
if (!isCollaboration) {
mChatWebView.loadChatViewUrl(ABookCommConstants.CHAT_ROOM_PAGE_URL);
}
mChatWebView.loadChatViewUrl(ABookCommConstants.CHAT_ROOM_PAGE_URL);
} else {
mChatWebView.loadChatViewUrl(String.format("javascript:ReverseDelegate.displayExistRoom('%s');", result.roomId.toString()));
}
......@@ -1220,7 +1168,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
}
public void updateFavorite() throws NetworkDisconnectedException, AcmsException {
updateFavoriteInfo();
chatData.updateFavoriteInfo();
}
public int createContentView() {
......@@ -1280,7 +1228,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
startContentListActivity(false);
}
public void startPipMode() {
public void startPIPMode() {
PictureInPictureParams.Builder mPipBuilder = new PictureInPictureParams.Builder();
enterPictureInPictureMode(mPipBuilder.build());
}
......@@ -1294,7 +1242,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
finishPIPmode();
}
public void finishPip() {
public void finishPIP() {
finishPIPmode();
}
......
......@@ -59,26 +59,6 @@ public class ChatWebView extends WebView {
}
@JavascriptInterface
public void getLoginParameter() {
post(new Runnable() {
@Override
public void run() {
chatActivity.getLogin();
}
});
}
@JavascriptInterface
public void getGlobalParameter() {
post(new Runnable() {
@Override
public void run() {
chatActivity.getQueryParam();
}
});
}
@JavascriptInterface
public void goHome() {
post(new Runnable() {
@Override
......@@ -181,8 +161,8 @@ public class ChatWebView extends WebView {
}
@JavascriptInterface
public void inviteUsers(String userIds, boolean isCollaboration) throws NetworkDisconnectedException, AcmsException {
chatActivity.inviteUsers(userIds,isCollaboration);
public void inviteUsers(String userIds) throws NetworkDisconnectedException, AcmsException {
chatActivity.inviteUsers(userIds);
}
@JavascriptInterface
......@@ -437,8 +417,8 @@ public class ChatWebView extends WebView {
}
@JavascriptInterface
public void startPipMode() {
chatActivity.startPipMode();
public void startPIPMode() {
chatActivity.startPIPMode();
}
@JavascriptInterface
......@@ -490,8 +470,8 @@ public class ChatWebView extends WebView {
}
@JavascriptInterface
public void finishPip() {
chatActivity.finishPip();
public void finishPIP() {
chatActivity.finishPIP();
}
@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