mirror of
https://github.com/TangSengDaoDao/TangSengDaoDaoWeb
synced 2025-06-02 23:39:30 +00:00
fix: update
This commit is contained in:
parent
441a09bc29
commit
acf90418e2
@ -24,7 +24,7 @@
|
|||||||
"react-spinners": "^0.11.0",
|
"react-spinners": "^0.11.0",
|
||||||
"react-viewer": "^3.2.2",
|
"react-viewer": "^3.2.2",
|
||||||
"sensitive-word-tool": "^1.1.9",
|
"sensitive-word-tool": "^1.1.9",
|
||||||
"wukongimjssdk": "^1.2.7"
|
"wukongimjssdk": "^1.2.11"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react-avatar-editor": "^13.0.0",
|
"@types/react-avatar-editor": "^13.0.0",
|
||||||
|
@ -242,6 +242,11 @@ export default class WKApp extends ProviderListener {
|
|||||||
private wsaddrs = new Array<string>(); // ws的连接地址
|
private wsaddrs = new Array<string>(); // ws的连接地址
|
||||||
private addrUsed = false; // 地址是否被使用
|
private addrUsed = false; // 地址是否被使用
|
||||||
|
|
||||||
|
isPC = false; // 是否是PC端
|
||||||
|
deviceId: string = ""; // 设备ID
|
||||||
|
deviceName: string = ""; // 设备名称
|
||||||
|
deviceModel: string = ""; // 设备型号
|
||||||
|
|
||||||
set notificationIsClose(v: boolean) {
|
set notificationIsClose(v: boolean) {
|
||||||
this._notificationIsClose = v;
|
this._notificationIsClose = v;
|
||||||
StorageService.shared.setItem("NotificationIsClose", v ? "1" : "");
|
StorageService.shared.setItem("NotificationIsClose", v ? "1" : "");
|
||||||
@ -255,6 +260,17 @@ export default class WKApp extends ProviderListener {
|
|||||||
startup() {
|
startup() {
|
||||||
WKApp.loginInfo.load(); // 加载登录信息
|
WKApp.loginInfo.load(); // 加载登录信息
|
||||||
|
|
||||||
|
// 是否是PC端
|
||||||
|
if ((window as any)?.__POWERED_ELECTRON__ || (window as any).__TAURI_IPC__) {
|
||||||
|
this.isPC = true;
|
||||||
|
console.log("PC端")
|
||||||
|
}
|
||||||
|
this.deviceId = this.getDeviceIdFromStorage();
|
||||||
|
this.deviceName = this.getOSAndVersion();
|
||||||
|
this.deviceModel = this.getBrandsFromUserAgent();
|
||||||
|
|
||||||
|
console.log("设备信息--->", this.deviceId, this.deviceName, this.deviceModel);
|
||||||
|
|
||||||
const themeMode = StorageService.shared.getItem("theme-mode");
|
const themeMode = StorageService.shared.getItem("theme-mode");
|
||||||
if (themeMode === "1") {
|
if (themeMode === "1") {
|
||||||
WKApp.config.themeMode = ThemeMode.dark;
|
WKApp.config.themeMode = ThemeMode.dark;
|
||||||
@ -267,7 +283,6 @@ export default class WKApp extends ProviderListener {
|
|||||||
this.wsaddrs = await WKApp.dataSource.commonDataSource.imConnectAddrs();
|
this.wsaddrs = await WKApp.dataSource.commonDataSource.imConnectAddrs();
|
||||||
}
|
}
|
||||||
if (this.wsaddrs.length > 0) {
|
if (this.wsaddrs.length > 0) {
|
||||||
console.log("connectAddrs--->", this.wsaddrs);
|
|
||||||
this.addrUsed = true;
|
this.addrUsed = true;
|
||||||
callback(this.wsaddrs[0]);
|
callback(this.wsaddrs[0]);
|
||||||
}
|
}
|
||||||
@ -312,12 +327,80 @@ export default class WKApp extends ProviderListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WKApp.remoteConfig.startRequestConfig();
|
WKApp.remoteConfig.startRequestConfig();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
getDeviceIdFromStorage() {
|
||||||
|
let deviceId = StorageService.shared.getItem("deviceId");
|
||||||
|
if (!deviceId || deviceId === "") {
|
||||||
|
deviceId = this.generateUUID();
|
||||||
|
StorageService.shared.setItem("deviceId", deviceId);
|
||||||
|
}
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
generateUUID() {
|
||||||
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (
|
||||||
|
c
|
||||||
|
) {
|
||||||
|
var r = (Math.random() * 16) | 0,
|
||||||
|
v = c == "x" ? r : (r & 0x3) | 0x8;
|
||||||
|
return v.toString(16);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getOSAndVersion() {
|
||||||
|
const userAgent: string = navigator.userAgent;
|
||||||
|
if (/Windows NT (\d+\.\d+)/i.test(userAgent)) {
|
||||||
|
const version = userAgent.match(/Windows NT (\d+\.\d+)/i)?.[1];
|
||||||
|
return `Windows ${version}`;
|
||||||
|
} else if (/Mac OS X (\d+_\d+(_\d+)?)/i.test(userAgent)) {
|
||||||
|
const version = userAgent.match(/Mac OS X (\d+_\d+(_\d+)?)/i)?.[1]?.replace(/_/g, ".");
|
||||||
|
return `MacOS ${version}`;
|
||||||
|
} else if (/Android (\d+(\.\d+)?)/i.test(userAgent)) {
|
||||||
|
const version = userAgent.match(/Android (\d+(\.\d+)?)/i)?.[1];
|
||||||
|
return `Android ${version}`;
|
||||||
|
} else if (/CPU (iPhone )?OS (\d+_\d+(_\d+)?)/i.test(userAgent)) {
|
||||||
|
const version = userAgent.match(/CPU (iPhone )?OS (\d+_\d+(_\d+)?)/i)?.[2]?.replace(/_/g, ".");
|
||||||
|
return `iOS ${version}`;
|
||||||
|
} else if (/Linux/i.test(userAgent)) {
|
||||||
|
return "Linux (version not available)";
|
||||||
|
} else {
|
||||||
|
return "Unknown OS and version";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getBrandsFromUserAgent(): string {
|
||||||
|
const userAgent: string = navigator.userAgent;
|
||||||
|
|
||||||
|
if (/Chrome\/(\d+)/i.test(userAgent)) {
|
||||||
|
const version = userAgent.match(/Chrome\/(\d+)/i)?.[1];
|
||||||
|
return `Chrome ${version}`;
|
||||||
|
} else if (/Firefox\/(\d+)/i.test(userAgent)) {
|
||||||
|
const version = userAgent.match(/Firefox\/(\d+)/i)?.[1];
|
||||||
|
return `Firefox ${version}`;
|
||||||
|
} else if (/Safari\/(\d+)/i.test(userAgent) && !/Chrome/i.test(userAgent)) {
|
||||||
|
const version = userAgent.match(/Version\/(\d+)/i)?.[1];
|
||||||
|
return `Safari ${version}`;
|
||||||
|
} else if (/Edge\/(\d+)/i.test(userAgent)) {
|
||||||
|
const version = userAgent.match(/Edge\/(\d+)/i)?.[1];
|
||||||
|
return `Edge ${version}`;
|
||||||
|
} else {
|
||||||
|
return "Unknown browser";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
startMain() {
|
startMain() {
|
||||||
this.connectIM();
|
this.connectIM();
|
||||||
WKApp.dataSource.contactsSync(); // 同步通讯录
|
WKApp.dataSource.contactsSync(); // 同步通讯录
|
||||||
ProhibitwordsService.shared.sync(); // 同步敏感词
|
ProhibitwordsService.shared.sync(); // 同步敏感词
|
||||||
|
|
||||||
|
WKApp.apiClient.get(`/user/devices/${WKApp.shared.deviceId}`).then((res) => {
|
||||||
|
if (res.id) {
|
||||||
|
WKSDK.shared().config.clientMsgDeviceId = res.id;
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
connectIM() {
|
connectIM() {
|
||||||
@ -335,6 +418,8 @@ export default class WKApp extends ProviderListener {
|
|||||||
this.notifyListener();
|
this.notifyListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 是否登录
|
// 是否登录
|
||||||
isLogined() {
|
isLogined() {
|
||||||
return WKApp.loginInfo.isLogined();
|
return WKApp.loginInfo.isLogined();
|
||||||
@ -374,14 +459,14 @@ export default class WKApp extends ProviderListener {
|
|||||||
return this.avatarChannel(c);
|
return this.avatarChannel(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
avatarOrg(orgID: string){
|
avatarOrg(orgID: string) {
|
||||||
const baseURl = WKApp.apiClient.config.apiURL;
|
const baseURl = WKApp.apiClient.config.apiURL;
|
||||||
return `${baseURl}organizations/${orgID}/logo`;
|
return `${baseURl}organizations/${orgID}/logo`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 我的用户头像发送改变
|
// 我的用户头像发送改变
|
||||||
myUserAvatarChange() {
|
myUserAvatarChange() {
|
||||||
this.changeChannelAvatarTag(new Channel(WKApp.loginInfo.uid||"", ChannelTypePerson));
|
this.changeChannelAvatarTag(new Channel(WKApp.loginInfo.uid || "", ChannelTypePerson));
|
||||||
}
|
}
|
||||||
|
|
||||||
changeChannelAvatarTag(channel: Channel) {
|
changeChannelAvatarTag(channel: Channel) {
|
||||||
@ -392,13 +477,13 @@ export default class WKApp extends ProviderListener {
|
|||||||
const t = new Date().getTime();
|
const t = new Date().getTime();
|
||||||
WKApp.loginInfo.setStorageItem(myAvatarTag, `${t}`);
|
WKApp.loginInfo.setStorageItem(myAvatarTag, `${t}`);
|
||||||
}
|
}
|
||||||
getChannelAvatarTag(channel? :Channel) {
|
getChannelAvatarTag(channel?: Channel) {
|
||||||
let myAvatarTag = "channelAvatarTag";
|
let myAvatarTag = "channelAvatarTag";
|
||||||
if (channel) {
|
if (channel) {
|
||||||
myAvatarTag = `channelAvatarTag:${channel.channelType}${channel.channelID}`;
|
myAvatarTag = `channelAvatarTag:${channel.channelType}${channel.channelID}`;
|
||||||
}
|
}
|
||||||
const tag = WKApp.loginInfo.getStorageItem(myAvatarTag);
|
const tag = WKApp.loginInfo.getStorageItem(myAvatarTag);
|
||||||
if(!tag) {
|
if (!tag) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
return tag;
|
return tag;
|
||||||
@ -529,9 +614,9 @@ export default class WKApp extends ProviderListener {
|
|||||||
return friendApplys;
|
return friendApplys;
|
||||||
}
|
}
|
||||||
|
|
||||||
public setFriendApplysUnreadCount(){
|
public setFriendApplysUnreadCount() {
|
||||||
if(WKApp.loginInfo.isLogined()){
|
if (WKApp.loginInfo.isLogined()) {
|
||||||
WKApp.apiClient.get(`/user/reddot/friendApply`).then(res=>{
|
WKApp.apiClient.get(`/user/reddot/friendApply`).then(res => {
|
||||||
WKApp.mittBus.emit('friend-applys-unread-count', res.count)
|
WKApp.mittBus.emit('friend-applys-unread-count', res.count)
|
||||||
WKApp.loginInfo.setStorageItem(`${WKApp.loginInfo.uid}-friend-applys-unread-count`, res.count);
|
WKApp.loginInfo.setStorageItem(`${WKApp.loginInfo.uid}-friend-applys-unread-count`, res.count);
|
||||||
WKApp.menus.refresh();
|
WKApp.menus.refresh();
|
||||||
|
@ -187,7 +187,7 @@ export class Conversation extends Component<ConversationProps> implements Conver
|
|||||||
this.uploadReadedIfNeed()
|
this.uploadReadedIfNeed()
|
||||||
}
|
}
|
||||||
|
|
||||||
this.vm.markUnread()
|
// this.vm.markUnread()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ export default class ConversationVM extends ProviderListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 选中消息
|
// 选中消息
|
||||||
checkedMessage(message: Message, checked: boolean): void {
|
checkedMessage(message: Message, checked: boolean): void {
|
||||||
let messageWrap = this.findMessageWithClientMsgNo(message.clientMsgNo)
|
let messageWrap = this.findMessageWithClientMsgNo(message.clientMsgNo)
|
||||||
@ -364,9 +364,7 @@ export default class ConversationVM extends ProviderListener {
|
|||||||
this.orgUnreadCount = unread
|
this.orgUnreadCount = unread
|
||||||
this.unreadCount = unread
|
this.unreadCount = unread
|
||||||
this.currentConversation = conversation
|
this.currentConversation = conversation
|
||||||
if (conversation.lastMessage) {
|
|
||||||
this.updateLastMessageIfNeed(new MessageWrap(conversation.lastMessage))
|
|
||||||
}
|
|
||||||
|
|
||||||
this.shouldShowHistorySplit = unread > 0
|
this.shouldShowHistorySplit = unread > 0
|
||||||
if (unread > 0) {
|
if (unread > 0) {
|
||||||
@ -378,6 +376,10 @@ export default class ConversationVM extends ProviderListener {
|
|||||||
this.browseToMessageSeq = conversation.lastMessage?.messageSeq || 0
|
this.browseToMessageSeq = conversation.lastMessage?.messageSeq || 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (conversation.lastMessage) {
|
||||||
|
this.updateLastMessageIfNeed(new MessageWrap(conversation.lastMessage))
|
||||||
|
}
|
||||||
|
|
||||||
WKSDK.shared().conversationManager.openConversation = conversation
|
WKSDK.shared().conversationManager.openConversation = conversation
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -681,7 +683,7 @@ export default class ConversationVM extends ProviderListener {
|
|||||||
this.lastMessage = message
|
this.lastMessage = message
|
||||||
change = true
|
change = true
|
||||||
}
|
}
|
||||||
if (change && this.showScrollToBottomBtn) {
|
if (change) {
|
||||||
this.refreshNewMsgCount()
|
this.refreshNewMsgCount()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -707,7 +709,6 @@ export default class ConversationVM extends ProviderListener {
|
|||||||
if (oldUnreadCount != this.unreadCount) {
|
if (oldUnreadCount != this.unreadCount) {
|
||||||
const conversation = WKSDK.shared().conversationManager.findConversation(this.channel)
|
const conversation = WKSDK.shared().conversationManager.findConversation(this.channel)
|
||||||
if (conversation) {
|
if (conversation) {
|
||||||
console.log("this.unreadCount--->",this.unreadCount)
|
|
||||||
conversation.unread = this.unreadCount
|
conversation.unread = this.unreadCount
|
||||||
WKSDK.shared().conversationManager.notifyConversationListeners(conversation, ConversationAction.update)
|
WKSDK.shared().conversationManager.notifyConversationListeners(conversation, ConversationAction.update)
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ export class EmojiPanel extends Component<EmojiPanelProps, EmojiPanelState> {
|
|||||||
this.setState({
|
this.setState({
|
||||||
emojis: this.emojiService.getAllEmoji()
|
emojis: this.emojiService.getAllEmoji()
|
||||||
})
|
})
|
||||||
// this.requestStickerCategory()
|
this.requestStickerCategory()
|
||||||
}
|
}
|
||||||
|
|
||||||
requestStickerCategory() {
|
requestStickerCategory() {
|
||||||
|
@ -182,14 +182,6 @@ export default class ChatPage extends Component<any> {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
updateConversation(channel: Channel) {
|
|
||||||
const conversation = WKSDK.shared().conversationManager.findConversation(channel)
|
|
||||||
if(conversation) {
|
|
||||||
conversation.unread = 0
|
|
||||||
conversation.lastMessage = undefined
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
render(): ReactNode {
|
render(): ReactNode {
|
||||||
return (
|
return (
|
||||||
<Provider
|
<Provider
|
||||||
|
@ -256,9 +256,7 @@ export class ChatVM extends ProviderListener {
|
|||||||
if (conversations && conversations.length > 0) {
|
if (conversations && conversations.length > 0) {
|
||||||
for (const conversation of conversations) {
|
for (const conversation of conversations) {
|
||||||
if(conversation.lastMessage?.content && conversation.lastMessage?.contentType == MessageContentType.text) {
|
if(conversation.lastMessage?.content && conversation.lastMessage?.contentType == MessageContentType.text) {
|
||||||
if (conversation.lastMessage.content.text) {
|
conversation.lastMessage.content.text = ProhibitwordsService.shared.filter(conversation.lastMessage.content.text)
|
||||||
conversation.lastMessage.content.text = ProhibitwordsService.shared.filter(conversation.lastMessage.content.text )
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
conversationWraps.push(new ConversationWrap(conversation))
|
conversationWraps.push(new ConversationWrap(conversation))
|
||||||
}
|
}
|
||||||
|
@ -13714,10 +13714,10 @@ ws@^8.13.0:
|
|||||||
resolved "https://registry.npmmirror.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc"
|
resolved "https://registry.npmmirror.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc"
|
||||||
integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==
|
integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==
|
||||||
|
|
||||||
wukongimjssdk@^1.2.7:
|
wukongimjssdk@^1.2.11:
|
||||||
version "1.2.10"
|
version "1.2.11"
|
||||||
resolved "https://registry.npmmirror.com/wukongimjssdk/-/wukongimjssdk-1.2.10.tgz#2aad714d9b04ca4ceae11bb527328bbeb715cb64"
|
resolved "https://registry.npmjs.org/wukongimjssdk/-/wukongimjssdk-1.2.11.tgz#0e08e0a8a7c5d068ee3be20ddcd46e9ad3c9badc"
|
||||||
integrity sha512-MX4NJoXGV+KnxZ6kK8UwsjLWEewGQudmCGV2d4/vrtI99Z78EkfWARPyVGX3jkqX0vwDzxid2JrcQewuo3vXGA==
|
integrity sha512-kupChGVdBEogDx85NYiL3rZJJRAr0eyDqC6/fuPMPoZmGan591qtdlqP65Kz0IgW7ifp7cpO2xxnlgUThPT3xQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/bignumber.js" "^5.0.0"
|
"@types/bignumber.js" "^5.0.0"
|
||||||
"@types/crypto-js" "^4.0.2"
|
"@types/crypto-js" "^4.0.2"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user