diff --git a/packages/tsdaodaobase/src/App.tsx b/packages/tsdaodaobase/src/App.tsx index 3a0a443..aef9d5d 100644 --- a/packages/tsdaodaobase/src/App.tsx +++ b/packages/tsdaodaobase/src/App.tsx @@ -256,6 +256,12 @@ export default class WKApp extends ProviderListener { WKApp.loginInfo.load(); // 加载登录信息 const themeMode = StorageService.shared.getItem("theme-mode"); + const currentSystemThemeModeIsDark = window.matchMedia( + "(prefers-color-scheme: dark)" + ).matches; + if (!themeMode && currentSystemThemeModeIsDark) { + WKApp.config.themeMode = ThemeMode.dark; + } if (themeMode === "1") { WKApp.config.themeMode = ThemeMode.dark; } @@ -374,14 +380,16 @@ export default class WKApp extends ProviderListener { return this.avatarChannel(c); } - avatarOrg(orgID: string){ + avatarOrg(orgID: string) { const baseURl = WKApp.apiClient.config.apiURL; return `${baseURl}organizations/${orgID}/logo`; } // 我的用户头像发送改变 myUserAvatarChange() { - this.changeChannelAvatarTag(new Channel(WKApp.loginInfo.uid||"", ChannelTypePerson)); + this.changeChannelAvatarTag( + new Channel(WKApp.loginInfo.uid || "", ChannelTypePerson) + ); } changeChannelAvatarTag(channel: Channel) { @@ -389,17 +397,17 @@ export default class WKApp extends ProviderListener { if (channel) { myAvatarTag = `channelAvatarTag:${channel.channelType}${channel.channelID}`; } - console.log('changeChannelAvatarTag0----->') + console.log("changeChannelAvatarTag0----->"); const t = new Date().getTime(); WKApp.loginInfo.setStorageItem(myAvatarTag, `${t}`); } - getChannelAvatarTag(channel? :Channel) { + getChannelAvatarTag(channel?: Channel) { let myAvatarTag = "channelAvatarTag"; if (channel) { myAvatarTag = `channelAvatarTag:${channel.channelType}${channel.channelID}`; } const tag = WKApp.loginInfo.getStorageItem(myAvatarTag); - if(!tag) { + if (!tag) { return ""; } return tag; @@ -530,13 +538,16 @@ export default class WKApp extends ProviderListener { return friendApplys; } - public setFriendApplysUnreadCount(){ - if(WKApp.loginInfo.isLogined()){ - WKApp.apiClient.get(`/user/reddot/friendApply`).then(res=>{ - WKApp.mittBus.emit('friend-applys-unread-count', res.count) - WKApp.loginInfo.setStorageItem(`${WKApp.loginInfo.uid}-friend-applys-unread-count`, res.count); + public setFriendApplysUnreadCount() { + if (WKApp.loginInfo.isLogined()) { + WKApp.apiClient.get(`/user/reddot/friendApply`).then((res) => { + WKApp.mittBus.emit("friend-applys-unread-count", res.count); + WKApp.loginInfo.setStorageItem( + `${WKApp.loginInfo.uid}-friend-applys-unread-count`, + res.count + ); WKApp.menus.refresh(); - }) + }); } } @@ -551,7 +562,9 @@ export default class WKApp extends ProviderListener { // } // } if (WKApp.loginInfo.isLogined()) { - const num = WKApp.loginInfo.getStorageItem(`${WKApp.loginInfo.uid}-friend-applys-unread-count`) + const num = WKApp.loginInfo.getStorageItem( + `${WKApp.loginInfo.uid}-friend-applys-unread-count` + ); unreadCount = Number(num); } return unreadCount; @@ -577,7 +590,10 @@ export default class WKApp extends ProviderListener { // WKApp.endpointManager.invokes(EndpointCategory.friendApplyDataChange); // } if (WKApp.loginInfo.isLogined()) { - WKApp.loginInfo.setStorageItem(`${WKApp.loginInfo.uid}-friend-applys-unread-count`, '0') + WKApp.loginInfo.setStorageItem( + `${WKApp.loginInfo.uid}-friend-applys-unread-count`, + "0" + ); } await WKApp.apiClient.delete(`/user/reddot/friendApply`); }