Commit 54452c9b by Takatoshi Miura

android修正分の適用

parent e22d4630
...@@ -240,4 +240,54 @@ CHAT_DB.getUserInfo = function(shopMemberId) { ...@@ -240,4 +240,54 @@ CHAT_DB.getUserInfo = function(shopMemberId) {
//String形式をJsonに変更してReturn //String形式をJsonに変更してReturn
return JSON.parse(android.getUserInfo(shopMemberId)); return JSON.parse(android.getUserInfo(shopMemberId));
} }
} };
\ No newline at end of file
CHAT_DB.getBeforeRoomType = function() {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
return callNativeApp("getBeforeRoomType", {});
}
};
CHAT_DB.getRoomType = function() {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
return callNativeApp("getRoomType", {});
}
};
CHAT_DB.removeFavoriteUser = function(shopMemberId) {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
var result = callNativeApp("removeFavoriteUser", {"shopMemberId": shopMemberId});
if (result == "true") {
return true;
} else {
return false;
}
}
};
CHAT_DB.addFavoriteUser = function(shopMemberId) {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
var result = callNativeApp("addFavoriteUser", {"shopMemberId": shopMemberId});
if (result == "true") {
return true;
} else {
return false;
}
}
};
CHAT_DB.addFavoriteGroup = function(groupId) {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
var result = callNativeApp("addFavoriteGroup", {"groupId": groupId});
if (result == "true") {
return true;
} else {
return false;
}
}
};
\ No newline at end of file
...@@ -693,7 +693,7 @@ CHAT_UI.showConfirmView = function(isInvite) { ...@@ -693,7 +693,7 @@ CHAT_UI.showConfirmView = function(isInvite) {
if (typeof(android) != "undefined") { if (typeof(android) != "undefined") {
android.createChatRoom("1", userIdList.join(','), newRoomName, makeRoomFlg.MAKE_ROOM); android.createChatRoom("1", userIdList.join(','), newRoomName, makeRoomFlg.MAKE_ROOM);
} else { } else {
webkit.messageHandlers.createChatRoom.postMessage({"roomType": "1", "userIdList": userIdList.join(','), "roomName": newRoomName}); webkit.messageHandlers.createChatRoom.postMessage({"roomType": "1", "userIdList": userIdList.join(','), "roomName": newRoomName, "screenFlg": makeRoomFlg.MAKE_ROOM});
} }
...@@ -787,8 +787,7 @@ CHAT_UI.showConfirmView = function(isInvite) { ...@@ -787,8 +787,7 @@ CHAT_UI.showConfirmView = function(isInvite) {
if (typeof(android) != "undefined") { if (typeof(android) != "undefined") {
android.createChatRoom("1", userIdList.join(','), encodedRoomName, makeRoomFlg.MAKE_ROOM); android.createChatRoom("1", userIdList.join(','), encodedRoomName, makeRoomFlg.MAKE_ROOM);
} else { } else {
//TODO webkit.messageHandlers.createChatRoom.postMessage({"roomType": "1", "userIdList": userIdList.join(','), "roomName": newRoomName, "screenFlg": makeRoomFlg.MAKE_ROOM});
webkit.messageHandlers.createChatRoom.postMessage({"roomType": "1", "userIdList": userIdList.join(','), "roomName": encodedRoomName});
} }
} }
} }
...@@ -1025,11 +1024,15 @@ CHAT_UI.refreshRoomList = function(roomType) { ...@@ -1025,11 +1024,15 @@ CHAT_UI.refreshRoomList = function(roomType) {
var beforeRoomType; var beforeRoomType;
if (typeof(android) != "undefined") { if (typeof(android) != "undefined") {
beforeRoomType = android.getBeforeRoomType(); beforeRoomType = android.getBeforeRoomType();
} else {
beforeRoomType = CHAT_DB.getBeforeRoomType();
} }
if (beforeRoomType != null) { if (beforeRoomType != null) {
roomType = beforeRoomType; roomType = beforeRoomType;
if (typeof(android) != "undefined") { if (typeof(android) != "undefined") {
android.clearBeforeRoomType(); android.clearBeforeRoomType();
} else {
webkit.messageHandlers.clearBeforeRoomType.postMessage({});
} }
} }
CHAT_UI.showLoadingIndicator(); CHAT_UI.showLoadingIndicator();
...@@ -1149,7 +1152,12 @@ CHAT_UI.loadMessages = function(roomId, roomName) { ...@@ -1149,7 +1152,12 @@ CHAT_UI.loadMessages = function(roomId, roomName) {
} else { } else {
CHAT_UI.refreshForOffline(); CHAT_UI.refreshForOffline();
} }
var roomType = android.getRoomType(); var roomType;
if (typeof(android) != "undefined") {
roomType = android.getRoomType();
} else {
roomType = CHAT_DB.getRoomType();
}
if (roomType == chatRoomType.DM) { if (roomType == chatRoomType.DM) {
$('#roomMenu').removeClass('none'); $('#roomMenu').removeClass('none');
} }
...@@ -1337,7 +1345,11 @@ $('#addUserConfirmBtn').on('click', function(e) { ...@@ -1337,7 +1345,11 @@ $('#addUserConfirmBtn').on('click', function(e) {
}); });
CHAT_UI.roomDisplayOff = function() { CHAT_UI.roomDisplayOff = function() {
android.roomDisplayOff(); if (typeof(android) != "undefined") {
android.roomDisplayOff();
} else {
webkit.messageHandlers.roomDisplayOff.postMessage({});
}
} }
CHAT_UI.favoriteUserChange = function(shopMemberId, star) { CHAT_UI.favoriteUserChange = function(shopMemberId, star) {
...@@ -1360,17 +1372,16 @@ CHAT_UI.removeFavoriteUser = function(shopMemberId) { ...@@ -1360,17 +1372,16 @@ CHAT_UI.removeFavoriteUser = function(shopMemberId) {
CHAT_UI.showLoadingIndicator(); CHAT_UI.showLoadingIndicator();
$('#userNameCard').modal('hide'); $('#userNameCard').modal('hide');
$('#myNameCard').modal('hide'); $('#myNameCard').modal('hide');
var result;
if (typeof(android) != "undefined") { if (typeof(android) != "undefined") {
var result = android.removeFavoriteUser(shopMemberId); result = android.removeFavoriteUser(shopMemberId);
if (!result) { } else {
$('.shopmember_'+shopMemberId).addClass('active'); result = CHAT_DB.removeFavoriteUser(shopMemberId);
$('.shopmember_'+shopMemberId).removeClass('disable'); }
} else { if (!result) {
$('.shopmember_'+shopMemberId).removeClass('active'); $('.shopmember_'+shopMemberId).addClass('active');
$('.shopmember_'+shopMemberId).addClass('disable'); $('.shopmember_'+shopMemberId).removeClass('disable');
}
} else { } else {
webkit.messageHandlers.removeFavoriteUser.postMessage({shopMemberId});
$('.shopmember_'+shopMemberId).removeClass('active'); $('.shopmember_'+shopMemberId).removeClass('active');
$('.shopmember_'+shopMemberId).addClass('disable'); $('.shopmember_'+shopMemberId).addClass('disable');
} }
...@@ -1380,7 +1391,12 @@ CHAT_UI.removeFavoriteUser = function(shopMemberId) { ...@@ -1380,7 +1391,12 @@ CHAT_UI.removeFavoriteUser = function(shopMemberId) {
CHAT_UI.insertFavoriteUser = function(shopMemberId) { CHAT_UI.insertFavoriteUser = function(shopMemberId) {
$('#userNameCard').modal('hide'); $('#userNameCard').modal('hide');
$('#myNameCard').modal('hide'); $('#myNameCard').modal('hide');
var result = android.addFavoriteUser(shopMemberId); var result;
if (typeof(android) != "undefined") {
result = android.addFavoriteUser(shopMemberId);
} else {
result = CHAT_DB.addFavoriteUser(shopMemberId);
}
if (!result) { if (!result) {
$('.shopmember_'+shopMemberId).addClass('disable'); $('.shopmember_'+shopMemberId).addClass('disable');
$('.shopmember_'+shopMemberId).removeClass('active'); $('.shopmember_'+shopMemberId).removeClass('active');
...@@ -1397,7 +1413,7 @@ CHAT_UI.removeFavoriteGroup = function(groupId) { ...@@ -1397,7 +1413,7 @@ CHAT_UI.removeFavoriteGroup = function(groupId) {
if (typeof(android) != "undefined") { if (typeof(android) != "undefined") {
android.removeFavoriteGroup(groupId); android.removeFavoriteGroup(groupId);
} else { } else {
webkit.messageHandlers.removeFavoriteGroup.postMessage({groupId}); webkit.messageHandlers.removeFavoriteGroup.postMessage(groupId);
} }
$('.group_'+groupId).removeClass('active'); $('.group_'+groupId).removeClass('active');
$('.group_'+groupId).addClass('disable'); $('.group_'+groupId).addClass('disable');
...@@ -1406,7 +1422,12 @@ CHAT_UI.removeFavoriteGroup = function(groupId) { ...@@ -1406,7 +1422,12 @@ CHAT_UI.removeFavoriteGroup = function(groupId) {
CHAT_UI.insertFavoriteGroup = function(groupId) { CHAT_UI.insertFavoriteGroup = function(groupId) {
CHAT_UI.showLoadingIndicator(); CHAT_UI.showLoadingIndicator();
var result = android.addFavoriteGroup(groupId); var result;
if (typeof(android) != "undefined") {
result = android.addFavoriteGroup(groupId);
} else {
result = CHAT_DB.addFavoriteGroup(groupId);
}
if (!result) { if (!result) {
$('.group_'+groupId).addClass('disable'); $('.group_'+groupId).addClass('disable');
$('.group_'+groupId).removeClass('active'); $('.group_'+groupId).removeClass('active');
...@@ -1536,7 +1557,7 @@ CHAT_UI.startChat = function(userShopMemberId,userName) { ...@@ -1536,7 +1557,7 @@ CHAT_UI.startChat = function(userShopMemberId,userName) {
if (typeof(android) != "undefined") { if (typeof(android) != "undefined") {
android.createChatRoom(chatRoomType.DM, userIdList.join(','),newRoomName, makeRoomFlg.NAME_CARD); android.createChatRoom(chatRoomType.DM, userIdList.join(','),newRoomName, makeRoomFlg.NAME_CARD);
} else { } else {
webkit.messageHandlers.createChatRoom.postMessage({"roomType": chatRoomType.DM, "userIdList": userIdList.join(','), "roomName": newRoomName}); webkit.messageHandlers.createChatRoom.postMessage({"roomType": "1", "userIdList": userIdList.join(','), "roomName": newRoomName, "screenFlg": makeRoomFlg.NAME_CARD});
} }
CHAT_UI.hideNamecard(nameCardAreaId.USER); CHAT_UI.hideNamecard(nameCardAreaId.USER);
}; };
...@@ -2021,8 +2042,7 @@ CHAT_UI.showMakeRoomConfirmView = function() { ...@@ -2021,8 +2042,7 @@ CHAT_UI.showMakeRoomConfirmView = function() {
if (typeof(android) != "undefined") { if (typeof(android) != "undefined") {
android.createChatRoom("1", userIdList.join(','), newRoomName, makeRoomFlg.MAKE_ROOM); android.createChatRoom("1", userIdList.join(','), newRoomName, makeRoomFlg.MAKE_ROOM);
} else { } else {
//TODO webkit.messageHandlers.createChatRoom.postMessage({"roomType": "1", "userIdList": userIdList.join(','), "roomName": newRoomName, "screenFlg": makeRoomFlg.MAKE_ROOM});
webkit.messageHandlers.createChatRoom.postMessage({"roomType": "1", "userIdList": userIdList.join(','), "roomName": newRoomName});
} }
} else if(trimmedRoomName.includes(';') || trimmedRoomName.includes('/') || trimmedRoomName.includes('?') || trimmedRoomName.includes(':') || trimmedRoomName.includes("@") } else if(trimmedRoomName.includes(';') || trimmedRoomName.includes('/') || trimmedRoomName.includes('?') || trimmedRoomName.includes(':') || trimmedRoomName.includes("@")
|| trimmedRoomName.includes('&') || trimmedRoomName.includes('=') || trimmedRoomName.includes("+") || trimmedRoomName.includes('$') || trimmedRoomName.includes(",") || trimmedRoomName.includes('-') || trimmedRoomName.includes('&') || trimmedRoomName.includes('=') || trimmedRoomName.includes("+") || trimmedRoomName.includes('$') || trimmedRoomName.includes(",") || trimmedRoomName.includes('-')
...@@ -2069,7 +2089,7 @@ CHAT_UI.showMakeRoomConfirmView = function() { ...@@ -2069,7 +2089,7 @@ CHAT_UI.showMakeRoomConfirmView = function() {
if (typeof(android) != "undefined") { if (typeof(android) != "undefined") {
android.createChatRoom("1", userIdList.join(','), trimmedRoomName, makeRoomFlg.MAKE_ROOM); android.createChatRoom("1", userIdList.join(','), trimmedRoomName, makeRoomFlg.MAKE_ROOM);
} else { } else {
webkit.messageHandlers.createChatRoom.postMessage({"roomType": "1", "userIdList": userIdList.join(','), "roomName": encodedRoomName}); webkit.messageHandlers.createChatRoom.postMessage({"roomType": "1", "userIdList": userIdList.join(','), "roomName": newRoomName, "screenFlg": makeRoomFlg.MAKE_ROOM});
} }
} }
}); });
......
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