Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abook_check
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abook_android
abook_check
Commits
ec57a518
Commit
ec57a518
authored
Feb 18, 2021
by
Lee Munkyeong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
チャット詳細実装
parent
a6ff1c56
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
236 additions
and
32 deletions
+236
-32
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/GroupListJSON.java
+3
-1
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/MessageInfoListJSON.java
+22
-5
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/ChatMessageDao.java
+35
-2
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/ChatRoomDao.java
+1
-2
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/GroupDao.java
+22
-1
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/ShopMemberDao.java
+21
-1
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/tables/MGroup.java
+1
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/dto/ChatMessageDto.java
+3
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/dto/GroupDto.java
+1
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/CommunicationLogic.java
+82
-1
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ChatWebviewActivity.java
+45
-19
No files found.
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/GroupListJSON.java
View file @
ec57a518
...
...
@@ -44,7 +44,9 @@ public class GroupListJSON extends AcmsCommonJSON {
GroupDto
groupDto
=
new
GroupDto
();
groupDto
.
groupId
=
groupListJsonArray
.
getJSONObject
(
listCount
).
getInt
(
GROUP_ID
);
groupDto
.
parentGroupId
=
groupListJsonArray
.
getJSONObject
(
listCount
).
getInt
(
PARENT_GROUP_ID
);
if
(
groupListJsonArray
.
getJSONObject
(
listCount
).
has
(
PARENT_GROUP_ID
))
{
groupDto
.
parentGroupId
=
groupListJsonArray
.
getJSONObject
(
listCount
).
getInt
(
PARENT_GROUP_ID
);
}
groupDto
.
groupName
=
groupListJsonArray
.
getJSONObject
(
listCount
).
getString
(
GROUP_NAME
);
groupDto
.
delFlg
=
groupListJsonArray
.
getJSONObject
(
listCount
).
getInt
(
DEL_FLG
);
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/MessageInfoListJSON.java
View file @
ec57a518
...
...
@@ -4,10 +4,12 @@ import org.json.adf.JSONArray;
import
org.json.adf.JSONObject
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
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.ShopMemberDto
;
import
jp.agentec.adf.util.DateTimeUtil
;
public
class
MessageInfoListJSON
extends
AcmsCommonJSON
{
...
...
@@ -20,9 +22,11 @@ public class MessageInfoListJSON extends AcmsCommonJSON {
private
static
final
String
SHOP_MEMBER_ID
=
"shopMemberId"
;
private
static
final
String
MESSAGE_TYPE
=
"messageType"
;
private
static
final
String
TIME
=
"time"
;
private
static
final
String
CRYPTED_MEMBER_NAME
=
"cryptedMemberName"
;
private
static
final
String
MEMBER_NAME
=
"memberName"
;
private
static
final
String
PROFILE_IMAGE_PATH
=
"profileImagePath"
;
public
ArrayList
<
ChatMessageDto
>
chatMessageDtoList
;
public
ArrayList
<
ChatMessageDto
>
chatMessageDtoArrayList
;
public
ArrayList
<
ShopMemberDto
>
shopMemberDtoArrayList
;
public
MessageInfoListJSON
(
String
jsonString
)
throws
AcmsException
{
super
(
jsonString
);
...
...
@@ -33,11 +37,13 @@ public class MessageInfoListJSON extends AcmsCommonJSON {
// メッセージ情報を取得
if
(!
json
.
has
(
Body
))
{
return
;
}
HashMap
<
Integer
,
Integer
>
existShopMmeberMap
=
new
HashMap
<
Integer
,
Integer
>();
JSONArray
messageInfoList
=
json
.
getJSONObject
(
Body
).
getJSONArray
(
MESSAGE_INFO_LIST
);
if
(
messageInfoList
==
null
)
{
return
;
}
chatMessageDtoList
=
new
ArrayList
<
ChatMessageDto
>();
chatMessageDtoArrayList
=
new
ArrayList
<
ChatMessageDto
>();
shopMemberDtoArrayList
=
new
ArrayList
<
ShopMemberDto
>();
for
(
int
listCount
=
0
;
listCount
<
messageInfoList
.
length
();
listCount
++)
{
if
(
messageInfoList
.
getJSONObject
(
listCount
).
length
()
==
0
)
{
break
;
...
...
@@ -54,8 +60,19 @@ public class MessageInfoListJSON extends AcmsCommonJSON {
if
(
messageInfoJSON
.
has
(
TIME
))
{
chatMessageDto
.
insertDate
=
DateTimeUtil
.
millToDateString
(
messageInfoJSON
.
getJSONObject
(
TIME
).
getLong
(
TIME
));
}
chatMessageDtoArrayList
.
add
(
chatMessageDto
);
if
(
existShopMmeberMap
.
get
(
chatMessageDto
.
shopMemberId
)
!=
null
)
{
continue
;
}
ShopMemberDto
shopMemberDto
=
new
ShopMemberDto
();
shopMemberDto
.
shopMemberId
=
messageInfoJSON
.
getInt
(
SHOP_MEMBER_ID
);
shopMemberDto
.
shopMemberName
=
messageInfoJSON
.
getString
(
MEMBER_NAME
);
if
(
messageInfoJSON
.
has
(
PROFILE_IMAGE_PATH
))
{
shopMemberDto
.
profileUrl
=
messageInfoJSON
.
getString
(
PROFILE_IMAGE_PATH
);
}
existShopMmeberMap
.
put
(
shopMemberDto
.
shopMemberId
,
shopMemberDto
.
shopMemberId
);
shopMemberDtoArrayList
.
add
(
shopMemberDto
);
chatMessageDtoList
.
add
(
chatMessageDto
);
}
}
}
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/ChatMessageDao.java
View file @
ec57a518
...
...
@@ -56,13 +56,46 @@ public class ChatMessageDao extends AbstractDao {
}
column
=
cursor
.
getColumnIndex
(
"insert_date"
);
if
(
column
!=
-
1
)
{
dto
.
savePath
=
cursor
.
getString
(
column
);
dto
.
insertDate
=
cursor
.
getString
(
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
(
"self_flg"
);
if
(
column
!=
-
1
)
{
dto
.
selfFlg
=
cursor
.
getInt
(
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
);
StringBuffer
sql
=
new
StringBuffer
();
sql
.
append
(
" SELECT "
);
sql
.
append
(
" cm.chat_message_id "
);
sql
.
append
(
" ,cm.chat_room_id "
);
sql
.
append
(
" ,cm.shop_member_id "
);
sql
.
append
(
" ,cm.message "
);
sql
.
append
(
" ,cm.message_type "
);
sql
.
append
(
" ,cm.image_name "
);
sql
.
append
(
" ,cm.download_file_name "
);
sql
.
append
(
" ,cm.save_path "
);
sql
.
append
(
" ,cm.insert_date "
);
sql
.
append
(
" ,sm.shop_member_name "
);
sql
.
append
(
" ,sm.profile_url "
);
sql
.
append
(
" ,sm.self_flg "
);
sql
.
append
(
" FROM "
);
sql
.
append
(
" t_chat_message AS cm "
);
sql
.
append
(
" INNER JOIN "
);
sql
.
append
(
" m_shop_member AS sm "
);
sql
.
append
(
" ON cm.shop_member_id = sm.shop_member_id "
);
sql
.
append
(
" WHERE cm.chat_room_id = ? "
);
sql
.
append
(
" ORDER BY cm.insert_date DESC "
);
List
<
ChatMessageDto
>
list
=
rawQueryGetDtoList
(
sql
.
toString
(),
new
String
[]{
""
+
chatRoomId
},
ChatMessageDto
.
class
);
return
list
;
}
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/ChatRoomDao.java
View file @
ec57a518
...
...
@@ -80,7 +80,7 @@ public class ChatRoomDao extends AbstractDao {
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 "
);
sql
.
append
(
" ORDER BY
unread_count,
cm.insert_date DESC "
);
List
<
ChatRoomDto
>
list
=
rawQueryGetDtoList
(
sql
.
toString
(),
null
,
ChatRoomDto
.
class
);
return
list
;
}
...
...
@@ -121,7 +121,6 @@ public class ChatRoomDao extends AbstractDao {
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
();
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/GroupDao.java
View file @
ec57a518
...
...
@@ -59,7 +59,10 @@ public class GroupDao extends AbstractDao {
if
(
column
!=
-
1
)
{
dto
.
userGroupFlg
=
toBool
(
cursor
.
getInt
(
column
));
}
column
=
cursor
.
getColumnIndex
(
"favorite_register_date"
);
if
(
column
!=
-
1
)
{
dto
.
favoriteRegisterDate
=
cursor
.
getString
(
column
);
}
return
dto
;
}
...
...
@@ -549,6 +552,24 @@ public class GroupDao extends AbstractDao {
}
}
public
void
updateFavoriteGroupList
(
List
<
GroupDto
>
groupList
)
{
StringBuffer
sql
=
new
StringBuffer
();
sql
.
append
(
" UPDATE m_group "
);
sql
.
append
(
" , favorite_register_date = ? "
);
sql
.
append
(
" WHERE group_id = ? "
);
try
{
beginTransaction
();
for
(
GroupDto
groupDto
:
groupList
)
{
update
(
sql
.
toString
(),
new
Object
[]
{
groupDto
.
favoriteRegisterDate
,
groupDto
.
groupId
});
}
commit
();
}
catch
(
Exception
e
)
{
rollback
();
Logger
.
e
(
"updateFavoriteGroupList failed."
,
e
);
throw
new
RuntimeException
(
e
);
}
}
public
void
deleteGroupList
(
List
<
GroupDto
>
groupList
)
{
StringBuffer
sql
=
new
StringBuffer
();
sql
.
append
(
" delete from m_group "
);
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/ShopMemberDao.java
View file @
ec57a518
...
...
@@ -62,8 +62,28 @@ public class ShopMemberDao extends AbstractDao {
try
{
beginTransaction
();
insert
(
"insert or replace into m_shop_member (shop_member_id, shop_member_name, profile_url, favorite_register_date, self_flg) values (?,?,?,?,?)"
,
dto
.
getInsertValues
());
for
(
Integer
groupId
:
dto
.
groupIdList
)
{
insert
(
"insert into r_shop_member_group (shop_member_id, group_id) values ("
+
dto
.
shopMemberId
+
",?)"
,
dto
.
getGroupIds
());
insert
(
"insert or replace into r_shop_member_group (shop_member_id, group_id) values ("
+
dto
.
shopMemberId
+
",?)"
,
dto
.
getGroupIds
());
}
commit
();
}
catch
(
Exception
e
)
{
rollback
();
Logger
.
e
(
"insertShopMember failed."
,
e
);
throw
new
RuntimeException
(
e
);
}
finally
{
}
}
public
void
insertShopMember
(
List
<
ShopMemberDto
>
dtoList
)
{
try
{
beginTransaction
();
for
(
ShopMemberDto
dto
:
dtoList
)
{
insert
(
"insert or replace into m_shop_member (shop_member_id, shop_member_name, profile_url, favorite_register_date, self_flg) values (?,?,?,?,?)"
,
dto
.
getInsertValues
());
if
(
dto
.
groupIdList
==
null
)
{
continue
;
}
for
(
Integer
groupId
:
dto
.
groupIdList
)
{
insert
(
"insert into r_shop_member_group (shop_member_id, group_id) values ("
+
dto
.
shopMemberId
+
",?)"
,
dto
.
getGroupIds
());
}
}
commit
();
}
catch
(
Exception
e
)
{
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/tables/MGroup.java
View file @
ec57a518
...
...
@@ -34,6 +34,7 @@ public class MGroup extends SQLiteTableScript {
sql
.
append
(
" , group_name VARCHAR(64) NOT NULL "
);
sql
.
append
(
" , group_path TEXT NOT NULL "
);
// path enumaerationパターンを適用する。since DatabaseVersions.Ver1_5_0
sql
.
append
(
" , user_group_flg BOOLEAN NOT NULL DEFAULT 0 "
);
// since DatabaseVersions.Plus_1_1_0
sql
.
append
(
" , favorite_register_date VARCHAR2(64) "
);
sql
.
append
(
" , PRIMARY KEY (group_relation_id) "
);
sql
.
append
(
" ) "
);
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/dto/ChatMessageDto.java
View file @
ec57a518
...
...
@@ -12,6 +12,9 @@ public class ChatMessageDto extends AbstractDto {
public
String
downloadFileName
;
public
String
savePath
;
public
String
insertDate
;
public
String
shopMemberName
;
public
String
profileUrl
;
public
Integer
selfFlg
;
@Override
public
Object
[]
getInsertValues
()
{
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/dto/GroupDto.java
View file @
ec57a518
...
...
@@ -15,6 +15,7 @@ public class GroupDto extends AbstractDto {
public
int
contentCount
=
0
;
public
String
displayCount
;
public
String
groupPath
;
public
String
favoriteRegisterDate
=
""
;
public
boolean
userGroupFlg
;
public
int
delFlg
;
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/CommunicationLogic.java
View file @
ec57a518
...
...
@@ -70,7 +70,6 @@ public class CommunicationLogic extends AbstractLogic {
}
public
String
getChatRoomList
()
{
List
<
ChatRoomDto
>
chatRoomList
=
chatRoomDao
.
getAllChatRoom
();
JSONArray
resultJsonArray
=
new
JSONArray
();
...
...
@@ -92,6 +91,77 @@ public class CommunicationLogic extends AbstractLogic {
return
roomListToStr
;
}
public
String
getMessages
(
Integer
roomId
)
{
List
<
ChatMessageDto
>
chatMessageDtoList
=
chatMessageDao
.
getChatMessage
(
roomId
);
JSONArray
resultJsonArray
=
new
JSONArray
();
for
(
ChatMessageDto
chatMessageDto
:
chatMessageDtoList
)
{
Map
<
String
,
Object
>
chatMessageMap
=
new
HashMap
<
String
,
Object
>();
chatMessageMap
.
put
(
"chatRoomId"
,
chatMessageDto
.
chatRoomId
);
chatMessageMap
.
put
(
"loginId"
,
chatMessageDto
.
shopMemberName
);
chatMessageMap
.
put
(
"message"
,
chatMessageDto
.
message
);
chatMessageMap
.
put
(
"messageType"
,
chatMessageDto
.
messageType
);
chatMessageMap
.
put
(
"insertDate"
,
chatMessageDto
.
insertDate
);
chatMessageMap
.
put
(
"profileImagePath"
,
chatMessageDto
.
profileUrl
);
chatMessageMap
.
put
(
"selfFlg"
,
chatMessageDto
.
selfFlg
);
JSONObject
jsonObject
=
new
JSONObject
(
chatMessageMap
);
resultJsonArray
.
put
(
jsonObject
);
}
String
messageListStr
=
resultJsonArray
.
toString
();
return
messageListStr
;
}
public
String
getMyInfo
()
{
ShopMemberDto
myInfo
=
shopMemberDao
.
getMyInfo
();
JSONObject
myInfoJson
=
new
JSONObject
();
myInfoJson
.
put
(
"shopMemberId"
,
myInfo
.
shopMemberId
);
myInfoJson
.
put
(
"shopMemberName"
,
myInfo
.
shopMemberName
);
myInfoJson
.
put
(
"profileUrl"
,
myInfo
.
profileUrl
);
String
myInfoStr
=
myInfoJson
.
toString
();
return
myInfoStr
;
}
public
String
getFavoriteUsers
()
{
List
<
ShopMemberDto
>
favoriteUsers
=
shopMemberDao
.
getfavoriteUserList
();
JSONArray
resultJsonArray
=
new
JSONArray
();
for
(
ShopMemberDto
favoriteUser
:
favoriteUsers
)
{
Map
<
String
,
Object
>
favoriteUserMap
=
new
HashMap
<
String
,
Object
>();
favoriteUserMap
.
put
(
"shopMemberId"
,
favoriteUser
.
shopMemberId
);
favoriteUserMap
.
put
(
"shopMemberName"
,
favoriteUser
.
shopMemberName
);
favoriteUserMap
.
put
(
"profileUrl"
,
favoriteUser
.
profileUrl
);
JSONObject
jsonObject
=
new
JSONObject
(
favoriteUserMap
);
resultJsonArray
.
put
(
jsonObject
);
}
String
favoriteUsersStr
=
resultJsonArray
.
toString
();
return
favoriteUsersStr
;
}
// public String getFavoriteGroups() {
//
// List<ShopMemberDto> favoriteUsers = groupDao.();
//
// JSONArray resultJsonArray = new JSONArray();
// for (ShopMemberDto favoriteUser : favoriteUsers) {
// Map<String, Object> favoriteUserMap = new HashMap<String, Object>();
// favoriteUserMap.put("shopMemberId",favoriteUser.shopMemberId);
// favoriteUserMap.put("shopMemberName",favoriteUser.shopMemberName);
// favoriteUserMap.put("profileUrl",favoriteUser.profileUrl);
// JSONObject jsonObject = new JSONObject(favoriteUserMap);
// resultJsonArray.put(jsonObject);
// }
//
// String favoriteUsersStr = resultJsonArray.toString();
// return favoriteUsersStr;
// }
public
void
insertChatRoomList
(
List
<
ChatRoomDto
>
roomList
)
{
List
<
ChatMessageDto
>
insertMessageList
=
new
ArrayList
<
ChatMessageDto
>();
for
(
ChatRoomDto
chatRoomDto
:
roomList
)
{
...
...
@@ -114,6 +184,17 @@ public class CommunicationLogic extends AbstractLogic {
public
void
insertShopMember
(
ShopMemberDto
shopMemberDto
)
{
shopMemberDao
.
insertShopMember
(
shopMemberDto
);
}
public
void
insertShopMember
(
List
<
ShopMemberDto
>
shopMemberDtoList
)
{
ShopMemberDto
myInfo
=
shopMemberDao
.
getMyInfo
();
for
(
ShopMemberDto
shopMemberDto
:
shopMemberDtoList
)
{
if
(
myInfo
.
shopMemberId
.
equals
(
shopMemberDto
.
shopMemberId
))
{
shopMemberDto
.
selfFlg
=
1
;
}
else
{
shopMemberDto
.
selfFlg
=
0
;
}
}
shopMemberDao
.
insertShopMember
(
shopMemberDtoList
);
}
public
void
updateGroup
(
List
<
GroupDto
>
GroupList
)
{
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ChatWebviewActivity.java
View file @
ec57a518
...
...
@@ -28,25 +28,17 @@ import android.widget.ImageView;
import
android.widget.LinearLayout
;
import
android.widget.Toast
;
import
org.json.JSONArray
;
import
java.io.File
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
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.CreatedRoomJSON
;
import
jp.agentec.abook.abv.bl.acms.client.json.GroupListJSON
;
import
jp.agentec.abook.abv.bl.acms.client.json.MessageInfoListJSON
;
import
jp.agentec.abook.abv.bl.acms.client.json.MyInfoJSON
;
import
jp.agentec.abook.abv.bl.acms.client.json.RoomListJSON
;
import
jp.agentec.abook.abv.bl.acms.client.json.ShopMemberListJSON
;
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.constant.ABookKeys
;
import
jp.agentec.abook.abv.bl.common.exception.AcmsException
;
...
...
@@ -54,12 +46,10 @@ import jp.agentec.abook.abv.bl.common.exception.NetworkDisconnectedException;
import
jp.agentec.abook.abv.bl.common.log.Logger
;
import
jp.agentec.abook.abv.bl.data.ABVDataCache
;
import
jp.agentec.abook.abv.bl.dto.ChatMessageDto
;
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.ShopMemberDto
;
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.launcher.android.R
;
import
jp.agentec.abook.abv.ui.common.appinfo.AppDefType
;
...
...
@@ -71,7 +61,6 @@ import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import
jp.agentec.abook.abv.ui.common.util.AlertDialogUtil
;
import
jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper
;
import
jp.agentec.abook.abv.ui.viewer.activity.ParentWebViewActivity
;
import
jp.agentec.adf.net.http.HttpResponse
;
import
static
org
.
chromium
.
net
.
NetError
.
ERR_FAILED
;
...
...
@@ -94,7 +83,10 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
private
ValueCallback
<
Uri
[]>
mUploadMessage
;
private
String
sid
,
roomName
,
loginId
,
shopName
;
private
String
sid
;
private
String
roomName
;
private
String
loginId
;
private
String
shopName
;
private
boolean
isOnline
;
private
Long
roomId
;
...
...
@@ -130,6 +122,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
if
(
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
checkSid
(
sid
))
{
isOnline
=
true
;
chatWebviewUrl
=
CHAT_PAGE_URL
;
updateMyInfoFromServer
();
}
}
catch
(
Exception
e
)
{
Logger
.
d
(
"SID_CHECK_ERROR"
);
...
...
@@ -692,7 +685,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
@JavascriptInterface
public
String
getRoomList
()
{
Map
<
String
,
Object
>
chatRoomList
;
String
chatRoomListStr
=
communicationLogic
.
getChatRoomList
();
return
chatRoomListStr
;
}
...
...
@@ -707,8 +699,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
@JavascriptInterface
public
void
updateMyInfo
()
throws
NetworkDisconnectedException
,
AcmsException
{
MyInfoJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
getMyInfo
(
sid
);
communicationLogic
.
insertShopMember
(
resultJson
.
shopMemberDto
);
updateMyInfoFromServer
();
}
@JavascriptInterface
...
...
@@ -721,16 +712,47 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
public
void
createChatRoom
(
String
roomType
,
String
userIdList
,
String
encodedRoomName
)
throws
NetworkDisconnectedException
,
AcmsException
{
CreatedRoomJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
createRoom
(
sid
,
roomType
,
userIdList
,
encodedRoomName
);
communicationLogic
.
insertChatRoom
(
resultJson
.
chatRoomDto
);
final
Integer
chatRoomId
=
resultJson
.
chatRoomDto
.
chatRoomId
;
final
String
chatRoomName
=
resultJson
.
chatRoomDto
.
chatRoomName
;
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
String
.
format
(
"javascript:CHAT_UI.joinRoom('%s', '%s');"
,
chatRoomId
,
chatRoomName
));
}
});
}
@JavascriptInterface
public
void
updateMessages
(
String
roomId
)
throws
NetworkDisconnectedException
,
AcmsException
{
MessageInfoListJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
getMessages
(
sid
,
roomId
);
for
(
ChatMessageDto
chatMessageDto
:
resultJson
.
chatMessageDtoList
)
{
for
(
ChatMessageDto
chatMessageDto
:
resultJson
.
chatMessageDto
Array
List
)
{
chatMessageDto
.
chatRoomId
=
Integer
.
parseInt
(
roomId
);
}
communicationLogic
.
insertMessageList
(
resultJson
.
chatMessageDtoList
);
communicationLogic
.
insertMessageList
(
resultJson
.
chatMessageDtoArrayList
);
communicationLogic
.
insertShopMember
(
resultJson
.
shopMemberDtoArrayList
);
}
@JavascriptInterface
public
String
getMessageList
(
String
roomId
)
{
String
messageListStr
=
communicationLogic
.
getMessages
(
Integer
.
parseInt
(
roomId
));
return
messageListStr
;
}
@JavascriptInterface
public
String
getFavoriteUsers
()
{
String
favoriteUsersStr
=
communicationLogic
.
getFavoriteUsers
();
return
favoriteUsersStr
;
}
// @JavascriptInterface
// public String getFavoriteGroups() {
// String favoriteGroupsStr = communicationLogic.getFavoriteGroups();
// return favoriteGroupsStr;
// }
}
/**
...
...
@@ -745,6 +767,10 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
startActivity
(
intent
,
NaviConsts
.
Left
);
}
private
void
updateMyInfoFromServer
()
throws
NetworkDisconnectedException
,
AcmsException
{
MyInfoJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
getMyInfo
(
sid
);
communicationLogic
.
insertShopMember
(
resultJson
.
shopMemberDto
);
}
/**
* ボタンイベント設定
*/
...
...
@@ -764,7 +790,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
intent
.
setClass
(
ChatWebviewActivity
.
this
,
OperationRelatedContentActivity
.
class
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_SINGLE_TOP
);
startActivity
(
intent
,
NaviConsts
.
Left
);
//
overridePendingTransition(R.anim.viewin_left_to_right, R.anim.viewin_left_to_right);
// overridePendingTransition(R.anim.viewin_left_to_right, R.anim.viewin_left_to_right);
}
// 設定画面へ遷移
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment