Commit 54452c9b by Takatoshi Miura

android修正分の適用

parent e22d4630
......@@ -240,4 +240,54 @@ CHAT_DB.getUserInfo = function(shopMemberId) {
//String形式をJsonに変更してReturn
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) {
if (typeof(android) != "undefined") {
android.createChatRoom("1", userIdList.join(','), newRoomName, makeRoomFlg.MAKE_ROOM);
} 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) {
if (typeof(android) != "undefined") {
android.createChatRoom("1", userIdList.join(','), encodedRoomName, makeRoomFlg.MAKE_ROOM);
} else {
//TODO
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});
}
}
}
......@@ -1025,11 +1024,15 @@ CHAT_UI.refreshRoomList = function(roomType) {
var beforeRoomType;
if (typeof(android) != "undefined") {
beforeRoomType = android.getBeforeRoomType();
} else {
beforeRoomType = CHAT_DB.getBeforeRoomType();
}
if (beforeRoomType != null) {
roomType = beforeRoomType;
if (typeof(android) != "undefined") {
android.clearBeforeRoomType();
} else {
webkit.messageHandlers.clearBeforeRoomType.postMessage({});
}
}
CHAT_UI.showLoadingIndicator();
......@@ -1149,7 +1152,12 @@ CHAT_UI.loadMessages = function(roomId, roomName) {
} else {
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) {
$('#roomMenu').removeClass('none');
}
......@@ -1337,7 +1345,11 @@ $('#addUserConfirmBtn').on('click', function(e) {
});
CHAT_UI.roomDisplayOff = function() {
if (typeof(android) != "undefined") {
android.roomDisplayOff();
} else {
webkit.messageHandlers.roomDisplayOff.postMessage({});
}
}
CHAT_UI.favoriteUserChange = function(shopMemberId, star) {
......@@ -1360,8 +1372,12 @@ CHAT_UI.removeFavoriteUser = function(shopMemberId) {
CHAT_UI.showLoadingIndicator();
$('#userNameCard').modal('hide');
$('#myNameCard').modal('hide');
var result;
if (typeof(android) != "undefined") {
var result = android.removeFavoriteUser(shopMemberId);
result = android.removeFavoriteUser(shopMemberId);
} else {
result = CHAT_DB.removeFavoriteUser(shopMemberId);
}
if (!result) {
$('.shopmember_'+shopMemberId).addClass('active');
$('.shopmember_'+shopMemberId).removeClass('disable');
......@@ -1369,18 +1385,18 @@ CHAT_UI.removeFavoriteUser = function(shopMemberId) {
$('.shopmember_'+shopMemberId).removeClass('active');
$('.shopmember_'+shopMemberId).addClass('disable');
}
} else {
webkit.messageHandlers.removeFavoriteUser.postMessage({shopMemberId});
$('.shopmember_'+shopMemberId).removeClass('active');
$('.shopmember_'+shopMemberId).addClass('disable');
}
CHAT_UI.dismissLoadingIndicator();
};
CHAT_UI.insertFavoriteUser = function(shopMemberId) {
$('#userNameCard').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) {
$('.shopmember_'+shopMemberId).addClass('disable');
$('.shopmember_'+shopMemberId).removeClass('active');
......@@ -1397,7 +1413,7 @@ CHAT_UI.removeFavoriteGroup = function(groupId) {
if (typeof(android) != "undefined") {
android.removeFavoriteGroup(groupId);
} else {
webkit.messageHandlers.removeFavoriteGroup.postMessage({groupId});
webkit.messageHandlers.removeFavoriteGroup.postMessage(groupId);
}
$('.group_'+groupId).removeClass('active');
$('.group_'+groupId).addClass('disable');
......@@ -1406,7 +1422,12 @@ CHAT_UI.removeFavoriteGroup = function(groupId) {
CHAT_UI.insertFavoriteGroup = function(groupId) {
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) {
$('.group_'+groupId).addClass('disable');
$('.group_'+groupId).removeClass('active');
......@@ -1536,7 +1557,7 @@ CHAT_UI.startChat = function(userShopMemberId,userName) {
if (typeof(android) != "undefined") {
android.createChatRoom(chatRoomType.DM, userIdList.join(','),newRoomName, makeRoomFlg.NAME_CARD);
} 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);
};
......@@ -2021,8 +2042,7 @@ CHAT_UI.showMakeRoomConfirmView = function() {
if (typeof(android) != "undefined") {
android.createChatRoom("1", userIdList.join(','), newRoomName, makeRoomFlg.MAKE_ROOM);
} else {
//TODO
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});
}
} else if(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() {
if (typeof(android) != "undefined") {
android.createChatRoom("1", userIdList.join(','), trimmedRoomName, makeRoomFlg.MAKE_ROOM);
} 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