Commit 9959fead by Kim Peace

Fixed to load profile image from db

parent 52db6456
......@@ -140,21 +140,33 @@ Common.getProfileImgUrl = function (path) {
return "./img/noImage.png";
} else if (path.includes("/mnt")) {
const userInfo = path.split("/").reverse();
return (
serverInfo.cmsURL +
"/chatapi/user?profileFileName=" +
userInfo[0] +
"&profileGetLoginId=" +
userInfo[1] +
"&sid=" +
currentUserInfo.sid +
"&cmd=12"
);
if (deviceInfo.isiOS()) {
const receivedString = NativeBridgeDataSource.getCachedImage(userInfo[1]);
if (receivedString == "" || receivedString == undefined) {
return Common.generateProfileImgURLFromServer(userInfo[0], userInfo[1]);
}
return "data:image/"+userInfo[0].split('.').pop()+";base64," + receivedString;
}
return Common.generateProfileImgURLFromServer(userInfo[0], userInfo[1]);
} else {
return path;
}
};
Common.generateProfileImgURLFromServer = function (fileName, loginID) {
return (
serverInfo.cmsURL +
"/chatapi/user?profileFileName=" +
fileName +
"&profileGetLoginId=" +
loginID +
"&sid=" +
currentUserInfo.sid +
"&cmd=12"
);
};
Common.startCollaboration = function (collaborationType) {
if (deviceInfo.isAndroid()) {
if (
......
......@@ -142,7 +142,7 @@ const SOCKET_KEY = {
CREATE_TEXT: "createText",
CREATE_IMAGE: "createImage",
CREATE_VIDEO: "createVideo",
COMMUNICATION: "communication",
COMMUNICATION: "communication",
GET_GROUP_LIST: "getGroupList",
LEAVE_ROOM: "leaveRoom",
};
......@@ -190,6 +190,7 @@ const NATIVE_KEY_IOS = {
getUserListByLoginId: "getUserListByLoginId",
getMessageListFromMessageId: "getMessageListFromMessageId",
updatePreMessage: "updatePreMessage",
getCachedImage: "getCachedImage",
};
const BIZ_TASK_YELL_URL = "https://biztaskyell.abookcloud.com";
\ No newline at end of file
const BIZ_TASK_YELL_URL = "https://biztaskyell.abookcloud.com";
......@@ -415,4 +415,10 @@ NativeBridgeDataSource.getHostRequestFlg = function () {
} else {
return android.getHostRequestFlg();
}
};
\ No newline at end of file
};
NativeBridgeDataSource.getCachedImage = function (loginID) {
if (deviceInfo.isiOS()) {
return callNativeApp(NATIVE_KEY_IOS.getCachedImage, { loginID: loginID });
}
};
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