Commit e966ab66 by Lee Munkyeong

オフライン対応

parent 70abde24
......@@ -158,6 +158,10 @@ main {
padding-right: 1rem;
margin-top: 1rem;
}
.disabled {
background: darkgray !important;
}
.profile_modal .modal-header { display: table; }
.profile_modal .modal-header,.profile_modal .modal-body { padding-bottom: 0; }
.profile_modal .modal-footer button { width: 33%; padding: 5px; }
......
......@@ -1132,6 +1132,7 @@ CHAT_UI.joinRoom = function(roomId,roomName) {
CHAT_UI.loadMessages = function(roomId, roomName) {
if (IS_ONLINE == 'true') {
CHAT_UI.refreshForOnline();
CHAT_SOCKET.connectSocket();
if (typeof(android) != "undefined") {
android.updateMessages(roomId);
......@@ -1141,6 +1142,8 @@ CHAT_UI.loadMessages = function(roomId, roomName) {
socket.emit('exitRoom',roomId);
socket.emit('joinRoom', roomId, roomName, function() {
});
} else {
CHAT_UI.refreshForOffline();
}
var roomType = android.getRoomType();
if (roomType == chatRoomType.DM) {
......@@ -1330,12 +1333,19 @@ CHAT_UI.removeFavoriteUser = function(shopMemberId) {
$('#userNameCard').modal('hide');
$('#myNameCard').modal('hide');
if (typeof(android) != "undefined") {
android.removeFavoriteUser(shopMemberId);
var result = android.removeFavoriteUser(shopMemberId);
if (!result) {
$('.shopmember_'+shopMemberId).addClass('active');
$('.shopmember_'+shopMemberId).removeClass('disable');
} else {
$('.shopmember_'+shopMemberId).removeClass('active');
$('.shopmember_'+shopMemberId).addClass('disable');
}
} else {
webkit.messageHandlers.removeFavoriteUser.postMessage({shopMemberId});
$('.shopmember_'+shopMemberId).removeClass('active');
$('.shopmember_'+shopMemberId).addClass('disable');
}
$('.shopmember_'+shopMemberId).removeClass('active');
$('.shopmember_'+shopMemberId).addClass('disable');
CHAT_UI.dismissLoadingIndicator();
};
......@@ -2155,4 +2165,30 @@ CHAT_UI.refreshMyGroupForAddUser = function() {
$('#myGroupListForMakeRoom').append(obj);
})
}
CHAT_UI.refreshForOnline = function() {
IS_ONLINE = 'true';
$('.craeteRoomButton').show();
$('#messageSend').removeClass('disabled');
$('#messageSend').attr('disabled', false);
$('#favoriteButton').attr('disabled', false);
$('#roomMenu').show();
$('.attach_file').show();
if (typeof $('#roomTitle').val() != 'undefined') {
CHAT_SOCKET.connectSocket();
socket.emit('exitRoom',CHAT.globalLoginParameter.roomId);
socket.emit('joinRoom', CHAT.globalLoginParameter.roomId, CHAT.globalLoginParameter.roomName, function() {
});
}
}
CHAT_UI.refreshForOffline = function() {
IS_ONLINE = 'false';
$('.craeteRoomButton').hide();
$('#messageSend').addClass('disabled');
$('#messageSend').attr('disabled', true);
$('#favoriteButton').attr('disabled', true);
$('#roomMenu').hide();
$('.attach_file').hide();
}
\ No newline at end of file
......@@ -21,17 +21,6 @@ $(function() {
}, 1000);
});
// お気に入りボタン押下イベント
$(".star").click(function () {
if ($(this).hasClass("active")) {
$(this).removeClass("active");
$(this).addClass("disable");
} else {
$(this).removeClass("disable");
$(this).addClass("active");
}
});
// 共通検索フォーム キャンセルボタン表示
$('.search_form input[type="search"]').click(function () {
$(this).addClass("focus");
......
......@@ -17,7 +17,7 @@
</div>
<div class="modal-footer border-0 justify-content-center">
{{#isFavorite}}
<button type="button" class="border-0 bg_navy" onclick="CHAT_UI.removeFavoriteUser({{shopMemberId}})">
<button type="button" class="border-0 bg_navy" onclick="CHAT_UI.removeFavoriteUser({{shopMemberId}})" id="favoriteButton">
<div class="d-flex flex-column">
<div class="img_wrap">
<img src="icon/icon_profile_favorite.png" alt="お気に入り">
......@@ -27,7 +27,7 @@
</button>
{{/isFavorite}}
{{^isFavorite}}
<button type="button" class="border-0 bg_navy" onclick="CHAT_UI.insertFavoriteUser({{shopMemberId}})">
<button type="button" class="border-0 bg_navy" onclick="CHAT_UI.insertFavoriteUser({{shopMemberId}})" id="favoriteButton">
<div class="d-flex flex-column">
<div class="img_wrap">
<img src="icon/icon_profile_favorite_white.png" alt="お気に入り">
......
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