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
accb8ff0
Commit
accb8ff0
authored
Dec 26, 2019
by
Takuya Ogawa
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'features/1.3.0' into 'features/1.3.0_test'
Features/1.3.0 See merge request
!56
parents
1bcc1ecf
d57e2d08
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
969 additions
and
195 deletions
+969
-195
ABVJE_Launcher_Android/assets/chat/public/js/chat.js
+674
-162
ABVJE_Launcher_Android/assets/chat/public/js/language_en.js
+4
-2
ABVJE_Launcher_Android/assets/chat/public/js/language_ja.js
+4
-2
ABVJE_Launcher_Android/assets/chat/public/js/language_ko.js
+5
-3
ABVJE_Launcher_Android/assets/chat/public/newstart.html
+18
-4
ABVJE_UI_Android/src/jp/agentec/abook/abv/launcher/android/OnAppDownloadReceiver.java
+2
-1
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ChatWebviewActivity.java
+262
-21
No files found.
ABVJE_Launcher_Android/assets/chat/public/js/chat.js
View file @
accb8ff0
...
...
@@ -89,10 +89,21 @@ function isLandscapeMode(){
function
profileImgPathValidCheck
(
path
,
checkProfileExist
)
{
if
(
checkProfileExist
==
1
&&
path
.
length
>
0
)
{
path
=
'./images/user-profile.png'
}
return
path
;
}
// #36170
function
profileImgPathValidCheck2
(
path
)
{
if
(
path
==
undefined
)
{
return
'./images/user-profile.png'
;
}
else
if
(
path
==
""
)
{
return
'./images/user-profile.png'
;
}
return
path
}
window
.
onload
=
function
(){
let
navbarHeight
=
document
.
getElementsByClassName
(
"navbar"
)[
0
].
offsetHeight
$
(
".tab-pane"
).
css
(
'padding'
,
`
${
navbarHeight
+
'px'
}
0px 0px`
)
...
...
@@ -222,7 +233,7 @@ socket.on('refreshRoomList', function(rooms, activeRoomId = null){
roomId
:
room
.
roomId
,
profileImage
:
room
.
profileImagePath
,
active
:
activeRoomId
===
room
.
roomId
?
'active_chat'
:
null
,
//現在、入っているルームだとhilight表示
lastMessage
:
room
.
message
.
includes
(
'<img'
)
?
getLocalizedString
(
"image"
)
:
(
keywordSearchMode
?
`
${
room
.
message
}${
getLocalizedString
(
"searchResult"
)}
`
:
room
.
message
)
,
lastMessage
:
room
.
message
.
includes
(
'<img'
)
?
getLocalizedString
(
"image"
)
:
(
keywordSearchMode
?
`
${
room
.
message
}${
getLocalizedString
(
"searchResult"
)}
`
:
room
.
message
)
,
time
:
room
.
time
?
formatDate
(
room
.
time
.
time
).
createdAt
:
''
,
unreadMsgCnt
:
room
.
unreadCnt
,
userCnt
:
room
.
userCnt
...
...
@@ -417,7 +428,8 @@ jQuery('#roomKeyButton').on('click', function(event) {
/* ---------------------------------------------------------------------- */
// New Message
socket
.
on
(
'newMessage'
,
function
(
message
){
// #36170
socket
.
on
(
'newMessage'
,
function
(
message
,
roomId
,
roomName
){
let
template
=
jQuery
(
'#message-template'
).
html
();
if
(
message
.
id
===
socket
.
id
)
{
// ユーザーが送信したメッセージの場合、自分のメッセージ様式を適用して表示する
...
...
@@ -425,25 +437,61 @@ socket.on('newMessage', function (message){
}
let
messageTime
=
formatDate
(
message
.
createdAt
);
//userProfilePathが使えるpathかをcheckして使えないpathの場合、default画像の経路に変更
message
.
profileImagePath
=
profileImgPathValidCheck
(
message
.
profileImagePath
,
message
.
checkProfileExist
)
try
{
message
.
text
=
decodeURIComponent
(
message
.
text
)
}
catch
(
e
)
{
message
.
text
=
message
.
text
}
readStringFromFile
(
message
.
from
,
message
.
timeStamp
,
message
.
userId
).
then
((
value
)
=>
{
if
(
value
.
profileImagePath
.
length
>
0
&&
value
.
timeStamp
==
"0"
)
{
//差分がある場合
message
.
profileImagePath
=
value
.
profileImagePath
}
else
if
(
value
.
profileImagePath
.
length
==
0
&&
value
.
timeStamp
==
"0"
)
{
//差分がない場合
message
.
profileImagePath
=
""
}
let
html
=
Mustache
.
render
(
template
,
{
text
:
message
.
text
,
from
:
message
.
from
,
profileImage
:
message
.
profileImagePath
,
createdAtDay
:
messageTime
.
createdAtDay
,
createdAtTime
:
messageTime
.
createdAtTime
});
// イメージの場合、img tagを追加する
html
=
message
.
text
.
includes
(
'attachedImages'
)
?
htmlDecode
(
html
)
:
html
;
jQuery
(
'#messages'
).
append
(
html
);
scrollToBottom
();
if
(
message
.
profileImagePath
==
undefined
)
{
socket
.
emit
(
'getProfileImageBeforeJoinRoom'
,
roomId
,
roomName
,
value
.
shopMemberId
,
value
.
timeStamp
,
(
data
)
=>
{
saveProfileImageFile
(
data
.
loginId
,
data
.
shopMemberId
,
data
.
timeStamp
,
data
.
profileImage
)
.
then
((
diffValue
)
=>
{
message
.
profileImagePath
=
diffValue
.
profileImagePath
;
message
.
profileImagePath
=
profileImgPathValidCheck2
(
message
.
profileImagePath
)
try
{
message
.
text
=
decodeURIComponent
(
message
.
text
)
}
catch
(
e
)
{
message
.
text
=
message
.
text
}
let
html
=
Mustache
.
render
(
template
,
{
text
:
message
.
text
,
from
:
message
.
from
,
profileImage
:
message
.
profileImagePath
,
createdAtDay
:
messageTime
.
createdAtDay
,
createdAtTime
:
messageTime
.
createdAtTime
});
// イメージの場合、img tagを追加する
html
=
message
.
text
.
includes
(
'attachedImages'
)
||
message
.
text
.
includes
(
'attachedVideos'
)
?
htmlDecode
(
html
)
:
html
;
jQuery
(
'#messages'
).
append
(
html
);
scrollToBottom
();
})
})
}
else
{
message
.
profileImagePath
=
profileImgPathValidCheck2
(
message
.
profileImagePath
)
try
{
message
.
text
=
decodeURIComponent
(
message
.
text
)
}
catch
(
e
)
{
message
.
text
=
message
.
text
}
let
html
=
Mustache
.
render
(
template
,
{
text
:
message
.
text
,
from
:
message
.
from
,
profileImage
:
message
.
profileImagePath
,
createdAtDay
:
messageTime
.
createdAtDay
,
createdAtTime
:
messageTime
.
createdAtTime
});
// イメージの場合、img tagを追加する
html
=
message
.
text
.
includes
(
'attachedImages'
)
||
message
.
text
.
includes
(
'attachedVideos'
)
?
htmlDecode
(
html
)
:
html
;
jQuery
(
'#messages'
).
append
(
html
);
scrollToBottom
();
}
})
});
// Notification
...
...
@@ -469,43 +517,192 @@ jQuery('#messages').scroll(function(){
});
// 新しいメッセージを受信する場合の処理
socket
.
on
(
'loadMessages'
,
function
(
messages
,
shopMemberId
){
let
jQueryMessages
=
jQuery
(
'#messages'
);
// スクロールの変化を防ぐため以前画面の高さを保存する
let
beforeHeight
=
jQueryMessages
.
prop
(
'scrollHeight'
);
// 順番でメッセージを画面に追加する
messages
.
forEach
(
function
(
message
)
{
let
template
=
jQuery
(
'#message-template'
).
html
();
if
(
message
.
shopMemberId
==
shopMemberId
)
{
template
=
jQuery
(
'#message-template-me'
).
html
();
}
let
messageTime
=
formatDate
(
message
.
time
.
time
);
// #36170
socket
.
on
(
'loadMessages'
,
function
(
messages
,
shopMemberId
,
users
,
roomId
,
roomName
){
if
(
users
!=
undefined
)
{
var
promisesGroup
=
new
Array
();
users
.
forEach
((
user
)
=>
{
//timeStampのCheckして、timeStampが0だったらpromisesGroupに入れない
promisesGroup
.
push
(
readStringFromFile
(
user
.
loginId
,
user
.
timeStamp
,
user
.
ShopMemberId
==
undefined
?
user
.
shopMemberId
:
user
.
ShopMemberId
));
//FIXME: ShopMemberId
});
//userProfilePathが使えるpathかをcheckして使えないpathの場合、default画像の経路に変更
message
.
profileImagePath
=
profileImgPathValidCheck
(
message
.
profileImagePath
,
message
.
checkProfileExist
)
Promise
.
all
(
promisesGroup
).
then
((
values
)
=>
{
users
.
forEach
((
part
,
index
)
=>
{
const
value
=
values
.
find
((
value
)
=>
{
let
shopMemberId
=
users
[
index
].
shopMemberId
==
undefined
?
users
[
index
].
ShopMemberId
:
users
[
index
].
shopMemberId
if
(
value
.
shopMemberId
==
shopMemberId
)
{
if
(
value
.
profileImagePath
.
length
>
0
&&
value
.
timeStamp
==
"0"
)
{
//差分がある場合
return
true
}
else
if
(
value
.
profileImagePath
.
length
==
0
&&
value
.
timeStamp
!=
"0"
)
{
//差分がない場合
return
false
}
else
{
return
true
}
}
})
if
(
value
!=
undefined
)
{
users
[
index
].
profileImagePath
=
value
.
profileImagePath
}
})
var
requestList
=
new
Array
()
// #36147
message
.
message
=
message
.
message
.
toString
()
values
.
forEach
((
value
)
=>
{
if
(
value
.
profileImagePath
.
length
==
0
&&
value
.
timeStamp
!=
"0"
){
requestList
.
push
(
value
)
}
})
let
userList
=
requestList
.
map
((
user
)
=>
{
return
user
.
shopMemberId
})
let
timeStamps
=
requestList
.
map
((
user
)
=>
{
return
user
.
timeStamp
})
if
(
requestList
.
length
>
0
)
{
//AISDevelop
socket
.
emit
(
'getProfileImageBeforeJoinRoom'
,
roomId
,
roomName
,
userList
,
timeStamps
,
(
userData
)
=>
{
console
.
log
(
'getProfileImageBeforeJoinRoom callback'
);
var
promisesGroupInDiffer
=
new
Array
();
userData
.
forEach
((
data
)
=>
{
promisesGroupInDiffer
.
push
(
saveProfileImageFile
(
data
.
loginId
,
data
.
shopMemberId
,
data
.
timeStamp
,
data
.
profileImage
));
});
//image change
Promise
.
all
(
promisesGroupInDiffer
)
.
then
((
diffValues
)
=>
{
diffValues
.
forEach
((
differ
)
=>
{
//differ object - > loginId, shopMemberId, profileImagePath,
//save end
console
.
log
(
"differ"
);
users
.
forEach
((
part
,
index
)
=>
{
const
value
=
diffValues
.
find
((
value
)
=>
{
return
value
.
shopMemberId
==
users
[
index
].
shopMemberId
})
if
(
value
){
users
[
index
].
profileImagePath
=
value
.
profileImagePath
;
}
})
})
let
jQueryMessages
=
jQuery
(
'#messages'
);
// スクロールの変化を防ぐため以前画面の高さを保存する
let
beforeHeight
=
jQueryMessages
.
prop
(
'scrollHeight'
);
// 順番でメッセージを画面に追加する
messages
.
forEach
(
function
(
message
)
{
let
template
=
jQuery
(
'#message-template'
).
html
();
if
(
message
.
shopMemberId
==
shopMemberId
)
{
template
=
jQuery
(
'#message-template-me'
).
html
();
}
let
messageTime
=
formatDate
(
message
.
time
.
time
);
let
user
=
users
.
find
((
user
)
=>
user
.
loginId
==
message
.
loginId
)
if
(
user
)
{
message
.
profileImagePath
=
profileImgPathValidCheck2
(
user
.
profileImagePath
)
}
else
{
message
.
profileImagePath
=
profileImgPathValidCheck2
(
""
)
}
// #36147
message
.
message
=
message
.
message
.
toString
();
let
html
=
Mustache
.
render
(
template
,
{
text
:
message
.
message
,
from
:
message
.
loginId
,
profileImage
:
message
.
profileImagePath
,
createdAtDay
:
messageTime
.
createdAtDay
,
createdAtTime
:
messageTime
.
createdAtTime
});
html
=
message
.
message
.
includes
(
'attachedImages'
)
||
message
.
message
.
includes
(
'attachedVideos'
)
?
htmlDecode
(
html
)
:
html
;
jQueryMessages
.
prepend
(
html
);
})
// 保存した以前画面の高さで現在のスクロールを設定する
jQueryMessages
.
scrollTop
(
jQueryMessages
.
prop
(
'scrollHeight'
)
-
beforeHeight
);
// ユーザ削除ボタン表示しない
jQuery
(
"#userSelectionDeleteBtn"
).
hide
();
let
html
=
Mustache
.
render
(
template
,
{
text
:
message
.
message
,
from
:
message
.
loginId
,
profileImage
:
message
.
profileImagePath
,
createdAtDay
:
messageTime
.
createdAtDay
,
createdAtTime
:
messageTime
.
createdAtTime
});
html
=
message
.
message
.
includes
(
'attachedImages'
)
?
htmlDecode
(
html
)
:
html
;
jQueryMessages
.
prepend
(
html
);
})
// 保存した以前画面の高さで現在のスクロールを設定する
jQueryMessages
.
scrollTop
(
jQueryMessages
.
prop
(
'scrollHeight'
)
-
beforeHeight
);
// ユーザ削除ボタン表示しない
jQuery
(
"#userSelectionDeleteBtn"
).
hide
();
dismissLoadingIndicator
();
//add some...
// チャットに遷移する
jQuery
(
'#pills-chat-tab'
).
tab
(
'show'
);
})
})
//request end
}
else
{
let
jQueryMessages
=
jQuery
(
'#messages'
);
// スクロールの変化を防ぐため以前画面の高さを保存する
let
beforeHeight
=
jQueryMessages
.
prop
(
'scrollHeight'
);
// 順番でメッセージを画面に追加する
messages
.
forEach
(
function
(
message
)
{
let
template
=
jQuery
(
'#message-template'
).
html
();
if
(
message
.
shopMemberId
==
shopMemberId
)
{
template
=
jQuery
(
'#message-template-me'
).
html
();
}
let
messageTime
=
formatDate
(
message
.
time
.
time
);
let
user
=
users
.
find
((
user
)
=>
user
.
loginId
==
message
.
loginId
)
//userProfilePathが使えるpathかをcheckして使えないpathの場合、default画像の経路に変更
if
(
user
)
{
message
.
profileImagePath
=
profileImgPathValidCheck2
(
user
.
profileImagePath
)
}
else
{
message
.
profileImagePath
=
profileImgPathValidCheck2
(
""
)
}
// #36147
message
.
message
=
message
.
message
.
toString
();
let
html
=
Mustache
.
render
(
template
,
{
text
:
message
.
message
,
from
:
message
.
loginId
,
profileImage
:
message
.
profileImagePath
,
createdAtDay
:
messageTime
.
createdAtDay
,
createdAtTime
:
messageTime
.
createdAtTime
});
html
=
message
.
message
.
includes
(
'attachedImages'
)
||
message
.
message
.
includes
(
'attachedVideos'
)
?
htmlDecode
(
html
)
:
html
;
jQueryMessages
.
prepend
(
html
);
})
// 保存した以前画面の高さで現在のスクロールを設定する
jQueryMessages
.
scrollTop
(
jQueryMessages
.
prop
(
'scrollHeight'
)
-
beforeHeight
);
// ユーザ削除ボタン表示しない
jQuery
(
"#userSelectionDeleteBtn"
).
hide
();
dismissLoadingIndicator
();
dismissLoadingIndicator
();
//add some...
// チャットに遷移する
jQuery
(
'#pills-chat-tab'
).
tab
(
'show'
);
// チャットに遷移する
jQuery
(
'#pills-chat-tab'
).
tab
(
'show'
);
}
})
}
else
{
let
jQueryMessages
=
jQuery
(
'#messages'
);
// スクロールの変化を防ぐため以前画面の高さを保存する
let
beforeHeight
=
jQueryMessages
.
prop
(
'scrollHeight'
);
// 順番でメッセージを画面に追加する
messages
.
forEach
(
function
(
message
)
{
let
template
=
jQuery
(
'#message-template'
).
html
();
if
(
message
.
shopMemberId
==
shopMemberId
)
{
template
=
jQuery
(
'#message-template-me'
).
html
();
}
let
messageTime
=
formatDate
(
message
.
time
.
time
);
//userProfilePathが使えるpathかをcheckして使えないpathの場合、default画像の経路に変更
message
.
profileImagePath
=
profileImgPathValidCheck2
(
message
.
profileImagePath
)
//message.profileImagePath = profileImgPathValidCheck(message.profileImagePath, message.checkProfileExist)
// #36147
message
.
message
=
message
.
message
.
toString
();
let
html
=
Mustache
.
render
(
template
,
{
text
:
message
.
message
,
from
:
message
.
loginId
,
profileImage
:
message
.
profileImagePath
,
createdAtDay
:
messageTime
.
createdAtDay
,
createdAtTime
:
messageTime
.
createdAtTime
});
html
=
message
.
message
.
includes
(
'attachedImages'
)
||
message
.
message
.
includes
(
'attachedVideos'
)
?
htmlDecode
(
html
)
:
html
;
jQueryMessages
.
prepend
(
html
);
})
// 保存した以前画面の高さで現在のスクロールを設定する
jQueryMessages
.
scrollTop
(
jQueryMessages
.
prop
(
'scrollHeight'
)
-
beforeHeight
);
// ユーザ削除ボタン表示しない
jQuery
(
"#userSelectionDeleteBtn"
).
hide
();
dismissLoadingIndicator
();
//add some...
// チャットに遷移する
jQuery
(
'#pills-chat-tab'
).
tab
(
'show'
);
}
});
// メッセージ送信
...
...
@@ -536,10 +733,19 @@ jQuery('#fileUploadButton').on('click', function(){
jQuery
(
'#imageInputTag'
).
click
();
});
// 動画アップロード
jQuery
(
'#fileUploadButton2'
).
on
(
'click'
,
function
(){
jQuery
(
'#imageInputTag2'
).
click
();
});
jQuery
(
'#imageInputTag'
).
on
(
'change'
,
function
(){
jQuery
(
'#image-form'
).
submit
();
});
jQuery
(
'#imageInputTag2'
).
on
(
'change'
,
function
(){
jQuery
(
'#image-form2'
).
submit
();
});
jQuery
(
'#image-form'
).
on
(
'submit'
,
function
(
e
){
e
.
preventDefault
();
const
imageInputTag
=
jQuery
(
'#imageInputTag'
);
...
...
@@ -561,43 +767,85 @@ jQuery('#image-form').on('submit', function(e){
uploadImage
(
fd
)
})
}
});
// // ファイルアップロード
// jQuery.ajax({
// async: true,
// url: SERVER_URL+"/upload",
// type: "post",
// data: fd,
// contentType: false,
// processData: false
// }).done(function( res ) {
// let imgPath = SERVER_URL + res.path;
// let downloadPath = SERVER_URL + '/download' + res.path;
// // アップロードが終了した後ローディング画面から離れてメッセージをメッセージを転送する
// const lightbox = jQuery('<a/>',{href:imgPath, 'data-lightbox':'attachedImages','data-title':res.fileName});
// const image = jQuery('<img/>',{src:imgPath, width:'auto',style:'max-width:100%'});
// const downloadIcon = jQuery('<a/>',{href:downloadPath, class:'fa fa-download', download:res.fileName});
// lightbox.append(image);
// lightbox.append(downloadIcon);
//
// let text = lightbox.prop('outerHTML')
// let encodedText
// try {
// encodedText = encodeURIComponent(text)
// } catch(e) {
// encodedText = text;
// }
//
// socket.emit('createMessage', {
// text: encodedText
// }, 1);
// jQuery('.overlay').removeClass('active undismissable');
// jQuery('.loader').removeClass('active');
// dismissLoadingIndicator();
// });
jQuery
(
'#image-form2'
).
on
(
'submit'
,
function
(
e
){
e
.
preventDefault
();
const
imageInputTag2
=
jQuery
(
'#imageInputTag2'
);
const
file
=
imageInputTag2
.
prop
(
'files'
)[
0
];
if
(
file
)
{
jQuery
(
'.overlay'
).
addClass
(
'active undismissable'
);
jQuery
(
'.loader'
).
addClass
(
'active'
);
showLoadingIndicator
();
var
fd
=
new
FormData
(
$
(
this
)[
0
]);
if
(
!
file
.
type
.
includes
(
"image"
))
{
// video 保存
// createVideoThumbnailAndUpload(file);
createVideoThumbnailAndUpload
(
file
,
function
(
resizeFile
,
thumbnailCreated
){
if
(
resizeFile
&&
thumbnailCreated
)
{
//ただ、画像の大きさが500pixel以下の場合はthumbnailは生成されない
fd
.
append
(
'thumb'
,
resizeFile
)
}
uploadImage
(
fd
);
})
return
;
}
}
});
// Video のサムネイルファイル生成する
function
createVideoThumbnailAndUpload
(
sourceImage
,
callback
)
{
var
fileReader
=
new
FileReader
();
fileReader
.
onload
=
function
()
{
var
blob
=
new
Blob
([
fileReader
.
result
],
{
type
:
sourceImage
.
type
});
var
url
=
URL
.
createObjectURL
(
blob
);
var
video
=
document
.
createElement
(
'video'
);
var
timeupdate
=
function
()
{
if
(
snapImage
())
{
video
.
removeEventListener
(
'timeupdate'
,
timeupdate
);
video
.
pause
();
}
};
video
.
addEventListener
(
'loadeddata'
,
function
()
{
if
(
snapImage
())
{
video
.
removeEventListener
(
'timeupdate'
,
timeupdate
);
}
});
var
snapImage
=
function
()
{
var
canvas
=
document
.
createElement
(
'canvas'
);
canvas
.
width
=
video
.
videoWidth
;
canvas
.
height
=
video
.
videoHeight
;
canvas
.
getContext
(
'2d'
).
drawImage
(
video
,
0
,
0
,
canvas
.
width
,
canvas
.
height
);
fetch
(
canvas
.
toDataURL
(
"image/jpeg"
))
.
then
(
function
(
res
){
return
res
.
arrayBuffer
();
})
.
then
(
function
(
buf
){
//回転された画像をFormDataに保存
const
newFile
=
new
File
([
buf
],
sourceImage
.
name
,
{
type
:
"image/jpeg"
});
callback
(
newFile
,
true
);
//ajax End
}).
catch
((
error
)
=>
{
//fetch Error catch Block
if
(
error
)
{
console
.
log
(
error
)
}
});
return
true
;
};
video
.
addEventListener
(
'timeupdate'
,
timeupdate
);
video
.
preload
=
'metadata'
;
video
.
src
=
url
;
// Load video in Safari / IE11
video
.
muted
=
true
;
video
.
playsInline
=
true
;
video
.
play
();
};
fileReader
.
readAsArrayBuffer
(
sourceImage
);
}
// Ajaxでイメージをアップロードする
function
uploadImage
(
formData
)
{
jQuery
.
ajax
({
...
...
@@ -612,30 +860,61 @@ function uploadImage(formData) {
var
imgPath
=
SERVER_URL
+
res
.
path
;
var
imageName
=
res
.
fileName
if
(
res
.
thumbnailPath
&&
res
.
thumbnailPath
.
length
>
0
)
{
imgPath
=
SERVER_URL
+
res
.
thumbnailPath
;
imageName
=
'thumb_'
+
imageName
;
}
// uploadFileの判断
var
extension
=
imageName
.
substr
(
imageName
.
lastIndexOf
(
'.'
)
+
1
).
toLowerCase
();
let
downloadPath
=
SERVER_URL
+
'/download'
+
res
.
path
;
// アップロードが終了した後ローディング画面から離れてメッセージをメッセージを転送する
const
lightbox
=
jQuery
(
'<a/>'
,{
href
:
imgPath
,
'data-lightbox'
:
'attachedImages'
,
'data-title'
:
imageName
});
const
image
=
jQuery
(
'<img/>'
,{
src
:
imgPath
,
width
:
'auto'
,
style
:
'max-width:100%'
});
const
downloadIcon
=
jQuery
(
'<a/>'
,{
href
:
downloadPath
,
class
:
'fa fa-download'
,
download
:
res
.
fileName
});
// 画像の処理
if
(
res
.
fileType
==
"jpeg"
||
res
.
fileType
==
"jpg"
||
res
.
fileType
==
"png"
)
{
if
(
res
.
thumbnailPath
&&
res
.
thumbnailPath
.
length
>
0
)
{
imgPath
=
SERVER_URL
+
res
.
thumbnailPath
;
imageName
=
'thumb_'
+
imageName
;
}
lightbox
.
append
(
image
);
lightbox
.
append
(
downloadIcon
);
let
text
=
lightbox
.
prop
(
'outerHTML'
)
let
encodedText
try
{
encodedText
=
encodeURIComponent
(
text
)
}
catch
(
e
)
{
encodedText
=
text
;
}
let
downloadPath
=
SERVER_URL
+
'/download'
+
res
.
path
;
// アップロードが終了した後ローディング画面から離れてメッセージをメッセージを転送する
const
lightbox
=
jQuery
(
'<a/>'
,{
href
:
imgPath
,
'data-lightbox'
:
'attachedImages'
,
'data-title'
:
imageName
});
const
image
=
jQuery
(
'<img/>'
,{
src
:
imgPath
,
width
:
'auto'
,
style
:
'max-width:100%'
});
const
downloadIcon
=
jQuery
(
'<a/>'
,{
href
:
downloadPath
,
class
:
'fa fa-download'
,
download
:
res
.
fileName
});
lightbox
.
append
(
image
);
lightbox
.
append
(
downloadIcon
);
let
text
=
lightbox
.
prop
(
'outerHTML'
)
let
encodedText
try
{
encodedText
=
encodeURIComponent
(
text
)
}
catch
(
e
)
{
encodedText
=
text
;
}
socket
.
emit
(
'createMessage'
,
{
text
:
encodedText
},
1
);
socket
.
emit
(
'createMessage'
,
{
text
:
encodedText
},
1
);
}
else
{
// 動画の処理
if
(
res
.
thumbnailPath
&&
res
.
thumbnailPath
.
length
>
0
)
{
imgPath
=
SERVER_URL
+
res
.
thumbnailPath
;
}
let
downloadPath
=
SERVER_URL
+
'/download'
+
res
.
path
;
const
aTag
=
jQuery
(
'<a/>'
,
{
id
:
"attachedImages"
})
const
image
=
jQuery
(
'<img/>'
,{
src
:
imgPath
,
width
:
'auto'
,
style
:
'max-width:100%'
});
const
downloadIcon
=
jQuery
(
'<a/>'
,{
href
:
downloadPath
,
class
:
'fa fa-download'
,
download
:
res
.
fileName
});
aTag
.
append
(
image
);
aTag
.
append
(
downloadIcon
);
let
text
=
aTag
.
prop
(
'outerHTML'
);
let
encodedText
try
{
encodedText
=
encodeURIComponent
(
text
)
}
catch
(
e
)
{
encodedText
=
text
;
}
socket
.
emit
(
'createMessage'
,
{
text
:
encodedText
},
1
);
}
jQuery
(
'.overlay'
).
removeClass
(
'active undismissable'
);
jQuery
(
'.loader'
).
removeClass
(
'active'
);
...
...
@@ -917,76 +1196,223 @@ socket.on('refreshGroupList', function(groups, isInvite){
});
// Update User List(Invite)
socket
.
on
(
'refreshUserListInGroup'
,
function
(
users
,
isInvite
){
// #36170
socket
.
on
(
'refreshUserListInGroup'
,
function
(
users
,
groupId
,
isInvite
){
jQuery
(
'#user_list'
).
html
(
''
);
const
template
=
jQuery
(
'#user-template'
).
html
();
//promise Array
var
promisesGroup
=
new
Array
();
users
.
forEach
((
user
)
=>
{
//timeStamp場合 0を確認, 0なら設定しない
promisesGroup
.
push
(
readStringFromFile
(
user
.
loginId
,
user
.
timeStamp
,
user
.
shopMemberId
));
});
//promises synchronize
Promise
.
all
(
promisesGroup
)
.
then
(
values
=>
{
// Promise.all(promises)
//渡す値をobjectにする
users
.
forEach
((
part
,
index
)
=>
{
const
value
=
values
.
find
((
value
)
=>
{
if
(
value
.
shopMemberId
==
users
[
index
].
shopMemberId
)
{
if
(
value
.
profileImagePath
.
length
>
0
&&
value
.
timeStamp
==
"0"
)
{
//차분이 있는 경우
return
true
}
else
if
(
value
.
profileImagePath
.
length
==
0
&&
value
.
timeStamp
!=
"0"
)
{
return
false
}
else
{
return
true
}
}
})
users
.
forEach
(
function
(
user
)
{
//loadingIndicatorを表示
showLoadingIndicator
();
if
(
value
!=
undefined
)
{
users
[
index
].
profileImagePath
=
value
.
profileImagePath
}
})
user
.
profileImagePath
=
profileImgPathValidCheck
(
user
.
profileImagePath
,
user
.
checkProfileExist
);
var
requestList
=
new
Array
()
let
html
=
Mustache
.
render
(
template
,
{
id
:
user
.
shopMemberId
,
profileImage
:
user
.
profileImagePath
,
name
:
user
.
loginId
});
values
.
forEach
((
value
)
=>
{
if
(
value
.
profileImagePath
.
length
==
0
&&
value
.
timeStamp
!=
"0"
){
requestList
.
push
(
value
)
}
})
// クリックするとactive クラスを与え、チェック表示を出させる。
let
obj
=
jQuery
(
jQuery
.
parseHTML
(
html
)).
on
(
'click'
,
function
(){
if
(
jQuery
(
this
).
find
(
'.userCheckBox.active'
).
length
>
0
)
{
//remove
globalSelectedUserList
=
globalSelectedUserList
.
filter
(
function
(
element
)
{
return
user
.
loginId
!=
element
.
loginId
;
let
userList
=
requestList
.
map
((
user
)
=>
{
return
user
.
shopMemberId
})
}
else
{
//add
globalSelectedUserList
.
push
({
loginId
:
user
.
loginId
,
shopMemberId
:
user
.
shopMemberId
,
profileImagePath
:
user
.
profileImagePath
});
}
jQuery
(
this
).
find
(
'.userCheckBox'
).
toggleClass
(
'active'
);
let
timeStamps
=
requestList
.
map
((
user
)
=>
{
return
user
.
timeStamp
})
//AISDevelop
if
(
globalSelectedUserList
.
length
>
0
)
{
jQuery
(
'#userSelectionLength'
).
text
(
globalSelectedUserList
.
length
);
if
(
userList
.
length
>
0
)
{
socket
.
emit
(
'getUserImageDataInGroup'
,
groupId
,
userList
,
timeStamps
,
(
userData
)
=>
{
var
promisesGroupInDiffer
=
new
Array
();
userData
.
forEach
((
data
)
=>
{
if
(
data
.
timeStamp
!=
undefined
&&
data
.
profileImage
!=
undefined
)
{
promisesGroupInDiffer
.
push
(
saveProfileImageFile
(
data
.
loginId
,
data
.
shopMemberId
,
data
.
timeStamp
,
data
.
profileImage
));
}
});
//image change
Promise
.
all
(
promisesGroupInDiffer
)
.
then
(
diffValues
=>
{
diffValues
.
forEach
((
differ
)
=>
{
//differ object - > loginId, shopMemberId, profileImagePath,
//save end
console
.
log
(
"differ"
);
users
.
forEach
((
part
,
index
)
=>
{
const
value
=
diffValues
.
find
((
value
)
=>
{
return
value
.
shopMemberId
==
users
[
index
].
shopMemberId
})
if
(
value
){
users
[
index
].
profileImagePath
=
value
.
profileImagePath
;
}
})
})
const
template
=
jQuery
(
'#user-template'
).
html
();
users
.
forEach
(
function
(
user
)
{
//loadingIndicatorを表示
showLoadingIndicator
();
//user.profileImagePath = profileImgPathValidCheck(user.profileImagePath, user.checkProfileExist);
user
.
profileImagePath
=
profileImgPathValidCheck2
(
user
.
profileImagePath
)
let
html
=
Mustache
.
render
(
template
,
{
id
:
user
.
shopMemberId
,
profileImage
:
user
.
profileImagePath
,
name
:
user
.
loginId
});
// クリックするとactive クラスを与え、チェック表示を出させる。
let
obj
=
jQuery
(
jQuery
.
parseHTML
(
html
)).
on
(
'click'
,
function
(){
if
(
jQuery
(
this
).
find
(
'.userCheckBox.active'
).
length
>
0
)
{
//remove
globalSelectedUserList
=
globalSelectedUserList
.
filter
(
function
(
element
)
{
return
user
.
loginId
!=
element
.
loginId
;
});
}
else
{
//add
globalSelectedUserList
.
push
({
loginId
:
user
.
loginId
,
shopMemberId
:
user
.
shopMemberId
,
profileImagePath
:
user
.
profileImagePath
});
}
jQuery
(
this
).
find
(
'.userCheckBox'
).
toggleClass
(
'active'
);
if
(
globalSelectedUserList
.
length
>
0
)
{
jQuery
(
'#userSelectionLength'
).
text
(
globalSelectedUserList
.
length
);
}
else
{
jQuery
(
'#userSelectionLength'
).
text
(
''
);
}
});
let
findObj
=
globalSelectedUserList
.
find
(
function
(
selectedUser
)
{
return
selectedUser
.
loginId
==
user
.
loginId
;
})
if
(
findObj
)
{
jQuery
(
obj
).
find
(
'.userCheckBox'
).
toggleClass
(
'active'
);
}
jQuery
(
'#user_list'
).
append
(
obj
);
})
jQuery
(
'.userCheckBox'
).
show
();
// Rotate
if
(
isLandscapeMode
())
{
jQuery
(
".user_list"
).
addClass
(
"col-6"
).
removeClass
(
"col-12"
);
$
(
".squareBoxContent span"
).
addClass
(
"landscape_span"
);
}
jQuery
(
'#backButton'
).
off
().
on
(
'click'
,
function
()
{
//loadingIndicatorを表示
showLoadingIndicator
();
socket
.
emit
(
'getGroupList'
,
isInvite
)
});
jQuery
(
"#userSelectionConfirmBtn"
).
off
().
on
(
'click'
,
function
(){
//loadingIndicatorを表示
showLoadingIndicator
();
setConfirmButtonEvent
(
isInvite
);
});
jQuery
(
'#backButton'
).
show
();
jQuery
(
'.roomListIcon, .chatRoomIcon'
).
hide
();
jQuery
(
'#userSelectionConfirmBtn'
).
show
();
jQuery
(
'.userCheckBox'
).
show
();
jQuery
(
'#pills-user-tab'
).
tab
(
'show'
);
})
})
}
else
{
jQuery
(
'#userSelectionLength'
).
text
(
''
);
}
});
//
let
findObj
=
globalSelectedUserList
.
find
(
function
(
selectedUser
)
{
return
selectedUser
.
loginId
==
user
.
loginId
;
})
if
(
findObj
)
{
jQuery
(
obj
).
find
(
'.userCheckBox'
).
toggleClass
(
'active'
);
}
const
template
=
jQuery
(
'#user-template'
).
html
();
jQuery
(
'#user_list'
).
append
(
obj
);
});
users
.
forEach
(
function
(
user
)
{
//loadingIndicatorを表示
showLoadingIndicator
();
// Rotate
if
(
isLandscapeMode
())
{
jQuery
(
".user_list"
).
addClass
(
"col-6"
).
removeClass
(
"col-12"
);
$
(
".squareBoxContent span"
).
addClass
(
"landscape_span"
);
}
user
.
profileImagePath
=
profileImgPathValidCheck2
(
user
.
profileImagePath
)
jQuery
(
'#backButton'
).
off
().
on
(
'click'
,
function
()
{
//loadingIndicatorを表示
showLoadingIndicator
();
socket
.
emit
(
'getGroupList'
,
isInvite
)
});
let
html
=
Mustache
.
render
(
template
,
{
id
:
user
.
shopMemberId
,
profileImage
:
user
.
profileImagePath
,
name
:
user
.
loginId
});
//
jQuery
(
"#userSelectionConfirmBtn"
).
off
().
on
(
'click'
,
function
(){
//loadingIndicatorを表示
showLoadingIndicator
();
setConfirmButtonEvent
(
isInvite
);
});
// クリックするとactive クラスを与え、チェック表示を出させる。
let
obj
=
jQuery
(
jQuery
.
parseHTML
(
html
)).
on
(
'click'
,
function
(){
if
(
jQuery
(
this
).
find
(
'.userCheckBox.active'
).
length
>
0
)
{
//remove
globalSelectedUserList
=
globalSelectedUserList
.
filter
(
function
(
element
)
{
return
user
.
loginId
!=
element
.
loginId
;
});
}
else
{
//add
globalSelectedUserList
.
push
({
loginId
:
user
.
loginId
,
shopMemberId
:
user
.
shopMemberId
,
profileImagePath
:
user
.
profileImagePath
});
}
jQuery
(
this
).
find
(
'.userCheckBox'
).
toggleClass
(
'active'
);
if
(
globalSelectedUserList
.
length
>
0
)
{
jQuery
(
'#userSelectionLength'
).
text
(
globalSelectedUserList
.
length
);
}
else
{
jQuery
(
'#userSelectionLength'
).
text
(
''
);
}
});
jQuery
(
'#backButton'
).
show
();
jQuery
(
'.roomListIcon, .chatRoomIcon'
).
hide
();
jQuery
(
'#userSelectionConfirmBtn'
).
show
();
jQuery
(
'.userCheckBox'
).
show
();
jQuery
(
'#pills-user-tab'
).
tab
(
'show'
);
let
findObj
=
globalSelectedUserList
.
find
(
function
(
selectedUser
)
{
return
selectedUser
.
loginId
==
user
.
loginId
;
})
if
(
findObj
)
{
jQuery
(
obj
).
find
(
'.userCheckBox'
).
toggleClass
(
'active'
);
}
jQuery
(
'#user_list'
).
append
(
obj
);
})
jQuery
(
'.userCheckBox'
).
show
();
// Rotate
if
(
isLandscapeMode
())
{
jQuery
(
".user_list"
).
addClass
(
"col-6"
).
removeClass
(
"col-12"
);
$
(
".squareBoxContent span"
).
addClass
(
"landscape_span"
);
}
jQuery
(
'#backButton'
).
off
().
on
(
'click'
,
function
()
{
//loadingIndicatorを表示
showLoadingIndicator
();
socket
.
emit
(
'getGroupList'
,
isInvite
)
});
jQuery
(
"#userSelectionConfirmBtn"
).
off
().
on
(
'click'
,
function
(){
//loadingIndicatorを表示
showLoadingIndicator
();
setConfirmButtonEvent
(
isInvite
);
});
jQuery
(
'#backButton'
).
show
();
jQuery
(
'.roomListIcon, .chatRoomIcon'
).
hide
();
jQuery
(
'#userSelectionConfirmBtn'
).
show
();
jQuery
(
'.userCheckBox'
).
show
();
jQuery
(
'#pills-user-tab'
).
tab
(
'show'
);
}
});
});
// グループ画面での検索
...
...
@@ -1409,6 +1835,9 @@ function htmlElementTextInitialize(languageCode) {
$
(
"#exitRoom"
).
text
(
getLocalizedString
(
"exitRoom"
)).
append
(
"<i class='fas fa-door-open'></i>"
)
$
(
"#participants"
).
text
(
getLocalizedString
(
"participants"
))
$
(
"#fileUploadButton"
).
text
(
getLocalizedString
(
"photo"
))
$
(
"#fileUploadButton2"
).
text
(
getLocalizedString
(
"video"
))
$
(
"#okayLabel"
).
text
(
getLocalizedString
(
"okayLabel"
))
$
(
"#completeLabel"
).
text
(
getLocalizedString
(
"completeLabel"
))
$
(
"#thankLabel"
).
text
(
getLocalizedString
(
"thankLabel"
))
...
...
@@ -1468,3 +1897,86 @@ function getLoginParameter(sid, loginId, shopName, roomId = undefined, roomName
dismissLoadingIndicator
();
});
}
// #36170
function
getLocalProfileFilePath
(
localSavedJsonPath
)
{
profileJsonFilePath
=
localSavedJsonPath
;
}
//local file save develop part
////////////////////////////////////////////////////////////////////////
// object for storing references to our promise-objects
var
promises
=
new
Array
();
// generates a unique id, not obligator a UUID
function
generateUUID
()
{
var
d
=
new
Date
().
getTime
();
var
uuid
=
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
.
replace
(
/
[
xy
]
/g
,
function
(
c
)
{
var
r
=
(
d
+
Math
.
random
()
*
16
)
%
16
|
0
;
d
=
Math
.
floor
(
d
/
16
);
return
(
c
==
'x'
?
r
:
(
r
&
0x3
|
0x8
)).
toString
(
16
);
});
return
uuid
;
};
// this funciton is called by native methods
// @param promiseId - id of the promise stored in global variable promises
function
resolvePromise
(
promiseId
,
userId
,
imagePath
,
timeStamp
,
shopMemberId
,
error
)
{
let
object
=
new
Object
()
object
.
userId
=
userId
;
object
.
profileImagePath
=
imagePath
;
object
.
timeStamp
=
timeStamp
;
object
.
shopMemberId
=
shopMemberId
;
if
(
error
)
{
promises
[
promiseId
].
reject
(
error
);
}
else
{
promises
[
promiseId
].
resolve
(
object
);
}
}
function
saveProfileImageFile
(
loginId
,
shopMemberId
,
timeStamp
,
profileImage
)
{
var
promise
=
new
Promise
(
function
(
resolve
,
reject
)
{
// we generate a unique id to reference the promise later
// from native function
var
promiseId
=
generateUUID
();
// save reference to promise in the global variable
this
.
promises
[
promiseId
]
=
{
resolve
,
reject
};
try
{
// call native function
android
.
requestProfileImagesJsonFilePath
(
promiseId
,
loginId
,
timeStamp
,
shopMemberId
,
profileImage
);
}
catch
(
exception
)
{
alert
(
exception
);
}
});
return
promise
;
}
function
fileSaveResolvePromise
(
promiseId
,
loginId
,
profileImagePath
,
shopMemberId
,
error
)
{
let
object
=
new
Object
();
object
.
loginId
=
loginId
;
object
.
profileImagePath
=
profileImagePath
;
object
.
shopMemberId
=
shopMemberId
;
if
(
error
)
{
promises
[
promiseId
].
reject
(
error
);
}
else
{
promises
[
promiseId
].
resolve
(
object
);
}
}
function
readStringFromFile
(
loginId
,
timeStamp
,
shopMemberId
)
{
var
promise
=
new
Promise
(
function
(
resolve
,
reject
)
{
var
promiseId
=
generateUUID
();
this
.
promises
[
promiseId
]
=
{
resolve
,
reject
};
try
{
android
.
readFileHandler
(
promiseId
,
loginId
,
timeStamp
,
shopMemberId
);
}
catch
(
exception
)
{
alert
(
exception
);
}
});
return
promise
;
}
ABVJE_Launcher_Android/assets/chat/public/js/language_en.js
View file @
accb8ff0
...
...
@@ -11,7 +11,7 @@ $.lang.en = {
"roomListEmptyString"
:
"There is no room available."
,
"left"
:
"%@ has left"
,
"join"
:
"%@ has joined"
,
"added"
:
"%@
has been add
ed"
,
"added"
:
"%@
has been invit
ed"
,
"welcome"
:
"Welcome to %@"
,
"userListDivideString"
:
", "
,
"orderByTime"
:
"OrderByTime"
,
...
...
@@ -44,5 +44,7 @@ $.lang.en = {
"errorConnect"
:
"There was a problem with the network.
\
n Please check the connection status of the network."
,
"errorRoomNotFound"
:
"This chat room has already been deleted."
,
"serverErrorOccured"
:
"App will not be able to communicate with the server.
\
n After a few moments, please try again."
,
"memberDeleteTitle"
:
"Do you want to remove selected members from the list?"
"memberDeleteTitle"
:
"Do you want to remove selected members from the list?"
,
"photo"
:
"Photo"
,
"video"
:
"Video"
}
ABVJE_Launcher_Android/assets/chat/public/js/language_ja.js
View file @
accb8ff0
...
...
@@ -11,7 +11,7 @@ $.lang.ja = {
"roomListEmptyString"
:
"入場できるルームがありません。"
,
"left"
:
"%@ 様が退場しました。"
,
"join"
:
"%@ 様が入場しました。"
,
"added"
:
"%@ 様
がルームに招待され
ました。"
,
"added"
:
"%@ 様
を招待し
ました。"
,
"welcome"
:
"%@ に入場しました。"
,
"userListDivideString"
:
" 様, "
,
"orderByTime"
:
"新着順"
,
...
...
@@ -44,5 +44,7 @@ $.lang.ja = {
"errorConnect"
:
"ネットワークに問題がありました。
\
nネットワークの接続状態を確認してください。"
,
"errorRoomNotFound"
:
"既に削除されたチャットルームです。"
,
"serverErrorOccured"
:
"サーバと通信できません。
\
nしばらく時間をおいて再度操作してください。"
,
"memberDeleteTitle"
:
"選択したメンバーをリストから削除しますか?"
"memberDeleteTitle"
:
"選択したメンバーをリストから削除しますか?"
,
"photo"
:
"写真"
,
"video"
:
"動画"
}
ABVJE_Launcher_Android/assets/chat/public/js/language_ko.js
View file @
accb8ff0
...
...
@@ -11,7 +11,7 @@ $.lang.ko = {
"roomListEmptyString"
:
"입장 가능한 방이 없습니다."
,
"left"
:
"%@ 님이 방을 떠났습니다."
,
"join"
:
"%@ 님이 참가했습니다."
,
"added"
:
"%@ 님
이 방에 초대되었
습니다."
,
"added"
:
"%@ 님
을 초대했
습니다."
,
"welcome"
:
"%@ 에 입장했습니다."
,
"userListDivideString"
:
" 님, "
,
"orderByTime"
:
"최신순"
,
...
...
@@ -24,7 +24,7 @@ $.lang.ko = {
"groupListKeyword"
:
"검색"
,
"groupPageSubtitle"
:
"그룹"
,
"noMessages"
:
"메시지가 없습니다."
,
"image"
:
"
사진
"
,
"image"
:
"
이미지
"
,
"chatKeyword"
:
"검색"
,
"userListKeyword"
:
"검색"
,
"newRoomName"
:
"방제목 입력"
,
...
...
@@ -44,5 +44,7 @@ $.lang.ko = {
"errorConnect"
:
"네트워크에 문제가 발생했습니다.
\
n네트워크 연결상태를 확인하여 주십시요."
,
"errorRoomNotFound"
:
"이미 삭제된 채팅룸입니다."
,
"serverErrorOccured"
:
"서버와 통신할 수 없습니다.
\
n잠시 후 다시 시도해보시기 바랍니다."
,
"memberDeleteTitle"
:
"목록에서 선택된 멤버를 삭제하시겠습니까?"
"memberDeleteTitle"
:
"목록에서 선택된 멤버를 삭제하시겠습니까?"
,
"photo"
:
"사진"
,
"video"
:
"동영상"
}
ABVJE_Launcher_Android/assets/chat/public/newstart.html
View file @
accb8ff0
...
...
@@ -209,10 +209,24 @@
<div
class=
"input_msg_write"
>
<div
class=
"input-group"
>
<div
class=
"input-group-prepend"
>
<button
class=
"btn input-group-text"
id=
"fileUploadButton"
type=
"button"
><i
class=
"fa fa-camera"
></i></button>
<form
id=
"image-form"
>
<input
class=
"d-none"
type=
"file"
name=
"image"
id=
"imageInputTag"
accept=
"image/x-png,image/jpeg"
>
</form>
<button
class=
"btn input-group-text dropdown-toggle"
data-toggle=
"dropdown"
type=
"button"
><i
class=
"fa fa-camera"
></i></button>
<!-- Video Upload -->
<div
class=
"dropdown-menu"
>
<a
class=
"dropdown-item"
id=
"fileUploadButton"
href=
"#"
>
Photo
<a
href=
"#"
>
<form
id=
"image-form"
>
<input
class=
"d-none"
type=
"file"
name=
"image"
id=
"imageInputTag"
accept=
"image/x-png,image/jpeg"
>
</form>
</a>
</a>
<a
class=
"dropdown-item"
id=
"fileUploadButton2"
href=
"#"
>
Video
<a
href=
"#"
>
<form
id=
"image-form2"
>
<input
class=
"d-none"
type=
"file"
name=
"image"
id=
"imageInputTag2"
accept=
"video/mp4"
>
</form>
</a>
</a>
</div>
</div>
<input
id=
"message-form"
type=
"text"
class=
"write_msg form-control"
name=
"message"
placeholder=
"Type a message"
autocomplete=
"off"
>
<div
class=
"input-group-append"
>
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/launcher/android/OnAppDownloadReceiver.java
View file @
accb8ff0
...
...
@@ -44,7 +44,8 @@ public class OnAppDownloadReceiver extends BroadcastReceiver {
Toast
.
makeText
(
context
,
intent
.
getAction
(),
Toast
.
LENGTH_LONG
).
show
();
}
else
{
// APK 確認することではない場合
if
(!
downloadedTo
.
toLowerCase
().
endsWith
(
".png"
)
&&
!
downloadedTo
.
toLowerCase
().
endsWith
(
".jpg"
)
&&
!
downloadedTo
.
toLowerCase
().
endsWith
(
".jpeg"
))
{
if
(!
downloadedTo
.
toLowerCase
().
endsWith
(
".png"
)
&&
!
downloadedTo
.
toLowerCase
().
endsWith
(
".jpg"
)
&&
!
downloadedTo
.
toLowerCase
().
endsWith
(
".jpeg"
)
&&
!
downloadedTo
.
toLowerCase
().
endsWith
(
".mp4"
)
&&
!
downloadedTo
.
toLowerCase
().
endsWith
(
".mov"
))
{
File
file
=
new
File
(
context
.
getExternalFilesDir
(
Environment
.
DIRECTORY_DOWNLOADS
),
ABVEnvironment
.
APK_FILE_NAME
);
if
(
file
.
exists
())
{
Intent
i
=
new
Intent
(
Intent
.
ACTION_VIEW
);
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ChatWebviewActivity.java
View file @
accb8ff0
...
...
@@ -57,8 +57,10 @@ import jp.agentec.abook.abv.ui.common.constant.NaviConsts;
import
jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog
;
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.ABookCheckWebViewHelper
;
import
jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper
;
import
jp.agentec.abook.abv.ui.viewer.activity.ParentWebViewActivity
;
import
jp.agentec.adf.util.FileUtil
;
/**
* Created by AIS-NB-048 on 2019/07/31.
...
...
@@ -88,6 +90,10 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
private
BroadcastReceiver
receiver
;
// ユーザプロファイルの保存場所パス
private
static
final
String
ProfileDirFormat
=
"%s/ABook/operation/profileimages"
;
// private static final String ProfileImgDirFormat = "%s/ABook/operation/profileimages/images";
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -105,15 +111,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
loginId
=
intent
.
getStringExtra
(
"loginId"
);
shopName
=
intent
.
getStringExtra
(
"shopName"
);
// チャットViewのクローズボタン
// final ImageButton imageButton = findViewById(R.id.chat_close_btn);
// imageButton.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// finish();
// }
// });
mChatWebView
=
findViewById
(
R
.
id
.
chatWebview2
);
mChatWebView
.
setOverScrollMode
(
View
.
OVER_SCROLL_NEVER
);
//オーバースクロールしない。
mChatWebView
.
setVerticalScrollBarEnabled
(
false
);
//スクロールバーを消す。
...
...
@@ -129,17 +126,14 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
mChatWebView
.
addJavascriptInterface
(
jsInf
,
"android"
);
//ページをロード
if
(
roomId
!=
0
&&
roomName
!=
null
)
{
// by push message
// mChatWebView.loadUrl(chatWebviewUrl + "?sid=" + sid + "&loginId=" + loginId + "&shopName=" + shopName + "&roomId=" + roomId + "&roomName=" + roomName);
String
parameterData
=
"sid="
+
sid
+
"&loginId="
+
loginId
+
"&shopName="
+
shopName
+
"&roomId="
+
roomId
+
"&roomName="
+
roomName
;
mChatWebView
.
postUrl
(
chatWebviewUrl
,
parameterData
.
getBytes
());
}
else
{
// Chat
if
(
lastRoomName
.
length
()
>
0
&&
lastRoomId
.
length
()
>
0
)
{
// mChatWebView.loadUrl(chatWebviewUrl + "?sid=" + sid + "&loginId=" + loginId + "&shopName=" + shopName + "&roomId=" + lastRoomId + "&roomName=" + lastRoomName);
String
parameterData
=
"sid="
+
sid
+
"&loginId="
+
loginId
+
"&shopName="
+
shopName
+
"&roomId="
+
lastRoomId
+
"&roomName="
+
lastRoomName
;
mChatWebView
.
postUrl
(
chatWebviewUrl
,
parameterData
.
getBytes
());
}
else
{
// mChatWebView.loadUrl(chatWebviewUrl + "?sid=" + sid + "&loginId=" + loginId + "&shopName=" + shopName);
String
parameterData
=
"sid="
+
sid
+
"&loginId="
+
loginId
+
"&shopName="
+
shopName
;
mChatWebView
.
postUrl
(
chatWebviewUrl
,
parameterData
.
getBytes
());
}
...
...
@@ -148,9 +142,14 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
mChatWebView
.
setWebChromeClient
(
new
WebChromeClient
()
{
@Override
public
boolean
onShowFileChooser
(
WebView
webView
,
ValueCallback
<
Uri
[]>
filePathCallback
,
FileChooserParams
fileChooserParams
)
{
boolean
result
;
// result = startCameraIntent(ABOOK_CHECK_TASK_IMAGE, "Camera", ABookKeys.IMAGE_VIDEO, true);
result
=
startCameraIntent
(
ABOOK_CHECK_TASK_IMAGE
,
"Camera"
,
ABookKeys
.
IMAGE
,
true
);
boolean
result
=
false
;
// 画像が選択された場合
if
(
fileChooserParams
.
getAcceptTypes
()[
0
].
toLowerCase
().
indexOf
(
ABookKeys
.
IMAGE
)
!=
-
1
)
{
result
=
startCameraIntent
(
ABOOK_CHECK_TASK_IMAGE
,
"Camera"
,
ABookKeys
.
IMAGE
,
true
);
// 動画が選択された場合
}
else
if
(
fileChooserParams
.
getAcceptTypes
()[
0
].
toLowerCase
().
indexOf
(
ABookKeys
.
VIDEO
)
!=
-
1
)
{
result
=
startCameraIntent
(
ABOOK_CHECK_TASK_VIDEO
,
"Camera"
,
ABookKeys
.
VIDEO
,
true
);
}
if
(
result
)
{
if
(
mUploadMessage
!=
null
)
{
mUploadMessage
.
onReceiveValue
(
null
);
...
...
@@ -296,16 +295,18 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
@Override
public
boolean
shouldOverrideUrlLoading
(
WebView
view
,
String
url
)
{
Logger
.
d
(
"url"
,
"url : "
+
url
);
// イメージをダウンロードする(png, jpg, jpeg)
if
(
url
.
toLowerCase
().
endsWith
(
".png"
)
||
url
.
toLowerCase
().
endsWith
(
".jpg"
)
||
url
.
toLowerCase
().
endsWith
(
".jpeg"
))
{
Uri
uri
=
Uri
.
parse
(
url
);
String
fileName
=
new
File
(
uri
.
getPath
()).
getName
();
// イメージをダウンロードする(png, jpg, jpeg, mp4, mov)
if
(
url
.
toLowerCase
().
endsWith
(
".png"
)
||
url
.
toLowerCase
().
endsWith
(
".jpg"
)
||
url
.
toLowerCase
().
endsWith
(
".jpeg"
)
||
url
.
toLowerCase
().
endsWith
(
".mov"
)
||
url
.
toLowerCase
().
endsWith
(
".mp4"
))
{
view
.
loadUrl
(
"javascript:showLoadingIndicator()"
);
DownloadManager
mdDownloadManager
=
(
DownloadManager
)
getSystemService
(
Context
.
DOWNLOAD_SERVICE
);
DownloadManager
.
Request
request
=
new
DownloadManager
.
Request
(
Uri
.
parse
(
url
));
File
destinationFile
=
new
File
(
Environment
.
getExternalStorageDirectory
(),
getFileName
(
url
));
request
.
setDescription
(
"Downloading ..."
);
File
destinationFile
=
new
File
(
Environment
.
getExternalStorageDirectory
(),
fileName
);
request
.
setDescription
(
"Downloading ..."
);
request
.
setNotificationVisibility
(
DownloadManager
.
Request
.
VISIBILITY_VISIBLE_NOTIFY_COMPLETED
);
request
.
setDestinationUri
(
Uri
.
fromFile
(
destinationFile
));
mdDownloadManager
.
enqueue
(
request
);
...
...
@@ -501,6 +502,95 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}
}
// #36170
// ユーザプロファイルのイメージを求める
public
void
getrofileImagesJsonFilePath
(
String
promiseId
,
String
loginId
,
String
timeStamp
,
String
shopMemberId
,
String
profileImage
)
{
String
mimeType
=
""
;
String
javascript
=
""
;
// Binary からファイルフォマットを取る
if
(
profileImage
.
contains
(
"jpg"
))
{
mimeType
=
"jpg"
;
}
else
if
(
profileImage
.
contains
(
"jpeg"
))
{
mimeType
=
"jpeg"
;
}
else
if
(
profileImage
.
contains
(
"png"
))
{
mimeType
=
"png"
;
}
// ファイルパースを生成する。
String
profileImagesPath
=
String
.
format
(
ProfileDirFormat
,
ABVEnvironment
.
getInstance
().
rootDirectory
)
+
File
.
separator
+
loginId
+
'_'
+
timeStamp
+
"."
+
mimeType
;
// 差分があるアルバあい既存ファイルを確認する
File
file
=
new
File
(
profileImagesPath
);
if
(
file
.
exists
())
{
javascript
=
String
.
format
(
"javascript:fileSaveResolvePromise('%s', '%s', '%s', '%s', null);"
,
promiseId
,
loginId
,
profileImagesPath
,
shopMemberId
);
mChatWebView
.
loadUrl
(
javascript
);
return
;
}
// 差分がある場合既存ファイルを削除する
// String differceImageFilePath = searchDifferceImageFiles(userID + "_", timeStamp);
// if (deleteTargetFilePath.length() > 0) {
// // ファイルがある場合のみ、削除
// FileUtil.delete(deleteTargetFilePath);
// }
String
isError
=
null
;
try
{
ABookCheckWebViewHelper
.
getInstance
().
decodeToImage
(
profileImage
,
profileImagesPath
);
}
catch
(
Exception
e
)
{
isError
=
"Error"
;
Logger
.
e
(
TAG
,
e
);
}
if
(
isError
!=
null
)
{
javascript
=
String
.
format
(
"javascript:fileSaveResolvePromise('%s', '%s', '%s', '%s', '%s');"
,
promiseId
,
loginId
,
profileImagesPath
,
shopMemberId
,
isError
);
}
else
{
javascript
=
String
.
format
(
"javascript:fileSaveResolvePromise('%s', '%s', '%s', '%s', null);"
,
promiseId
,
loginId
,
profileImagesPath
,
shopMemberId
);
}
mChatWebView
.
loadUrl
(
javascript
);
}
// ユーザプロファイルの差分のためファイル検索
public
void
getFileHandler
(
String
promiseId
,
String
loginId
,
String
timeStamp
,
String
shopMemberId
)
{
String
javascript
=
""
;
// timeStampが「0」の場合、そのまま値を返す
if
(
timeStamp
.
equals
(
"0"
))
{
//ここに既存のイメージの削除logicが必要だ
String
deleteImageFilePath
=
searchImageFiles
(
loginId
+
"_"
);
if
(
deleteImageFilePath
.
length
()
>
0
)
{
// ファイルがある場合のみ、削除
if
(
FileUtil
.
delete
(
deleteImageFilePath
))
{
Logger
.
d
(
"Delete imageFile "
,
"delete file path :"
+
deleteImageFilePath
);
}
}
javascript
=
String
.
format
(
"javascript:resolvePromise('%s', '%s', '%s', '%s', '%s', null);"
,
promiseId
,
loginId
,
""
,
"0"
,
shopMemberId
);
// default
}
else
{
//差分を確認し差分がある場合、差分対象のファイルのtimeStampを返す
String
searchFileInfo
=
searchDifferceImageFiles
(
loginId
+
"_"
,
timeStamp
);
String
profileImagesPath
=
""
;
// 差分がない場合、同じファイルで
if
(
searchFileInfo
.
lastIndexOf
(
"."
)
>
0
)
{
profileImagesPath
=
String
.
format
(
ProfileDirFormat
,
ABVEnvironment
.
getInstance
().
rootDirectory
)
+
File
.
separator
+
searchFileInfo
;
searchFileInfo
=
"0"
;
}
// 差分がある場合、既存ファイルのTimeStampでsearchFileInfoにoldTimeStampとして返す
else
if
(
searchFileInfo
.
length
()
>
1
)
{
profileImagesPath
=
""
;
// 差分がない、ファイルがない場合
}
else
if
(
searchFileInfo
.
equals
(
"0"
))
{
profileImagesPath
=
""
;
searchFileInfo
=
"20000101121211"
;
// サーバに差分のファイルを要求するためダミー日付を渡す
}
String
error
=
null
;
javascript
=
String
.
format
(
"javascript:resolvePromise('%s', '%s', '%s', '%s', '%s', null);"
,
promiseId
,
loginId
,
profileImagesPath
,
searchFileInfo
,
shopMemberId
);
}
mChatWebView
.
loadUrl
(
javascript
);
}
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
...
...
@@ -590,6 +680,157 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
});
}
// #36170
@JavascriptInterface
public
void
requestProfileImagesJsonFilePath
(
final
String
promiseId
,
final
String
loginId
,
final
String
timeStamp
,
final
String
shopMemberId
,
final
String
profileImage
)
{
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
getrofileImagesJsonFilePath
(
promiseId
,
loginId
,
timeStamp
,
shopMemberId
,
profileImage
);
}
});
}
@JavascriptInterface
public
String
getProfileImage
(
String
loginId
)
{
String
profileImage
=
searchImageFiles
(
loginId
+
"_"
);
if
(
profileImage
.
length
()
>
0
)
{
return
profileImage
;
}
else
{
profileImage
=
""
;
}
return
profileImage
;
// logidId, profileimagePath, timestamp
}
@JavascriptInterface
// public String getProfileimageDifference(String loginId, String timeStamp) {
public
void
getfileimageDifference
(
String
promiseId
,
String
loginId
,
String
timeStamp
)
{
String
profileImageStamp
=
searchDifferceImageFiles
(
loginId
+
"_"
,
timeStamp
);
if
(
profileImageStamp
.
length
()
>
0
)
{
// return profileImageStamp;
}
else
{
profileImageStamp
=
""
;
}
String
javascript
=
String
.
format
(
"javascript:resolvePromise('%s', '%s', '%s', null, null);"
,
promiseId
,
loginId
,
profileImageStamp
);
mChatWebView
.
loadUrl
(
javascript
);
}
@JavascriptInterface
public
void
readFileHandler
(
final
String
promiseId
,
final
String
loginId
,
final
String
timeStamp
,
final
String
shopMemberId
)
{
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
getFileHandler
(
promiseId
,
loginId
,
timeStamp
,
shopMemberId
);
}
});
}
}
// 保存されているユーザプロファイルの場所からファイルを検索
private
String
searchImageFiles
(
String
loginId
)
{
String
profileImagePath
=
""
;
String
profileImagesJsonPath
=
String
.
format
(
ProfileDirFormat
,
ABVEnvironment
.
getInstance
().
rootDirectory
);
List
<
String
>
listDirectory
=
new
ArrayList
<>();
listDirectory
.
add
(
profileImagesJsonPath
);
int
m
=
0
;
int
n
=
0
;
String
[]
fileName
;
String
imgPath
=
null
;
// dirList.size() は動的変化あり注意
while
(
listDirectory
.
size
()
>
m
){
// get(m) リスト内の指定された位置 m にある要素を返す
File
directory
=
new
File
(
listDirectory
.
get
(
m
));
// java.io.File クラスのメソッド list()
// 指定したディレクトリに含まれるファイル、ディレクトリの一覧を String 型の配列で返す。
fileName
=
directory
.
list
();
if
(
fileName
==
null
)
break
;
n
=
0
;
while
(
fileName
.
length
>
n
){
File
subFile
;
subFile
=
new
File
(
directory
.
getPath
()
+
"/"
+
fileName
[
n
]);
if
(
subFile
.
isDirectory
())
{
listDirectory
.
add
(
directory
.
getPath
()
+
"/"
+
fileName
[
n
]);
imgPath
=
directory
.
getPath
()
+
"/"
+
fileName
[
n
];
}
else
if
(
subFile
.
getName
().
startsWith
(
loginId
))
{
imgPath
=
directory
.
getPath
()
+
"/"
+
fileName
[
n
];
profileImagePath
=
imgPath
;
break
;
}
else
{
profileImagePath
=
""
;
}
n
++;
}
m
++;
}
return
profileImagePath
;
}
// User Profile ついて差分を確認する
private
String
searchDifferceImageFiles
(
String
loginId
,
String
timeStamp
)
{
String
profileImageTimeStamp
=
"0"
;
String
profileImagesJsonPath
=
String
.
format
(
ProfileDirFormat
,
ABVEnvironment
.
getInstance
().
rootDirectory
);
List
<
String
>
listDirectory
=
new
ArrayList
<>();
listDirectory
.
add
(
profileImagesJsonPath
);
int
m
=
0
;
int
n
=
0
;
String
[]
fileName
;
String
imgPath
=
null
;
// dirList.size() は動的変化あり注意
while
(
listDirectory
.
size
()
>
m
){
// get(m) リスト内の指定された位置 m にある要素を返す
File
directory
=
new
File
(
listDirectory
.
get
(
m
));
// java.io.File クラスのメソッド list()
// 指定したディレクトリに含まれるファイル、ディレクトリの一覧を String 型の配列で返す。
fileName
=
directory
.
list
();
if
(
fileName
==
null
)
break
;
n
=
0
;
while
(
fileName
.
length
>
n
){
File
subFile
;
subFile
=
new
File
(
directory
.
getPath
()
+
"/"
+
fileName
[
n
]);
if
(
subFile
.
isDirectory
())
{
listDirectory
.
add
(
directory
.
getPath
()
+
"/"
+
fileName
[
n
]);
imgPath
=
directory
.
getPath
()
+
"/"
+
fileName
[
n
];
}
else
if
(
subFile
.
getName
().
startsWith
(
loginId
))
{
imgPath
=
directory
.
getPath
()
+
"/"
+
fileName
[
n
];
fileName
[
n
].
substring
(
0
,
fileName
[
n
].
lastIndexOf
(
"."
));
// 拡張子を抜けて比較する
if
(!
fileName
[
n
].
substring
(
0
,
fileName
[
n
].
lastIndexOf
(
"."
)).
equals
(
loginId
+
timeStamp
))
{
// loginId だけ同じファイルの場合timeStampを返す
profileImageTimeStamp
=
fileName
[
n
].
substring
(
fileName
[
n
].
indexOf
(
"_"
)+
1
,
fileName
[
n
].
lastIndexOf
(
"."
));
}
else
if
(
fileName
[
n
].
substring
(
0
,
fileName
[
n
].
lastIndexOf
(
"."
)).
equals
(
loginId
+
timeStamp
))
{
// loginId + timestamp と同じファイルの場合、拡張子を抜けた値を返す
profileImageTimeStamp
=
fileName
[
n
];
}
break
;
}
else
{
profileImageTimeStamp
=
"0"
;
}
n
++;
}
m
++;
}
return
profileImageTimeStamp
;
}
/**
...
...
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