Compare commits
No commits in common. "de4a06be77de074d33cf9a8df63948b3c5ddb119" and "22d688f6f1540204427e84ecda4f31d23c06f57d" have entirely different histories.
de4a06be77
...
22d688f6f1
@ -1500,26 +1500,16 @@ class _MessageItem extends StatelessWidget {
|
||||
}
|
||||
_isOpeningCpInviteDialog = true;
|
||||
try {
|
||||
var latestState = _cpInviteStateForMessage(data);
|
||||
if (actionState != RoomCpInviteActionState.pending ||
|
||||
latestState != _CpInviteMessageState.pending) {
|
||||
_showCpInviteDialogFromMessage(
|
||||
data,
|
||||
cpInvite,
|
||||
actionState == RoomCpInviteActionState.pending
|
||||
? _cpInviteActionState(latestState)
|
||||
: actionState,
|
||||
);
|
||||
_showCpInviteDialogFromMessage(data, cpInvite, actionState);
|
||||
if (actionState != RoomCpInviteActionState.pending) {
|
||||
return;
|
||||
}
|
||||
latestState = await _latestCpInviteStateForMessage(data);
|
||||
if (!context.mounted) {
|
||||
final latestState = await _latestCpInviteStateForMessage(data);
|
||||
if (!context.mounted ||
|
||||
latestState == _CpInviteMessageState.pending ||
|
||||
!SmartDialog.checkExist(tag: RoomCpInviteDialog.dialogTag)) {
|
||||
return;
|
||||
}
|
||||
if (latestState != _CpInviteMessageState.pending) {
|
||||
_rememberCpInviteState(data, latestState);
|
||||
updateCall();
|
||||
}
|
||||
_showCpInviteDialogFromMessage(
|
||||
data,
|
||||
cpInvite,
|
||||
@ -1740,10 +1730,6 @@ class _MessageItem extends StatelessWidget {
|
||||
SCSystemInvitMessageRes? cpInvite,
|
||||
RoomCpInviteActionState actionState,
|
||||
) {
|
||||
final effectiveActionState =
|
||||
actionState == RoomCpInviteActionState.pending
|
||||
? _cpInviteActionState(_cpInviteStateForMessage(data))
|
||||
: actionState;
|
||||
final currentProfile = AccountStorage().getCurrentUser()?.userProfile;
|
||||
final currentName = _cpDisplayName(
|
||||
nickname: currentProfile?.userNickname,
|
||||
@ -1882,20 +1868,20 @@ class _MessageItem extends StatelessWidget {
|
||||
isInviter
|
||||
? RoomCpInviteDialogStyle.waiting
|
||||
: RoomCpInviteDialogStyle.incoming,
|
||||
actionState: effectiveActionState,
|
||||
actionState: actionState,
|
||||
countdownSeconds: _cpInviteSecondsLeft(data),
|
||||
descriptionText: _cpInviteDescriptionText(relationType),
|
||||
onAccept:
|
||||
!isInviter &&
|
||||
cpInvite != null &&
|
||||
effectiveActionState == RoomCpInviteActionState.pending &&
|
||||
actionState == RoomCpInviteActionState.pending &&
|
||||
applyId.isNotEmpty
|
||||
? () => _processCpInviteFromMessage(applyId, cpInvite, true, data)
|
||||
: null,
|
||||
onReject:
|
||||
!isInviter &&
|
||||
cpInvite != null &&
|
||||
effectiveActionState == RoomCpInviteActionState.pending &&
|
||||
actionState == RoomCpInviteActionState.pending &&
|
||||
applyId.isNotEmpty
|
||||
? () =>
|
||||
_processCpInviteFromMessage(applyId, cpInvite, false, data)
|
||||
@ -1994,20 +1980,6 @@ class _MessageItem extends StatelessWidget {
|
||||
: localState;
|
||||
}
|
||||
|
||||
void _rememberCpInviteState(
|
||||
Map<String, dynamic> data,
|
||||
_CpInviteMessageState state,
|
||||
) {
|
||||
if (state == _CpInviteMessageState.pending) {
|
||||
return;
|
||||
}
|
||||
final applyId = _cpApplyIdFromData(data);
|
||||
if (applyId.isEmpty) {
|
||||
return;
|
||||
}
|
||||
onCpInviteStateChanged?.call(applyId, state);
|
||||
}
|
||||
|
||||
_CpInviteMessageState? _cpInviteStateFromBackendStatus(String? status) {
|
||||
final text = status?.trim().toUpperCase() ?? "";
|
||||
if (text.isEmpty || text == "WAIT" || text == "WAITING") {
|
||||
@ -2366,7 +2338,6 @@ class _MessageItem extends StatelessWidget {
|
||||
data["expiredAt"],
|
||||
data["timeoutAt"],
|
||||
data["endTime"],
|
||||
data["dismissEndTime"],
|
||||
content["expireTime"],
|
||||
content["expiredTime"],
|
||||
content["expireAt"],
|
||||
@ -2386,9 +2357,8 @@ class _MessageItem extends StatelessWidget {
|
||||
content["createTime"],
|
||||
content["createdAt"],
|
||||
content["sendTime"],
|
||||
message.timestamp,
|
||||
]) ??
|
||||
now;
|
||||
(message.timestamp ?? now);
|
||||
return (startAt + 86400 - now).clamp(0, 86400).toInt();
|
||||
}
|
||||
|
||||
|
||||
@ -72,7 +72,6 @@ class _MessageSystemPageState extends State<MessageSystemPage> {
|
||||
RtmProvider? rtmProvider;
|
||||
V2TimConversation? currentConversation;
|
||||
List<V2TimMessage> currentConversationMessageList = [];
|
||||
final Map<String, _CpInviteMessageState> _localCpInviteStates = {};
|
||||
|
||||
BusinessLogicStrategy get _strategy => SCGlobalConfig.businessLogicStrategy;
|
||||
|
||||
@ -261,8 +260,6 @@ class _MessageSystemPageState extends State<MessageSystemPage> {
|
||||
: null,
|
||||
currentConversationMessageList:
|
||||
currentConversationMessageList,
|
||||
localCpInviteStates: _localCpInviteStates,
|
||||
onCpInviteStateChanged: _setLocalCpInviteState,
|
||||
updateCall: () {
|
||||
setState(() {});
|
||||
},
|
||||
@ -275,17 +272,6 @@ class _MessageSystemPageState extends State<MessageSystemPage> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _setLocalCpInviteState(String applyId, _CpInviteMessageState state) {
|
||||
final normalizedApplyId = applyId.trim();
|
||||
if (normalizedApplyId.isEmpty) {
|
||||
return;
|
||||
}
|
||||
_localCpInviteStates[normalizedApplyId] = state;
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class _MessageItem extends StatelessWidget {
|
||||
@ -294,9 +280,6 @@ class _MessageItem extends StatelessWidget {
|
||||
final V2TimMessage message;
|
||||
final V2TimMessage? preMessage;
|
||||
List<V2TimMessage> currentConversationMessageList = [];
|
||||
final Map<String, _CpInviteMessageState> localCpInviteStates;
|
||||
final void Function(String applyId, _CpInviteMessageState state)?
|
||||
onCpInviteStateChanged;
|
||||
Function updateCall;
|
||||
|
||||
///上一条
|
||||
@ -306,8 +289,6 @@ class _MessageItem extends StatelessWidget {
|
||||
required this.message,
|
||||
this.preMessage,
|
||||
required this.currentConversationMessageList,
|
||||
this.localCpInviteStates = const {},
|
||||
this.onCpInviteStateChanged,
|
||||
required this.updateCall,
|
||||
});
|
||||
|
||||
@ -573,26 +554,16 @@ class _MessageItem extends StatelessWidget {
|
||||
}
|
||||
_isOpeningCpInviteDialog = true;
|
||||
try {
|
||||
var latestState = _cpInviteStateForMessage(data);
|
||||
if (actionState != RoomCpInviteActionState.pending ||
|
||||
latestState != _CpInviteMessageState.pending) {
|
||||
_showCpInviteDialogFromMessage(
|
||||
data,
|
||||
cpInvite,
|
||||
actionState == RoomCpInviteActionState.pending
|
||||
? _cpInviteActionState(latestState)
|
||||
: actionState,
|
||||
);
|
||||
_showCpInviteDialogFromMessage(data, cpInvite, actionState);
|
||||
if (actionState != RoomCpInviteActionState.pending) {
|
||||
return;
|
||||
}
|
||||
latestState = await _latestCpInviteStateForMessage(data);
|
||||
if (!context.mounted) {
|
||||
final latestState = await _latestCpInviteStateForMessage(data);
|
||||
if (!context.mounted ||
|
||||
latestState == _CpInviteMessageState.pending ||
|
||||
!SmartDialog.checkExist(tag: RoomCpInviteDialog.dialogTag)) {
|
||||
return;
|
||||
}
|
||||
if (latestState != _CpInviteMessageState.pending) {
|
||||
_rememberCpInviteState(data, latestState);
|
||||
updateCall();
|
||||
}
|
||||
_showCpInviteDialogFromMessage(
|
||||
data,
|
||||
cpInvite,
|
||||
@ -756,10 +727,6 @@ class _MessageItem extends StatelessWidget {
|
||||
SCSystemInvitMessageRes? cpInvite,
|
||||
RoomCpInviteActionState actionState,
|
||||
) {
|
||||
final effectiveActionState =
|
||||
actionState == RoomCpInviteActionState.pending
|
||||
? _cpInviteActionState(_cpInviteStateForMessage(data))
|
||||
: actionState;
|
||||
final currentProfile = AccountStorage().getCurrentUser()?.userProfile;
|
||||
final currentName = _cpDisplayName(
|
||||
nickname: currentProfile?.userNickname,
|
||||
@ -855,12 +822,12 @@ class _MessageItem extends StatelessWidget {
|
||||
isInviter
|
||||
? RoomCpInviteDialogStyle.waiting
|
||||
: RoomCpInviteDialogStyle.incoming,
|
||||
actionState: effectiveActionState,
|
||||
actionState: actionState,
|
||||
countdownSeconds: _cpInviteSecondsLeft(data),
|
||||
descriptionText: _cpInviteDescriptionText(relationType),
|
||||
onAccept:
|
||||
!isInviter &&
|
||||
effectiveActionState == RoomCpInviteActionState.pending &&
|
||||
actionState == RoomCpInviteActionState.pending &&
|
||||
applyId.isNotEmpty
|
||||
? () => acceptOpt(
|
||||
applyId,
|
||||
@ -871,7 +838,7 @@ class _MessageItem extends StatelessWidget {
|
||||
: null,
|
||||
onReject:
|
||||
!isInviter &&
|
||||
effectiveActionState == RoomCpInviteActionState.pending &&
|
||||
actionState == RoomCpInviteActionState.pending &&
|
||||
applyId.isNotEmpty
|
||||
? () => rejectOpt(
|
||||
applyId,
|
||||
@ -888,7 +855,7 @@ class _MessageItem extends StatelessWidget {
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
final state = _cpInviteStateForMessage(data);
|
||||
final state = _cpInviteStateFromData(data);
|
||||
if (state == _CpInviteMessageState.pending || !_isCpInvitePayload(data)) {
|
||||
return null;
|
||||
}
|
||||
@ -923,10 +890,6 @@ class _MessageItem extends StatelessWidget {
|
||||
}
|
||||
|
||||
_CpInviteMessageState _cpInviteStateForMessage(Map<String, dynamic> data) {
|
||||
final localState = _localCpInviteStateForData(data);
|
||||
if (localState != null) {
|
||||
return localState;
|
||||
}
|
||||
final explicitState = _cpInviteStateFromConversation(data);
|
||||
if (explicitState != _CpInviteMessageState.pending) {
|
||||
return explicitState;
|
||||
@ -990,10 +953,6 @@ class _MessageItem extends StatelessWidget {
|
||||
Map<String, dynamic> currentData,
|
||||
) {
|
||||
final applyId = _cpApplyIdFromData(currentData);
|
||||
final localState = _localCpInviteStateForApplyId(applyId);
|
||||
if (localState != null) {
|
||||
return localState;
|
||||
}
|
||||
final currentState = _cpInviteStateFromData(currentData);
|
||||
if (currentState != _CpInviteMessageState.pending || applyId.isEmpty) {
|
||||
return currentState;
|
||||
@ -1015,32 +974,6 @@ class _MessageItem extends StatelessWidget {
|
||||
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];
|
||||
}
|
||||
|
||||
void _rememberCpInviteState(
|
||||
Map<String, dynamic> data,
|
||||
_CpInviteMessageState state,
|
||||
) {
|
||||
if (state == _CpInviteMessageState.pending) {
|
||||
return;
|
||||
}
|
||||
final applyId = _cpApplyIdFromData(data);
|
||||
if (applyId.isEmpty) {
|
||||
return;
|
||||
}
|
||||
onCpInviteStateChanged?.call(applyId, state);
|
||||
}
|
||||
|
||||
_CpInviteMessageState _cpInviteStateFromData(Map<String, dynamic> data) {
|
||||
final content = _cpContentMap(data);
|
||||
final values = <String>[
|
||||
@ -1178,14 +1111,12 @@ class _MessageItem extends StatelessWidget {
|
||||
data["expiredAt"],
|
||||
data["timeoutAt"],
|
||||
data["endTime"],
|
||||
data["dismissEndTime"],
|
||||
content["expireTime"],
|
||||
content["expiredTime"],
|
||||
content["expireAt"],
|
||||
content["expiredAt"],
|
||||
content["timeoutAt"],
|
||||
content["endTime"],
|
||||
content["dismissEndTime"],
|
||||
]);
|
||||
if (explicitExpireAt != null) {
|
||||
return (explicitExpireAt - now).clamp(0, 86400).toInt();
|
||||
@ -1198,9 +1129,8 @@ class _MessageItem extends StatelessWidget {
|
||||
content["createTime"],
|
||||
content["createdAt"],
|
||||
content["sendTime"],
|
||||
message.timestamp,
|
||||
]) ??
|
||||
now;
|
||||
(message.timestamp ?? now);
|
||||
return (startAt + 86400 - now).clamp(0, 86400).toInt();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user