Commit 0b9baea9 by Lee Munkyeong

コードレビュー対応

parent 67e11f79
......@@ -706,3 +706,23 @@ a.article:hover {
.chat-list-type-btn {
width: 30%;
}
#my_info > div > div {
padding-left: 5%;
}
#favorite_list > div > div {
padding-left: 5%;
}
#my_group_list > div > div {
padding-left: 5%;
}
.contact-seperator {
width: 100%;
background-color: #095395!important;
color: white;
margin-bottom: 0px;
}
......@@ -234,14 +234,14 @@
</div>
<div id="my_info" class="inbox_user row">
</div>
<div class="collapsible-content">
<label class="contact-seperator" id="favorite-seperator">Favorite</label>
<div id="favorite_list" class="inbox_user row">
</div>
</div>
<div class="collapsible-content">
<label class="contact-seperator" id="mygroup-seperator">MY GROUP</label>
<div id="my_group_list" class="inbox_user row">
</div>
</div>
</div>
</div>
......@@ -458,6 +458,28 @@
</div>
</div>
</script>
<script id="favorite-user-template" type="text/template">
<div class="user_list col-12" data-name="{{name}}">
<div class="user_people">
<div class="user_img">
<img src="{{profileImage}}" alt="">
</div>
<div class="user_ib">
<h5>{{name}}</h5>
<p>{{info}}</p>
</div>
<div class="squareBox userCheckBox" data-name="{{name}}" data-id="{{id}}">
<div class="squareBoxContent">
<div>
<span>
<i class="fas fa-check"></i>
</span>
</div>
</div>
</div>
</div>
</div>
</script>
<script src="./socket.io/dist/socket.io.js"></script>
<script src="./js/libs/socket.io.js"></script>
<script src="./js/libs/jquery-3.3.1.min.js"></script>
......
......@@ -133,7 +133,7 @@ $('#room-search').on('input', function(event) {
} else {
if (IS_ONLINE == 'true') {
android.updateRoomList();
CHAT_UI.refreshRoomList("1");
CHAT_UI.refreshRoomList(chatRoomType.DM);
CHAT_UI.dismissLoadingIndicator();
}
}
......@@ -401,7 +401,7 @@ $('a[data-toggle="pill"]').on('show.bs.tab', function (e) {
android.updateRoomList();
});
}
CHAT_UI.refreshRoomList("1");
CHAT_UI.refreshRoomList(chatRoomType.DM);
CHAT_UI.dismissLoadingIndicator();
});
console.log("show #pills-chat")
......@@ -826,6 +826,9 @@ CHAT_UI.htmlElementTextInitialize = function(languageCode) {
$("#dmBtn").text(getLocalizedString("directMessageChatRoom"))
$("#groupBtn").text(getLocalizedString("groupChatRoom"))
$("#favorite-seperator").text(getLocalizedString("favorite"))
$("#mygroup-seperator").text(getLocalizedString("mygroup"))
}
// 画像の読み込みが全て終わったタイミングでコールバック実行
......@@ -854,6 +857,10 @@ $('#contactButton').on('click', function(event){
CHAT_UI.refreshContactScreen();
});
$('#chatButton').on('click', function(event){
CHAT_UI.refreshRoomList(chatRoomType.DM);
});
CHAT_UI.refreshContactScreen = function() {
//loadingIndicatorを表示
$('#my_info').html('');
......@@ -896,7 +903,9 @@ CHAT_UI.refreshContactScreen = function() {
$('#my_info').append(obj);
var groupUserList = CHAT_DB.getMyGroupUsers();
console.log(groupUserList);
groupUserList.forEach(function(groupUser) {
groupUser.profileImagePath = CHAT.getProfileImgUrl(groupUser.profileUrl)
let html = Mustache.render(userTemplate, {
id: groupUser.shopMemberId,
profileImage: groupUser.profileImagePath,
......@@ -905,12 +914,11 @@ CHAT_UI.refreshContactScreen = function() {
let obj = $(jQuery.parseHTML(html)).on('click',function(){
//TODO need onClick Action
console.log('groupUserClick');
});
$('#my_group_list').append(obj);
})
var favoriteCount = 0;
var favoriteGroupList = CHAT_DB.getFavoriteGroups();
favoriteGroupList.forEach(function(favoriteGroup) {
let html = Mustache.render(groupTemplate, {
......@@ -919,14 +927,14 @@ CHAT_UI.refreshContactScreen = function() {
let obj = $(jQuery.parseHTML(html)).on('click',function(){
//TODO need onClick Action
console.log('groupClick');
});
favoriteCount++
$('#favorite_list').append(obj);
})
var favoriteUserList = CHAT_DB.getFavoriteUsers();
favoriteUserList.forEach(function(favoriteUser) {
favoriteUser.profileImagePath = CHAT.getProfileImgUrl(favoriteUser.profileUrl)
let html = Mustache.render(groupTemplate, {
id: favoriteUser.shopMemberId,
profileImage: favoriteUser.profileImagePath,
......@@ -935,12 +943,18 @@ CHAT_UI.refreshContactScreen = function() {
let obj = $(jQuery.parseHTML(html)).on('click',function(){
//TODO need onClick Action
console.log('userClick');
});
favoriteCount++
$('#favorite_list').append(obj);
})
if (favoriteCount == 0) {
$('#favorite_list').hide();
$('#favorite-seperator').hide();
} else {
$('#favorite_list').show();
$('#favorite-seperator').show();
}
console.log('LOAD DONE CONTACT SCREEN');
CHAT_UI.dismissLoadingIndicator();
}
......@@ -1035,7 +1049,6 @@ CHAT_UI.joinRoom = function(roomId,roomName) {
android.updateMessages(roomId);
socket.emit('joinRoom', roomId, roomName, function() {
});
} else {
}
var messages = CHAT_DB.getMessages(roomId);
console.log(messages);
......@@ -1110,9 +1123,9 @@ CHAT_UI.loadMessages = function(messages, roomId, roomName) {
$('#dmBtn').on('click', function (e){
CHAT_UI.refreshRoomList("1");
CHAT_UI.refreshRoomList(chatRoomType.DM);
});
$('#groupBtn').on('click', function (e){
CHAT_UI.refreshRoomList("0");
CHAT_UI.refreshRoomList(chatRoomType.GROUP);
});
\ No newline at end of file
......@@ -7,33 +7,31 @@ function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnlin
IS_MOBILE = isMobile;
IS_ONLINE = isOnline;
connectSocket();
};
};
android.getGlobalParameter();
function connectSocket() {
CHAT_UI.dismissLoadingIndicator();
if (IS_ONLINE == 'true') {
console.log('isOnline');
socket = io(CHAT_SERVER_URL);
console.log('insOnline');
setSocketAction();
android.updateRoomList();
CHAT_UI.refreshRoomList("1");
CHAT_UI.refreshRoomList(chatRoomType.DM);
CHAT_UI.dismissLoadingIndicator();
$('#createChatRoom').show();
} else {
console.log('insOffline');
console.log('isOffline');
//オフラインの場合、DBからルーム一覧を表示。
if (CHAT_UTIL.isIOS()) {
//TODO IOSの場合
} else if (CHAT_UTIL.isAndroid()) {
console.log('insAnd');
//$('.overlay').removeClass('active undismissable');
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
android.getLoginParameter();
console.log('init')
CHAT_UI.refreshRoomList("1");
CHAT_UI.refreshRoomList(chatRoomType.DM);
CHAT_UI.dismissLoadingIndicator();
$('#createChatRoom').show();
}
......@@ -400,7 +398,7 @@ function setSocketAction () {
} else {
if (IS_ONLINE == 'true') {
android.updateRoomList();
CHAT_UI.refreshRoomList("1");
CHAT_UI.refreshRoomList(chatRoomType.DM);
CHAT_UI.dismissLoadingIndicator();
}
}
......
......@@ -20,3 +20,8 @@ const messageType = {
const userAPICmd = {
MYINFO : 9
}
const chatRoomType = {
DM : "1",
GROUP : "0"
}
......@@ -56,5 +56,7 @@ $.lang.en = {
"contactListTitle":"Contact",
"contactSearch":"Contact search",
"directMessageChatRoom":"DM",
"favorite":"Favorite List",
"mygroup":"My Group",
"groupChatRoom":"Group"
}
......@@ -56,5 +56,7 @@ $.lang.ja = {
"contactListTitle":"コンタクト",
"contactSearch":"コンタクト検索",
"directMessageChatRoom":"DM",
"favorite":"お気に入りリスト",
"mygroup":"マイグループ",
"groupChatRoom":"グループ"
}
......@@ -56,5 +56,7 @@ $.lang.ko = {
"contactListTitle":"연락처",
"contactSearch":"연락처 검색",
"directMessageChatRoom":"DM",
"favorite":"즐겨찾기리스트",
"mygroup":"마이그룹",
"groupChatRoom":"그룹"
}
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