Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
chat_webview
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
abookCommunication
chat_webview
Commits
fc5eb4c0
Commit
fc5eb4c0
authored
Apr 06, 2021
by
Takatoshi Miura
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iosローカルdb連携中
parent
5fb3f400
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
251 additions
and
66 deletions
+251
-66
public_new/archive.html
+1
-1
public_new/chat.html
+1
-1
public_new/chat_room.html
+1
-1
public_new/contact.html
+1
-1
public_new/js/chat-db.js
+236
-62
public_new/js/chat-ui.js
+11
-0
No files found.
public_new/archive.html
View file @
fc5eb4c0
...
...
@@ -147,7 +147,7 @@
$
(
"#loadingArea"
).
load
(
"./loading.html"
);
android
.
getLoginParameter
();
android
.
getGlobalParameter
();
webkit
.
messageHandlers
.
getLoginParameter
.
postMessage
(
);
webkit
.
messageHandlers
.
loginInfoRequestMessageHandlerId
.
postMessage
({}
);
webkit
.
messageHandlers
.
getGlobalParameter
.
postMessage
();
function
getGlobalParam
(
chatServerUrl
,
cmsServerUrl
,
platform
,
isMobile
,
isOnline
)
{
...
...
public_new/chat.html
View file @
fc5eb4c0
...
...
@@ -133,7 +133,7 @@
$
(
"#loadingArea"
).
load
(
"./loading.html"
);
android
.
getLoginParameter
();
android
.
getGlobalParameter
();
webkit
.
messageHandlers
.
getLoginParameter
.
postMessage
(
);
webkit
.
messageHandlers
.
loginInfoRequestMessageHandlerId
.
postMessage
({}
);
webkit
.
messageHandlers
.
getGlobalParameter
.
postMessage
();
function
getGlobalParam
(
chatServerUrl
,
cmsServerUrl
,
platform
,
isMobile
,
isOnline
)
{
...
...
public_new/chat_room.html
View file @
fc5eb4c0
...
...
@@ -207,7 +207,7 @@
$
(
"#loadingArea"
).
load
(
"./loading.html"
);
android
.
getLoginParameter
();
android
.
getGlobalParameter
();
webkit
.
messageHandlers
.
getLoginParameter
.
postMessage
(
);
webkit
.
messageHandlers
.
loginInfoRequestMessageHandlerId
.
postMessage
({}
);
webkit
.
messageHandlers
.
getGlobalParameter
.
postMessage
();
function
getGlobalParam
(
chatServerUrl
,
cmsServerUrl
,
platform
,
isMobile
,
isOnline
)
{
...
...
public_new/contact.html
View file @
fc5eb4c0
...
...
@@ -228,7 +228,7 @@
$
(
"#loadingArea"
).
load
(
"./loading.html"
);
android
.
getLoginParameter
();
android
.
getGlobalParameter
();
webkit
.
messageHandlers
.
getLoginParameter
.
postMessage
(
);
webkit
.
messageHandlers
.
loginInfoRequestMessageHandlerId
.
postMessage
({}
);
webkit
.
messageHandlers
.
getGlobalParameter
.
postMessage
();
function
getGlobalParam
(
chatServerUrl
,
cmsServerUrl
,
platform
,
isMobile
,
isOnline
)
{
...
...
public_new/js/chat-db.js
View file @
fc5eb4c0
// 名前空間
var
CHAT_DB
=
{};
// ios用
var
iosKey
=
"objc-processing"
;
function
watchValue
(
obj
,
propName
,
func
)
{
let
value
=
obj
[
propName
];
Object
.
defineProperty
(
obj
,
propName
,
{
get
:
()
=>
value
,
set
:
newValue
=>
{
const
oldValue
=
value
;
value
=
newValue
;
func
(
oldValue
,
newValue
);
},
configurable
:
true
});
}
const
iosData
=
{
iosRoomList
:
""
,
iosMyInfo
:
""
,
iosMessages
:
""
,
iosFavoriteUsers
:
""
,
iosFavoriteGroups
:
""
,
iosMyGroupUsers
:
""
,
iosGroupInfo
:
""
,
iosNameCardData
:
""
,
iosMyGroupShopMemberByName
:
""
,
iosAllGroupShopMemberByName
:
""
,
iosGroupByName
:
""
,
iosUsersInRoom
:
""
,
iosArchiveList
:
""
,
iosSearchArchiveList
:
""
,
iosArchiveDetail
:
""
};
function
onChange
(
v1
,
v2
)
{
console
.
log
(
v1
);
console
.
log
(
' =>'
,
v2
);
console
.
log
(
''
);
};
Object
.
getOwnPropertyNames
(
iosData
).
forEach
(
propName
=>
watchValue
(
iosData
,
propName
,
onChange
));
iosData
.
iosRoomList
=
"roomList"
;
//ロカールDBからルーム一覧情報を取得
CHAT_DB
.
getRoomList
=
function
(
roomType
,
keyWord
)
{
...
...
@@ -11,144 +55,281 @@ CHAT_DB.getRoomList = function(roomType, keyWord) {
}
};
var
iosRoomList
;
CHAT_DB
.
getIosRoomList
=
function
(
roomList
)
{
iosRoomList
=
roomList
;
CHAT_DB
.
getRoomList
(
0
);
};
CHAT_DB
.
callGetRoomList
=
function
(
roomType
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
getRoomList
.
postMessage
({
roomType
});
// TODO: iosからデータを受け取るまで待つ
return
JSON
.
parse
(
iosRoomList
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getRoomList
(
roomType
));
}
}
CHAT_DB
.
getIosRoomList
=
function
(
roomList
)
{
iosRoomList
=
roomList
;
};
//ロカールDBからログインしたユーザのデータを取得する。
CHAT_DB
.
getMyInfo
=
function
(
input
)
{
CHAT_DB
.
getMyInfo
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
//TODO IOS処理追加必要
iosMyInfo
=
""
;
webkit
.
messageHandlers
.
getMyInfo
.
postMessage
();
// JavascriptからObjective-cのメソッドを指定してコールバックを受ける方法がないため、
// 値が入るまで待たせている。値の変更を検知してreturn。
return
watchValue
(
iosMyInfo
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getMyInfo
());
}
};
CHAT_DB
.
getIosMyInfo
=
function
(
myInfo
)
{
iosMyInfo
=
myInfo
;
iosKey
=
"myInfo"
;
};
CHAT_DB
.
getMessages
=
function
(
roomId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
//TODO IOS処理追加必要
iosMessages
=
""
;
webkit
.
messageHandlers
.
getMessages
.
postMessage
({
roomId
});
// JavascriptからObjective-cのメソッドを指定してコールバックを受ける方法がないため、
// 値が入るまで待たせている。
while
(
iosKey
==
"objc-processing"
)
{};
if
(
iosKey
==
"messages"
)
{
iosKey
=
"objc-processing"
;
return
JSON
.
parse
(
iosMessages
);
}
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getMessageList
(
roomId
));
}
};
CHAT_DB
.
getIosMessages
=
function
(
messages
)
{
iosMessages
=
messages
;
iosKey
=
"messages"
;
};
CHAT_DB
.
getFavoriteUsers
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
//TODO IOS処理追加必要
iosFavoriteUsers
=
""
;
webkit
.
messageHandlers
.
getFavoriteUsers
.
postMessage
();
// JavascriptからObjective-cのメソッドを指定してコールバックを受ける方法がないため、
// 値が入るまで待たせている。
while
(
iosKey
==
"objc-processing"
)
{};
if
(
iosKey
==
"favoriteUsers"
)
{
iosKey
=
"objc-processing"
;
return
JSON
.
parse
(
iosFavoriteUsers
);
}
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getFavoriteUsers
());
}
};
CHAT_DB
.
getIosFavoriteUsers
=
function
(
user
)
{
iosFavoriteUsers
=
user
;
iosKey
=
"favoriteUsers"
;
};
CHAT_DB
.
getFavoriteGroups
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
//TODO IOS処理追加必要
iosFavoriteGroups
=
""
;
webkit
.
messageHandlers
.
getFavoriteGroups
.
postMessage
();
// JavascriptからObjective-cのメソッドを指定してコールバックを受ける方法がないため、
// 値が入るまで待たせている。
while
(
iosKey
==
"objc-processing"
)
{};
if
(
iosKey
==
"favoriteGroups"
)
{
iosKey
=
"objc-processing"
;
return
JSON
.
parse
(
iosFavoriteGroups
);
}
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getFavoriteGroups
());
}
};
CHAT_DB
.
getIosFavoriteGroups
=
function
(
groups
)
{
iosFavoriteGroups
=
groups
;
iosKey
=
"favoriteGroups"
;
};
CHAT_DB
.
getMyGroupUsers
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
//TODO IOS処理追加必要
iosMyGroupUsers
=
""
;
webkit
.
messageHandlers
.
getMyGroupUsers
.
postMessage
();
// JavascriptからObjective-cのメソッドを指定してコールバックを受ける方法がないため、
// 値が入るまで待たせている。
while
(
iosKey
==
"objc-processing"
)
{};
if
(
iosKey
==
"myGroupUsers"
)
{
iosKey
=
"objc-processing"
;
return
JSON
.
parse
(
iosMyGroupUsers
);
}
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getMyGroupUsers
());
}
};
CHAT_DB
.
getIosMyGroupUsers
=
function
(
user
)
{
iosMyGroupUsers
=
user
;
iosKey
=
"myGroupUsers"
;
};
CHAT_DB
.
getGroupInfo
=
function
(
groupId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
//TODO IOS処理追加必要
iosGroupInfo
=
""
;
webkit
.
messageHandlers
.
getGroupInfo
.
postMessage
({
groupId
});
// JavascriptからObjective-cのメソッドを指定してコールバックを受ける方法がないため、
// 値が入るまで待たせている。
while
(
iosKey
==
"objc-processing"
)
{};
if
(
iosKey
==
"groupInfo"
)
{
iosKey
=
"objc-processing"
;
return
JSON
.
parse
(
iosGroupInfo
);
}
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getGroupInfo
(
groupId
));
}
};
CHAT_DB
.
getIosGroupInfo
=
function
(
info
)
{
iosGroupInfo
=
info
;
iosKey
=
"groupInfo"
;
};
CHAT_DB
.
getNameCardData
=
function
(
shopMemberId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
//TODO IOS処理追加必要
iosNameCardData
=
""
;
webkit
.
messageHandlers
.
getNameCardData
.
postMessage
({
shopMemberId
});
// JavascriptからObjective-cのメソッドを指定してコールバックを受ける方法がないため、
// 値が入るまで待たせている。
while
(
iosKey
==
"objc-processing"
)
{};
if
(
iosKey
==
"nameCardData"
)
{
iosKey
=
"objc-processing"
;
return
JSON
.
parse
(
iosNameCardData
);
}
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
return
JSON
.
parse
(
android
.
getNameCardData
(
shopMemberId
));
}
};
CHAT_DB
.
getIosNameCardData
=
function
(
nameCard
)
{
iosNameCardData
=
nameCard
;
iosKey
=
"nameCardData"
;
};
CHAT_DB
.
getMyGroupShopMemberByName
=
function
(
shopMemberName
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
//TODO IOS処理追加必要
iosMyGroupShopMemberByName
=
""
;
webkit
.
messageHandlers
.
getMyGroupShopMemberByName
.
postMessage
({
shopMemberName
});
// JavascriptからObjective-cのメソッドを指定してコールバックを受ける方法がないため、
// 値が入るまで待たせている。
while
(
iosKey
==
"objc-processing"
)
{};
if
(
iosKey
==
"myGroupShopMemberByName"
)
{
iosKey
=
"objc-processing"
;
return
JSON
.
parse
(
iosMyGroupShopMemberByName
);
}
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getMyGroupShopMemberByName
(
shopMemberName
));
}
};
CHAT_DB
.
getIosMyGroupShopMemberByName
=
function
(
user
)
{
iosMyGroupShopMemberByName
=
user
;
iosKey
=
"myGroupShopMemberByName"
;
};
CHAT_DB
.
getAllGroupShopMemberByName
=
function
(
shopMemberName
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
//TODO IOS処理追加必要
iosAllGroupShopMemberByName
=
""
;
webkit
.
messageHandlers
.
getAllGroupShopMemberByName
.
postMessage
({
shopMemberName
});
// JavascriptからObjective-cのメソッドを指定してコールバックを受ける方法がないため、
// 値が入るまで待たせている。
while
(
iosKey
==
"objc-processing"
)
{};
if
(
iosKey
==
"allGroupShopMemberByName"
)
{
iosKey
=
"objc-processing"
;
return
JSON
.
parse
(
iosAllGroupShopMemberByName
);
}
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getAllGroupShopMemberByName
(
shopMemberName
));
}
};
CHAT_DB
.
getIosAllGroupShopMemberByName
=
function
(
user
)
{
iosAllGroupShopMemberByName
=
user
;
iosKey
=
"allGroupShopMemberByName"
;
};
CHAT_DB
.
getGroupByName
=
function
(
groupName
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
//TODO IOS処理追加必要
iosGroupByName
=
""
;
webkit
.
messageHandlers
.
getGroupByName
.
postMessage
({
groupName
});
// JavascriptからObjective-cのメソッドを指定してコールバックを受ける方法がないため、
// 値が入るまで待たせている。
while
(
iosKey
==
"objc-processing"
)
{};
if
(
iosKey
==
"groupByName"
)
{
iosKey
=
"objc-processing"
;
return
JSON
.
parse
(
iosGroupByName
);
}
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getGroupByName
(
groupName
));
}
};
CHAT_DB
.
getIosGroupByName
=
function
(
group
)
{
iosGroupByName
=
group
;
iosKey
=
"groupByName"
;
};
CHAT_DB
.
getUsersInRoom
=
function
(
roomId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
//TODO IOS処理追加必要
iosUsersInRoom
=
""
;
webkit
.
messageHandlers
.
getUsersInRoom
.
postMessage
({
roomId
});
// JavascriptからObjective-cのメソッドを指定してコールバックを受ける方法がないため、
// 値が入るまで待たせている。
while
(
iosKey
==
"objc-processing"
)
{};
if
(
iosKey
==
"usersInRoom"
)
{
iosKey
=
"objc-processing"
;
return
JSON
.
parse
(
iosUsersInRoom
);
}
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
//String形式をJsonに変更してReturn
return
JSON
.
parse
(
android
.
getUsersInRoom
(
roomId
));
}
}
// アーカイブ一覧
var
iosArchiveList
;
CHAT_DB
.
getIosUsersInRoom
=
function
(
user
)
{
iosUsersInRoom
=
user
;
iosKey
=
"usersInRoom"
;
};
CHAT_DB
.
callGetArchiveList
=
function
()
{
// アーカイブ一覧
CHAT_DB
.
getArchiveList
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
iosArchiveList
=
""
;
webkit
.
messageHandlers
.
getArchiveList
.
postMessage
();
// JavascriptからObjective-cのメソッドを指定してコールバックを受ける方法がないため、
// 値が入るまで待たせている。
while
(
iosKey
==
"objc-processing"
)
{};
if
(
iosKey
==
"archiveList"
)
{
iosKey
=
"objc-processing"
;
return
JSON
.
parse
(
iosArchiveList
);
}
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
CHAT_UI
.
refreshArchiveScreen
();
// TODO
}
};
CHAT_DB
.
getIosArchiveList
=
function
(
archiveList
)
{
iosArchiveList
=
archiveList
;
CHAT_UI
.
refreshArchiveScreen
();
};
CHAT_DB
.
getArchiveList
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
iosArchiveList
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
// TODO
}
iosKey
=
"archiveList"
;
};
CHAT_DB
.
updateArchiveList
=
function
()
{
...
...
@@ -160,56 +341,49 @@ CHAT_DB.updateArchiveList = function() {
};
// アーカイブ一覧検索
var
iosSearchArchiveList
;
var
searchWord
;
CHAT_DB
.
callGetArchiveByName
=
function
(
keyword
)
{
CHAT_DB
.
getArchiveByName
=
function
(
archiveName
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
iosSearchArchiveList
=
""
;
searchWord
=
keyword
;
webkit
.
messageHandlers
.
getArchiveByName
.
postMessage
({
keyword
});
webkit
.
messageHandlers
.
getArchiveByName
.
postMessage
({
archiveName
});
// JavascriptからObjective-cのメソッドを指定してコールバックを受ける方法がないため、
// 値が入るまで待たせている。
while
(
iosKey
==
"objc-processing"
)
{};
if
(
iosKey
==
"searchArchiveList"
)
{
iosKey
=
"objc-processing"
;
return
JSON
.
parse
(
iosSearchArchiveList
);
}
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
ARCHIVE_UI
.
refreshSearchScreen
(
keyword
);
// TODO
}
};
CHAT_DB
.
getIosSearchArchiveList
=
function
(
archiveList
)
{
iosSearchArchiveList
=
archiveList
;
ARCHIVE_UI
.
refreshSearchScreen
(
searchWord
);
};
CHAT_DB
.
getArchiveByName
=
function
(
archiveName
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
return
JSON
.
parse
(
iosSearchArchiveList
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
// TODO
}
iosKey
=
"searchArchiveList"
;
};
// アーカイブ詳細
var
iosArchiveDetail
;
CHAT_DB
.
getIosArchiveDetail
=
function
(
archiveDetail
)
{
iosArchiveDetail
=
archiveDetail
;
CHAT_DB
.
callGetArchiveDetail
(
archiveDetail
.
archiveId
);
};
CHAT_DB
.
callGetArchiveDetail
=
function
(
archiveId
)
{
CHAT_DB
.
getArchiveDetail
=
function
(
archiveId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
iosArchiveDetail
=
""
;
webkit
.
messageHandlers
.
getArchiveDetail
.
postMessage
({
archiveId
});
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
CHAT_UI
.
refreshArchiveDetailScreen
(
archiveId
);
}
};
CHAT_DB
.
getArchiveDetail
=
function
()
{
if
(
CHAT_UTIL
.
isIOS
())
{
// JavascriptからObjective-cのメソッドを指定してコールバックを受ける方法がないため、
// 値が入るまで待たせている。
while
(
iosKey
==
"objc-processing"
)
{};
if
(
iosKey
==
"archiveDetail"
)
{
iosKey
=
"objc-processing"
;
return
JSON
.
parse
(
iosArchiveDetail
);
}
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
// TODO
}
};
CHAT_DB
.
getIosArchiveDetail
=
function
(
archiveDetail
)
{
iosArchiveDetail
=
archiveDetail
;
iosKey
=
"archiveDetail"
;
};
CHAT_DB
.
updateArchiveDetail
=
function
(
archiveId
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
updateArchiveDetail
.
postMessage
({
archiveId
});
...
...
public_new/js/chat-ui.js
View file @
fc5eb4c0
...
...
@@ -683,6 +683,17 @@ CHAT_UI.showConfirmView = function(isInvite) {
//todo android create room api
android
.
createChatRoom
(
"1"
,
userIdList
.
join
(
','
),
newRoomName
);
if
(
CHAT_UTIL
.
isIOS
())
{
// TODO
var
roomDic
=
{
roomType
:
"1"
,
userIdList
:
userIdList
.
join
(
','
),
roomName
:
newRoomName
};
webkit
.
messageHandlers
.
createChatRoom
.
postMessage
({
roomDic
});
}
/*socket.emit('createNewRoom', userIdList, encodedRoomName, function(newRoomId) {
socket.emit('joinRoom', newRoomId, newRoomName, function() {
...
...
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