Compare commits

..

No commits in common. "bb9b92230ba02fc8ee9636cd70f385ca961461b7" and "2e1a3037b6c967605b84ec308f52dc75dfc1e37f" have entirely different histories.

View File

@ -146,7 +146,6 @@ class _SCMessageChatPageState extends State<SCMessageChatPage> {
SocialChatUserProfile? friend; SocialChatUserProfile? friend;
SCVipResourceRes? _selfVipChatBubble; SCVipResourceRes? _selfVipChatBubble;
bool _isSelfVipChatBubbleLoading = false; bool _isSelfVipChatBubbleLoading = false;
final Map<String, _CpInviteMessageState> _localCpInviteStates = {};
/// ///
bool showSend = false; bool showSend = false;
@ -603,8 +602,6 @@ class _SCMessageChatPageState extends State<SCMessageChatPage> {
currentConversationMessageList[i].sender == "administrator", currentConversationMessageList[i].sender == "administrator",
friend: friend, friend: friend,
currentConversationMessageList: currentConversationMessageList, currentConversationMessageList: currentConversationMessageList,
localCpInviteStates: _localCpInviteStates,
onCpInviteStateChanged: _setLocalCpInviteState,
updateCall: () { updateCall: () {
setState(() {}); setState(() {});
}, },
@ -617,17 +614,6 @@ class _SCMessageChatPageState extends State<SCMessageChatPage> {
); );
} }
void _setLocalCpInviteState(String applyId, _CpInviteMessageState state) {
final normalizedApplyId = applyId.trim();
if (normalizedApplyId.isEmpty) {
return;
}
_localCpInviteStates[normalizedApplyId] = state;
if (mounted) {
setState(() {});
}
}
List<V2TimMessage> _messagesInDisplayOrder(List<V2TimMessage> messages) { List<V2TimMessage> _messagesInDisplayOrder(List<V2TimMessage> messages) {
final indexedMessages = messages.asMap().entries.toList(); final indexedMessages = messages.asMap().entries.toList();
indexedMessages.sort((left, right) { indexedMessages.sort((left, right) {
@ -1191,9 +1177,6 @@ class _MessageItem extends StatelessWidget {
final SocialChatUserProfile? friend; final SocialChatUserProfile? friend;
bool isSystem = false; bool isSystem = false;
List<V2TimMessage> currentConversationMessageList = []; List<V2TimMessage> currentConversationMessageList = [];
final Map<String, _CpInviteMessageState> localCpInviteStates;
final void Function(String applyId, _CpInviteMessageState state)?
onCpInviteStateChanged;
Function updateCall; Function updateCall;
/// ///
@ -1207,8 +1190,6 @@ class _MessageItem extends StatelessWidget {
// this.userProfile, // this.userProfile,
this.isSystem = false, this.isSystem = false,
required this.currentConversationMessageList, required this.currentConversationMessageList,
this.localCpInviteStates = const {},
this.onCpInviteStateChanged,
this.friend, this.friend,
required this.updateCall, required this.updateCall,
}); });
@ -1545,7 +1526,7 @@ class _MessageItem extends StatelessWidget {
if (data == null || !_isCpInvitePayload(data)) { if (data == null || !_isCpInvitePayload(data)) {
return null; return null;
} }
if (_cpInviteStateForMessage(data) != _CpInviteMessageState.accepted) { if (_cpInviteStateFromData(data) != _CpInviteMessageState.accepted) {
return null; return null;
} }
final cpInvite = _cpInviteFromMessageData(data); final cpInvite = _cpInviteFromMessageData(data);
@ -1686,7 +1667,7 @@ class _MessageItem extends StatelessWidget {
if (data == null || !_isCpInvitePayload(data)) { if (data == null || !_isCpInvitePayload(data)) {
return null; return null;
} }
final state = _cpInviteStateForMessage(data); final state = _cpInviteStateFromData(data);
if (state == _CpInviteMessageState.pending) { if (state == _CpInviteMessageState.pending) {
return null; return null;
} }
@ -1941,10 +1922,6 @@ class _MessageItem extends StatelessWidget {
return; return;
} }
SmartDialog.dismiss(tag: RoomCpInviteDialog.dialogTag); SmartDialog.dismiss(tag: RoomCpInviteDialog.dialogTag);
onCpInviteStateChanged?.call(
applyId,
agree ? _CpInviteMessageState.accepted : _CpInviteMessageState.rejected,
);
_cpMessageLog( _cpMessageLog(
'process submitted applyId=$applyId agree=$agree ' 'process submitted applyId=$applyId agree=$agree '
'wait_backend_result=true', 'wait_backend_result=true',
@ -2032,10 +2009,6 @@ class _MessageItem extends StatelessWidget {
} }
_CpInviteMessageState _cpInviteStateForMessage(Map<String, dynamic> data) { _CpInviteMessageState _cpInviteStateForMessage(Map<String, dynamic> data) {
final localState = _localCpInviteStateForData(data);
if (localState != null) {
return localState;
}
final explicitState = _cpInviteStateFromConversation(data); final explicitState = _cpInviteStateFromConversation(data);
if (explicitState != _CpInviteMessageState.pending) { if (explicitState != _CpInviteMessageState.pending) {
return explicitState; return explicitState;
@ -2049,10 +2022,6 @@ class _MessageItem extends StatelessWidget {
Map<String, dynamic> currentData, Map<String, dynamic> currentData,
) { ) {
final applyId = _cpApplyIdFromData(currentData); final applyId = _cpApplyIdFromData(currentData);
final localState = _localCpInviteStateForApplyId(applyId);
if (localState != null) {
return localState;
}
final currentState = _cpInviteStateFromData(currentData); final currentState = _cpInviteStateFromData(currentData);
if (currentState != _CpInviteMessageState.pending || applyId.isEmpty) { if (currentState != _CpInviteMessageState.pending || applyId.isEmpty) {
return currentState; return currentState;
@ -2074,18 +2043,6 @@ class _MessageItem extends StatelessWidget {
return _CpInviteMessageState.pending; return _CpInviteMessageState.pending;
} }
_CpInviteMessageState? _localCpInviteStateForData(Map<String, dynamic> data) {
return _localCpInviteStateForApplyId(_cpApplyIdFromData(data));
}
_CpInviteMessageState? _localCpInviteStateForApplyId(String applyId) {
final normalizedApplyId = applyId.trim();
if (normalizedApplyId.isEmpty) {
return null;
}
return localCpInviteStates[normalizedApplyId];
}
bool _isDuplicateCpInviteMessageForConversation(Map<String, dynamic> data) { bool _isDuplicateCpInviteMessageForConversation(Map<String, dynamic> data) {
final currentKey = _cpInviteMessageDedupKey(data); final currentKey = _cpInviteMessageDedupKey(data);
if (currentKey.isEmpty) { if (currentKey.isEmpty) {
@ -2129,7 +2086,7 @@ class _MessageItem extends StatelessWidget {
if (!_isCpInvitePayload(data)) { if (!_isCpInvitePayload(data)) {
return ""; return "";
} }
final state = _cpInviteStateForMessage(data); final state = _cpInviteStateFromData(data);
final applyId = _cpApplyIdFromData(data); final applyId = _cpApplyIdFromData(data);
if (applyId.isEmpty) { if (applyId.isEmpty) {
return ""; return "";