From 18bbfdea54596ff1cef6ddb5d76d494c071455ea Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Mon, 18 Sep 2023 08:39:49 -0700 Subject: [PATCH] Only show appear offline if not in test mode (bug in test framework cannot scroll past) --- lib/views/addeditprofileview.dart | 47 ++++++++++++++++--------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/lib/views/addeditprofileview.dart b/lib/views/addeditprofileview.dart index 2d1478a1..094dcec2 100644 --- a/lib/views/addeditprofileview.dart +++ b/lib/views/addeditprofileview.dart @@ -268,28 +268,31 @@ class _AddEditProfileViewState extends State { secondary: Icon(CwtchIcons.favorite_24dp, color: Provider.of(context).current().mainTextColor), ), - // Auto start - SwitchListTile( - title: Text(AppLocalizations.of(context)!.profileAppearOffline, style: TextStyle(color: Provider.of(context).current().mainTextColor)), - subtitle: Text(AppLocalizations.of(context)!.profileAppearOfflineDescription), - value: Provider.of(context).appearOffline, - onChanged: (bool value) { - Provider.of(context, listen: false).appearOffline = value; - var onion = Provider.of(context, listen: false).onion; - if (!onion.isEmpty) { - Provider.of(context, listen: false).cwtch.SetProfileAttribute(onion, "profile.appear-offline", value ? "true" : "false"); - // if the profile is already enabled, then cycle the peer engine... - if (value == true && Provider.of(context, listen: false).enabled) { - Provider.of(context, listen: false).deactivatePeerEngine(context); - Provider.of(context, listen: false).cwtch.ActivatePeerEngine(onion); - Provider.of(context, listen: false).cwtch.ConfigureConnections(onion, false, false, false); - } - } - }, - activeTrackColor: Provider.of(context).theme.defaultButtonColor, - inactiveTrackColor: Provider.of(context).theme.defaultButtonDisabledColor, - secondary: Icon(CwtchIcons.favorite_24dp, color: Provider.of(context).current().mainTextColor), - ), + // Appear Offline + Visibility( + // FIXME don't show the disable switch in test mode...this is a bug relating to scrolling things into view + visible: Provider.of(context).onion.isNotEmpty && (EnvironmentConfig.TEST_MODE == false), + child: SwitchListTile( + title: Text(AppLocalizations.of(context)!.profileAppearOffline, style: TextStyle(color: Provider.of(context).current().mainTextColor)), + subtitle: Text(AppLocalizations.of(context)!.profileAppearOfflineDescription), + value: Provider.of(context).appearOffline, + onChanged: (bool value) { + Provider.of(context, listen: false).appearOffline = value; + var onion = Provider.of(context, listen: false).onion; + if (!onion.isEmpty) { + Provider.of(context, listen: false).cwtch.SetProfileAttribute(onion, "profile.appear-offline", value ? "true" : "false"); + // if the profile is already enabled, then cycle the peer engine... + if (value == true && Provider.of(context, listen: false).enabled) { + Provider.of(context, listen: false).deactivatePeerEngine(context); + Provider.of(context, listen: false).cwtch.ActivatePeerEngine(onion); + Provider.of(context, listen: false).cwtch.ConfigureConnections(onion, false, false, false); + } + } + }, + activeTrackColor: Provider.of(context).theme.defaultButtonColor, + inactiveTrackColor: Provider.of(context).theme.defaultButtonDisabledColor, + secondary: Icon(CwtchIcons.favorite_24dp, color: Provider.of(context).current().mainTextColor), + )), Visibility( visible: Provider.of(context).onion.isEmpty,