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