Commit f5246fcd by Lee Munkyeong

add Dao, Js file

parent c73df9b5
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.ArchiveDto;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.CollaborationDto;
public class ArchiveDao extends AbstractDao {
/**
* {@link ArchiveDao} のインスタンスを初期化します。
* アンドロイドの android.content.Context のインスタンス
* @throws ClassCastException 引数のcontextが android.content.Context 又は、その継承クラスではありません。
* @since 1.0.0
*/
/*package*/ ArchiveDao() {
}
@Override
protected ArchiveDto convert(Cursor cursor) {
ArchiveDto dto = new ArchiveDto();
int column = cursor.getColumnIndex("archive_id");
if (column != -1) {
dto.archiveId = cursor.getInt(column);
}
column = cursor.getColumnIndex("archive_name");
if (column != -1) {
dto.archiveName = cursor.getString(column);
}
column = cursor.getColumnIndex("archive_type");
if (column != -1) {
dto.archiveType = cursor.getInt(column);
}
column = cursor.getColumnIndex("archive_url");
if (column != -1) {
dto.archiveUrl = cursor.getString(column);
}
column = cursor.getColumnIndex("collaboration_id");
if (column != -1) {
dto.collaborationId = cursor.getInt(column);
}
column = cursor.getColumnIndex("shop_member_id");
if (column != -1) {
dto.shopMemberId = cursor.getInt(column);
}
column = cursor.getColumnIndex("archive_save_path");
if (column != -1) {
dto.archiveSavePath = cursor.getString(column);
}
return dto;
}
public List<ArchiveDto> getArchive(int archiveId) {
List<ArchiveDto> list = rawQueryGetDtoList("select * from t_archive where archive_id = ?", new String[]{""+ archiveId}, ArchiveDto.class);
return list;
}
public void insertArchive(ArchiveDto dto) {
insert("insert into t_archive (archive_id, archive_name, archive_type, archive_url, collaboration_id, shop_member_id, archive_save_path) values (?,?)", dto.getInsertValues());
}
public boolean updateArchive(ArchiveDto dto) {
long count = update("update t_archive set archive_name=?, archive_type=?, archive_url=?, collaboration_id=?, shop_member_id=?, archive_save_path=? where archive_id=?", dto.getUpdateValues());
return count > 0;
}
public void deleteArchive() {
try {
beginTransaction();
delete("t_archive", null, null);
commit();
} catch (Exception e) {
rollback();
Logger.e("deleteArchive failed.", e);
throw new RuntimeException(e);
}
}
}
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
public class ChatMessageDao extends AbstractDao {
/**
* {@link ChatMessageDao} のインスタンスを初期化します。
* アンドロイドの android.content.Context のインスタンス
* @throws ClassCastException 引数のcontextが android.content.Context 又は、その継承クラスではありません。
* @since 1.0.0
*/
/*package*/ ChatMessageDao() {
}
@Override
protected ChatMessageDto convert(Cursor cursor) {
ChatMessageDto dto = new ChatMessageDto();
int column = cursor.getColumnIndex("chat_message_id");
if (column != -1) {
dto.chatMessageId = cursor.getInt(column);
}
column = cursor.getColumnIndex("chat_room_id");
if (column != -1) {
dto.chatRoomId = cursor.getInt(column);
}
column = cursor.getColumnIndex("shop_member_id");
if (column != -1) {
dto.shopMemberId = cursor.getInt(column);
}
column = cursor.getColumnIndex("message");
if (column != -1) {
dto.message = cursor.getString(column);
}
column = cursor.getColumnIndex("message_type");
if (column != -1) {
dto.messageType = cursor.getInt(column);
}
column = cursor.getColumnIndex("image_name");
if (column != -1) {
dto.imageName = cursor.getString(column);
}
column = cursor.getColumnIndex("download_file_name");
if (column != -1) {
dto.downloadFileName = cursor.getString(column);
}
column = cursor.getColumnIndex("save_path");
if (column != -1) {
dto.savePath = cursor.getString(column);
}
return dto;
}
public List<ChatMessageDto> getChatMessage(int chatRoomId) {
List<ChatMessageDto> list = rawQueryGetDtoList("select * from t_chat_message where chat_room_id = ?", new String[]{""+ chatRoomId}, ChatMessageDto.class);
return list;
}
public void insertChatMessage(ChatMessageDto dto) {
insert("insert into t_chat_message (chat_message_id, chat_room_id, shop_member_id, message, message_type, image_name, download_file_name, save_path) values (?,?,?,?,?,?,?,?)", dto.getInsertValues());
}
public boolean updateChatMessage(ChatMessageDto dto) {
long count = update("update t_chat_message set chat_room_id=?, shop_member_id=?, message=?, message_type=?, image_name=?, download_file_name=?, save_path=? where chat_message_id=?", dto.getUpdateValues());
return count > 0;
}
public void deleteChatMessage() {
try {
beginTransaction();
delete("t_chat_message", null, null);
commit();
} catch (Exception e) {
rollback();
Logger.e("deleteChatMessage failed.", e);
throw new RuntimeException(e);
} finally {
}
}
}
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.CollaborationDto;
public class CollaborationDao extends AbstractDao {
/**
* {@link CollaborationDao} のインスタンスを初期化します。
* アンドロイドの android.content.Context のインスタンス
* @throws ClassCastException 引数のcontextが android.content.Context 又は、その継承クラスではありません。
* @since 1.0.0
*/
/*package*/ CollaborationDao() {
}
@Override
protected CollaborationDto convert(Cursor cursor) {
CollaborationDto dto = new CollaborationDto();
int column = cursor.getColumnIndex("collaboration_id");
if (column != -1) {
dto.collaborationId = cursor.getInt(column);
}
column = cursor.getColumnIndex("chat_message_id");
if (column != -1) {
dto.chatMessageId = cursor.getInt(column);
}
return dto;
}
public List<CollaborationDto> getCollaboration(int collaborationId) {
List<CollaborationDto> list = rawQueryGetDtoList("select * from t_collaboration where collaboration_id = ?", new String[]{""+ collaborationId}, CollaborationDto.class);
return list;
}
public void insertCollaboration(CollaborationDto dto) {
insert("insert into t_collaboration (collaboration_id, chat_message_id) values (?,?)", dto.getInsertValues());
}
public void deleteCollaboration() {
try {
beginTransaction();
delete("t_collaboration", null, null);
commit();
} catch (Exception e) {
rollback();
Logger.e("deleteCollaboration failed.", e);
throw new RuntimeException(e);
}
}
}
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.CollaborationDetailDto;
public class CollaborationDetailDao extends AbstractDao {
/**
* {@link CollaborationDetailDao} のインスタンスを初期化します。
* アンドロイドの android.content.Context のインスタンス
* @throws ClassCastException 引数のcontextが android.content.Context 又は、その継承クラスではありません。
* @since 1.0.0
*/
/*package*/ CollaborationDetailDao() {
}
@Override
protected CollaborationDetailDto convert(Cursor cursor) {
CollaborationDetailDto dto = new CollaborationDetailDto();
int column = cursor.getColumnIndex("collaboration_detial_id");
if (column != -1) {
dto.collaborationDetialId = cursor.getInt(column);
}
column = cursor.getColumnIndex("collaboration_id");
if (column != -1) {
dto.collaborationId = cursor.getInt(column);
}
column = cursor.getColumnIndex("collaboration_type");
if (column != -1) {
dto.collaborationType = cursor.getInt(column);
}
column = cursor.getColumnIndex("collaboration_duration");
if (column != -1) {
dto.collaborationDuration = cursor.getString(column);
}
return dto;
}
public List<CollaborationDetailDto> getCollaborationDetail(int collaborationDetialId) {
List<CollaborationDetailDto> list = rawQueryGetDtoList("select * from t_collaboration_detail where collaboration_detial_id = ?", new String[]{""+ collaborationDetialId}, CollaborationDetailDto.class);
return list;
}
public void insertCollaborationDetail(CollaborationDetailDto dto) {
insert("insert into t_collaboration_detail (collaboration_detial_id, collaboration_id, collaboration_type, collaboration_duration) values (?,?,?,?)", dto.getInsertValues());
}
public void deleteCollaborationDetail() {
try {
beginTransaction();
delete("t_collaboration_detail", null, null);
commit();
} catch (Exception e) {
rollback();
Logger.e("deleteCollaborationDetail failed.", e);
throw new RuntimeException(e);
}
}
}
...@@ -21,10 +21,10 @@ public class TChatMessage extends SQLiteTableScript { ...@@ -21,10 +21,10 @@ public class TChatMessage extends SQLiteTableScript {
sql.append(" , shop_member_id INTEGER NOT NULL "); sql.append(" , shop_member_id INTEGER NOT NULL ");
sql.append(" , message VARCHAR2 "); sql.append(" , message VARCHAR2 ");
sql.append(" , message_type INTEGER "); sql.append(" , message_type INTEGER ");
sql.append(" , link_url VARCHAR2 "); sql.append(" , image_name VARCHAR2 ");
sql.append(" , download_file_name VARCHAR2 ");
sql.append(" , save_path VARCHAR2 ");
sql.append(" , PRIMARY KEY (chat_message_id) "); sql.append(" , PRIMARY KEY (chat_message_id) ");
sql.append(" , FOREIGN KEY (chat_room_id) REFERENCES t_chat_room (chat_room_id) ");
sql.append(" , FOREIGN KEY (shop_member_id) REFERENCES m_shop_member (shop_member_id) ");
sql.append(" ) "); sql.append(" ) ");
ddl.add(sql.toString()); ddl.add(sql.toString());
......
...@@ -19,7 +19,6 @@ public class TCollaboration extends SQLiteTableScript { ...@@ -19,7 +19,6 @@ public class TCollaboration extends SQLiteTableScript {
sql.append(" collaboration_id INTEGER NOT NULL "); sql.append(" collaboration_id INTEGER NOT NULL ");
sql.append(" , chat_message_id INTEGER NOT NULL "); sql.append(" , chat_message_id INTEGER NOT NULL ");
sql.append(" , PRIMARY KEY (collaboration_id)"); sql.append(" , PRIMARY KEY (collaboration_id)");
sql.append(" , FOREIGN KEY (chat_message_id) REFERENCES t_chat_message (chat_message_id) ");
sql.append(" ) "); sql.append(" ) ");
ddl.add(sql.toString()); ddl.add(sql.toString());
......
package jp.agentec.abook.abv.bl.dto; package jp.agentec.abook.abv.bl.dto;
public class ArchiveDto extends AbstractDto { public class ArchiveDto extends AbstractDto {
public Integer archiveId; public Integer archiveId;
public String archiveName; public String archiveName;
public Integer archiveType; public Integer archiveType;
public String archiveUrl; public String archiveUrl;
public Integer collaborationId; public Integer collaborationId;
public Integer shop_memberId; public Integer shopMemberId;
public String archiveSavePath; public String archiveSavePath;
@Override @Override
public Object[] getInsertValues() { public Object[] getInsertValues() {
return new Object[]{archiveId, archiveName, archiveType, archiveUrl, collaborationId, shop_memberId, archiveSavePath}; return new Object[]{archiveId, archiveName, archiveType, archiveUrl, collaborationId, shopMemberId, archiveSavePath};
} }
@Override @Override
public Object[] getUpdateValues() { public Object[] getUpdateValues() {
return new Object[]{archiveSavePath, archiveName, archiveType, archiveUrl, collaborationId, shop_memberId, archiveId}; return new Object[]{archiveName, archiveType, archiveUrl, collaborationId, shopMemberId,archiveSavePath, archiveId};
} }
@Override @Override
......
...@@ -6,17 +6,18 @@ public class ChatMessageDto extends AbstractDto { ...@@ -6,17 +6,18 @@ public class ChatMessageDto extends AbstractDto {
public Integer shopMemberId; public Integer shopMemberId;
public String message; public String message;
public Integer messageType; public Integer messageType;
public String linkUrl; public String imageName;
public String downloadFileName;
public String savePath;
@Override @Override
public Object[] getInsertValues() { public Object[] getInsertValues() {
return new Object[]{chatMessageId, chatRoomId, shopMemberId, shopMemberId, message, messageType, linkUrl}; return new Object[]{chatMessageId, chatRoomId, shopMemberId, message, messageType, imageName, downloadFileName, savePath};
} }
@Override @Override
public Object[] getUpdateValues() { public Object[] getUpdateValues() {
return new Object[]{chatRoomId, shopMemberId, shopMemberId, message, messageType, linkUrl, chatMessageId}; return new Object[]{chatRoomId, shopMemberId, message, messageType, imageName, downloadFileName, savePath, chatMessageId};
} }
@Override @Override
......
package jp.agentec.abook.abv.bl.logic;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import jdk.nashorn.internal.parser.JSONParser;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.DownloadedContentInfoJSON;
import jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsContentCheckParameters;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.NetworkDisconnectedException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.common.util.ContentFileUtil;
import jp.agentec.abook.abv.bl.common.util.JsonUtil;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ChatRoomDao;
import jp.agentec.abook.abv.bl.data.dao.ContentCategoryDao;
import jp.agentec.abook.abv.bl.data.dao.ContentDao;
import jp.agentec.abook.abv.bl.data.dao.ContentGroupDao;
import jp.agentec.abook.abv.bl.data.dao.ContentMarkingDao;
import jp.agentec.abook.abv.bl.data.dao.ContentPageDao;
import jp.agentec.abook.abv.bl.data.dao.ContentResourceDao;
import jp.agentec.abook.abv.bl.data.dao.ContentTagDao;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.ContentPageDto;
import jp.agentec.abook.abv.bl.dto.ContentTagDto;
import jp.agentec.abook.abv.bl.dto.comparator.ContentPageDtoComparator;
import jp.agentec.adf.util.FileUtil;
import jp.agentec.adf.util.StringUtil;
/**
* @author Lee-mk
*/
public class CommunicationLogic extends AbstractLogic {
private static final String TAG = "CommunicationLogic";
private ChatRoomDao chatRoomDao = AbstractDao.getDao(ChatRoomDao.class);
/**
* {@link CommunicationLogic} クラスのインスタンスを初期化します。
* context Androidとの互換性の為のプロパティです。Androidの android.content.Context のインスタンスを指定します。<br>
* UIがAndroidでない場合、何かのオブジェクトを指定しても、nullと見なします。
* @see AbstractLogic
* @since 1.2.3.6
*/
/*package*/ CommunicationLogic() {
}
public String getChatRoomList() {
List<ChatRoomDto> chatRoomList = chatRoomDao.getAllChatRoom();
JSONArray resultJsonArray = new JSONArray();
for (ChatRoomDto chatRoomDto : chatRoomList) {
Map<String, Object> chatRoomMap = new HashMap<String, Object>();
chatRoomMap.put("chatRoomId",chatRoomDto.chatRoomId);
chatRoomMap.put("chatRoomName",chatRoomDto.chatRoomName);
chatRoomMap.put("type",chatRoomDto.type);
JSONObject jsonObject =new JSONObject(chatRoomMap);
resultJsonArray.put(jsonObject);
}
String testStr1 = resultJsonArray.toString();
return testStr1;
}
}
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
let ASSET_PATH = './'; let ASSET_PATH = './';
let PLATFORM = ''; let PLATFORM = '';
let IS_MOBILE = true; let IS_MOBILE = true;
let IS_ONLINE = true; let IS_ONLINE = false;
function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) { function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) {
console.log('TEST get GP'); console.log('TEST get GP');
......
// 名前空間
var CHAT_DB = {};
//ロカールDBからルーム一覧情報を取得
CHAT_DB.getRoomList = function(input) {
if (CHAT_UTIL.isIOS()) {
//TODO IOS処理追加必要
} else (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getRoomList());
}
}
\ No newline at end of file
...@@ -765,3 +765,91 @@ CHAT_UI.waitForLoadingImage = function(div, callback) { ...@@ -765,3 +765,91 @@ CHAT_UI.waitForLoadingImage = function(div, callback) {
}); });
} }
CHAT_UI.refreshRoomList = function(rooms, activeRoomId = null){
CHAT.globalIsInvite = false;
// #36146に対応
let keywordSearchMode = false;
if ($('#room-search').val().length > 0) {
keywordSearchMode = true;
}
$('#room_list').html('');
let roomListTitle = getLocalizedString("roomListTitle");
$('.titleRoomName').text(roomListTitle);
if (rooms.length === 0) {
// 検索結果がない場合のメッセージを追加
if (!keywordSearchMode) {
let emptyListString = getLocalizedString("roomListEmptyString")
$('#room_list').append(`<center class="text-secondary">${emptyListString}</center>`);
} else {
let emptyListString = getLocalizedString("searchRoomListEmptyString")
$('#room_list').append(`<center class="text-secondary">${emptyListString}</center>`);
}
}
// チャットルームの様式を読み込む
const template = $('#room-template').html();
rooms.forEach( function(room) {
room.profileImagePath = ASSET_PATH + 'images/user-profile.png'
if (room.message) {
room.message = room.message.toString()
} else {
room.message = getLocalizedString("noMessages")
}
let html = Mustache.render(template, {
roomName: room.roomName,
roomId: room.roomId,
profileImage: room.profileImagePath,
active: activeRoomId === room.roomId ? 'active_chat' : null, // 現在、入っているルームだとhilight表示
lastMessage: room.message.includes('<img') ? getLocalizedString("image") : (keywordSearchMode ? `${room.message}${getLocalizedString("searchResult")}` : room.message) ,
time: room.time ? CHAT_UTIL.formatDate(room.time.time).createdAt : '',
unreadMsgCnt: room.unreadCnt,
userCnt: room.userCnt
});
// Click event
let obj = $(jQuery.parseHTML(html)).on('click',function(){
if (activeRoomId === room.roomId) {
// 既存チャットルームをタッチする場合、チャット画面に遷移
$('#pills-chat-tab').tab('show');
} else {
// loadingIndicatorを表示しない
CHAT_UI.showLoadingIndicator();
// 新しいチャットルームをタッチする場合、チャットルームの接続処理を実行
socket.emit('joinRoom', room.roomId, room.roomName, function (){
CHAT.saveRoomInfo(room.roomId, room.roomName);
$('#messages').html('');
// チャットルーム名を変更する
$('.titleRoomName').text(room.roomName).data('roomName', room.roomName);
});
}
});
// チャットルームリストに追加する
$('#room_list').append(obj);
});
if(rooms.length > 0) {
if(!keywordSearchMode) {
$(".roomListIcon").show()
$('#roomDeleteButton, #arrangeRooms').show()
} else {
$(".roomListIcon").show()
$('#roomDeleteButton, #arrangeRooms').hide()
}
} else {
if(!keywordSearchMode) {
$(".roomListIcon").hide()
} else {
$(".roomListIcon").show()
$('#roomDeleteButton, #arrangeRooms').hide()
}
}
$('#createChatRoom').show()
if(CHAT_UI.isLandscapeMode()) {
$(".chat_list").removeClass("col-12").addClass("col-6");
}
$("#userSelectionDeleteBtn").hide();
// チャットルームリスト画面に遷移
$('#pills-chatlist-tab').tab('show');
// loadingIndicatorを表示しない
CHAT_UI.dismissLoadingIndicator();
};
var socket = io(CHAT_SERVER_URL); console.log('isOnlineRead');
console.log(IS_ONLINE);
var socket;
connectSocket(IS_ONLINE);
function connectSocket(isOnline) {
console.log(isOnline);
if (isOnline == 'true') {
socket = io(CHAT_SERVER_URL);
setSocketAction();
} else {
//オフラインの場合、DBからルーム一覧を表示。
if (CHAT_UTIL.isIOS()) {
//TODO IOSの場合
} else if (CHAT_UTIL.isAndroid()) {
var result = CHAT_DB.getRoomList();
console.log(result);
}
}
}
/* --------------------------------------------------- /* ---------------------------------------------------
* Socket Connect/Disconnect * Socket Connect/Disconnectc
* --------------------------------------------------- */ * --------------------------------------------------- */
function setSocketAction () {
socket.on('connect', function (){ socket.on('connect', function (){
console.log('connect');
// socketが接続されたらチャット画面で画面を更新する // socketが接続されたらチャット画面で画面を更新する
$('.overlay').removeClass('active undismissable'); $('.overlay').removeClass('active undismissable');
// loadingIndicatorを表示 // loadingIndicatorを表示
...@@ -15,38 +38,40 @@ socket.on('connect', function (){ ...@@ -15,38 +38,40 @@ socket.on('connect', function (){
} else if (CHAT_UTIL.isAndroid()) { } else if (CHAT_UTIL.isAndroid()) {
android.getLoginParameter(); android.getLoginParameter();
} }
}); });
socket.on('disconnect', function (){ socket.on('disconnect', function (){
console.log('disconnect');
//socketが切断されたら黒画面で画面を更新する //socketが切断されたら黒画面で画面を更新する
$('.overlay').addClass('active undismissable'); $('.overlay').addClass('active undismissable');
//alert('Disconnected from the server'); //alert('Disconnected from the server');
CHAT_UI.dismissLoadingIndicator(); CHAT_UI.dismissLoadingIndicator();
}); });
socket.on('connect_error', function (){ socket.on('connect_error', function (){
// $('.overlay').addClass('active undismissable'); console.log('connect_error');
// $('.overlay').addClass('active undismissable');
// #36174 // #36174
// $("#customAlertTitle").text(getLocalizedString("errorConnect")); // $("#customAlertTitle").text(getLocalizedString("errorConnect"));
// $("#customAlertOk").text(getLocalizedString("yesTitle")); // $("#customAlertOk").text(getLocalizedString("yesTitle"));
// //
// $('#customAlert').appendTo("body").modal({ // $('#customAlert').appendTo("body").modal({
// backdrop: 'static', // backdrop: 'static',
// keyboard: false // keyboard: false
// }) // })
// .on('click', '#customAlertOk', function(e) { // .on('click', '#customAlertOk', function(e) {
// }); // });
CHAT_UI.dismissLoadingIndicator(); CHAT_UI.dismissLoadingIndicator();
}); });
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
* *
* Chat Room List Tab * Chat Room List Tab
* *
* ---------------------------------------------------------------------- */ * ---------------------------------------------------------------------- */
// Update Room List // Update Room List
socket.on('refreshRoomList', function(rooms, activeRoomId = null){ socket.on('refreshRoomList', function(rooms, activeRoomId = null){
CHAT.globalIsInvite = false; CHAT.globalIsInvite = false;
...@@ -147,11 +172,11 @@ socket.on('refreshRoomList', function(rooms, activeRoomId = null){ ...@@ -147,11 +172,11 @@ socket.on('refreshRoomList', function(rooms, activeRoomId = null){
// loadingIndicatorを表示しない // loadingIndicatorを表示しない
CHAT_UI.dismissLoadingIndicator(); CHAT_UI.dismissLoadingIndicator();
}); });
// New Message // New Message
// #36170 // #36170
socket.on('newMessage', function (message, roomId, roomName){ socket.on('newMessage', function (message, roomId, roomName){
let template = $('#message-template').html(); let template = $('#message-template').html();
if (message.id === socket.id) { if (message.id === socket.id) {
// ユーザーが送信したメッセージの場合、自分のメッセージ様式を適用して表示する // ユーザーが送信したメッセージの場合、自分のメッセージ様式を適用して表示する
...@@ -181,17 +206,17 @@ socket.on('newMessage', function (message, roomId, roomName){ ...@@ -181,17 +206,17 @@ socket.on('newMessage', function (message, roomId, roomName){
setTimeout(function () { setTimeout(function () {
CHAT_UI.scrollToBottom(); CHAT_UI.scrollToBottom();
}, 1500); }, 1500);
}); });
// Notification // Notification
socket.on('newNotification', function(keyword, event){ socket.on('newNotification', function(keyword, event){
var notificationString = getLocalizedString(event, keyword) var notificationString = getLocalizedString(event, keyword)
$('#messageNotification').finish().text(notificationString).delay(500).slideDown().delay(1500).slideUp(); $('#messageNotification').finish().text(notificationString).delay(500).slideDown().delay(1500).slideUp();
}); });
// 新しいメッセージを受信する場合の処理 // 新しいメッセージを受信する場合の処理
// #36170 // #36170
socket.on('loadMessages', function(messages, shopMemberId, users, roomId, roomName){ socket.on('loadMessages', function(messages, shopMemberId, users, roomId, roomName){
let jQueryMessages = $('#messages'); let jQueryMessages = $('#messages');
// スクロールの変化を防ぐため以前画面の高さを保存する // スクロールの変化を防ぐため以前画面の高さを保存する
let beforeHeight = jQueryMessages.prop('scrollHeight'); let beforeHeight = jQueryMessages.prop('scrollHeight');
...@@ -260,11 +285,11 @@ socket.on('loadMessages', function(messages, shopMemberId, users, roomId, roomNa ...@@ -260,11 +285,11 @@ socket.on('loadMessages', function(messages, shopMemberId, users, roomId, roomNa
// チャットに遷移する // チャットに遷移する
$('#pills-chat-tab').tab('show'); $('#pills-chat-tab').tab('show');
}); });
// Update User List In Room // Update User List In Room
// サイドバーのユーザーリストアップデート。 // サイドバーのユーザーリストアップデート。
socket.on('updateUserList', function(users, onlineUsers){ socket.on('updateUserList', function(users, onlineUsers){
if (users.length > 0) { if (users.length > 0) {
$('#users').removeData(); $('#users').removeData();
$('#users').data(users); $('#users').data(users);
...@@ -301,11 +326,11 @@ socket.on('updateUserList', function(users, onlineUsers){ ...@@ -301,11 +326,11 @@ socket.on('updateUserList', function(users, onlineUsers){
li.append(a); li.append(a);
ul.append(li); ul.append(li);
}); });
$('#users').html(ul); $('#users').html(ul);
}); });
// Update Group List(Invite) // Update Group List(Invite)
socket.on('refreshGroupList', function(groups, isInvite){ socket.on('refreshGroupList', function(groups, isInvite){
$('#group_list').html(''); $('#group_list').html('');
const template = $('#group-template').html(); const template = $('#group-template').html();
if (groups.length === 0) { if (groups.length === 0) {
...@@ -370,11 +395,11 @@ socket.on('refreshGroupList', function(groups, isInvite){ ...@@ -370,11 +395,11 @@ socket.on('refreshGroupList', function(groups, isInvite){
socket.emit('getRoomList'); socket.emit('getRoomList');
} }
}); });
}); });
// Update User List(Invite) // Update User List(Invite)
// #36170 // #36170
socket.on('refreshUserListInGroup', function(users, groupId, isInvite){ socket.on('refreshUserListInGroup', function(users, groupId, isInvite){
$('#user_list').html(''); $('#user_list').html('');
const template = $('#user-template').html(); const template = $('#user-template').html();
...@@ -449,13 +474,13 @@ socket.on('refreshUserListInGroup', function(users, groupId, isInvite){ ...@@ -449,13 +474,13 @@ socket.on('refreshUserListInGroup', function(users, groupId, isInvite){
$('#userSelectionConfirmBtn').show(); $('#userSelectionConfirmBtn').show();
$('.userCheckBox').show(); $('.userCheckBox').show();
$('#pills-user-tab').tab('show'); $('#pills-user-tab').tab('show');
}); });
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
/* Show Error Log */ /* Show Error Log */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
socket.on('showServerError', function (message){ socket.on('showServerError', function (message){
// #36174 // #36174
// #36215 // #36215
...@@ -484,10 +509,10 @@ socket.on('showServerError', function (message){ ...@@ -484,10 +509,10 @@ socket.on('showServerError', function (message){
if(message == "Room not found"){ if(message == "Room not found"){
CHAT.saveRoomInfo(); CHAT.saveRoomInfo();
} }
}); });
// server's request : user info (retry join) // server's request : user info (retry join)
socket.on("retryJoinProcess", () => { socket.on("retryJoinProcess", () => {
var ua = window.navigator.userAgent.toLowerCase(); var ua = window.navigator.userAgent.toLowerCase();
//if((ua.indexOf('iphone') > 0 || ua.indexOf('ipad') > 0) && ua.indexOf("safari") == -1) { //if((ua.indexOf('iphone') > 0 || ua.indexOf('ipad') > 0) && ua.indexOf("safari") == -1) {
if (CHAT_UTIL.isIOS()) { if (CHAT_UTIL.isIOS()) {
...@@ -524,4 +549,5 @@ socket.on("retryJoinProcess", () => { ...@@ -524,4 +549,5 @@ socket.on("retryJoinProcess", () => {
CHAT_UI.dismissLoadingIndicator(); CHAT_UI.dismissLoadingIndicator();
}); });
} }
}) })
\ No newline at end of file }
\ No newline at end of file
...@@ -28,8 +28,13 @@ import android.widget.ImageView; ...@@ -28,8 +28,13 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.Toast; import android.widget.Toast;
import org.json.JSONArray;
import java.io.File; import java.io.File;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient; import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
...@@ -38,7 +43,12 @@ import jp.agentec.abook.abv.bl.common.constant.ABookKeys; ...@@ -38,7 +43,12 @@ import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.exception.NetworkDisconnectedException; import jp.agentec.abook.abv.bl.common.exception.NetworkDisconnectedException;
import jp.agentec.abook.abv.bl.common.log.Logger; import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.ABVDataCache; import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
import jp.agentec.abook.abv.bl.dto.ContentReadingLogDto;
import jp.agentec.abook.abv.bl.dto.PushMessageDto; import jp.agentec.abook.abv.bl.dto.PushMessageDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.CommunicationLogic;
import jp.agentec.abook.abv.bl.logic.ContentLogic;
import jp.agentec.abook.abv.cl.util.PreferenceUtil; import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R; import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType; import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
...@@ -83,6 +93,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -83,6 +93,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
private BroadcastReceiver receiver; private BroadcastReceiver receiver;
private CommunicationLogic communicationLogic = AbstractLogic.getLogic(CommunicationLogic.class);
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
...@@ -665,6 +677,27 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -665,6 +677,27 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}); });
} }
@JavascriptInterface
public String getRoomList() {
Map<String, Object> chatRoomList;
//chatRoomList = communicationLogic.getChatRoomList();
String chatRoomListStr = communicationLogic.getChatRoomList();
return chatRoomListStr;
/* mChatWebView.post(new Runnable() {
@Override
public void run() {
List<ChatRoomDto> chatRoomList;
chatRoomList = communicationLogic.getChatRoomList();
JSONArray resulttest = new JSONArray(chatRoomList);
String resultString = resulttest.toString();
mChatWebView.loadUrl(String.format("javascript:CHAT_UI.getRoomList('%s')",resultString));
}
});*/
}
} }
/** /**
......
...@@ -38,6 +38,8 @@ app_versioncode=1 ...@@ -38,6 +38,8 @@ app_versioncode=1
# abvEnvironments.xml # abvEnvironments.xml
#cms server #cms server
#acms_address=http://10.0.2.2:8081/acms
#download_server_address=http://10.0.2.2:8081/acms
acms_address=https://chatdev2.abook.bz/acms acms_address=https://chatdev2.abook.bz/acms
download_server_address=https://chatdev2.abook.bz/acms download_server_address=https://chatdev2.abook.bz/acms
......
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