Commit 2f285958 by Takatoshi Miura

undefined対策

parent 42b78026
......@@ -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;
......
......@@ -126,11 +126,14 @@
let IS_MOBILE = true;
let IS_ONLINE = false;
$("#loadingArea").load("./loading.html");
android.getLoginParameter();
android.getGlobalParameter();
android.saveSelectedUserList("");
webkit.messageHandlers.loginInfoRequestMessageHandlerId.postMessage({});
webkit.messageHandlers.getGlobalParameter.postMessage({});
if (typeof(android) != "undefined") {
android.getLoginParameter();
android.getGlobalParameter();
android.saveSelectedUserList("");
} else {
webkit.messageHandlers.loginInfoRequestMessageHandlerId.postMessage({});
webkit.messageHandlers.getGlobalParameter.postMessage({});
}
function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) {
CHAT_SERVER_URL = chatServerUrl;
......
......@@ -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;
......
......@@ -227,10 +227,13 @@
let IS_MOBILE = true;
let IS_ONLINE = false;
$("#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;
......
......@@ -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) {
......@@ -941,15 +940,17 @@ CHAT_UI.refreshContactScreen = function() {
});
if (IS_ONLINE == 'true') {
android.updateGroupInfo('0');
android.updateMyInfo();
android.updateGroupUser();
android.updateFavorite();
webkit.messageHandlers.updateGroupInfo.postMessage({'0'});
webkit.messageHandlers.updateMyInfo.postMessage({});
webkit.messageHandlers.updateGroupUser.postMessage({});
webkit.messageHandlers.updateFavorite.postMessage({});
if (typeof(android) != "undefined") {
android.updateGroupInfo('0');
android.updateMyInfo();
android.updateGroupUser();
android.updateFavorite();
} else {
webkit.messageHandlers.updateGroupInfo.postMessage("0");
webkit.messageHandlers.updateMyInfo.postMessage({});
webkit.messageHandlers.updateGroupUser.postMessage({});
webkit.messageHandlers.updateFavorite.postMessage({});
}
}
var myInfo = CHAT_DB.getMyInfo();
......@@ -1024,8 +1025,11 @@ CHAT_UI.refreshRoomList = function(roomType) {
}
if (IS_ONLINE == 'true') {
android.updateRoomList();
webkit.messageHandlers.updateRoomList.postMessage({});
if (typeof(android) != "undefined") {
android.updateRoomList();
} else {
webkit.messageHandlers.updateRoomList.postMessage({});
}
}
var rooms = CHAT_DB.getRoomList(roomType, null);
CHAT.globalIsInvite = false;
......@@ -1112,15 +1116,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() {
});
......@@ -1310,8 +1320,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();
......@@ -1334,8 +1347,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();
......@@ -1372,8 +1388,11 @@ CHAT_UI.refreshAllGroupSearch = function(paramGroupId) {
//オンライン状態であればサーバから情報更新。
if (IS_ONLINE == 'true') {
android.updateGroupInfo(groupId);
webkit.messageHandlers.updateGroupInfo.postMessage({groupId});
if (typeof(android) != "undefined") {
android.updateGroupInfo(groupId);
} else {
webkit.messageHandlers.updateGroupInfo.postMessage({groupId});
}
}
//画面エリアを初期化。
......@@ -1466,8 +1485,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