修复语音房列表的bug
This commit is contained in:
parent
575a252f90
commit
60d5c427de
@ -13,11 +13,11 @@ class SCVariant1Config implements AppConfig {
|
|||||||
@override
|
@override
|
||||||
String get packageName => 'com.org.yumi';
|
String get packageName => 'com.org.yumi';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get apiHost => const String.fromEnvironment(
|
String get apiHost => const String.fromEnvironment(
|
||||||
'API_HOST',
|
'API_HOST',
|
||||||
defaultValue: 'http://10.0.2.2:1100/',
|
defaultValue: 'https://jvapi.haiyihy.com/',
|
||||||
); // 默认走模拟器宿主机地址,真机可通过 --dart-define=API_HOST 覆盖
|
); // 默认连线上环境,本地调试可通过 --dart-define=API_HOST 覆盖
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get imgHost => 'https://img.atuchat.com/'; // 测试图片服务器,上架前需替换为正式域名
|
String get imgHost => 'https://img.atuchat.com/'; // 测试图片服务器,上架前需替换为正式域名
|
||||||
@ -74,7 +74,7 @@ class SCVariant1Config implements AppConfig {
|
|||||||
int get primaryColor => 0xffFF5722; // 不同主色(橙色)
|
int get primaryColor => 0xffFF5722; // 不同主色(橙色)
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get tencentImAppid => '20035299';
|
String get tencentImAppid => '20036101';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get agoraRtcAppid => 'ceb9e2620d454bca9725f7a7f11d4019';
|
String get agoraRtcAppid => 'ceb9e2620d454bca9725f7a7f11d4019';
|
||||||
@ -86,7 +86,7 @@ class SCVariant1Config implements AppConfig {
|
|||||||
String get gameAppChannel => 'yumi';
|
String get gameAppChannel => 'yumi';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get bigBroadcastGroup => '@TGS#2XDMSPK5CR';
|
String get bigBroadcastGroup => '@TGS#2RUK4PK5C2';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get imAdmin => 'c2c_yumiadmin';
|
String get imAdmin => 'c2c_yumiadmin';
|
||||||
|
|||||||
@ -16,6 +16,9 @@ import 'package:yumi/shared/tools/sc_loading_manager.dart';
|
|||||||
import 'package:yumi/shared/tools/sc_version_utils.dart';
|
import 'package:yumi/shared/tools/sc_version_utils.dart';
|
||||||
import 'package:yumi/shared/data_sources/sources/repositories/sc_user_repository_impl.dart';
|
import 'package:yumi/shared/data_sources/sources/repositories/sc_user_repository_impl.dart';
|
||||||
import 'package:yumi/shared/business_logic/models/res/login_res.dart';
|
import 'package:yumi/shared/business_logic/models/res/login_res.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:yumi/services/audio/rtc_manager.dart';
|
||||||
|
import 'package:yumi/services/audio/rtm_manager.dart';
|
||||||
|
|
||||||
///密码账户登录
|
///密码账户登录
|
||||||
class SCLoginWithAccountPage extends StatefulWidget {
|
class SCLoginWithAccountPage extends StatefulWidget {
|
||||||
@ -365,6 +368,18 @@ class SCLoginWithAccountPageState extends State<SCLoginWithAccountPage>
|
|||||||
SCVersionUtils.checkReview(),
|
SCVersionUtils.checkReview(),
|
||||||
]);
|
]);
|
||||||
var user = (results[0] as SocialChatLoginRes);
|
var user = (results[0] as SocialChatLoginRes);
|
||||||
|
if (!mounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await Provider.of<RtcProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
).resetLocalRoomState(
|
||||||
|
fallbackRtmProvider: Provider.of<RtmProvider>(context, listen: false),
|
||||||
|
);
|
||||||
|
if (!mounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
AccountStorage().setCurrentUser(user);
|
AccountStorage().setCurrentUser(user);
|
||||||
SCLoadingManager.hide();
|
SCLoadingManager.hide();
|
||||||
DataPersistence.setString("Login_Account", account);
|
DataPersistence.setString("Login_Account", account);
|
||||||
|
|||||||
@ -21,6 +21,8 @@ import 'package:yumi/shared/data_sources/sources/local/user_manager.dart';
|
|||||||
import 'package:yumi/shared/business_logic/models/res/login_res.dart';
|
import 'package:yumi/shared/business_logic/models/res/login_res.dart';
|
||||||
import 'package:yumi/services/general/sc_app_general_manager.dart';
|
import 'package:yumi/services/general/sc_app_general_manager.dart';
|
||||||
import 'package:yumi/services/auth/user_profile_manager.dart';
|
import 'package:yumi/services/auth/user_profile_manager.dart';
|
||||||
|
import 'package:yumi/services/audio/rtc_manager.dart';
|
||||||
|
import 'package:yumi/services/audio/rtm_manager.dart';
|
||||||
import 'package:yumi/app/constants/sc_global_config.dart';
|
import 'package:yumi/app/constants/sc_global_config.dart';
|
||||||
|
|
||||||
import '../../../shared/business_logic/usecases/sc_custom_filtering_textinput_formatter.dart';
|
import '../../../shared/business_logic/usecases/sc_custom_filtering_textinput_formatter.dart';
|
||||||
@ -466,8 +468,8 @@ class _SCEditProfilePageState extends State<SCEditProfilePage> {
|
|||||||
textTheme: CupertinoTextThemeData(
|
textTheme: CupertinoTextThemeData(
|
||||||
// 在这里设置字体颜色、大小等样式
|
// 在这里设置字体颜色、大小等样式
|
||||||
dateTimePickerTextStyle: TextStyle(
|
dateTimePickerTextStyle: TextStyle(
|
||||||
color: Colors.white, // 设置字体颜色
|
color: Colors.white, // 设置字体颜色
|
||||||
fontSize: 16.sp, // 设置字体大小
|
fontSize: 16.sp, // 设置字体大小
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -542,6 +544,15 @@ class _SCEditProfilePageState extends State<SCEditProfilePage> {
|
|||||||
idToken,
|
idToken,
|
||||||
userProvider!.editUser!,
|
userProvider!.editUser!,
|
||||||
);
|
);
|
||||||
|
if (!mounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await Provider.of<RtcProvider>(context, listen: false).resetLocalRoomState(
|
||||||
|
fallbackRtmProvider: Provider.of<RtmProvider>(context, listen: false),
|
||||||
|
);
|
||||||
|
if (!mounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
AccountStorage().setCurrentUser(user);
|
AccountStorage().setCurrentUser(user);
|
||||||
SCLoadingManager.hide();
|
SCLoadingManager.hide();
|
||||||
SCNavigatorUtils.push(context, SCRoutes.home, clearStack: true);
|
SCNavigatorUtils.push(context, SCRoutes.home, clearStack: true);
|
||||||
|
|||||||
@ -34,21 +34,25 @@ class _SplashPageState extends State<SplashPage> {
|
|||||||
_startTimer(context);
|
_startTimer(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
///加载启动页配置
|
///加载启动页配置
|
||||||
void getStartPage() {
|
void getStartPage() {
|
||||||
SCConfigRepositoryImp().getStartPage().then((result) {
|
SCConfigRepositoryImp().getStartPage().then((result) {
|
||||||
startPages = result;
|
startPages = result;
|
||||||
if (startPages.length > 1) {
|
if (startPages.length > 1) {
|
||||||
int index = Random().nextInt(startPages.length);
|
int index = Random().nextInt(startPages.length);
|
||||||
currentStartPage = result[index];
|
currentStartPage = result[index];
|
||||||
} else {
|
} else if (startPages.isNotEmpty) {
|
||||||
currentStartPage = result.first;
|
currentStartPage = result.first;
|
||||||
}
|
} else {
|
||||||
|
currentStartPage = null;
|
||||||
status = 1;
|
}
|
||||||
setState(() {});
|
|
||||||
});
|
status = 1;
|
||||||
}
|
if (mounted) {
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import 'package:yumi/shared/tools/sc_lk_dialog_util.dart';
|
|||||||
import 'package:yumi/shared/tools/sc_loading_manager.dart';
|
import 'package:yumi/shared/tools/sc_loading_manager.dart';
|
||||||
import 'package:yumi/shared/tools/sc_gift_vap_svga_manager.dart';
|
import 'package:yumi/shared/tools/sc_gift_vap_svga_manager.dart';
|
||||||
import 'package:yumi/shared/data_sources/sources/repositories/sc_user_repository_impl.dart';
|
import 'package:yumi/shared/data_sources/sources/repositories/sc_user_repository_impl.dart';
|
||||||
|
import 'package:yumi/shared/data_sources/sources/local/data_persistence.dart';
|
||||||
import 'package:yumi/shared/business_logic/models/res/join_room_res.dart';
|
import 'package:yumi/shared/business_logic/models/res/join_room_res.dart';
|
||||||
import 'package:yumi/shared/business_logic/models/res/login_res.dart';
|
import 'package:yumi/shared/business_logic/models/res/login_res.dart';
|
||||||
import 'package:yumi/shared/business_logic/models/res/mic_res.dart';
|
import 'package:yumi/shared/business_logic/models/res/mic_res.dart';
|
||||||
@ -290,7 +291,15 @@ class RealTimeCommunicationManager extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
if (roomId == currenRoom?.roomProfile?.roomProfile?.id) {
|
if (roomId == currenRoom?.roomProfile?.roomProfile?.id) {
|
||||||
///最小化进入房间,或者进入的是同一个房间
|
///最小化进入房间,或者进入的是同一个房间
|
||||||
loadRoomInfo(currenRoom?.roomProfile?.roomProfile?.id ?? "");
|
final loaded = await loadRoomInfo(
|
||||||
|
currenRoom?.roomProfile?.roomProfile?.id ?? "",
|
||||||
|
);
|
||||||
|
if (!loaded) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!context.mounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Provider.of<SocialChatUserProfileManager>(
|
Provider.of<SocialChatUserProfileManager>(
|
||||||
context,
|
context,
|
||||||
listen: false,
|
listen: false,
|
||||||
@ -321,20 +330,29 @@ class RealTimeCommunicationManager extends ChangeNotifier {
|
|||||||
if (currenRoom != null) {
|
if (currenRoom != null) {
|
||||||
await exitCurrentVoiceRoomSession(false);
|
await exitCurrentVoiceRoomSession(false);
|
||||||
}
|
}
|
||||||
|
if (!context.mounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
rtmProvider = Provider.of<RtmProvider>(context, listen: false);
|
rtmProvider = Provider.of<RtmProvider>(context, listen: false);
|
||||||
SCLoadingManager.show(context: context);
|
SCLoadingManager.show(context: context);
|
||||||
currenRoom = await SCAccountRepository().entryRoom(
|
try {
|
||||||
roomId,
|
currenRoom = await SCAccountRepository().entryRoom(
|
||||||
pwd: pwd,
|
roomId,
|
||||||
redPackId: redPackId,
|
pwd: pwd,
|
||||||
needOpenRedenvelope: needOpenRedenvelope,
|
redPackId: redPackId,
|
||||||
);
|
needOpenRedenvelope: needOpenRedenvelope,
|
||||||
await initializeRoomSession(
|
);
|
||||||
needOpenRedenvelope: needOpenRedenvelope,
|
await initializeRoomSession(
|
||||||
redPackId: redPackId,
|
needOpenRedenvelope: needOpenRedenvelope,
|
||||||
);
|
redPackId: redPackId,
|
||||||
SCLoadingManager.hide();
|
);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
} catch (e) {
|
||||||
|
await resetLocalRoomState(fallbackRtmProvider: rtmProvider);
|
||||||
|
rethrow;
|
||||||
|
} finally {
|
||||||
|
SCLoadingManager.hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -551,6 +569,28 @@ class RealTimeCommunicationManager extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> resetLocalRoomState({RtmProvider? fallbackRtmProvider}) async {
|
||||||
|
rtmProvider ??= fallbackRtmProvider;
|
||||||
|
try {
|
||||||
|
SCHeartbeatUtils.cancelTimer();
|
||||||
|
SCHeartbeatUtils.cancelAnchorTimer();
|
||||||
|
final groupId = currenRoom?.roomProfile?.roomProfile?.roomAccount ?? "";
|
||||||
|
if (groupId.isNotEmpty) {
|
||||||
|
await rtmProvider?.quitGroup(groupId);
|
||||||
|
}
|
||||||
|
await engine?.leaveChannel();
|
||||||
|
await Future.delayed(const Duration(milliseconds: 100));
|
||||||
|
await engine?.release();
|
||||||
|
} catch (e) {
|
||||||
|
print('rtc清理本地房间状态出错: $e');
|
||||||
|
} finally {
|
||||||
|
engine = null;
|
||||||
|
rtmProvider?.cleanRoomData();
|
||||||
|
_clearData();
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///清空列表数据
|
///清空列表数据
|
||||||
void _clearData() {
|
void _clearData() {
|
||||||
roomRocketStatus = null;
|
roomRocketStatus = null;
|
||||||
@ -568,6 +608,7 @@ class RealTimeCommunicationManager extends ChangeNotifier {
|
|||||||
currenRoom = null;
|
currenRoom = null;
|
||||||
isMic = true;
|
isMic = true;
|
||||||
isMusicPlaying = false;
|
isMusicPlaying = false;
|
||||||
|
DataPersistence.setLastTimeRoomId("");
|
||||||
SCGiftVapSvgaManager().clearTasks();
|
SCGiftVapSvgaManager().clearTasks();
|
||||||
SCRoomUtils.closeAllDialogs();
|
SCRoomUtils.closeAllDialogs();
|
||||||
SCGlobalConfig.isEntryVehicleAnimation = true;
|
SCGlobalConfig.isEntryVehicleAnimation = true;
|
||||||
@ -853,8 +894,9 @@ class RealTimeCommunicationManager extends ChangeNotifier {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadRoomInfo(String roomId) {
|
Future<bool> loadRoomInfo(String roomId) async {
|
||||||
SCChatRoomRepository().specific(roomId).then((value) {
|
try {
|
||||||
|
final value = await SCChatRoomRepository().specific(roomId);
|
||||||
currenRoom = currenRoom?.copyWith(
|
currenRoom = currenRoom?.copyWith(
|
||||||
roomProfile: currenRoom?.roomProfile?.copyWith(
|
roomProfile: currenRoom?.roomProfile?.copyWith(
|
||||||
roomCounter: value.counter,
|
roomCounter: value.counter,
|
||||||
@ -879,7 +921,12 @@ class RealTimeCommunicationManager extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
});
|
return true;
|
||||||
|
} catch (e) {
|
||||||
|
await resetLocalRoomState(fallbackRtmProvider: rtmProvider);
|
||||||
|
SCTts.show("Room not exists");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///解锁麦位
|
///解锁麦位
|
||||||
|
|||||||
@ -12,6 +12,9 @@ import 'package:yumi/shared/data_sources/sources/local/user_manager.dart';
|
|||||||
import 'package:yumi/shared/data_sources/sources/repositories/sc_user_repository_impl.dart';
|
import 'package:yumi/shared/data_sources/sources/repositories/sc_user_repository_impl.dart';
|
||||||
import 'package:yumi/shared/business_logic/models/res/login_res.dart';
|
import 'package:yumi/shared/business_logic/models/res/login_res.dart';
|
||||||
import 'package:yumi/ui_kit/components/sc_tts.dart';
|
import 'package:yumi/ui_kit/components/sc_tts.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:yumi/services/audio/rtc_manager.dart';
|
||||||
|
import 'package:yumi/services/audio/rtm_manager.dart';
|
||||||
|
|
||||||
import '../../shared/data_sources/models/enum/sc_auth_type.dart';
|
import '../../shared/data_sources/models/enum/sc_auth_type.dart';
|
||||||
|
|
||||||
@ -55,6 +58,21 @@ class SocialChatAuthenticationManager extends ChangeNotifier {
|
|||||||
SCVersionUtils.checkReview(),
|
SCVersionUtils.checkReview(),
|
||||||
]);
|
]);
|
||||||
var user = (res[0] as SocialChatLoginRes);
|
var user = (res[0] as SocialChatLoginRes);
|
||||||
|
if (!context.mounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await Provider.of<RtcProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
).resetLocalRoomState(
|
||||||
|
fallbackRtmProvider: Provider.of<RtmProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (!context.mounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
AccountStorage().setCurrentUser(user);
|
AccountStorage().setCurrentUser(user);
|
||||||
SCLoadingManager.hide();
|
SCLoadingManager.hide();
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
@ -80,6 +98,21 @@ class SocialChatAuthenticationManager extends ChangeNotifier {
|
|||||||
SCVersionUtils.checkReview(),
|
SCVersionUtils.checkReview(),
|
||||||
]);
|
]);
|
||||||
var user = (res[0] as SocialChatLoginRes);
|
var user = (res[0] as SocialChatLoginRes);
|
||||||
|
if (!context.mounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await Provider.of<RtcProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
).resetLocalRoomState(
|
||||||
|
fallbackRtmProvider: Provider.of<RtmProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (!context.mounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
AccountStorage().setCurrentUser(user);
|
AccountStorage().setCurrentUser(user);
|
||||||
SCLoadingManager.hide();
|
SCLoadingManager.hide();
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|||||||
@ -31,13 +31,13 @@ class BaseNetworkClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _confD() {
|
void _confD() {
|
||||||
dio.transformer = BackgroundTransformer()..jsonDecodeCallback = parseJson;
|
dio.transformer = BackgroundTransformer()..jsonDecodeCallback = parseJson;
|
||||||
dio.options = BaseOptions(
|
dio.options = BaseOptions(
|
||||||
connectTimeout: const Duration(seconds: 12),
|
connectTimeout: const Duration(seconds: 12),
|
||||||
receiveTimeout: const Duration(seconds: 15),
|
receiveTimeout: const Duration(seconds: 30),
|
||||||
contentType: 'application/json; charset=UTF-8',
|
contentType: 'application/json; charset=UTF-8',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void init() {}
|
void init() {}
|
||||||
|
|
||||||
|
|||||||
@ -272,20 +272,11 @@ const Map<String, String> _localRouteOverrides = {
|
|||||||
"/user/vip/ability/update",
|
"/user/vip/ability/update",
|
||||||
};
|
};
|
||||||
|
|
||||||
bool _isLocalGatewayBaseUrl(String baseUrl) {
|
String _resolveRequestPath(String baseUrl, String path) {
|
||||||
final uri = Uri.tryParse(baseUrl);
|
// Prefer the known plain-text route when we have one.
|
||||||
if (uri == null) return false;
|
// This avoids environment-specific AES forwarding mismatches at the gateway.
|
||||||
return uri.host == "10.0.2.2" ||
|
return _localRouteOverrides[path] ?? path;
|
||||||
uri.host == "127.0.0.1" ||
|
}
|
||||||
uri.host == "localhost";
|
|
||||||
}
|
|
||||||
|
|
||||||
String _resolveRequestPath(String baseUrl, String path) {
|
|
||||||
if (!_isLocalGatewayBaseUrl(baseUrl)) {
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
return _localRouteOverrides[path] ?? path;
|
|
||||||
}
|
|
||||||
|
|
||||||
class NetworkClient extends BaseNetworkClient {
|
class NetworkClient extends BaseNetworkClient {
|
||||||
@override
|
@override
|
||||||
@ -465,7 +456,7 @@ class ResponseData<T> {
|
|||||||
|
|
||||||
/// 超时拦截器
|
/// 超时拦截器
|
||||||
class TimeOutInterceptor extends Interceptor {
|
class TimeOutInterceptor extends Interceptor {
|
||||||
static const int globalTimeoutSeconds = 15;
|
static const int globalTimeoutSeconds = 25;
|
||||||
static const String timeoutSecondsKey = "requestTimeoutSeconds";
|
static const String timeoutSecondsKey = "requestTimeoutSeconds";
|
||||||
final Map<String, Timer> _timers = {};
|
final Map<String, Timer> _timers = {};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user