Commit 0b614d87 by Lee Munkyeong

Merge branch 'features/1.2.360_develop_ABCOMM-265-offline対応' into 'features/abcomm_sp2'

Features/1.2.360 develop abcomm 265 offline対応

See merge request !87
parents b9bcf707 381469fa
...@@ -31,6 +31,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.OperationListJSON; ...@@ -31,6 +31,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.OperationListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ProcessDataJSON; import jp.agentec.abook.abv.bl.acms.client.json.ProcessDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.RequirePasswordChangeJSON; import jp.agentec.abook.abv.bl.acms.client.json.RequirePasswordChangeJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ResultJSON; import jp.agentec.abook.abv.bl.acms.client.json.ResultJSON;
import jp.agentec.abook.abv.bl.acms.client.json.RoomListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.SceneEntryJSON; import jp.agentec.abook.abv.bl.acms.client.json.SceneEntryJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ServerTimeZoneJSON; import jp.agentec.abook.abv.bl.acms.client.json.ServerTimeZoneJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ServiceOptionsJSON; import jp.agentec.abook.abv.bl.acms.client.json.ServiceOptionsJSON;
...@@ -525,6 +526,21 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -525,6 +526,21 @@ public class AcmsClient implements AcmsClientResponseListener {
} }
/** /**
* チャットルーム一覧情報を取得する。
*
* @param sid
* @return
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public RoomListJSON getRoomList(String sid) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetChatRooms, new AcmsParameters(sid,AcmsApis.Cmds.getRoomList));
RoomListJSON json = new RoomListJSON(response.httpResponseBody);
return json;
}
/**
* 作業報告データ送信 * 作業報告データ送信
* @param sid * @param sid
* @param operationId * @param operationId
......
package jp.agentec.abook.abv.bl.acms.client.json;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
import java.util.ArrayList;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
import jp.agentec.adf.util.DateTimeUtil;
public class RoomListJSON extends AcmsCommonJSON {
private static final String Body = "body";
private static final String ChatRoomInfoList = "chatRoomInfoList";
private static final String InsertDate = "insertDate";
private static final String Time = "time";
private static final String RoomId = "roomId";
private static final String RoomName = "roomName";
private static final String RoomType = "roomType";
private static final String LastMessageInfo = "lastMessageInfo";
private static final String Message = "message";
private static final String MessageId = "messageId";
private static final String ShopMemberId = "shopMemberId";
private static final String MessageType = "messageType";
private static final String UnreadCount = "unreadCount";
private static final String AttendUsers = "attendUsers";
public ArrayList<ChatRoomDto> roomList;
public RoomListJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
// ルーム一覧情報を取得
if (!json.has(Body)) { return; }
JSONArray roomListJsonArray = json.getJSONObject(Body).getJSONArray(ChatRoomInfoList);
if (roomListJsonArray == null) { return; }
roomList = new ArrayList<ChatRoomDto>();
for (int listCount = 0; listCount < roomListJsonArray.length(); listCount++) {
if (roomListJsonArray.getJSONObject(listCount).length() == 0) {
break;
}
ChatRoomDto chatRoomDto = new ChatRoomDto();
ChatMessageDto chatMessageDto = new ChatMessageDto();
chatRoomDto.chatRoomId = roomListJsonArray.getJSONObject(listCount).getInt(RoomId);
chatRoomDto.chatRoomName = roomListJsonArray.getJSONObject(listCount).getString(RoomName);
chatRoomDto.type = roomListJsonArray.getJSONObject(listCount).getInt(RoomType);
chatRoomDto.unreadCount = roomListJsonArray.getJSONObject(listCount).has(UnreadCount) ? roomListJsonArray.getJSONObject(listCount).getInt(UnreadCount) : 0;
chatRoomDto.userCount = roomListJsonArray.getJSONObject(listCount).getJSONArray(AttendUsers).length();
//最後メッセージ情報がある場合の処理
JSONObject lastMessageInfoJSON = roomListJsonArray.getJSONObject(listCount).has(LastMessageInfo) ? roomListJsonArray.getJSONObject(listCount).getJSONObject(LastMessageInfo) : null;
if (lastMessageInfoJSON != null && lastMessageInfoJSON.has(MessageId)) {
chatMessageDto.chatRoomId = chatRoomDto.chatRoomId;
chatMessageDto.message = lastMessageInfoJSON.getString(Message);
chatMessageDto.messageType = lastMessageInfoJSON.getInt(MessageType);
if (lastMessageInfoJSON.has(InsertDate)) {
chatMessageDto.insertDate = DateTimeUtil.millToDateString(lastMessageInfoJSON.getJSONObject(InsertDate).getLong(Time));
}
chatMessageDto.shopMemberId = lastMessageInfoJSON.getInt(ShopMemberId);
chatMessageDto.chatMessageId = lastMessageInfoJSON.getInt(MessageId);
chatRoomDto.lastMessageInfo = chatMessageDto;
}
roomList.add(chatRoomDto);
}
}
}
...@@ -14,7 +14,7 @@ public class AcmsParameters extends HttpParameterObject { ...@@ -14,7 +14,7 @@ public class AcmsParameters extends HttpParameterObject {
* @since 1.0.0 * @since 1.0.0
*/ */
private String sid; private String sid;
private String cmd;
/** /**
* {@link AcmsParameters} のインスタンスを初期化します。 * {@link AcmsParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。 * @param sid ログインした時のセッションIDです。
...@@ -25,6 +25,17 @@ public class AcmsParameters extends HttpParameterObject { ...@@ -25,6 +25,17 @@ public class AcmsParameters extends HttpParameterObject {
} }
/** /**
* {@link AcmsParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @param cmd Apiリクエストに必要なコマンド(ABOOK COMM専用)。
* @since 1.0.0
*/
public AcmsParameters(String sid, String cmd) {
this.sid = sid;
this.cmd = cmd;
}
/**
* セッションIDを返します。 * セッションIDを返します。
* @return ログインした時のセッションIDです。 * @return ログインした時のセッションIDです。
* @since 1.0.0 * @since 1.0.0
...@@ -32,4 +43,13 @@ public class AcmsParameters extends HttpParameterObject { ...@@ -32,4 +43,13 @@ public class AcmsParameters extends HttpParameterObject {
public String getSid() { public String getSid() {
return sid; return sid;
} }
/**
* コマンドを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getCmd() {
return cmd;
}
} }
...@@ -170,6 +170,11 @@ public class AcmsApis { ...@@ -170,6 +170,11 @@ public class AcmsApis {
// チャット // チャット
public static final String ChatApiUrlFormat = "%s/%s/chatapi/%s/"; public static final String ChatApiUrlFormat = "%s/%s/chatapi/%s/";
public static final String ApiGetChatPushData = "push"; public static final String ApiGetChatPushData = "push";
public static final String ApigetChatRooms = "room";
public static final class Cmds {
public static final String getRoomList = "5";
}
// download // download
/** /**
...@@ -217,7 +222,7 @@ public class AcmsApis { ...@@ -217,7 +222,7 @@ public class AcmsApis {
methodName.equals(ApiOperationGroupMaster) || methodName.equals(ApiGetApertureMasterData) || methodName.equals(ApiQuickReportSearch) || methodName.equals(ApiQuickReportRevision) methodName.equals(ApiOperationGroupMaster) || methodName.equals(ApiGetApertureMasterData) || methodName.equals(ApiQuickReportSearch) || methodName.equals(ApiQuickReportRevision)
|| methodName.equals(ApiGetProcessData) || methodName.equals(ApiDeleteProcess)) { || methodName.equals(ApiGetProcessData) || methodName.equals(ApiDeleteProcess)) {
apiValue = Constant.ApiValue.checkapi; apiValue = Constant.ApiValue.checkapi;
} else if (methodName.equals(ApiGetChatPushData)) { // pushActionはchatapiを指定 } else if (methodName.equals(ApiGetChatPushData) || methodName.equals(ApigetChatRooms)) { // pushActionはchatapiを指定
apiValue = Constant.ApiValue.chatapi; apiValue = Constant.ApiValue.chatapi;
} }
......
...@@ -16,13 +16,22 @@ import jp.agentec.abook.abv.bl.data.tables.MMemberInfo; ...@@ -16,13 +16,22 @@ import jp.agentec.abook.abv.bl.data.tables.MMemberInfo;
import jp.agentec.abook.abv.bl.data.tables.MOperationGroupMaster; import jp.agentec.abook.abv.bl.data.tables.MOperationGroupMaster;
import jp.agentec.abook.abv.bl.data.tables.MPasswordLockInfo; import jp.agentec.abook.abv.bl.data.tables.MPasswordLockInfo;
import jp.agentec.abook.abv.bl.data.tables.MServiceOption; import jp.agentec.abook.abv.bl.data.tables.MServiceOption;
import jp.agentec.abook.abv.bl.data.tables.MShopMember;
import jp.agentec.abook.abv.bl.data.tables.MWorkerGroup; import jp.agentec.abook.abv.bl.data.tables.MWorkerGroup;
import jp.agentec.abook.abv.bl.data.tables.RChatRoomShopMember;
import jp.agentec.abook.abv.bl.data.tables.RCollaborationMember;
import jp.agentec.abook.abv.bl.data.tables.ROperationContent; import jp.agentec.abook.abv.bl.data.tables.ROperationContent;
import jp.agentec.abook.abv.bl.data.tables.RContentCategory; import jp.agentec.abook.abv.bl.data.tables.RContentCategory;
import jp.agentec.abook.abv.bl.data.tables.RContentGroup; import jp.agentec.abook.abv.bl.data.tables.RContentGroup;
import jp.agentec.abook.abv.bl.data.tables.ROperationGroupMasterOperation; import jp.agentec.abook.abv.bl.data.tables.ROperationGroupMasterOperation;
import jp.agentec.abook.abv.bl.data.tables.RShopMemberGroup;
import jp.agentec.abook.abv.bl.data.tables.RTaskWorkerGroup; import jp.agentec.abook.abv.bl.data.tables.RTaskWorkerGroup;
import jp.agentec.abook.abv.bl.data.tables.SQLiteTableScript; import jp.agentec.abook.abv.bl.data.tables.SQLiteTableScript;
import jp.agentec.abook.abv.bl.data.tables.TArchive;
import jp.agentec.abook.abv.bl.data.tables.TChatMessage;
import jp.agentec.abook.abv.bl.data.tables.TChatRoom;
import jp.agentec.abook.abv.bl.data.tables.TCollaboration;
import jp.agentec.abook.abv.bl.data.tables.TCollaborationDetail;
import jp.agentec.abook.abv.bl.data.tables.TContent; import jp.agentec.abook.abv.bl.data.tables.TContent;
import jp.agentec.abook.abv.bl.data.tables.TContentBookmark; import jp.agentec.abook.abv.bl.data.tables.TContentBookmark;
import jp.agentec.abook.abv.bl.data.tables.TContentDownloadQueue; import jp.agentec.abook.abv.bl.data.tables.TContentDownloadQueue;
...@@ -100,6 +109,18 @@ public class ABVDataOpenHelper { ...@@ -100,6 +109,18 @@ public class ABVDataOpenHelper {
iTableScripts.add(new MOperationGroupMaster()); iTableScripts.add(new MOperationGroupMaster());
iTableScripts.add(new ROperationGroupMasterOperation()); iTableScripts.add(new ROperationGroupMasterOperation());
iTableScripts.add(new TTaskReportApproval()); iTableScripts.add(new TTaskReportApproval());
//ABCOMM関連テーブル
iTableScripts.add(new MShopMember());
iTableScripts.add(new TChatRoom());
iTableScripts.add(new TChatMessage());
iTableScripts.add(new TCollaboration());
iTableScripts.add(new TCollaborationDetail());
iTableScripts.add(new TArchive());
iTableScripts.add(new RShopMemberGroup());
iTableScripts.add(new RChatRoomShopMember());
iTableScripts.add(new RCollaborationMember());
return iTableScripts; return iTableScripts;
} }
......
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);
}
column = cursor.getColumnIndex("insert_date");
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, insert_date) values (?,?,?,?,?,?,?,?,?)", dto.getInsertValues());
}
public void insertChatMessage(List<ChatMessageDto> chatMessageDtoList) {
try {
beginTransaction();
for (ChatMessageDto chatMessageDto : chatMessageDtoList) {
insertChatMessage(chatMessageDto);
}
commit();
} catch (Exception e) {
rollback();
Logger.e("insertChatRoomList failed.", e);
throw new RuntimeException(e);
}
}
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=?, insert_date=? 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.ChatRoomDto;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
public class ChatRoomDao extends AbstractDao {
/**
* {@link ChatRoomDao} のインスタンスを初期化します。
* アンドロイドの android.content.Context のインスタンス
* @throws ClassCastException 引数のcontextが android.content.Context 又は、その継承クラスではありません。
* @since 1.0.0
*/
/*package*/ ChatRoomDao() {
}
@Override
protected ChatRoomDto convert(Cursor cursor) {
ChatRoomDto dto = new ChatRoomDto();
int column = cursor.getColumnIndex("chat_room_id");
if (column != -1) {
dto.chatRoomId = cursor.getInt(column);
}
column = cursor.getColumnIndex("chat_room_name");
if (column != -1) {
dto.chatRoomName = cursor.getString(column);
}
column = cursor.getColumnIndex("type");
if (column != -1) {
dto.type = cursor.getInt(column);
}
column = cursor.getColumnIndex("unread_count");
if (column != -1) {
dto.unreadCount = cursor.getInt(column);
}
column = cursor.getColumnIndex("user_count");
if (column != -1) {
dto.userCount = cursor.getInt(column);
}
column = cursor.getColumnIndex("favorite_register_date");
if (column != -1) {
dto.favoriteRegisterDate = cursor.getString(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("insert_date");
if (column != -1) {
dto.insertDate = cursor.getString(column);
}
return dto;
}
public List<ChatRoomDto> getAllChatRoom() {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
sql.append(" cr.chat_room_id ");
sql.append(" ,cr.chat_room_name ");
sql.append(" ,cr.type ");
sql.append(" ,coalesce (cr.favorite_register_date,'') favorite_register_date");
sql.append(" ,coalesce (cr.unread_count,0) unread_count");
sql.append(" ,coalesce (cm.message,'') message");
sql.append(" ,coalesce (cm.message_type,0) message_type");
sql.append(" ,coalesce (cm.insert_date,'') insert_date");
sql.append(" ,coalesce (cr.user_count,0) user_count ");
sql.append(" FROM ");
sql.append(" t_chat_room AS cr ");
sql.append(" LEFT JOIN ");
sql.append(" ( SELECT max(insert_date) insert_date, message, message_type, chat_room_id FROM t_chat_message GROUP BY chat_room_id ) AS cm ");
sql.append(" ON cr.chat_room_id = cm.chat_room_id ");
sql.append(" GROUP BY cr.chat_room_id ");
sql.append(" ORDER BY cm.insert_date DESC ");
List<ChatRoomDto> list = rawQueryGetDtoList(sql.toString(), null, ChatRoomDto.class);
return list;
}
public ChatRoomDto getFavoriteChatRoom() {
return rawQueryGetDto("select * from t_chat_room where favorite_register_date is NOT NULL", null, ChatRoomDto.class);
}
public ChatRoomDto getNotFavoriteChatRoom() {
return rawQueryGetDto("select * from t_chat_room where favorite_register_date is NULL", null, ChatRoomDto.class);
}
public void insertChatRoom(ChatRoomDto dto) {
insert("insert into t_chat_room (chat_room_id, chat_room_name, type, unread_count, user_count, favorite_register_date) values (?,?,?,?,?,?)", dto.getInsertValues());
}
public void insertChatRoom(List<ChatRoomDto> chatRoomDtoList) {
try {
beginTransaction();
for (ChatRoomDto chatRoomDto : chatRoomDtoList) {
insertChatRoom(chatRoomDto);
}
commit();
} catch (Exception e) {
rollback();
Logger.e("insertChatRoomList failed.", e);
throw new RuntimeException(e);
}
}
public boolean updateChatRoom(ChatRoomDto dto) {
long count = update("update t_chat_room set chat_room_name=?, type=?, unread_count=?, user_count=?, favorite_register_date=? where chat_room_id=?", dto.getUpdateValues());
return count > 0;
}
public void deleteChatRoom() {
try {
beginTransaction();
delete("t_chat_room", null, null);
delete("r_chat_room_shop_member", null, null);
delete("t_chat_message", null, null);
commit();
} catch (Exception e) {
rollback();
Logger.e("deleteChatRoom 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);
}
}
}
package jp.agentec.abook.abv.bl.data.dao;
import java.util.Date;
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.MemberInfoDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
public class ShopMemberDao extends AbstractDao {
/**
* {@link ShopMemberDao} のインスタンスを初期化します。
* アンドロイドの android.content.Context のインスタンス
* @throws ClassCastException 引数のcontextが android.content.Context 又は、その継承クラスではありません。
* @since 1.0.0
*/
/*package*/ ShopMemberDao() {
}
@Override
protected ShopMemberDto convert(Cursor cursor) {
ShopMemberDto dto = new ShopMemberDto();
int column = cursor.getColumnIndex("shop_member_id");
if (column != -1) {
dto.shopMemberId = cursor.getInt(column);
}
column = cursor.getColumnIndex("shop_member_name");
if (column != -1) {
dto.shopMemberName = cursor.getString(column);
}
column = cursor.getColumnIndex("profile_url");
if (column != -1) {
dto.profileUrl = cursor.getString(column);
}
column = cursor.getColumnIndex("favorite_register_date");
if (column != -1) {
dto.favoriteRegisterDate = cursor.getString(column);
}
return dto;
}
public List<ShopMemberDto> getAllShopMember() {
List<ShopMemberDto> list = rawQueryGetDtoList("select * from m_shop_member", null, ShopMemberDto.class);
return list;
}
public ShopMemberDto getShopMember(int shopMemberId) {
return rawQueryGetDto("select * from m_shop_member where shop_member_id=?", new String[]{""+ shopMemberId}, ShopMemberDto.class);
}
public void insertShopMember(ShopMemberDto dto) {
insert("insert into m_shop_member (shop_member_id, shop_member_name, profile_url, favorite_register_date) values (?,?,?,?)", dto.getInsertValues());
}
public boolean updateShopMember(MemberInfoDto dto) {
long count = update("update m_shop_member set shop_member_name=?, profile_url=?, favorite_register_date=? where shop_member_id=?", dto.getUpdateValues());
return count > 0;
}
public void deleteShopMember() {
try {
beginTransaction();
delete("m_shop_member", null, null);
commit();
} catch (Exception e) {
rollback();
Logger.e("deleteShopMember failed.", e);
throw new RuntimeException(e);
} finally {
}
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public class MShopMember extends SQLiteTableScript {
public MShopMember() {
};
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" create table m_shop_member ( ");
sql.append(" shop_member_id INTEGER NOT NULL ");
sql.append(" , shop_member_name VARCHAR(64) ");
sql.append(" , profile_url VARCHAR(64) ");
sql.append(" , favorite_register_date VARCHAR2(64) ");
sql.append(" , PRIMARY KEY (shop_member_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public class RChatRoomShopMember extends SQLiteTableScript {
public RChatRoomShopMember() {
super();
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" create table r_chat_room_shop_member ( ");
sql.append(" chat_room_id INTEGER NOT NULL ");
sql.append(" , shop_member_id INTEGER NOT NULL ");
sql.append(" , PRIMARY KEY (chat_room_id, shop_member_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public class RCollaborationMember extends SQLiteTableScript {
public RCollaborationMember() {
super();
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" create table r_collaboration_member ( ");
sql.append(" collaboration_id INTEGER NOT NULL ");
sql.append(" , shop_member_id INTEGER NOT NULL ");
sql.append(" , PRIMARY KEY (collaboration_id, shop_member_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public class RShopMemberGroup extends SQLiteTableScript {
public RShopMemberGroup() {
super();
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" create table r_shop_member_group ( ");
sql.append(" shop_member_id INTEGER NOT NULL ");
sql.append(" , group_id INTEGER NOT NULL ");
sql.append(" , PRIMARY KEY (shop_member_id, group_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public class TArchive extends SQLiteTableScript {
public TArchive() {
};
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" create table t_archive ( ");
sql.append(" archive_id INTEGER NOT NULL ");
sql.append(" , archive_name VARCHAR2(64) ");
sql.append(" , archive_type INTEGER NOT NULL ");
sql.append(" , archive_url VARCHAR2 ");
sql.append(" , collaboration_id INTEGER NOT NULL ");
sql.append(" , shop_member_id INTEGER NOT NULL ");
sql.append(" , archive_save_path VARCHAR2 ");
sql.append(" , PRIMARY KEY (archive_id)");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public class TChatMessage extends SQLiteTableScript {
public TChatMessage() {
};
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" create table t_chat_message ( ");
sql.append(" chat_message_id INTEGER NOT NULL ");
sql.append(" , chat_room_id INTEGER NOT NULL ");
sql.append(" , shop_member_id INTEGER NOT NULL ");
sql.append(" , message VARCHAR2 ");
sql.append(" , message_type INTEGER ");
sql.append(" , image_name VARCHAR2 ");
sql.append(" , download_file_name VARCHAR2 ");
sql.append(" , save_path VARCHAR2 ");
sql.append(" , insert_date VARCHAR2(64)");
sql.append(" , PRIMARY KEY (chat_message_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public class TChatRoom extends SQLiteTableScript {
public TChatRoom() {
};
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" create table t_chat_room ( ");
sql.append(" chat_room_id INTEGER NOT NULL ");
sql.append(" , chat_room_name VARCHAR2(64) ");
sql.append(" , type INTEGER NOT NULL ");
sql.append(" , unread_count INTEGER ");
sql.append(" , user_count INTEGER ");
sql.append(" , favorite_register_date VARCHAR2(64) ");
sql.append(" , PRIMARY KEY (chat_room_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public class TCollaboration extends SQLiteTableScript {
public TCollaboration() {
};
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" create table t_collaboration ( ");
sql.append(" collaboration_id INTEGER NOT NULL ");
sql.append(" , chat_message_id INTEGER NOT NULL ");
sql.append(" , PRIMARY KEY (collaboration_id)");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public class TCollaborationDetail extends SQLiteTableScript {
public TCollaborationDetail() {
};
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" create table t_collaboration_detail ( ");
sql.append(" collaboration_detial_id INTEGER NOT NULL ");
sql.append(" , collaboration_id INTEGER NOT NULL ");
sql.append(" , collaboration_type INTEGER ");
sql.append(" , collaboration_duration VARCHAR2(64) ");
sql.append(" , chat_room_id INTEGER NOT NULL ");
sql.append(" , PRIMARY KEY (collaboration_detial_id)");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
}
package jp.agentec.abook.abv.bl.dto;
public class ArchiveDto extends AbstractDto {
public Integer archiveId;
public String archiveName;
public Integer archiveType;
public String archiveUrl;
public Integer collaborationId;
public Integer shopMemberId;
public String archiveSavePath;
@Override
public Object[] getInsertValues() {
return new Object[]{archiveId, archiveName, archiveType, archiveUrl, collaborationId, shopMemberId, archiveSavePath};
}
@Override
public Object[] getUpdateValues() {
return new Object[]{archiveName, archiveType, archiveUrl, collaborationId, shopMemberId,archiveSavePath, archiveId};
}
@Override
public String[] getKeyValues() {
return new String[]{""+ archiveId};
}
}
package jp.agentec.abook.abv.bl.dto;
import java.util.Date;
public class ChatMessageDto extends AbstractDto {
public Integer chatMessageId;
public Integer chatRoomId;
public Integer shopMemberId;
public String message;
public Integer messageType;
public String imageName;
public String downloadFileName;
public String savePath;
public String insertDate;
@Override
public Object[] getInsertValues() {
return new Object[] { chatMessageId, chatRoomId, shopMemberId, message, messageType, imageName, downloadFileName, savePath, insertDate };
}
@Override
public Object[] getUpdateValues() {
return new Object[] { chatRoomId, shopMemberId, message, messageType, imageName, downloadFileName, savePath, insertDate, chatMessageId };
}
@Override
public String[] getKeyValues() {
return new String[]{ "" + chatMessageId };
}
}
package jp.agentec.abook.abv.bl.dto;
import java.util.Date;
import java.util.List;
public class ChatRoomDto extends AbstractDto {
public Integer chatRoomId;
public String chatRoomName;
public Integer type;
public String favoriteRegisterDate = "";
public Integer unreadCount;
public Integer userCount;
public String message;
public Integer messageType;
public String insertDate;
public ChatMessageDto lastMessageInfo;
@Override
public Object[] getInsertValues() {
return new Object[] { chatRoomId, chatRoomName, type, unreadCount, userCount, favoriteRegisterDate };
}
@Override
public Object[] getUpdateValues() {
return new Object[] { favoriteRegisterDate, chatRoomName, type, unreadCount, userCount, chatRoomId };
}
@Override
public String[] getKeyValues() {
return new String[] { "" + chatRoomId };
}
}
package jp.agentec.abook.abv.bl.dto;
public class CollaborationDetailDto extends AbstractDto {
public Integer collaborationDetialId;
public Integer collaborationId;
public Integer collaborationType;
public String collaborationDuration;
@Override
public Object[] getInsertValues() {
return new Object[] { collaborationDetialId, collaborationId, collaborationType, collaborationDuration };
}
@Override
public Object[] getUpdateValues() {
return new Object[] { collaborationDuration, collaborationId, collaborationType, collaborationDetialId };
}
@Override
public String[] getKeyValues() {
return new String[]{ "" + collaborationDetialId };
}
}
package jp.agentec.abook.abv.bl.dto;
public class CollaborationDto extends AbstractDto {
public Integer collaborationId;
public Integer chatMessageId;
@Override
public Object[] getInsertValues() {
return new Object[]{collaborationId, chatMessageId};
}
@Override
public Object[] getUpdateValues() {
return new Object[]{chatMessageId, collaborationId};
}
@Override
public String[] getKeyValues() {
return new String[]{""+ collaborationId};
}
}
package jp.agentec.abook.abv.bl.dto;
import java.util.Date;
public class ShopMemberDto extends AbstractDto {
public Integer shopMemberId;
public String shopMemberName;
public String profileUrl;
public String favoriteRegisterDate;
@Override
public Object[] getInsertValues() {
return new Object[] { shopMemberId, shopMemberName, profileUrl, favoriteRegisterDate };
}
@Override
public Object[] getUpdateValues() {
return new Object[] { shopMemberName, profileUrl, favoriteRegisterDate, shopMemberId };
}
@Override
public String[] getKeyValues() {
return new String[]{ "" + shopMemberId };
}
}
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.ChatMessageDao;
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.ChatMessageDto;
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);
private ChatMessageDao chatMessageDao = AbstractDao.getDao(ChatMessageDao.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);
chatRoomMap.put("favoriteRegisterDate", chatRoomDto.favoriteRegisterDate);
chatRoomMap.put("unreadCount", chatRoomDto.unreadCount);
chatRoomMap.put("message", chatRoomDto.message);
chatRoomMap.put("messageType", chatRoomDto.messageType);
chatRoomMap.put("insertDate", chatRoomDto.insertDate);
chatRoomMap.put("userCount", chatRoomDto.userCount);
JSONObject jsonObject = new JSONObject(chatRoomMap);
resultJsonArray.put(jsonObject);
}
String roomListToStr = resultJsonArray.toString();
return roomListToStr;
}
public void insertChatRoomList(List<ChatRoomDto> roomList) {
List<ChatMessageDto> insertMessageList = new ArrayList<ChatMessageDto>();
for (ChatRoomDto chatRoomDto : roomList) {
if (chatRoomDto.lastMessageInfo != null) {
insertMessageList.add(chatRoomDto.lastMessageInfo);
}
}
chatRoomDao.insertChatRoom(roomList);
chatMessageDao.insertChatMessage(insertMessageList);
}
public void deleteChatRoomList() {
chatRoomDao.deleteChatRoom();
}
}
...@@ -584,4 +584,13 @@ public class DateTimeUtil { ...@@ -584,4 +584,13 @@ public class DateTimeUtil {
return calendar1.before(calendar2); return calendar1.before(calendar2);
} }
public static String millToDateString(long mills) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
Date timeInDate = new Date(mills);
String timeInFormat = dateFormat.format(timeInDate);
return timeInFormat;
}
} }
...@@ -62,20 +62,32 @@ img { ...@@ -62,20 +62,32 @@ img {
.top_spac{ margin: 20px 0 0;} .top_spac{ margin: 20px 0 0;}
.recent_heading {float: left; width:40%;} .recent_heading {float: left; width:90%;}
.srch_bar { .srch_bar {
display: inline-block; display: inline-block;
text-align: right; text-align: center;
width: 60%; width: 100%;
/*padding:*/ /*padding:*/
} }
.heading_srch { padding:10px 20px 10px 20px; overflow:hidden; border-bottom:1px solid #c4c4c4;} .heading_srch { padding:5px 10px 5px 10px; overflow:hidden; border-bottom:1px solid #c4c4c4;}
.recent_heading h4 { .recent_heading h4 {
color: #095395; color: #095395;
font-size: 21px; font-size: 21px;
margin: auto; margin: auto;
} }
.data_srch h3, .recent_heading h3 {
color: #095395;
font-size: 20px;
margin: auto;
margin-left: 10px;
}
.inbox_people .data_srch {
padding: 5px 10px 5px 10px;
}
.chat_list, .group_list, .user_list, .select_user_list { .chat_list, .group_list, .user_list, .select_user_list {
border-bottom: 1px solid #c4c4c4; border-bottom: 1px solid #c4c4c4;
margin: 0; margin: 0;
...@@ -89,14 +101,28 @@ img { ...@@ -89,14 +101,28 @@ img {
} }
#room_list, #group_list, #user_list, #select_user_list { #room_list, #group_list, #user_list, #select_user_list {
margin-left: 0; margin-left: 0;
}
.room-list-title {
display: inline-flex;
max-width: 100%;
}
.room-name-font {
font-size: 1rem !important;
margin-right: 5px;
}
.room-member-count {
line-height: 1.5;
} }
.chat_img, .group_img, .user_img { .chat_img, .group_img, .user_img {
float: left; float: left;
width: 11%; width: 11%;
} }
.srch_bar input { border:1px solid #cdcdcd; border-width:0 0 1px 0; width:80%; padding:2px 0 4px 6px; background:none; } .srch_bar input { border:1px solid #cdcdcd; border-width:0 0 1px 0; width:90%; padding:4px 0 4px 6px; background:none; }
.srch_bar .input-group-addon button { .srch_bar .input-group-addon button {
background: rgba(0, 0, 0, 0) none repeat scroll 0 0; background: rgba(0, 0, 0, 0) none repeat scroll 0 0;
border: medium none; border: medium none;
...@@ -172,11 +198,20 @@ img { ...@@ -172,11 +198,20 @@ img {
} }
.received_withd_msg { width: 57%;} .received_withd_msg { width: 57%;}
.mesgs { .mesgs {
margin-top: 40px;
padding: 0px 15px 48px 15px; padding: 0px 15px 48px 15px;
} }
.search-bar-fixed {
position: fixed;
}
.search-group {
margin-bottom: 38px;
}
.landscape_mesgs { .landscape_mesgs {
padding: 0px 10% 48px 10%; padding: 0px 10% 48px 10%;
} }
.outgoing_msg{ overflow:hidden; margin:24px 0 24px;} .outgoing_msg{ overflow:hidden; margin:24px 0 24px;}
...@@ -215,7 +250,10 @@ img { ...@@ -215,7 +250,10 @@ img {
} }
.messaging { padding: 0 0 50px 0;} .messaging { padding: 0 0 50px 0;}
.msg_history { .msg_history {
height: calc(100vh - 88px);
/* チャット画面スクロール範囲
* 画面の高さ - (画面上部タイトルの高さ(58px) + ルーム名検索欄の高さ(38px) + メッセージ入力欄の高さ(48px)) */
height: calc(100vh - 144px);
overflow-y: auto; overflow-y: auto;
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
} }
...@@ -314,7 +352,7 @@ a[aria-expanded="true"] { ...@@ -314,7 +352,7 @@ a[aria-expanded="true"] {
} }
#sidebar .sidebar-footer{ #sidebar .sidebar-footer{
position: sticky; position: sticky;
bottom: 0; bottom: 0;
width: 100%; width: 100%;
background: #095395; background: #095395;
...@@ -351,7 +389,7 @@ a.article:hover { ...@@ -351,7 +389,7 @@ a.article:hover {
position:fixed; position:fixed;
width:60px; width:60px;
height:60px; height:60px;
bottom:18px; bottom:20px;
right:18px; right:18px;
background-color:#095395; background-color:#095395;
color:#FFF; color:#FFF;
...@@ -496,7 +534,6 @@ a.article:hover { ...@@ -496,7 +534,6 @@ a.article:hover {
#newRoomName{ #newRoomName{
display: none; display: none;
width: auto;
} }
.bg-primary, .btn-primary{ .bg-primary, .btn-primary{
...@@ -584,6 +621,19 @@ a.article:hover { ...@@ -584,6 +621,19 @@ a.article:hover {
z-index:10050; z-index:10050;
} }
#errorMsg{
margin-top: 60px;
text-align: center;
}
.bg-footer {
background-color: #F2F2F2;
}
.talign-center{
text-align: center;
}
/* --------------------------------------------------- */ /* --------------------------------------------------- */
/* ERROR PAGE STYLE */ /* ERROR PAGE STYLE */
/* --------------------------------------------------- */ /* --------------------------------------------------- */
......
// 名前空間
var CHAT_DB = {};
//ロカールDBからルーム一覧情報を取得
CHAT_DB.getRoomList = function(input) {
if (CHAT_UTIL.isIOS()) {
//TODO IOS処理追加必要
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getRoomList());
}
};
\ No newline at end of file
...@@ -17,6 +17,12 @@ CHAT_UTIL.formatDate = function(date) { ...@@ -17,6 +17,12 @@ CHAT_UTIL.formatDate = function(date) {
const REFERENCE = moment(); const REFERENCE = moment();
const TODAY = REFERENCE.clone().startOf('day'); const TODAY = REFERENCE.clone().startOf('day');
let createdAt = moment(date); let createdAt = moment(date);
if (date.length == 14) {
createdAt = moment(date,'YYYYMMDDhhmmss');
} else {
createdAt = moment(date);
}
// #36171 // #36171
const createdAtDay = createdAt.format('MMM Do'); const createdAtDay = createdAt.format('MMM Do');
const createdAtTime = createdAt.format('HH:mm'); const createdAtTime = createdAt.format('HH:mm');
......
/** /**
* Constant定義ファイル * Constant定義ファイル
*/ */
const readyState = { const readyState = {
UNINITIALIZED : 0 , UNINITIALIZED : 0 ,
LOADING : 1 , LOADING : 1 ,
LOADED : 2 , LOADED : 2 ,
INTERACTIVE : 3 , INTERACTIVE : 3 ,
COMPLETED : 4 COMPLETED : 4
} }
\ No newline at end of file
const messageType = {
TEXT : 0 ,
IMAGE : 1 ,
VIDEO : 2 ,
SYSTEM : 3 ,
COMMUNICATION : 4
}
$.lang.en = { $.lang.en = {
"chat_placeholder":"Type message", "chat_placeholder":"Type message",
"chat_search_placeholder":" Search Message",
"room_search_placeholder":" Search Room",
"participants":"Member List", "participants":"Member List",
"exitRoom":"Exit ", "exitRoom":"Exit ",
"roomListTitle":"Room List", "roomListTitle":"Room List",
"deleteRoomTitle":"Delete Room", "deleteRoomTitle":"Delete Room",
"inviteUsersButton":"invite", "inviteUsersButton":"invite",
"inviteUsersTitle":"Invite Member", "inviteUsersTitle":"Invite Member",
"createRoomSubtitle":"Create Room", "createRoomTitle":"Create Room",
"createRoomSubtitle":"Room Name",
"inviteUsersSubtitle":"Invite User", "inviteUsersSubtitle":"Invite User",
"roomListEmptyString":"There is no room available.", "roomListEmptyString":"There is no room available.",
"invitedUser":"Invited Users",
"left":"%@ has left", "left":"%@ has left",
"join":"%@ has joined", "join":"%@ has joined",
"added":"%@ has been invited", "added":"%@ has been invited",
...@@ -22,12 +26,14 @@ $.lang.en = { ...@@ -22,12 +26,14 @@ $.lang.en = {
"thankLabel":"Thank you", "thankLabel":"Thank you",
"startToWorkLabel":"Start to work", "startToWorkLabel":"Start to work",
"groupListKeyword":"Search", "groupListKeyword":"Search",
"userSearch":"User Search",
"groupSearch":"Group Search",
"groupPageSubtitle":"Groups", "groupPageSubtitle":"Groups",
"noMessages":"No Messages", "noMessages":"No Messages",
"image":"Image", "image":"Image",
"chatKeyword":"Search", "chatKeyword":"Search",
"userListKeyword":"Search", "userListKeyword":"Search",
"newRoomName":"Enter Roomname", "newRoomName":"Please input Room Name",
"everyoneIsHere":"Everyone is in the chat.", "everyoneIsHere":"Everyone is in the chat.",
"people":"people", "people":"people",
"searchResult":"Results", "searchResult":"Results",
......
$.lang.ja = { $.lang.ja = {
"chat_placeholder":"メッセージを入力", "chat_placeholder":"メッセージを入力",
"chat_search_placeholder":" メッセージ検索",
"room_search_placeholder":" ルーム検索",
"participants":"メンバーリスト", "participants":"メンバーリスト",
"exitRoom":"退出 ", "exitRoom":"退出 ",
"roomListTitle":"ルーム一覧", "roomListTitle":"ルーム一覧",
"deleteRoomTitle":"ルーム削除", "deleteRoomTitle":"ルーム削除",
"inviteUsersButton":"招待", "inviteUsersButton":"招待",
"inviteUsersTitle":"メンバー追加", "inviteUsersTitle":"メンバー追加",
"createRoomSubtitle":"ルーム生成", "createRoomTitle":"ルーム開設",
"createRoomSubtitle":"ルーム名",
"inviteUsersSubtitle":"ユーザ招待", "inviteUsersSubtitle":"ユーザ招待",
"roomListEmptyString":"入場できるルームがありません。", "roomListEmptyString":"入場できるルームがありません。",
"left":"%@ 様が退場しました。", "left":"%@ 様が退場しました。",
...@@ -21,13 +24,16 @@ $.lang.ja = { ...@@ -21,13 +24,16 @@ $.lang.ja = {
"completeLabel":"完了しました。", "completeLabel":"完了しました。",
"thankLabel":"ありがとうございます。", "thankLabel":"ありがとうございます。",
"startToWorkLabel":"作業開始します。", "startToWorkLabel":"作業開始します。",
"userSearch":"ユーザー検索",
"groupSearch":"グループ検索",
"groupListKeyword":"検索", "groupListKeyword":"検索",
"groupPageSubtitle":"グループ", "groupPageSubtitle":"グループ",
"noMessages":"メッセージがありません。", "noMessages":"メッセージがありません。",
"image":"画像", "image":"画像",
"chatKeyword":"検索", "chatKeyword":"検索",
"userListKeyword":"検索", "userListKeyword":"検索",
"newRoomName":"ルーム名を入力", "invitedUser":"参加者",
"newRoomName":"ルーム名を入力してください",
"everyoneIsHere":"招待可能なメンバーがいません。", "everyoneIsHere":"招待可能なメンバーがいません。",
"people":"人", "people":"人",
"searchResult":"件のトーク", "searchResult":"件のトーク",
......
$.lang.ko = { $.lang.ko = {
"chat_placeholder":"메시지를 입력하세요.", "chat_placeholder":"메시지를 입력하세요.",
"chat_search_placeholder":" 메세지검색",
"room_search_placeholder":" 채팅방 검색",
"participants":"멤버 리스트", "participants":"멤버 리스트",
"exitRoom":"나가기 ", "exitRoom":"나가기 ",
"roomListTitle":"채팅 리스트", "roomListTitle":"채팅 리스트",
"deleteRoomTitle":"채팅방 삭제", "deleteRoomTitle":"채팅방 삭제",
"inviteUsersButton":"유저 초대", "inviteUsersButton":"유저 초대",
"inviteUsersTitle":"대화상대 추가", "inviteUsersTitle":"대화상대 추가",
"createRoomSubtitle":"방 생성", "createRoomTitle":"방 개설",
"createRoomSubtitle":"방 이름",
"inviteUsersSubtitle":"유저 초대", "inviteUsersSubtitle":"유저 초대",
"roomListEmptyString":"입장 가능한 방이 없습니다.", "roomListEmptyString":"입장 가능한 방이 없습니다.",
"invitedUser":"참가자",
"left":"%@ 님이 방을 떠났습니다.", "left":"%@ 님이 방을 떠났습니다.",
"join":"%@ 님이 참가했습니다.", "join":"%@ 님이 참가했습니다.",
"added":"%@ 님을 초대했습니다.", "added":"%@ 님을 초대했습니다.",
...@@ -22,12 +26,14 @@ $.lang.ko = { ...@@ -22,12 +26,14 @@ $.lang.ko = {
"thankLabel":"감사합니다.", "thankLabel":"감사합니다.",
"startToWorkLabel":"작업을 시작합니다.", "startToWorkLabel":"작업을 시작합니다.",
"groupListKeyword":"검색", "groupListKeyword":"검색",
"userSearch":"유저 검색",
"groupSearch":"그룹 검색",
"groupPageSubtitle":"그룹", "groupPageSubtitle":"그룹",
"noMessages":"메시지가 없습니다.", "noMessages":"메시지가 없습니다.",
"image":"이미지", "image":"이미지",
"chatKeyword":"검색", "chatKeyword":"검색",
"userListKeyword":"검색", "userListKeyword":"검색",
"newRoomName":"방제목 입력", "newRoomName":"방 이름을 입력해주세요.",
"everyoneIsHere":"초대가능한 유저가 없습니다.", "everyoneIsHere":"초대가능한 유저가 없습니다.",
"people":"명", "people":"명",
"searchResult":"건의 결과", "searchResult":"건의 결과",
......
<!doctype html>
<html lang="en" style="background: #DBDBDB;">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1, user-scalable=0">
<title>Prototype</title>
<link href="./fontawesome/css/all.css" rel="stylesheet">
<link rel="stylesheet" href="./css/bootstrap.min.css">
<link rel="stylesheet" href="./css/lightbox.min.css">
<link rel="stylesheet" href="./css/chat.css">
<script>
const PLATFORM = 'android';
const IS_MOBILE = true;
</script>
</script>
</head>
<body>
<nav class="navbar navbar-expand navbar-dark bg-primary fixed-top flex-md-nowrap p-2 shadow">
<ul class="navbar-nav col-3" id="navbarLeft">
<button class="btn btn-primary" type="button" id="homeButton">
<i class="fa fa-home" style="font-size: 1.6rem;"></i>
</button>
</ul>
<a class="navbar-brand col-6 mr-0 text-truncate titleRoomName text-center" href="#">Error</a>
</nav>
<div class="error-aria">
<img id="errorImg" src="./icon/error_top_icon.svg">
<div id="errorTitle">
<a>ネットワークエラー</a>
</div>
<div id="errorMsg">
ネットワークに接続できませんでした。電波が良いところでもう一度接続してください。
</div>
<button class="bg-primary reload-button" id="reloadButton">更新</button>
<img id="errorEnd" src="./icon/error_footer_img.svg">
</div>
</div>
<script src="./js/libs/jquery-3.3.1.min.js"></script>
<script src="./js/libs/popper.min.js"></script>
<script src="./js/libs/moment.js"></script>
<script src="./js/libs/locale/ko.js" charset="UTF-8"></script>
<script src="./js/libs/locale/ja.js" charset="UTF-8"></script>
<script src="./js/libs/mustache.min.js"></script>
<script src="./js/libs/deparam.js"></script>
<script src="./js/libs/bootstrap.min.js"></script>
<script src="./js/libs/jquery.mark.min.js"></script>
<script src="./js/libs/lightbox.js"></script>
<script src="./js/language.js"></script>
<script src="./js/language_ko.js" charset="UTF-8"></script>
<script src="./js/language_ja.js" charset="UTF-8"></script>
<script src="./js/language_en.js" charset="UTF-8"></script>
<script src="./js/chat-util.js"></script>
<script src="./js/chat-error.js"></script>
</body>
</html>
\ No newline at end of file
The MIT License (MIT)
Copyright (c) 2014 Guillermo Rauch
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
\ No newline at end of file
# socket.io-client
[![Build Status](https://secure.travis-ci.org/socketio/socket.io-client.svg?branch=master)](http://travis-ci.org/socketio/socket.io-client)
[![Dependency Status](https://david-dm.org/socketio/socket.io-client.svg)](https://david-dm.org/socketio/socket.io-client)
[![devDependency Status](https://david-dm.org/socketio/socket.io-client/dev-status.svg)](https://david-dm.org/socketio/socket.io-client#info=devDependencies)
[![NPM version](https://badge.fury.io/js/socket.io-client.svg)](https://www.npmjs.com/package/socket.io-client)
![Downloads](http://img.shields.io/npm/dm/socket.io-client.svg?style=flat)
[![](http://slack.socket.io/badge.svg?)](http://slack.socket.io)
[![Sauce Test Status](https://saucelabs.com/browser-matrix/socket.svg)](https://saucelabs.com/u/socket)
## How to use
A standalone build of `socket.io-client` is exposed automatically by the
socket.io server as `/socket.io/socket.io.js`. Alternatively you can
serve the file `socket.io.js` found in the `dist` folder.
```html
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io('http://localhost');
socket.on('connect', function(){});
socket.on('event', function(data){});
socket.on('disconnect', function(){});
</script>
```
```js
// with ES6 import
import io from 'socket.io-client';
const socket = io('http://localhost');
```
A slim build (without `JSON3`, a JSON polyfill for IE6/IE7, and `debug`) is also available: `socket.io.slim.js`.
Socket.IO is compatible with [browserify](http://browserify.org/) and [webpack](https://webpack.js.org/) (see example [there](https://github.com/socketio/socket.io/tree/2.0.3/examples/webpack-build)).
### Node.JS (server-side usage)
Add `socket.io-client` to your `package.json` and then:
```js
var socket = require('socket.io-client')('http://localhost');
socket.on('connect', function(){});
socket.on('event', function(data){});
socket.on('disconnect', function(){});
```
## API
See [API](/docs/API.md)
## License
[MIT](/LICENSE)
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
/**
* Module dependencies.
*/
var url = require('./url');
var parser = require('socket.io-parser');
var Manager = require('./manager');
var debug = require('debug')('socket.io-client');
/**
* Module exports.
*/
module.exports = exports = lookup;
/**
* Managers cache.
*/
var cache = exports.managers = {};
/**
* Looks up an existing `Manager` for multiplexing.
* If the user summons:
*
* `io('http://localhost/a');`
* `io('http://localhost/b');`
*
* We reuse the existing instance based on same scheme/port/host,
* and we initialize sockets for each namespace.
*
* @api public
*/
function lookup (uri, opts) {
if (typeof uri === 'object') {
opts = uri;
uri = undefined;
}
opts = opts || {};
var parsed = url(uri);
var source = parsed.source;
var id = parsed.id;
var path = parsed.path;
var sameNamespace = cache[id] && path in cache[id].nsps;
var newConnection = opts.forceNew || opts['force new connection'] ||
false === opts.multiplex || sameNamespace;
var io;
if (newConnection) {
debug('ignoring socket cache for %s', source);
io = Manager(source, opts);
} else {
if (!cache[id]) {
debug('new io instance for %s', source);
cache[id] = Manager(source, opts);
}
io = cache[id];
}
if (parsed.query && !opts.query) {
opts.query = parsed.query;
}
return io.socket(parsed.path, opts);
}
/**
* Protocol version.
*
* @api public
*/
exports.protocol = parser.protocol;
/**
* `connect`.
*
* @param {String} uri
* @api public
*/
exports.connect = lookup;
/**
* Expose constructors for standalone build.
*
* @api public
*/
exports.Manager = require('./manager');
exports.Socket = require('./socket');
/**
* Module exports.
*/
module.exports = on;
/**
* Helper for subscriptions.
*
* @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter`
* @param {String} event name
* @param {Function} callback
* @api public
*/
function on(obj, ev, fn) {
obj.on(ev, fn);
return {
destroy: function() {
obj.removeListener(ev, fn);
}
};
}
/**
* Module dependencies.
*/
var parser = require('socket.io-parser');
var Emitter = require('component-emitter');
var toArray = require('to-array');
var on = require('./on');
var bind = require('component-bind');
var debug = require('debug')('socket.io-client:socket');
var parseqs = require('parseqs');
var hasBin = require('has-binary2');
/**
* Module exports.
*/
module.exports = exports = Socket;
/**
* Internal events (blacklisted).
* These events can't be emitted by the user.
*
* @api private
*/
var events = {
connect: 1,
connect_error: 1,
connect_timeout: 1,
connecting: 1,
disconnect: 1,
error: 1,
reconnect: 1,
reconnect_attempt: 1,
reconnect_failed: 1,
reconnect_error: 1,
reconnecting: 1,
ping: 1,
pong: 1
};
/**
* Shortcut to `Emitter#emit`.
*/
var emit = Emitter.prototype.emit;
/**
* `Socket` constructor.
*
* @api public
*/
function Socket(io, nsp, opts) {
this.io = io;
this.nsp = nsp;
this.json = this; // compat
this.ids = 0;
this.acks = {};
this.receiveBuffer = [];
this.sendBuffer = [];
this.connected = false;
this.disconnected = true;
this.flags = {};
if (opts && opts.query) {
this.query = opts.query;
}
if (this.io.autoConnect) this.open();
}
/**
* Mix in `Emitter`.
*/
Emitter(Socket.prototype);
/**
* Subscribe to open, close and packet events
*
* @api private
*/
Socket.prototype.subEvents = function() {
if (this.subs) return;
var io = this.io;
this.subs = [
on(io, 'open', bind(this, 'onopen')),
on(io, 'packet', bind(this, 'onpacket')),
on(io, 'close', bind(this, 'onclose'))
];
};
/**
* "Opens" the socket.
*
* @api public
*/
Socket.prototype.open =
Socket.prototype.connect = function() {
if (this.connected) return this;
this.subEvents();
this.io.open(); // ensure open
if ('open' === this.io.readyState) this.onopen();
this.emit('connecting');
return this;
};
/**
* Sends a `message` event.
*
* @return {Socket} self
* @api public
*/
Socket.prototype.send = function() {
var args = toArray(arguments);
args.unshift('message');
this.emit.apply(this, args);
return this;
};
/**
* Override `emit`.
* If the event is in `events`, it's emitted normally.
*
* @param {String} event name
* @return {Socket} self
* @api public
*/
Socket.prototype.emit = function(ev) {
if (events.hasOwnProperty(ev)) {
emit.apply(this, arguments);
return this;
}
var args = toArray(arguments);
var packet = {
type: (this.flags.binary !== undefined ? this.flags.binary : hasBin(args)) ? parser.BINARY_EVENT : parser.EVENT,
data: args
};
packet.options = {};
packet.options.compress = !this.flags || false !== this.flags.compress;
// event ack callback
if ('function' === typeof args[args.length - 1]) {
debug('emitting packet with ack id %d', this.ids);
this.acks[this.ids] = args.pop();
packet.id = this.ids++;
}
if (this.connected) {
this.packet(packet);
} else {
this.sendBuffer.push(packet);
}
this.flags = {};
return this;
};
/**
* Sends a packet.
*
* @param {Object} packet
* @api private
*/
Socket.prototype.packet = function(packet) {
packet.nsp = this.nsp;
this.io.packet(packet);
};
/**
* Called upon engine `open`.
*
* @api private
*/
Socket.prototype.onopen = function() {
debug('transport is open - connecting');
// write connect packet if necessary
if ('/' !== this.nsp) {
if (this.query) {
var query = typeof this.query === 'object' ? parseqs.encode(this.query) : this.query;
debug('sending connect packet with query %s', query);
this.packet({type: parser.CONNECT, query: query});
} else {
this.packet({type: parser.CONNECT});
}
}
};
/**
* Called upon engine `close`.
*
* @param {String} reason
* @api private
*/
Socket.prototype.onclose = function(reason) {
debug('close (%s)', reason);
this.connected = false;
this.disconnected = true;
delete this.id;
this.emit('disconnect', reason);
};
/**
* Called with socket packet.
*
* @param {Object} packet
* @api private
*/
Socket.prototype.onpacket = function(packet) {
var sameNamespace = packet.nsp === this.nsp;
var rootNamespaceError = packet.type === parser.ERROR && packet.nsp === '/';
if (!sameNamespace && !rootNamespaceError) return;
switch (packet.type) {
case parser.CONNECT:
this.onconnect();
break;
case parser.EVENT:
this.onevent(packet);
break;
case parser.BINARY_EVENT:
this.onevent(packet);
break;
case parser.ACK:
this.onack(packet);
break;
case parser.BINARY_ACK:
this.onack(packet);
break;
case parser.DISCONNECT:
this.ondisconnect();
break;
case parser.ERROR:
this.emit('error', packet.data);
break;
}
};
/**
* Called upon a server event.
*
* @param {Object} packet
* @api private
*/
Socket.prototype.onevent = function(packet) {
var args = packet.data || [];
debug('emitting event %j', args);
if (null != packet.id) {
debug('attaching ack callback to event');
args.push(this.ack(packet.id));
}
if (this.connected) {
emit.apply(this, args);
} else {
this.receiveBuffer.push(args);
}
};
/**
* Produces an ack callback to emit with an event.
*
* @api private
*/
Socket.prototype.ack = function(id) {
var self = this;
var sent = false;
return function () {
// prevent double callbacks
if (sent) return;
sent = true;
var args = toArray(arguments);
debug('sending ack %j', args);
self.packet({
type: hasBin(args) ? parser.BINARY_ACK : parser.ACK,
id: id,
data: args
});
};
};
/**
* Called upon a server acknowlegement.
*
* @param {Object} packet
* @api private
*/
Socket.prototype.onack = function(packet) {
var ack = this.acks[packet.id];
if ('function' === typeof ack) {
debug('calling ack %s with %j', packet.id, packet.data);
ack.apply(this, packet.data);
delete this.acks[packet.id];
} else {
debug('bad ack %s', packet.id);
}
};
/**
* Called upon server connect.
*
* @api private
*/
Socket.prototype.onconnect = function() {
this.connected = true;
this.disconnected = false;
this.emit('connect');
this.emitBuffered();
};
/**
* Emit buffered events (received and emitted).
*
* @api private
*/
Socket.prototype.emitBuffered = function() {
var i;
for (i = 0; i < this.receiveBuffer.length; i++) {
emit.apply(this, this.receiveBuffer[i]);
}
this.receiveBuffer = [];
for (i = 0; i < this.sendBuffer.length; i++) {
this.packet(this.sendBuffer[i]);
}
this.sendBuffer = [];
};
/**
* Called upon server disconnect.
*
* @api private
*/
Socket.prototype.ondisconnect = function() {
debug('server disconnect (%s)', this.nsp);
this.destroy();
this.onclose('io server disconnect');
};
/**
* Called upon forced client/server side disconnections,
* this method ensures the manager stops tracking us and
* that reconnections don't get triggered for this.
*
* @api private.
*/
Socket.prototype.destroy = function() {
if (this.subs) {
// clean subscriptions to avoid reconnections
for (var i = 0; i < this.subs.length; i++) {
this.subs[i].destroy();
}
this.subs = null;
}
this.io.destroy(this);
};
/**
* Disconnects the socket manually.
*
* @return {Socket} self
* @api public
*/
Socket.prototype.close =
Socket.prototype.disconnect = function() {
if (this.connected) {
debug('performing disconnect (%s)', this.nsp);
this.packet({ type: parser.DISCONNECT });
}
// remove socket from pool
this.destroy();
if (this.connected) {
// fire events
this.onclose('io client disconnect');
}
return this;
};
/**
* Sets the compress flag.
*
* @param {Boolean} if `true`, compresses the sending data
* @return {Socket} self
* @api public
*/
Socket.prototype.compress = function(compress) {
this.flags.compress = compress;
return this;
};
/**
* Sets the binary flag
*
* @param {Boolean} whether the emitted data contains binary
* @return {Socket} self
* @api public
*/
Socket.prototype.binary = function(binary) {
this.flags.binary = binary;
return this;
};
/**
* Module dependencies.
*/
var parseuri = require('parseuri');
var debug = require('debug')('socket.io-client:url');
/**
* Module exports.
*/
module.exports = url;
/**
* URL parser.
*
* @param {String} url
* @param {Object} An object meant to mimic window.location.
* Defaults to window.location.
* @api public
*/
function url (uri, loc) {
var obj = uri;
// default to window.location
loc = loc || global.location;
if (null == uri) uri = loc.protocol + '//' + loc.host;
// relative path support
if ('string' === typeof uri) {
if ('/' === uri.charAt(0)) {
if ('/' === uri.charAt(1)) {
uri = loc.protocol + uri;
} else {
uri = loc.host + uri;
}
}
if (!/^(https?|wss?):\/\//.test(uri)) {
debug('protocol-less url %s', uri);
if ('undefined' !== typeof loc) {
uri = loc.protocol + '//' + uri;
} else {
uri = 'https://' + uri;
}
}
// parse
debug('parse %s', uri);
obj = parseuri(uri);
}
// make sure we treat `localhost:80` and `localhost` equally
if (!obj.port) {
if (/^(http|ws)$/.test(obj.protocol)) {
obj.port = '80';
} else if (/^(http|ws)s$/.test(obj.protocol)) {
obj.port = '443';
}
}
obj.path = obj.path || '/';
var ipv6 = obj.host.indexOf(':') !== -1;
var host = ipv6 ? '[' + obj.host + ']' : obj.host;
// define unique id
obj.id = obj.protocol + '://' + host + ':' + obj.port;
// define href
obj.href = obj.protocol + '://' + host + (loc && loc.port === obj.port ? '' : (':' + obj.port));
return obj;
}
{
"_args": [
[
"socket.io-client@2.1.1",
"/Users/AIS-NB-048/Downloads/node-chat-app-master"
]
],
"_from": "socket.io-client@2.1.1",
"_id": "socket.io-client@2.1.1",
"_inBundle": false,
"_integrity": "sha512-jxnFyhAuFxYfjqIgduQlhzqTcOEQSn+OHKVfAxWaNWa7ecP7xSNk2Dx/3UEsDcY7NcFafxvNvKPmmO7HTwTxGQ==",
"_location": "/socket.io-client",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "socket.io-client@2.1.1",
"name": "socket.io-client",
"escapedName": "socket.io-client",
"rawSpec": "2.1.1",
"saveSpec": null,
"fetchSpec": "2.1.1"
},
"_requiredBy": [
"/socket.io"
],
"_resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.1.1.tgz",
"_spec": "2.1.1",
"_where": "/Users/AIS-NB-048/Downloads/node-chat-app-master",
"bugs": {
"url": "https://github.com/Automattic/socket.io-client/issues"
},
"contributors": [
{
"name": "Guillermo Rauch",
"email": "rauchg@gmail.com"
},
{
"name": "Arnout Kazemier",
"email": "info@3rd-eden.com"
},
{
"name": "Vladimir Dronnikov",
"email": "dronnikov@gmail.com"
},
{
"name": "Einar Otto Stangvik",
"email": "einaros@gmail.com"
}
],
"dependencies": {
"backo2": "1.0.2",
"base64-arraybuffer": "0.1.5",
"component-bind": "1.0.0",
"component-emitter": "1.2.1",
"debug": "~3.1.0",
"engine.io-client": "~3.2.0",
"has-binary2": "~1.0.2",
"has-cors": "1.1.0",
"indexof": "0.0.1",
"object-component": "0.0.3",
"parseqs": "0.0.5",
"parseuri": "0.0.5",
"socket.io-parser": "~3.2.0",
"to-array": "0.1.4"
},
"description": "[![Build Status](https://secure.travis-ci.org/socketio/socket.io-client.svg?branch=master)](http://travis-ci.org/socketio/socket.io-client) [![Dependency Status](https://david-dm.org/socketio/socket.io-client.svg)](https://david-dm.org/socketio/socket.io-client) [![devDependency Status](https://david-dm.org/socketio/socket.io-client/dev-status.svg)](https://david-dm.org/socketio/socket.io-client#info=devDependencies) [![NPM version](https://badge.fury.io/js/socket.io-client.svg)](https://www.npmjs.com/package/socket.io-client) ![Downloads](http://img.shields.io/npm/dm/socket.io-client.svg?style=flat) [![](http://slack.socket.io/badge.svg?)](http://slack.socket.io)",
"devDependencies": {
"babel-core": "^6.24.1",
"babel-eslint": "4.1.7",
"babel-loader": "7.0.0",
"babel-preset-es2015": "6.24.1",
"concat-stream": "^1.6.0",
"derequire": "^2.0.6",
"eslint-config-standard": "4.4.0",
"eslint-plugin-standard": "1.3.1",
"expect.js": "0.3.1",
"gulp": "^3.9.1",
"gulp-eslint": "1.1.1",
"gulp-file": "^0.3.0",
"gulp-istanbul": "^1.1.1",
"gulp-mocha": "^4.3.1",
"gulp-task-listing": "1.0.1",
"imports-loader": "^0.7.1",
"istanbul": "^0.4.5",
"mocha": "^3.3.0",
"socket.io": "2.1.1",
"socket.io-browsers": "^1.0.0",
"strip-loader": "0.1.2",
"text-blob-builder": "0.0.1",
"webpack-merge": "4.1.2",
"webpack-stream": "3.2.0",
"zuul": "^3.11.1 ",
"zuul-builder-webpack": "^1.2.0",
"zuul-ngrok": "4.0.0"
},
"files": [
"lib/",
"dist/"
],
"homepage": "https://github.com/Automattic/socket.io-client#readme",
"keywords": [
"realtime",
"framework",
"websocket",
"tcp",
"events",
"client"
],
"license": "MIT",
"main": "./lib/index",
"name": "socket.io-client",
"repository": {
"type": "git",
"url": "git+https://github.com/Automattic/socket.io-client.git"
},
"scripts": {
"test": "gulp test"
},
"version": "2.1.1"
}
...@@ -89,7 +89,7 @@ android { ...@@ -89,7 +89,7 @@ android {
armv7 { armv7 {
versionCode defaultConfig.versionCode versionCode defaultConfig.versionCode
ndk { ndk {
abiFilters "armeabi-v7a", "" abiFilters "armeabi-v7a", "x86", ""
} }
} }
...@@ -124,7 +124,7 @@ android { ...@@ -124,7 +124,7 @@ android {
armv7 { armv7 {
versionCode defaultConfig.versionCode versionCode defaultConfig.versionCode
ndk { ndk {
abiFilters "armeabi-v7a", "" abiFilters "armeabi-v7a", "x86", ""
} }
} }
armv8 { armv8 {
......
...@@ -28,16 +28,32 @@ import android.widget.ImageView; ...@@ -28,16 +28,32 @@ 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;
import jp.agentec.abook.abv.bl.acms.client.json.AcmsCommonJSON;
import jp.agentec.abook.abv.bl.acms.client.json.RoomListJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsParameters;
import jp.agentec.abook.abv.bl.acms.type.AcmsApis;
import jp.agentec.abook.abv.bl.common.ABVEnvironment; import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys; import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
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.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.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;
...@@ -49,6 +65,7 @@ import jp.agentec.abook.abv.ui.common.util.ABVToastUtil; ...@@ -49,6 +65,7 @@ import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil; import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper; import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.viewer.activity.ParentWebViewActivity; import jp.agentec.abook.abv.ui.viewer.activity.ParentWebViewActivity;
import jp.agentec.adf.net.http.HttpResponse;
import static org.chromium.net.NetError.ERR_FAILED; import static org.chromium.net.NetError.ERR_FAILED;
...@@ -63,6 +80,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -63,6 +80,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
private final String TAG = "ChatWebviewActivity"; private final String TAG = "ChatWebviewActivity";
private final String NETWORK_ERROR_PLACE_HOLDER = "file:///android_asset/chat/public/index.html"; private final String NETWORK_ERROR_PLACE_HOLDER = "file:///android_asset/chat/public/index.html";
//private final String NETWORK_ERROR_PLACE_HOLDER = "file:///android_asset/chat/public/networkError.html";
private final String CHAT_PAGE_URL = "file:///android_asset/chat/public/index.html";
//AISDevelop //AISDevelop
private JsInf jsInf = new JsInf(); private JsInf jsInf = new JsInf();
...@@ -70,6 +89,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -70,6 +89,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
private ValueCallback<Uri[]> mUploadMessage; private ValueCallback<Uri[]> mUploadMessage;
private String sid, roomName, loginId, shopName; private String sid, roomName, loginId, shopName;
private boolean isOnline;
private Long roomId; private Long roomId;
public AlertDialog myAlertDialog; public AlertDialog myAlertDialog;
...@@ -79,6 +99,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -79,6 +99,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);
...@@ -93,13 +115,15 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -93,13 +115,15 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
roomName = intent.getStringExtra("roomName"); roomName = intent.getStringExtra("roomName");
loginId = intent.getStringExtra("loginId"); loginId = intent.getStringExtra("loginId");
shopName = intent.getStringExtra("shopName"); shopName = intent.getStringExtra("shopName");
isOnline = false;
//ネットワークがない場合専用のページを表示。 //ネットワークがない場合専用のページを表示。
chatWebviewUrl = NETWORK_ERROR_PLACE_HOLDER; chatWebviewUrl = NETWORK_ERROR_PLACE_HOLDER;
if (ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) { if (ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
try { try {
if (AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).checkSid(sid)) { if (AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).checkSid(sid)) {
chatWebviewUrl = intent.getStringExtra("chatWebviewUrl"); isOnline = true;
chatWebviewUrl = CHAT_PAGE_URL;
} }
} catch (Exception e) { } catch (Exception e) {
Logger.d("SID_CHECK_ERROR"); Logger.d("SID_CHECK_ERROR");
...@@ -136,6 +160,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -136,6 +160,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
String lastRoomId = PreferenceUtil.getUserPref(getApplicationContext(), AppDefType.UserPrefKey.CHAT_LAST_ROOMID, ""); String lastRoomId = PreferenceUtil.getUserPref(getApplicationContext(), AppDefType.UserPrefKey.CHAT_LAST_ROOMID, "");
mChatWebView.addJavascriptInterface(jsInf, "android"); mChatWebView.addJavascriptInterface(jsInf, "android");
String fixedParam = "&platform=android&isMobile=true&chatServerUrl=" + ABVEnvironment.getInstance().websocketServerHttpUrl; String fixedParam = "&platform=android&isMobile=true&chatServerUrl=" + ABVEnvironment.getInstance().websocketServerHttpUrl;
//ページをロード //ページをロード
if(roomId != 0 && roomName != null) { // by push message if(roomId != 0 && roomName != null) { // by push message
...@@ -510,6 +535,14 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -510,6 +535,14 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
} }
} }
public void getQueryParam() {
String chatServerUrl = ABVEnvironment.getInstance().websocketServerHttpUrl;
chatServerUrl= chatServerUrl.substring(0, chatServerUrl.length() - 3);
String cmsServerUrl = ABVEnvironment.getInstance().acmsAddress+ ABVDataCache.getInstance().getUrlPath();
mChatWebView.loadUrl(String.format("javascript:getGlobalParam('%s', '%s', '%s', '%s', '%s');", chatServerUrl, cmsServerUrl, "android", true, isOnline));
}
@Override @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) { protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
...@@ -593,6 +626,16 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -593,6 +626,16 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
} }
@JavascriptInterface @JavascriptInterface
public void getGlobalParameter() {
mChatWebView.post(new Runnable() {
@Override
public void run() {
getQueryParam();
}
});
}
@JavascriptInterface
public void goHome() { public void goHome() {
mChatWebView.post(new Runnable() { mChatWebView.post(new Runnable() {
@Override @Override
...@@ -640,6 +683,21 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -640,6 +683,21 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}); });
} }
@JavascriptInterface
public String getRoomList() {
Map<String, Object> chatRoomList;
String chatRoomListStr = communicationLogic.getChatRoomList();
return chatRoomListStr;
}
@JavascriptInterface
public void updateRoomList() throws NetworkDisconnectedException, AcmsException {
Map<String, Object> chatRoomList;
RoomListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getRoomList(sid);
communicationLogic.deleteChatRoomList();
communicationLogic.insertChatRoomList(resultJson.roomList);
}
} }
/** /**
......
...@@ -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