chore: update styles, add splash config, and improve search functionality
- Replace deprecated StyleSheet.absoluteFillObject with StyleSheet.absoluteFill (React Native 0.76+) - Add splash screen configuration in app.json - Fix duplicate UIBackgroundModes and add audio mode for iOS - Disable Android ripple effect on tab bar buttons - Improve SmartImage loading state to prevent unnecessary re-renders - Refactor ImageGrid to use mainUri with separate previewUrl for better preview handling - Add market search support with trade items tab in SearchScreen - Pass homeTab prop to SearchScreen for context-aware search behavior - Simplify fetchUnreadCount return type to void in MessageSyncService - Fix StatusBar import from expo to react-native in ChatScreen
This commit is contained in:
@@ -208,7 +208,7 @@ class MessageManager {
|
||||
return this.syncService.loadMoreMessages(conversationId, beforeSeq, limit);
|
||||
}
|
||||
|
||||
async fetchUnreadCount(): Promise<{ totalUnread: number; systemUnread: number }> {
|
||||
async fetchUnreadCount(): Promise<void> {
|
||||
return this.syncService.fetchUnreadCount();
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ export class MessageSyncService implements IMessageSyncService {
|
||||
/** 正在加载会话列表下一页 */
|
||||
private loadingMoreConversations = false;
|
||||
/** fetchUnreadCount 去重:复用 in-flight promise */
|
||||
private fetchUnreadCountPromise: Promise<{ totalUnread: number; systemUnread: number }> | null = null;
|
||||
private fetchUnreadCountPromise: Promise<void> | null = null;
|
||||
|
||||
constructor(
|
||||
getCurrentUserId: () => string | null,
|
||||
@@ -352,20 +352,19 @@ export class MessageSyncService implements IMessageSyncService {
|
||||
/**
|
||||
* 获取未读数(去重:复用 in-flight promise)
|
||||
*/
|
||||
async fetchUnreadCount(): Promise<{ totalUnread: number; systemUnread: number }> {
|
||||
async fetchUnreadCount(): Promise<void> {
|
||||
if (this.fetchUnreadCountPromise) {
|
||||
return this.fetchUnreadCountPromise;
|
||||
}
|
||||
this.fetchUnreadCountPromise = this.doFetchUnreadCount();
|
||||
try {
|
||||
const result = await this.fetchUnreadCountPromise;
|
||||
return result;
|
||||
await this.fetchUnreadCountPromise;
|
||||
} finally {
|
||||
this.fetchUnreadCountPromise = null;
|
||||
}
|
||||
}
|
||||
|
||||
private async doFetchUnreadCount(): Promise<{ totalUnread: number; systemUnread: number }> {
|
||||
private async doFetchUnreadCount(): Promise<void> {
|
||||
const store = useMessageStore.getState();
|
||||
|
||||
try {
|
||||
@@ -393,10 +392,8 @@ export class MessageSyncService implements IMessageSyncService {
|
||||
|
||||
// 服务端汇总未读为 0:不主动清零本地未读,等 fetchConversations 提供权威数据
|
||||
// 避免后端缓存竞态导致的未读数抖动
|
||||
return { totalUnread, systemUnread };
|
||||
} catch (error) {
|
||||
console.error('[MessageSyncService] 获取未读数失败:', error);
|
||||
return { totalUnread: 0, systemUnread: 0 };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user