Commit 41fff884 by Takatoshi Miura

Merge branch 'origin/#573_message' into 'release_sp3'

android追加修正分の適用

See merge request !62
parents 3d74fed4 1234b73c
...@@ -219,7 +219,7 @@ CHAT_DB.getArchiveDetail = function(archiveId) { ...@@ -219,7 +219,7 @@ CHAT_DB.getArchiveDetail = function(archiveId) {
CHAT_DB.updateArchiveDetail = function(archiveId) { CHAT_DB.updateArchiveDetail = function(archiveId) {
if (CHAT_UTIL.isIOS()) { if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.updateArchiveDetail.postMessage({archiveId}); webkit.messageHandlers.updateArchiveDetail.postMessage(archiveId);
} else if (CHAT_UTIL.isAndroid()) { } else if (CHAT_UTIL.isAndroid()) {
android.updateArchiveDetail(archiveId); android.updateArchiveDetail(archiveId);
} }
...@@ -249,4 +249,54 @@ CHAT_DB.getUserInfo = function(shopMemberId) { ...@@ -249,4 +249,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');
} }
...@@ -1344,7 +1352,11 @@ $('#addUserConfirmBtn').on('click', function(e) { ...@@ -1344,7 +1352,11 @@ $('#addUserConfirmBtn').on('click', function(e) {
}); });
CHAT_UI.roomDisplayOff = function() { CHAT_UI.roomDisplayOff = function() {
if (typeof(android) != "undefined") {
android.roomDisplayOff(); android.roomDisplayOff();
} else {
webkit.messageHandlers.roomDisplayOff.postMessage({});
}
} }
CHAT_UI.favoriteUserChange = function(shopMemberId, star) { CHAT_UI.favoriteUserChange = function(shopMemberId, star) {
...@@ -1367,8 +1379,12 @@ CHAT_UI.removeFavoriteUser = function(shopMemberId) { ...@@ -1367,8 +1379,12 @@ 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);
} else {
result = CHAT_DB.removeFavoriteUser(shopMemberId);
}
if (!result) { if (!result) {
$('.shopmember_'+shopMemberId).addClass('active'); $('.shopmember_'+shopMemberId).addClass('active');
$('.shopmember_'+shopMemberId).removeClass('disable'); $('.shopmember_'+shopMemberId).removeClass('disable');
...@@ -1376,18 +1392,18 @@ CHAT_UI.removeFavoriteUser = function(shopMemberId) { ...@@ -1376,18 +1392,18 @@ CHAT_UI.removeFavoriteUser = function(shopMemberId) {
$('.shopmember_'+shopMemberId).removeClass('active'); $('.shopmember_'+shopMemberId).removeClass('active');
$('.shopmember_'+shopMemberId).addClass('disable'); $('.shopmember_'+shopMemberId).addClass('disable');
} }
} else {
webkit.messageHandlers.removeFavoriteUser.postMessage({shopMemberId});
$('.shopmember_'+shopMemberId).removeClass('active');
$('.shopmember_'+shopMemberId).addClass('disable');
}
CHAT_UI.dismissLoadingIndicator(); CHAT_UI.dismissLoadingIndicator();
}; };
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');
...@@ -1404,7 +1420,7 @@ CHAT_UI.removeFavoriteGroup = function(groupId) { ...@@ -1404,7 +1420,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');
...@@ -1413,7 +1429,12 @@ CHAT_UI.removeFavoriteGroup = function(groupId) { ...@@ -1413,7 +1429,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');
...@@ -1543,7 +1564,7 @@ CHAT_UI.startChat = function(userShopMemberId,userName) { ...@@ -1543,7 +1564,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);
}; };
...@@ -1711,9 +1732,7 @@ CHAT_UI.refreshArchiveDetailScreen = function(archiveId) { ...@@ -1711,9 +1732,7 @@ CHAT_UI.refreshArchiveDetailScreen = function(archiveId) {
// 参加ユーザ情報を表示 // 参加ユーザ情報を表示
let attendUserList = archive.attendUserIds; let attendUserList = archive.attendUserIds;
if (CHAT_UTIL.isAndroid()) {
attendUserList = JSON.parse(archive.attendUserIds); attendUserList = JSON.parse(archive.attendUserIds);
}
attendUserList.forEach(function(user) { attendUserList.forEach(function(user) {
...@@ -2028,8 +2047,7 @@ CHAT_UI.showMakeRoomConfirmView = function() { ...@@ -2028,8 +2047,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('-')
...@@ -2076,7 +2094,7 @@ CHAT_UI.showMakeRoomConfirmView = function() { ...@@ -2076,7 +2094,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});
} }
} }
}); });
...@@ -2111,7 +2129,11 @@ CHAT_UI.showAddUserConfirmView = function() { ...@@ -2111,7 +2129,11 @@ CHAT_UI.showAddUserConfirmView = function() {
selectedUserList.forEach(function(user){ selectedUserList.forEach(function(user){
userIdList.push(user.shopMemberId); userIdList.push(user.shopMemberId);
}) })
if (typeof(android) != "undefined") {
android.inviteUsers(userIdList.join(',')); android.inviteUsers(userIdList.join(','));
} else {
webkit.messageHandlers.inviteUsers.postMessage({"userIdList": userIdList.join(',')});
}
}); });
} }
......
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