Commit 5b684341 by Lee Daehyun

Merge branch 'origin/develop_bugfix' into 'release_sp3'

undefined対策

See merge request !30
parents 6e2d9b07 555001d0
...@@ -147,10 +147,13 @@ ...@@ -147,10 +147,13 @@
let IS_ONLINE = false; let IS_ONLINE = false;
$("#chatMenuModal").load("./modal_chat_menu.html"); $("#chatMenuModal").load("./modal_chat_menu.html");
$("#loadingArea").load("./loading.html"); $("#loadingArea").load("./loading.html");
android.getLoginParameter(); if (typeof(android) != "undefined") {
android.getGlobalParameter(); android.getLoginParameter();
webkit.messageHandlers.loginInfoRequestMessageHandlerId.postMessage({}); android.getGlobalParameter();
webkit.messageHandlers.getGlobalParameter.postMessage({}); } else {
webkit.messageHandlers.loginInfoRequestMessageHandlerId.postMessage({});
webkit.messageHandlers.getGlobalParameter.postMessage({});
}
function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) { function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) {
CHAT_SERVER_URL = chatServerUrl; CHAT_SERVER_URL = chatServerUrl;
......
...@@ -130,8 +130,7 @@ ...@@ -130,8 +130,7 @@
android.getLoginParameter(); android.getLoginParameter();
android.getGlobalParameter(); android.getGlobalParameter();
android.saveSelectedUserList(""); android.saveSelectedUserList("");
} } else {
if (typeof(webkit) != "undefined") {
webkit.messageHandlers.loginInfoRequestMessageHandlerId.postMessage({}); webkit.messageHandlers.loginInfoRequestMessageHandlerId.postMessage({});
webkit.messageHandlers.getGlobalParameter.postMessage({}); webkit.messageHandlers.getGlobalParameter.postMessage({});
} }
......
...@@ -178,11 +178,14 @@ ...@@ -178,11 +178,14 @@
$("#pictureModal").load("./modal_chat_picture.html"); $("#pictureModal").load("./modal_chat_picture.html");
$("#chatMenuModal").load("./modal_chat_menu.html"); $("#chatMenuModal").load("./modal_chat_menu.html");
$("#loadingArea").load("./loading.html"); $("#loadingArea").load("./loading.html");
android.getLoginParameter(); if (typeof(android) != "undefined") {
android.getGlobalParameter(); android.getLoginParameter();
webkit.messageHandlers.loginInfoRequestMessageHandlerId.postMessage({}); android.getGlobalParameter();
webkit.messageHandlers.getGlobalParameter.postMessage(); } else {
webkit.messageHandlers.loginInfoRequestMessageHandlerId.postMessage({});
webkit.messageHandlers.getGlobalParameter.postMessage({});
}
function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) { function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) {
CHAT_SERVER_URL = chatServerUrl; CHAT_SERVER_URL = chatServerUrl;
CMS_SERVER_URL = cmsServerUrl; CMS_SERVER_URL = cmsServerUrl;
......
...@@ -206,8 +206,7 @@ ...@@ -206,8 +206,7 @@
if (typeof(android) != "undefined") { if (typeof(android) != "undefined") {
android.getLoginParameter(); android.getLoginParameter();
android.getGlobalParameter(); android.getGlobalParameter();
} } else {
if (typeof(webkit) != "undefined") {
webkit.messageHandlers.loginInfoRequestMessageHandlerId.postMessage({}); webkit.messageHandlers.loginInfoRequestMessageHandlerId.postMessage({});
webkit.messageHandlers.getGlobalParameter.postMessage({}); webkit.messageHandlers.getGlobalParameter.postMessage({});
} }
......
...@@ -125,8 +125,11 @@ $('#room-search').on('input', function(event) { ...@@ -125,8 +125,11 @@ $('#room-search').on('input', function(event) {
socket.emit('roomSearch', encodeURIComponent($('#room-search').val())); socket.emit('roomSearch', encodeURIComponent($('#room-search').val()));
} else { } else {
if (IS_ONLINE == 'true') { if (IS_ONLINE == 'true') {
android.updateRoomList(); if (typeof(android) != "undefined") {
webkit.messageHandlers.updateRoomList.postMessage({}); android.updateRoomList();
} else {
webkit.messageHandlers.updateRoomList.postMessage({});
}
CHAT_UI.refreshRoomList(chatRoomType.DM); CHAT_UI.refreshRoomList(chatRoomType.DM);
CHAT_UI.dismissLoadingIndicator(); CHAT_UI.dismissLoadingIndicator();
} }
...@@ -417,8 +420,11 @@ $('a[data-toggle="pill"]').on('show.bs.tab', function(e) { ...@@ -417,8 +420,11 @@ $('a[data-toggle="pill"]').on('show.bs.tab', function(e) {
CHAT.saveRoomInfo(); CHAT.saveRoomInfo();
if (IS_ONLINE == 'true') { if (IS_ONLINE == 'true') {
socket.emit('leaveRoom', function() { socket.emit('leaveRoom', function() {
android.updateRoomList(); if (typeof(android) != "undefined") {
webkit.messageHandlers.updateRoomList.postMessage({}); android.updateRoomList();
} else {
webkit.messageHandlers.updateRoomList.postMessage({"groupId":"0"});
}
}); });
} }
CHAT_UI.refreshRoomList(chatRoomType.DM); CHAT_UI.refreshRoomList(chatRoomType.DM);
...@@ -684,18 +690,11 @@ CHAT_UI.showConfirmView = function(isInvite) { ...@@ -684,18 +690,11 @@ CHAT_UI.showConfirmView = function(isInvite) {
//todo android create room api //todo android create room api
android.createChatRoom("1",userIdList.join(','),newRoomName); if (typeof(android) != "undefined") {
android.createChatRoom("1",userIdList.join(','),newRoomName);
if (CHAT_UTIL.isIOS()) { } else {
// TODO webkit.messageHandlers.createChatRoom.postMessage({"roomType": "1", "userIdList": userIdList.join(','), "roomName": newRoomName});
var roomDic = {
roomType: "1",
userIdList: userIdList.join(','),
roomName: newRoomName
};
webkit.messageHandlers.createChatRoom.postMessage({roomDic});
} }
/*socket.emit('createNewRoom', userIdList, encodedRoomName, function(newRoomId) { /*socket.emit('createNewRoom', userIdList, encodedRoomName, function(newRoomId) {
...@@ -942,17 +941,13 @@ CHAT_UI.refreshContactScreen = function() { ...@@ -942,17 +941,13 @@ CHAT_UI.refreshContactScreen = function() {
}); });
if (IS_ONLINE == 'true') { if (IS_ONLINE == 'true') {
if ( typeof(android) != "undefined") { if (typeof(android) != "undefined") {
android.updateGroupInfo('0'); android.updateGroupInfo('0');
android.updateMyInfo(); android.updateMyInfo();
android.updateGroupUser(); android.updateGroupUser();
android.updateFavorite(); android.updateFavorite();
} } else {
if ( typeof(webkit) != "undefined") { webkit.messageHandlers.updateGroupInfo.postMessage("0");
webkit.messageHandlers.updateGroupInfo.postMessage({"groupId":"0"});
webkit.messageHandlers.updateMyInfo.postMessage({});
webkit.messageHandlers.updateGroupUser.postMessage({});
webkit.messageHandlers.updateFavorite.postMessage({});
} }
} }
...@@ -1028,10 +1023,10 @@ CHAT_UI.refreshRoomList = function(roomType) { ...@@ -1028,10 +1023,10 @@ CHAT_UI.refreshRoomList = function(roomType) {
} }
if (IS_ONLINE == 'true') { if (IS_ONLINE == 'true') {
if (CHAT_UTIL.isIOS()) { if (typeof(android) != "undefined") {
webkit.messageHandlers.updateRoomList.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.updateRoomList(); android.updateRoomList();
} else {
webkit.messageHandlers.updateRoomList.postMessage({});
} }
} }
var rooms = CHAT_DB.getRoomList(roomType, null); var rooms = CHAT_DB.getRoomList(roomType, null);
...@@ -1119,15 +1114,21 @@ CHAT_UI.refreshRoomList = function(roomType) { ...@@ -1119,15 +1114,21 @@ CHAT_UI.refreshRoomList = function(roomType) {
CHAT_UI.joinRoom = function(roomId,roomName) { CHAT_UI.joinRoom = function(roomId,roomName) {
//native側に入場対象のroomId,roomNameを保存。(ルーム詳細画面初期化の時に使用。) //native側に入場対象のroomId,roomNameを保存。(ルーム詳細画面初期化の時に使用。)
android.joinRoom(roomId,roomName); if (typeof(android) != "undefined") {
webkit.messageHandlers.roomInfosaveMessageHandlerId.postMessage({"roomId": roomId, "roomName": roomName}); android.joinRoom(roomId,roomName);
} else {
webkit.messageHandlers.roomInfosaveMessageHandlerId.postMessage({"roomId": roomId, "roomName": roomName});
}
}; };
CHAT_UI.loadMessages = function(roomId, roomName) { CHAT_UI.loadMessages = function(roomId, roomName) {
if (IS_ONLINE == 'true') { if (IS_ONLINE == 'true') {
CHAT_SOCKET.connectSocket(); CHAT_SOCKET.connectSocket();
android.updateMessages(roomId); if (typeof(android) != "undefined") {
webkit.messageHandlers.updateMessages.postMessage({roomId}); android.updateMessages(roomId);
} else {
webkit.messageHandlers.updateMessages.postMessage({roomId});
}
socket.emit('exitRoom',roomId); socket.emit('exitRoom',roomId);
socket.emit('joinRoom', roomId, roomName, function() { socket.emit('joinRoom', roomId, roomName, function() {
}); });
...@@ -1318,8 +1319,11 @@ CHAT_UI.removeFavoriteUser = function(shopMemberId) { ...@@ -1318,8 +1319,11 @@ CHAT_UI.removeFavoriteUser = function(shopMemberId) {
CHAT_UI.showLoadingIndicator(); CHAT_UI.showLoadingIndicator();
$('#userNameCard').modal('hide'); $('#userNameCard').modal('hide');
$('#myNameCard').modal('hide'); $('#myNameCard').modal('hide');
android.removeFavoriteUser(shopMemberId); if (typeof(android) != "undefined") {
webkit.messageHandlers.removeFavoriteUser.postMessage({shopMemberId}); android.removeFavoriteUser(shopMemberId);
} else {
webkit.messageHandlers.removeFavoriteUser.postMessage({shopMemberId});
}
$('.shopmember_'+shopMemberId).removeClass('active'); $('.shopmember_'+shopMemberId).removeClass('active');
$('.shopmember_'+shopMemberId).addClass('disable'); $('.shopmember_'+shopMemberId).addClass('disable');
CHAT_UI.dismissLoadingIndicator(); CHAT_UI.dismissLoadingIndicator();
...@@ -1342,8 +1346,11 @@ CHAT_UI.insertFavoriteUser = function(shopMemberId) { ...@@ -1342,8 +1346,11 @@ CHAT_UI.insertFavoriteUser = function(shopMemberId) {
}; };
CHAT_UI.removeFavoriteGroup = function(groupId) { CHAT_UI.removeFavoriteGroup = function(groupId) {
android.removeFavoriteGroup(groupId); if (typeof(android) != "undefined") {
webkit.messageHandlers.removeFavoriteGroup.postMessage({groupId}); android.removeFavoriteGroup(groupId);
} else {
webkit.messageHandlers.removeFavoriteGroup.postMessage({groupId});
}
$('.group_'+groupId).removeClass('active'); $('.group_'+groupId).removeClass('active');
$('.group_'+groupId).addClass('disable'); $('.group_'+groupId).addClass('disable');
CHAT_UI.dismissLoadingIndicator(); CHAT_UI.dismissLoadingIndicator();
...@@ -1380,10 +1387,10 @@ CHAT_UI.refreshAllGroupSearch = function(paramGroupId) { ...@@ -1380,10 +1387,10 @@ CHAT_UI.refreshAllGroupSearch = function(paramGroupId) {
//オンライン状態であればサーバから情報更新。 //オンライン状態であればサーバから情報更新。
if (IS_ONLINE == 'true') { if (IS_ONLINE == 'true') {
if (CHAT_UTIL.isIOS()) { if (typeof(android) != "undefined") {
webkit.messageHandlers.updateGroupInfo.postMessage({groupId});
} else if (CHAT_UTIL.isAndroid()) {
android.updateGroupInfo(groupId); android.updateGroupInfo(groupId);
} else {
webkit.messageHandlers.updateGroupInfo.postMessage({groupId});
} }
} }
...@@ -1477,8 +1484,11 @@ CHAT_UI.startChat = function(userShopMemberId,userName) { ...@@ -1477,8 +1484,11 @@ CHAT_UI.startChat = function(userShopMemberId,userName) {
// 参加ユーザ名でルーム名を生成 // 参加ユーザ名でルーム名を生成
let newRoomName = CHAT.globalLoginParameter.loginId + ',' +userName; let newRoomName = CHAT.globalLoginParameter.loginId + ',' +userName;
android.createChatRoom(chatRoomType.DM, userIdList.join(','),newRoomName); if (typeof(android) != "undefined") {
webkit.messageHandlers.createChatRoom.postMessage({"roomType": chatRoomType.DM, "userIdList": userIdList.join(','), "roomName": newRoomName}); android.createChatRoom(chatRoomType.DM, userIdList.join(','),newRoomName);
} else {
webkit.messageHandlers.createChatRoom.postMessage({"roomType": chatRoomType.DM, "userIdList": userIdList.join(','), "roomName": newRoomName});
}
CHAT_UI.hideNamecard(nameCardAreaId.USER); CHAT_UI.hideNamecard(nameCardAreaId.USER);
}; };
......
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