An open-source cross-platform alternative to AirDrop
fix: remove unavailable actions from the Troubleshoot page (#3494)
Shlomo5c1a0079fc56
diff --git a/app/lib/pages/troubleshoot_page.dart b/app/lib/pages/troubleshoot_page.dartindex 0a49cd09..e173de88 100644--- a/app/lib/pages/troubleshoot_page.dart+++ b/app/lib/pages/troubleshoot_page.dart@@ -27,32 +27,33 @@ class TroubleshootPage extends StatelessWidget {children: [Text(t.troubleshootPage.subTitle, textAlign: TextAlign.center),const SizedBox(height: 5),- _TroubleshootItem(- symptomText: t.troubleshootPage.firewall.symptom,- solutionText: t.troubleshootPage.firewall.solution(port: settings.port),- primaryButton: _FixButton(- label: t.troubleshootPage.fixButton,- onTapMap: {- TargetPlatform.windows: _CommandFixAction(- adminPrivileges: true,- commands: [- 'netsh advfirewall firewall add rule name="LocalSend" dir=in action=allow protocol=TCP localport=${settings.port}',- 'netsh advfirewall firewall add rule name="LocalSend" dir=in action=allow protocol=UDP localport=${settings.port}',- ],- ),- },- ),- secondaryButton: _FixButton(- label: t.troubleshootPage.firewall.openFirewall,- onTapMap: {- TargetPlatform.windows: _CommandFixAction(- adminPrivileges: false,- commands: ['wf'],- ),- TargetPlatform.macOS: _NativeFixAction(() => macos_channel.openFirewallSettings()),- },+ if (checkPlatformIsDesktop())+ _TroubleshootItem(+ symptomText: t.troubleshootPage.firewall.symptom,+ solutionText: t.troubleshootPage.firewall.solution(port: settings.port),+ primaryButton: _FixButton(+ label: t.troubleshootPage.fixButton,+ onTapMap: {+ TargetPlatform.windows: _CommandFixAction(+ adminPrivileges: true,+ commands: [+ 'netsh advfirewall firewall add rule name="LocalSend" dir=in action=allow protocol=TCP localport=${settings.port}',+ 'netsh advfirewall firewall add rule name="LocalSend" dir=in action=allow protocol=UDP localport=${settings.port}',+ ],+ ),+ },+ ),+ secondaryButton: _FixButton(+ label: t.troubleshootPage.firewall.openFirewall,+ onTapMap: {+ TargetPlatform.windows: _CommandFixAction(+ adminPrivileges: false,+ commands: ['wf'],+ ),+ TargetPlatform.macOS: _NativeFixAction(() => macos_channel.openFirewallSettings()),+ },+ ),),- ),_TroubleshootItem(symptomText: t.troubleshootPage.noDiscovery.symptom,solutionText: t.troubleshootPage.noDiscovery.solution,@@ -101,17 +102,17 @@ class _TroubleshootItemState extends State<_TroubleshootItem> {const SizedBox(height: 10),Text(t.troubleshootPage.solution),Text(widget.solutionText),- if (widget.primaryButton != null) ...[+ if (widget.primaryButton?.onTap != null || widget.secondaryButton?.onTap != null) ...[const SizedBox(height: 10),Wrap(runSpacing: 10,children: [- widget.primaryButton!,- if (widget.secondaryButton != null) ...[- const SizedBox(width: 10),+ if (widget.primaryButton?.onTap != null) widget.primaryButton!,+ if (widget.secondaryButton?.onTap != null) ...[+ if (widget.primaryButton?.onTap != null) const SizedBox(width: 10),widget.secondaryButton!,],- if (widget.primaryButton!.onTap?.commands != null) ...[+ if (widget.primaryButton?.onTap?.commands != null) ...[const SizedBox(width: 10),CustomIconButton(onPressed: () {