feat(message): add conversation notification mute feature
Some checks failed
Frontend CI / build-and-push-web (push) Failing after 57s
Frontend CI / ota-android (push) Successful in 10m53s
Frontend CI / build-android-apk (push) Failing after 1h12m12s

Add notification mute functionality for conversations with the following changes:

- Add notification_muted field to ConversationResponse and related DTOs
- Add notificationMutedMap to message store for tracking mute state
- Add setConversationNotificationMuted API method
- Integrate mute toggle in GroupInfoScreen and PrivateChatInfoScreen
- Skip system notifications for muted conversations
- Suppress vibration for muted conversations in WS handler
- Clean up selected mentions when @mentions are removed from text

Chore changes:
- Update PostCard bookmark icon from 'bookmark' to 'star'
- Refine card styles across AppsScreen, MaterialsScreen, and SubjectMaterialsScreen
- Improve week selector scrolling to center selected week in ScheduleScreen
This commit is contained in:
lafay
2026-04-25 21:23:22 +08:00
parent de0afa93a1
commit 5fa5403d6a
15 changed files with 252 additions and 101 deletions

View File

@@ -23,6 +23,7 @@ import { messageService } from '@/services/message';
import { ApiError } from '@/services/core';
import { messageRepository, conversationRepository } from '@/database';
import { messageManager } from '../../stores/message';
import { useMessageStore } from '../../stores/message/store';
import { userManager } from '../../stores/user';
import { Avatar, Text, Button, Loading, Divider } from '../../components/common';
import { User } from '../../types';
@@ -51,7 +52,7 @@ const PrivateChatInfoScreen: React.FC = () => {
const [isBlocked, setIsBlocked] = useState(false);
// 聊天设置状态
const [isMuted, setIsMuted] = useState(false);
const isMuted = useMessageStore(state => state.notificationMutedMap.get(conversationId) || false);
const [isPinned, setIsPinned] = useState(false);
// 加载用户信息
@@ -96,15 +97,12 @@ const PrivateChatInfoScreen: React.FC = () => {
loadChatSettings();
}, [loadUserInfo, loadChatSettings]);
// 切换免打扰仅本地状态实际需要API支持
// 切换免打扰
const toggleMute = async () => {
try {
const newValue = !isMuted;
setIsMuted(newValue);
// TODO: 调用API更新免打扰状态
// await conversationService.updateConversationMute(conversationId, newValue);
await messageManager.toggleNotificationMuted(conversationId, newValue);
} catch (error) {
setIsMuted(!isMuted);
Alert.alert('错误', '设置免打扰失败');
}
};