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