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");
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,10 +178,13 @@
$("#pictureModal").load("./modal_chat_picture.html");
$("#chatMenuModal").load("./modal_chat_menu.html");
$("#loadingArea").load("./loading.html");
if (typeof(android) != "undefined") {
android.getLoginParameter();
android.getGlobalParameter();
} else {
webkit.messageHandlers.loginInfoRequestMessageHandlerId.postMessage({});
webkit.messageHandlers.getGlobalParameter.postMessage();
webkit.messageHandlers.getGlobalParameter.postMessage({});
}
function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) {
CHAT_SERVER_URL = chatServerUrl;
......
......@@ -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') {
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() {
if (typeof(android) != "undefined") {
android.updateRoomList();
webkit.messageHandlers.updateRoomList.postMessage({});
} else {
webkit.messageHandlers.updateRoomList.postMessage({"groupId":"0"});
}
});
}
CHAT_UI.refreshRoomList(chatRoomType.DM);
......@@ -684,20 +690,13 @@ CHAT_UI.showConfirmView = function(isInvite) {
//todo android create room api
if (typeof(android) != "undefined") {
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});
} else {
webkit.messageHandlers.createChatRoom.postMessage({"roomType": "1", "userIdList": userIdList.join(','), "roomName": newRoomName});
}
/*socket.emit('createNewRoom', userIdList, encodedRoomName, function(newRoomId) {
socket.emit('joinRoom', newRoomId, newRoomName, function() {
CHAT.saveRoomInfo(newRoomId, newRoomName);
......@@ -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を保存。(ルーム詳細画面初期化の時に使用。)
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();
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');
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) {
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;
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