fix(PostImages, CreatePostScreen): adjust image gap for improved layout consistency
Some checks failed
Frontend CI / build-and-push-web (push) Successful in 9m17s
Frontend CI / ota-android (push) Successful in 11m48s
Frontend CI / build-android-apk (push) Successful in 1h12m38s
Frontend CI / ota-android (pull_request) Has been skipped
Frontend CI / build-and-push-web (pull_request) Failing after 37s
Frontend CI / build-android-apk (pull_request) Has been cancelled

- Reduced image gap in PostImages and CreatePostScreen components from 12 to 4 (desktop) and 8 to 2 (mobile) for better spacing.
- Updated ImageGrid component to modify grid item widths for enhanced layout.
- Refactored PostRepository to improve local caching logic, ensuring non-blocking UI updates during cache writes.
- Introduced saveConversationsWithRelatedCache function to streamline conversation, user, and group data saving in the database.
This commit is contained in:
lafay
2026-03-25 17:08:11 +08:00
parent f875b417c8
commit 619f08275c
7 changed files with 91 additions and 49 deletions

View File

@@ -43,9 +43,7 @@ import {
saveUserCache,
updateMessageStatus,
deleteConversation as deleteConversationFromDb,
saveConversationsCache,
saveUsersCache,
saveGroupsCache,
saveConversationsWithRelatedCache,
} from '../services/database';
import { api } from '../services/api';
import { vibrateOnMessage } from '../services/messageVibrationService';
@@ -396,24 +394,17 @@ class MessageManager {
/** 与会话列表同步写入本地缓存(参与者 / 群 / 列表) */
private persistConversationListCache(): void {
const list = Array.from(this.state.conversations.values());
saveConversationsCache(list).catch(error => {
const users = list.flatMap(conv => [
...(conv.participants || []),
...(conv.last_message?.sender ? [conv.last_message.sender] : []),
]);
const groups = list
.map(conv => conv.group)
.filter((group): group is NonNullable<ConversationResponse['group']> => Boolean(group));
saveConversationsWithRelatedCache(list, users, groups).catch(error => {
console.error('[MessageManager] 持久化会话列表失败:', error);
});
saveUsersCache(
list.flatMap(conv => [
...(conv.participants || []),
...(conv.last_message?.sender ? [conv.last_message.sender] : []),
])
).catch(error => {
console.error('[MessageManager] 持久化会话相关用户失败:', error);
});
saveGroupsCache(
list
.map(conv => conv.group)
.filter((group): group is NonNullable<ConversationResponse['group']> => Boolean(group))
).catch(error => {
console.error('[MessageManager] 持久化会话相关群组失败:', error);
});
}
private recomputeConversationTotalUnread(): void {