Skip to content

Commit

Permalink
Added option to toggle layout api endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Decoder07 committed Aug 4, 2023
1 parent 28b2716 commit 40b5f09
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/hms_room_kit/lib/src/preview/preview_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class PreviewStore extends ChangeNotifier
//the HMSConfig for external usage
endPoint: initEndPoint);
dynamic value = await hmsSDKInteractor.getRoomLayout(
authToken: tokenData, endPoint: layoutAPIEndPoint);
authToken: tokenData, endPoint: getLayoutAPIEndpoint());
log(value.toString());
hmsSDKInteractor.startHMSLogger(
Constant.webRTCLogLevel, Constant.sdkLogLevel);
Expand Down
4 changes: 2 additions & 2 deletions packages/hms_room_kit/lib/src/service/app_debug_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AppDebugConfig {

static bool isDebugMode = false;
static bool isStreamingFlow = true;
static bool isMockLayoutAPI = true;
static bool isMockLayoutAPIEnabled = true;

static HMSIOSScreenshareConfig? iOSScreenshareConfig;

Expand All @@ -30,6 +30,6 @@ class AppDebugConfig {
isAudioMixerDisabled = true;
isAutoSimulcast = true;
isStreamingFlow = true;
isMockLayoutAPI = true;
isMockLayoutAPIEnabled = true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ class AudioTile extends StatelessWidget {
decoration: BoxDecoration(
color: const Color.fromRGBO(0, 0, 0, 0.9),
borderRadius: BorderRadius.circular(8)),
child: const Center(
child: Center(
child: Padding(
padding: EdgeInsets.all(4),
padding: const EdgeInsets.all(4),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
children: const [
NetworkIconWidget(),
PeerName(),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ class _PeerTileState extends State<PeerTile> {
decoration: BoxDecoration(
color: transparentBackgroundColor,
borderRadius: BorderRadius.circular(8)),
child: const Center(
child: Center(
child: Padding(
padding: EdgeInsets.only(
padding: const EdgeInsets.only(
left: 8.0, right: 4, top: 4, bottom: 4),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
children: const [
NetworkIconWidget(),
PeerName(),
DegradeText()
Expand Down
36 changes: 36 additions & 0 deletions packages/hmssdk_flutter/example/lib/app_settings_bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class _AppSettingsBottomSheetState extends State<AppSettingsBottomSheet> {
bool isDebugMode = false;
HMSAudioMode currentAudioMode = HMSAudioMode.VOICE;
bool isStreamingFlow = true;
bool isMockLayoutAPIEnabled = true;

var versions = {};

Expand Down Expand Up @@ -73,6 +74,9 @@ class _AppSettingsBottomSheetState extends State<AppSettingsBottomSheet> {
isStreamingFlow =
await Utilities.getBoolData(key: 'is_streaming_flow') ?? true;

isMockLayoutAPIEnabled =
await Utilities.getBoolData(key: 'is_mock_layout_api_enabled') ?? true;

WidgetsBinding.instance.addPostFrameCallback((_) {
setState(() {});
});
Expand All @@ -91,6 +95,7 @@ class _AppSettingsBottomSheetState extends State<AppSettingsBottomSheet> {
AppDebugConfig.skipPreview = skipPreview;
AppDebugConfig.isDebugMode = isDebugMode;
AppDebugConfig.isStreamingFlow = isStreamingFlow;
AppDebugConfig.isMockLayoutAPIEnabled = isMockLayoutAPIEnabled;
}

Future<void> _launchUrl() async {
Expand Down Expand Up @@ -252,6 +257,37 @@ class _AppSettingsBottomSheetState extends State<AppSettingsBottomSheet> {
setState(() {})
}),
),
ListTile(
horizontalTitleGap: 2,
enabled: false,
contentPadding: EdgeInsets.zero,
leading: SvgPicture.asset(
"packages/hms_room_kit/lib/src/assets/icons/screen_share.svg",
fit: BoxFit.scaleDown,
colorFilter:
ColorFilter.mode(themeDefaultColor, BlendMode.srcIn),
),
title: Text(
"Enable Mock Layout API",
semanticsLabel: "fl_enable_mock_layout_api",
style: GoogleFonts.inter(
fontSize: 14,
color: themeDefaultColor,
letterSpacing: 0.25,
fontWeight: FontWeight.w600),
),
trailing: CupertinoSwitch(
activeColor: hmsdefaultColor,
value: isMockLayoutAPIEnabled,
onChanged: (value) => {
isMockLayoutAPIEnabled = value,
Utilities.saveBoolData(
key: 'is_mock_layout_api_enabled',
value: value),
AppDebugConfig.isMockLayoutAPIEnabled = value,
setState(() {})
}),
),
ListTile(
horizontalTitleGap: 2,
enabled: false,
Expand Down

0 comments on commit 40b5f09

Please sign in to comment.