红包bug 修复

This commit is contained in:
roxy 2026-05-11 10:21:47 +08:00
parent 85e6d88472
commit fec672dfb6
6 changed files with 78 additions and 23 deletions

View File

@ -502,7 +502,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 12;
DEVELOPMENT_TEAM = S9X2AJ2US9;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@ -511,7 +511,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.3.0;
MARKETING_VERSION = 1.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.org.yumiparty;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -693,7 +693,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/RunnerDebug.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 12;
DEVELOPMENT_TEAM = F33K8VUZ62;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@ -702,7 +702,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.3.0;
MARKETING_VERSION = 1.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.org.yumiparty;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -722,7 +722,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/RunnerRelease.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 12;
DEVELOPMENT_TEAM = F33K8VUZ62;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@ -731,7 +731,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.3.0;
MARKETING_VERSION = 1.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.org.yumiparty;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";

View File

@ -52,6 +52,7 @@ class VoiceRoomPage extends StatefulWidget {
class _VoiceRoomPageState extends State<VoiceRoomPage>
with SingleTickerProviderStateMixin {
static const int _chatTabCount = 3;
static const Duration _luckyGiftComboWindow = Duration(seconds: 3);
static const Duration _luckyGiftQueueDrainWindow = Duration(seconds: 3);
static const int _maxLuckyGiftTrackedAnimations = 5;
@ -65,7 +66,6 @@ class _VoiceRoomPageState extends State<VoiceRoomPage>
static const Duration _giftVisualBatchDedupeWindow = Duration(seconds: 4);
late TabController _tabController;
final List<Widget> _pages = [AllChatPage(), ChatPage(), GiftChatPage()];
late StreamSubscription _subscription;
final RoomGiftSeatFlightController _giftSeatFlightController =
RoomGiftSeatFlightController();
@ -80,7 +80,7 @@ class _VoiceRoomPageState extends State<VoiceRoomPage>
@override
void initState() {
super.initState();
_tabController = TabController(length: _pages.length, vsync: this);
_tabController = TabController(length: _chatTabCount, vsync: this);
_enableRoomVisualEffects();
_tabController.addListener(_handleTabChange);
_subscription = eventBus.on<SCGiveRoomLuckPageDisposeEvent>().listen((
@ -277,6 +277,7 @@ class _VoiceRoomPageState extends State<VoiceRoomPage>
@override
Widget build(BuildContext context) {
final chatRoomKey = _chatRoomKey(context);
return PopScope(
canPop: false,
onPopInvokedWithResult: (bool didPop, Object? result) {
@ -334,7 +335,7 @@ class _VoiceRoomPageState extends State<VoiceRoomPage>
children: [
Column(
children: [
_buildChatView(),
_buildChatView(chatRoomKey),
const RoomBottomWidget(showGiftComboButton: false),
],
),
@ -373,7 +374,7 @@ class _VoiceRoomPageState extends State<VoiceRoomPage>
}
///
Widget _buildChatView() {
Widget _buildChatView(String chatRoomKey) {
return Expanded(
child: Stack(
alignment: AlignmentDirectional.bottomEnd,
@ -418,7 +419,7 @@ class _VoiceRoomPageState extends State<VoiceRoomPage>
SCGlobalConfig.businessLogicStrategy
.getVoiceRoomTabDividerColor(),
controller: _tabController,
tabs: List<Widget>.generate(_pages.length, _buildImageTab),
tabs: List<Widget>.generate(_chatTabCount, _buildImageTab),
),
Expanded(
child: Container(
@ -436,7 +437,7 @@ class _VoiceRoomPageState extends State<VoiceRoomPage>
removeTop: true,
child: TabBarView(
controller: _tabController,
children: _pages,
children: _buildChatPages(chatRoomKey),
),
),
),
@ -449,6 +450,28 @@ class _VoiceRoomPageState extends State<VoiceRoomPage>
);
}
String _chatRoomKey(BuildContext context) {
final roomProfile =
context.read<RtcProvider>().currenRoom?.roomProfile?.roomProfile;
final roomId = roomProfile?.id?.trim() ?? "";
final groupId = roomProfile?.roomAccount?.trim() ?? "";
return "$roomId|$groupId";
}
List<Widget> _buildChatPages(String chatRoomKey) {
return <Widget>[
KeyedSubtree(
key: ValueKey("all_chat_$chatRoomKey"),
child: const AllChatPage(),
),
KeyedSubtree(key: ValueKey("chat_$chatRoomKey"), child: ChatPage()),
KeyedSubtree(
key: ValueKey("gift_chat_$chatRoomKey"),
child: const GiftChatPage(),
),
];
}
Widget _buildImageTab(int index) {
return Tab(
height: 32.w,

View File

@ -1048,6 +1048,9 @@ class RealTimeMessagingManager extends ChangeNotifier {
lastMsgID: null,
);
final messages = result.data ?? const <V2TimMessage>[];
if (!_isCurrentVoiceRoomGroup(normalizedGroupId)) {
return;
}
for (final message in messages.reversed) {
_addRoomHistoryMessage(normalizedGroupId, message);
}
@ -1722,6 +1725,11 @@ class RealTimeMessagingManager extends ChangeNotifier {
'';
}
bool _isCurrentVoiceRoomGroup(String groupId) {
final currentGroupId = _currentVoiceRoomGroupId();
return currentGroupId.isNotEmpty && currentGroupId == groupId.trim();
}
bool _shouldRouteUntrackedRoomRedPacketBroadcast(
String groupId,
V2TimMessage message,
@ -1956,8 +1964,11 @@ class RealTimeMessagingManager extends ChangeNotifier {
///
var fData = data["data"];
final payload = _broadcastPayloadMap(fData);
final packetId = _payloadText(payload['packetId']);
final packetRoomId = _payloadText(payload["roomId"]);
if (isRegionBroadcastGroup &&
!_isDelayedRoomRedPacketPayload(fData)) {
return;
}
if (!_isSameRoomRedPacketRegion(fData)) {
return;
}
@ -2554,6 +2565,7 @@ class RealTimeMessagingManager extends ChangeNotifier {
Future<void> sendRoomRedPacketBroadcast(
Map<String, dynamic> payload, {
String roomGroupId = '',
bool includeRegionBroadcast = false,
}) async {
if (payload.isEmpty) {
return;
@ -2564,13 +2576,15 @@ class RealTimeMessagingManager extends ChangeNotifier {
targetGroupIds.add(normalizedRoomGroupId);
}
var regionGroupId = roomRedPacketBroadcastGroupId?.trim() ?? '';
if (regionGroupId.isEmpty) {
await syncRoomRedPacketBroadcastGroup();
regionGroupId = roomRedPacketBroadcastGroupId?.trim() ?? '';
}
if (regionGroupId.isNotEmpty) {
targetGroupIds.add(regionGroupId);
if (includeRegionBroadcast) {
var regionGroupId = roomRedPacketBroadcastGroupId?.trim() ?? '';
if (regionGroupId.isEmpty) {
await syncRoomRedPacketBroadcastGroup();
regionGroupId = roomRedPacketBroadcastGroupId?.trim() ?? '';
}
if (regionGroupId.isNotEmpty) {
targetGroupIds.add(regionGroupId);
}
}
if (targetGroupIds.isEmpty) {
@ -2620,6 +2634,18 @@ class RealTimeMessagingManager extends ChangeNotifier {
return _isSameRegionBroadcastPayload(payload);
}
bool _isDelayedRoomRedPacketPayload(dynamic payload) {
final map = _broadcastPayloadMap(payload);
final packetMode = _payloadText(map['packetMode']).toUpperCase();
if (packetMode == 'DELAYED') {
return true;
}
if (packetMode == 'IMMEDIATE') {
return false;
}
return _payloadText(map['claimStartTime']).isNotEmpty;
}
bool _isSameRegionBroadcastPayload(dynamic payload) {
final map = _broadcastPayloadMap(payload);
final packetRegion = map['regionCode']?.toString().trim();

View File

@ -584,6 +584,9 @@ class OverlayManager {
if (message.isRegionBroadcast) {
return _shouldDisplayRegionBroadcastMessage(context, message);
}
if (message.type == 4) {
return _isCurrentRoomFloatingMessage(context, message);
}
if (SCGlobalConfig.isFloatingBroadcastRoomOnly) {
return _isCurrentRoomFloatingMessage(context, message);
}

View File

@ -664,7 +664,8 @@ class _RoomRedPacketSendPanelState extends State<RoomRedPacketSendPanel> {
currentUser?.userNickname ?? result.userName ?? 'Lucky Pack';
final senderAvatar = currentUser?.userAvatar ?? result.userAvatar ?? '';
final claimStartTime = (result.claimStartTime ?? '').trim();
if (_isDelayedRedPacketResult(result) && claimStartTime.isEmpty) {
final isDelayedPacket = _isDelayedRedPacketResult(result);
if (isDelayedPacket && claimStartTime.isEmpty) {
debugPrint(
'[RoomRedPacket][SendFallback] skip delayed local UI because server '
'claimStartTime is empty packetId=$packetId',
@ -718,6 +719,7 @@ class _RoomRedPacketSendPanelState extends State<RoomRedPacketSendPanel> {
rtmProvider.sendRoomRedPacketBroadcast(
payload,
roomGroupId: roomProfile?.roomAccount ?? '',
includeRegionBroadcast: isDelayedPacket,
),
);
OverlayManager().addMessage(
@ -730,7 +732,8 @@ class _RoomRedPacketSendPanelState extends State<RoomRedPacketSendPanel> {
toUserId: packetId,
coins: result.totalAmount ?? _selectedAmount,
number: result.totalCount ?? _selectedCount,
broadcastScope: SCFloatingMessage.broadcastScopeRegion,
broadcastScope:
isDelayedPacket ? SCFloatingMessage.broadcastScopeRegion : '',
priority: 1000,
),
);

View File

@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.3.0+11
version: 1.3.1+12
environment: