Merge pull request 'Only show appear offline if not in test mode (bug in test framework cannot scroll past)' (#723) from stable-blockers into trunk
continuous-integration/drone/push Build is failing Details

Reviewed-on: #723
This commit is contained in:
Sarah Jamie Lewis 2023-09-18 15:40:43 +00:00
commit a788540944
1 changed files with 25 additions and 22 deletions

View File

@ -268,28 +268,31 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
secondary: Icon(CwtchIcons.favorite_24dp, color: Provider.of<Settings>(context).current().mainTextColor),
),
// Auto start
SwitchListTile(
title: Text(AppLocalizations.of(context)!.profileAppearOffline, style: TextStyle(color: Provider.of<Settings>(context).current().mainTextColor)),
subtitle: Text(AppLocalizations.of(context)!.profileAppearOfflineDescription),
value: Provider.of<ProfileInfoState>(context).appearOffline,
onChanged: (bool value) {
Provider.of<ProfileInfoState>(context, listen: false).appearOffline = value;
var onion = Provider.of<ProfileInfoState>(context, listen: false).onion;
if (!onion.isEmpty) {
Provider.of<FlwtchState>(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<ProfileInfoState>(context, listen: false).enabled) {
Provider.of<ProfileInfoState>(context, listen: false).deactivatePeerEngine(context);
Provider.of<FlwtchState>(context, listen: false).cwtch.ActivatePeerEngine(onion);
Provider.of<FlwtchState>(context, listen: false).cwtch.ConfigureConnections(onion, false, false, false);
}
}
},
activeTrackColor: Provider.of<Settings>(context).theme.defaultButtonColor,
inactiveTrackColor: Provider.of<Settings>(context).theme.defaultButtonDisabledColor,
secondary: Icon(CwtchIcons.favorite_24dp, color: Provider.of<Settings>(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<ProfileInfoState>(context).onion.isNotEmpty && (EnvironmentConfig.TEST_MODE == false),
child: SwitchListTile(
title: Text(AppLocalizations.of(context)!.profileAppearOffline, style: TextStyle(color: Provider.of<Settings>(context).current().mainTextColor)),
subtitle: Text(AppLocalizations.of(context)!.profileAppearOfflineDescription),
value: Provider.of<ProfileInfoState>(context).appearOffline,
onChanged: (bool value) {
Provider.of<ProfileInfoState>(context, listen: false).appearOffline = value;
var onion = Provider.of<ProfileInfoState>(context, listen: false).onion;
if (!onion.isEmpty) {
Provider.of<FlwtchState>(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<ProfileInfoState>(context, listen: false).enabled) {
Provider.of<ProfileInfoState>(context, listen: false).deactivatePeerEngine(context);
Provider.of<FlwtchState>(context, listen: false).cwtch.ActivatePeerEngine(onion);
Provider.of<FlwtchState>(context, listen: false).cwtch.ConfigureConnections(onion, false, false, false);
}
}
},
activeTrackColor: Provider.of<Settings>(context).theme.defaultButtonColor,
inactiveTrackColor: Provider.of<Settings>(context).theme.defaultButtonDisabledColor,
secondary: Icon(CwtchIcons.favorite_24dp, color: Provider.of<Settings>(context).current().mainTextColor),
)),
Visibility(
visible: Provider.of<ProfileInfoState>(context).onion.isEmpty,