An open-source cross-platform alternative to AirDrop
feat: move troubleshoot out of navigation
Tien Do Name11b5f69ecff
diff --git a/assets/CHANGELOG.md b/assets/CHANGELOG.mdindex 297bd117..12a0d5ad 100644--- a/assets/CHANGELOG.md+++ b/assets/CHANGELOG.md@@ -2,10 +2,13 @@- feat: allow deleting history entry when file could not be opened (by @TheGB0077)- feat: close message request when copied / opened link+- feat(desktop): move troubleshoot out of navigation into send page- feat(desktop): save last window position (by @TheGB0077)- feat(android): enable edge-to-edge mode+- feat(android): add monochrome app icons for Android 13 (by @h9419)- fix: clear selection after finished message transfer- fix(android, ios): fallback asset picker strings to English translation (by @TheGB0077)+- fix(linux): header bar glitches## 1.8.0 (2023-03-05)diff --git a/assets/i18n/_missing_translations_ar.json b/assets/i18n/_missing_translations_ar.jsonindex 90123116..529648c8 100644--- a/assets/i18n/_missing_translations_ar.json+++ b/assets/i18n/_missing_translations_ar.json@@ -29,7 +29,7 @@"multicastGroupWarning": "You might not be detected by other devices because you are using a custom multicast address. (default: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "Troubleshoot","subTitle": "This app does not work as expected? Here you can find common solutions.","solution": "Solution:",diff --git a/assets/i18n/_missing_translations_bn.json b/assets/i18n/_missing_translations_bn.jsonindex 08d687e7..bdaa0617 100644--- a/assets/i18n/_missing_translations_bn.json+++ b/assets/i18n/_missing_translations_bn.json@@ -27,7 +27,7 @@"multicastGroupWarning": "You might not be detected by other devices because you are using a custom multicast address. (default: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "Troubleshoot","subTitle": "This app does not work as expected? Here you can find common solutions.","solution": "Solution:",diff --git a/assets/i18n/_missing_translations_de.json b/assets/i18n/_missing_translations_de.jsonindex 57e67d58..9fe39ff5 100644--- a/assets/i18n/_missing_translations_de.json+++ b/assets/i18n/_missing_translations_de.json@@ -1,7 +1,6 @@{"@@info": ["Here are translations that exist in <en> but not in <de>.",- "After editing this file, you can run 'flutter pub run slang apply --locale=de' to quickly apply the newly added translations.",- "Congratulations! There are no missing translations! :)"+ "After editing this file, you can run 'flutter pub run slang apply --locale=de' to quickly apply the newly added translations."]}diff --git a/assets/i18n/_missing_translations_hu.json b/assets/i18n/_missing_translations_hu.jsonindex 3c29dccc..aca1951d 100644--- a/assets/i18n/_missing_translations_hu.json+++ b/assets/i18n/_missing_translations_hu.json@@ -1,7 +1,6 @@{"@@info": ["Here are translations that exist in <en> but not in <hu>.",- "After editing this file, you can run 'flutter pub run slang apply --locale=hu' to quickly apply the newly added translations.",- "Congratulations! There are no missing translations! :)"+ "After editing this file, you can run 'flutter pub run slang apply --locale=hu' to quickly apply the newly added translations."]}diff --git a/assets/i18n/_missing_translations_in.json b/assets/i18n/_missing_translations_in.jsonindex 71b01eef..d5cc1213 100644--- a/assets/i18n/_missing_translations_in.json+++ b/assets/i18n/_missing_translations_in.json@@ -27,7 +27,7 @@"multicastGroupWarning": "You might not be detected by other devices because you are using a custom multicast address. (default: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "Troubleshoot","subTitle": "This app does not work as expected? Here you can find common solutions.","solution": "Solution:",diff --git a/assets/i18n/_missing_translations_it.json b/assets/i18n/_missing_translations_it.jsonindex 5a09bafc..276af3b1 100644--- a/assets/i18n/_missing_translations_it.json+++ b/assets/i18n/_missing_translations_it.json@@ -27,7 +27,7 @@"multicastGroupWarning": "You might not be detected by other devices because you are using a custom multicast address. (default: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "Troubleshoot","subTitle": "This app does not work as expected? Here you can find common solutions.","solution": "Solution:",diff --git a/assets/i18n/_missing_translations_iw.json b/assets/i18n/_missing_translations_iw.jsonindex ff8562cc..984d36c8 100644--- a/assets/i18n/_missing_translations_iw.json+++ b/assets/i18n/_missing_translations_iw.json@@ -29,7 +29,7 @@"multicastGroupWarning": "You might not be detected by other devices because you are using a custom multicast address. (default: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "Troubleshoot","subTitle": "This app does not work as expected? Here you can find common solutions.","solution": "Solution:",diff --git a/assets/i18n/_missing_translations_ja.json b/assets/i18n/_missing_translations_ja.jsonindex 754e70e3..4b2a8bfe 100644--- a/assets/i18n/_missing_translations_ja.json+++ b/assets/i18n/_missing_translations_ja.json@@ -1,7 +1,6 @@{"@@info": ["Here are translations that exist in <en> but not in <ja>.",- "After editing this file, you can run 'flutter pub run slang apply --locale=ja' to quickly apply the newly added translations.",- "Congratulations! There are no missing translations! :)"+ "After editing this file, you can run 'flutter pub run slang apply --locale=ja' to quickly apply the newly added translations."]}diff --git a/assets/i18n/_missing_translations_ko.json b/assets/i18n/_missing_translations_ko.jsonindex 57da0c5b..f6a84bec 100644--- a/assets/i18n/_missing_translations_ko.json+++ b/assets/i18n/_missing_translations_ko.json@@ -27,7 +27,7 @@"multicastGroupWarning": "You might not be detected by other devices because you are using a custom multicast address. (default: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "Troubleshoot","subTitle": "This app does not work as expected? Here you can find common solutions.","solution": "Solution:",diff --git a/assets/i18n/_missing_translations_ne.json b/assets/i18n/_missing_translations_ne.jsonindex 0893fb8f..a3667369 100644--- a/assets/i18n/_missing_translations_ne.json+++ b/assets/i18n/_missing_translations_ne.json@@ -29,7 +29,7 @@"multicastGroupWarning": "You might not be detected by other devices because you are using a custom multicast address. (default: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "Troubleshoot","subTitle": "This app does not work as expected? Here you can find common solutions.","solution": "Solution:",diff --git a/assets/i18n/_missing_translations_pl.json b/assets/i18n/_missing_translations_pl.jsonindex ad70aaf8..f4355ec8 100644--- a/assets/i18n/_missing_translations_pl.json+++ b/assets/i18n/_missing_translations_pl.json@@ -29,7 +29,7 @@"multicastGroupWarning": "You might not be detected by other devices because you are using a custom multicast address. (default: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "Troubleshoot","subTitle": "This app does not work as expected? Here you can find common solutions.","solution": "Solution:",diff --git a/assets/i18n/_missing_translations_pt_BR.json b/assets/i18n/_missing_translations_pt_BR.jsonindex 95caeac0..55df4e33 100644--- a/assets/i18n/_missing_translations_pt_BR.json+++ b/assets/i18n/_missing_translations_pt_BR.json@@ -1,7 +1,6 @@{"@@info": ["Here are translations that exist in <en> but not in <pt-BR>.",- "After editing this file, you can run 'flutter pub run slang apply --locale=pt-BR' to quickly apply the newly added translations.",- "Congratulations! There are no missing translations! :)"+ "After editing this file, you can run 'flutter pub run slang apply --locale=pt-BR' to quickly apply the newly added translations."]}diff --git a/assets/i18n/_missing_translations_ru.json b/assets/i18n/_missing_translations_ru.jsonindex 194e6f62..5ead1b1e 100644--- a/assets/i18n/_missing_translations_ru.json+++ b/assets/i18n/_missing_translations_ru.json@@ -1,7 +1,6 @@{"@@info": ["Here are translations that exist in <en> but not in <ru>.",- "After editing this file, you can run 'flutter pub run slang apply --locale=ru' to quickly apply the newly added translations.",- "Congratulations! There are no missing translations! :)"+ "After editing this file, you can run 'flutter pub run slang apply --locale=ru' to quickly apply the newly added translations."]}diff --git a/assets/i18n/_missing_translations_sv.json b/assets/i18n/_missing_translations_sv.jsonindex d758de3b..5b1f78ec 100644--- a/assets/i18n/_missing_translations_sv.json+++ b/assets/i18n/_missing_translations_sv.json@@ -29,7 +29,7 @@"multicastGroupWarning": "You might not be detected by other devices because you are using a custom multicast address. (default: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "Troubleshoot","subTitle": "This app does not work as expected? Here you can find common solutions.","solution": "Solution:",diff --git a/assets/i18n/_missing_translations_tr.json b/assets/i18n/_missing_translations_tr.jsonindex 7258dffd..532f5349 100644--- a/assets/i18n/_missing_translations_tr.json+++ b/assets/i18n/_missing_translations_tr.json@@ -27,7 +27,7 @@"multicastGroupWarning": "You might not be detected by other devices because you are using a custom multicast address. (default: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "Troubleshoot","subTitle": "This app does not work as expected? Here you can find common solutions.","solution": "Solution:",diff --git a/assets/i18n/_missing_translations_uk.json b/assets/i18n/_missing_translations_uk.jsonindex 78925653..f173ec5f 100644--- a/assets/i18n/_missing_translations_uk.json+++ b/assets/i18n/_missing_translations_uk.json@@ -1,7 +1,6 @@{"@@info": ["Here are translations that exist in <en> but not in <uk>.",- "After editing this file, you can run 'flutter pub run slang apply --locale=uk' to quickly apply the newly added translations.",- "Congratulations! There are no missing translations! :)"+ "After editing this file, you can run 'flutter pub run slang apply --locale=uk' to quickly apply the newly added translations."]}diff --git a/assets/i18n/_missing_translations_zh_Hans.json b/assets/i18n/_missing_translations_zh_Hans.jsonindex e76443c3..ebd18bd8 100644--- a/assets/i18n/_missing_translations_zh_Hans.json+++ b/assets/i18n/_missing_translations_zh_Hans.json@@ -1,7 +1,6 @@{"@@info": ["Here are translations that exist in <en> but not in <zh-Hans>.",- "After editing this file, you can run 'flutter pub run slang apply --locale=zh-Hans' to quickly apply the newly added translations.",- "Congratulations! There are no missing translations! :)"+ "After editing this file, you can run 'flutter pub run slang apply --locale=zh-Hans' to quickly apply the newly added translations."]}diff --git a/assets/i18n/_missing_translations_zh_Hant_HK.json b/assets/i18n/_missing_translations_zh_Hant_HK.jsonindex e9abb3bc..5e09e5fd 100644--- a/assets/i18n/_missing_translations_zh_Hant_HK.json+++ b/assets/i18n/_missing_translations_zh_Hant_HK.json@@ -29,7 +29,7 @@"multicastGroupWarning": "You might not be detected by other devices because you are using a custom multicast address. (default: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "Troubleshoot","subTitle": "This app does not work as expected? Here you can find common solutions.","solution": "Solution:",diff --git a/assets/i18n/strings.i18n.json b/assets/i18n/strings.i18n.jsonindex a7ba4618..0a2a4aa4 100644--- a/assets/i18n/strings.i18n.json+++ b/assets/i18n/strings.i18n.json@@ -110,7 +110,7 @@"multicastGroupWarning": "You might not be detected by other devices because you are using a custom multicast address. (default: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "Troubleshoot","subTitle": "This app does not work as expected? Here you can find common solutions.","solution": "Solution:",diff --git a/assets/i18n/strings_cs.i18n.json b/assets/i18n/strings_cs.i18n.jsonindex 590f6a13..d05a241d 100644--- a/assets/i18n/strings_cs.i18n.json+++ b/assets/i18n/strings_cs.i18n.json@@ -109,7 +109,7 @@"multicastGroupWarning": "Je možné, že vás ostatní zařízení nezjistí, protože používáte vlastní adresu vícesměrového vysílání. (výchozí: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "Odstraňování problémů","subTitle": "Tato aplikace nefunguje podle očekávání? Zde najdete častá řešení.","solution": "Řešení:",diff --git a/assets/i18n/strings_de.i18n.json b/assets/i18n/strings_de.i18n.jsonindex 555b6a51..46ee7e55 100644--- a/assets/i18n/strings_de.i18n.json+++ b/assets/i18n/strings_de.i18n.json@@ -110,7 +110,7 @@"multicastGroupWarning": "Möglicherweise wirst du von anderen Geräten nicht erkannt, weil du eine benutzerdefinierte Multicast-Adresse verwendest. (Standard: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "Fehlerbehebung","subTitle": "Diese App funktioniert nicht wie erwartet? Hier findest du häufige Lösungsansätze.","solution": "Lösung:",diff --git a/assets/i18n/strings_es-ES.i18n.json b/assets/i18n/strings_es-ES.i18n.jsonindex 1e19dbf6..198938f6 100644--- a/assets/i18n/strings_es-ES.i18n.json+++ b/assets/i18n/strings_es-ES.i18n.json@@ -109,7 +109,7 @@"multicastGroupWarning": "Es posible que no seas visible para otros dispositivos porque estás utilizando una dirección multicast personalizada. (Dirección multicast por defecto: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "Solucionar problemas","subTitle": "¿La aplicación no funciona como se espera? Aquí puedes encontrar soluciones a problemas comunes.","solution": "Solución:",diff --git a/assets/i18n/strings_fr-FR.i18n.json b/assets/i18n/strings_fr-FR.i18n.jsonindex be585dd4..efd903a8 100644--- a/assets/i18n/strings_fr-FR.i18n.json+++ b/assets/i18n/strings_fr-FR.i18n.json@@ -109,7 +109,7 @@"multicastGroupWarning": "Il est possible que vous ne soyez pas détecté par d'autres appareils car vous utilisez une adresse multicast différente de celle par défaut. (par défaut: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "Dépannage","subTitle": "Cette application ne marche pas comme vous l'espérez? Vous pouvez ici trouver des solutions à des problèmes communs.","solution": "Solution:",diff --git a/assets/i18n/strings_hu.i18n.json b/assets/i18n/strings_hu.i18n.jsonindex 06052af6..8df08929 100644--- a/assets/i18n/strings_hu.i18n.json+++ b/assets/i18n/strings_hu.i18n.json@@ -110,7 +110,7 @@"multicastGroupWarning": "Előfordulhat, hogy más eszközök nem észlelik eszközét, mert egyéni multicast címet használ. (alapérték: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "Hibaelhárítás","subTitle": "Az alkalmazás nem a várt módon működik? Itt találhat általános megoldásokat.","solution": "Megoldás:",diff --git a/assets/i18n/strings_ja.i18n.json b/assets/i18n/strings_ja.i18n.jsonindex 1d3f0ab3..fb9d436e 100644--- a/assets/i18n/strings_ja.i18n.json+++ b/assets/i18n/strings_ja.i18n.json@@ -110,7 +110,7 @@"multicastGroupWarning": "カスタムのマルチキャストアドレスを使用しているため、他のデバイスから検出されない場合があります。(デフォルト: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "トラブルシューティング","subTitle": "アプリが期待通りに動作しませんか?ここでは一般的な解決策を紹介します。","solution": "解決策:",diff --git a/assets/i18n/strings_nl.i18n.json b/assets/i18n/strings_nl.i18n.jsonindex 7c11f623..2ef3716c 100644--- a/assets/i18n/strings_nl.i18n.json+++ b/assets/i18n/strings_nl.i18n.json@@ -109,7 +109,7 @@"multicastGroupWarning": "Je wordt mogelijk niet gedetecteerd door andere apparaten omdate je een aangepaste multicast-addres gebruikt. (standaard: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "Probleem oplossen","subTitle": "Werkt de app niet als verwacht? Hier kan je algemene oplossingen vinden.","solution": "Oplossing:",diff --git a/assets/i18n/strings_pt-BR.i18n.json b/assets/i18n/strings_pt-BR.i18n.jsonindex 05e34998..b795b2d7 100644--- a/assets/i18n/strings_pt-BR.i18n.json+++ b/assets/i18n/strings_pt-BR.i18n.json@@ -110,7 +110,7 @@"multicastGroupWarning": "Você pode estar indetectável para outros dispositivos por estar usando um endereço multicast customizado. (Padrão: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "Diagnostique problemas","subTitle": "Este aplicativo não está funcionando como esperado? Aqui você pode encontrar soluções comuns.","solution": "Solução:",diff --git a/assets/i18n/strings_ru.i18n.json b/assets/i18n/strings_ru.i18n.jsonindex 257bea10..3a7d9f52 100644--- a/assets/i18n/strings_ru.i18n.json+++ b/assets/i18n/strings_ru.i18n.json@@ -110,7 +110,7 @@"multicastGroupWarning": "Другие устройства могут Вас не обнаружить, поскольку Вы используете другой групповой адрес. (default: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "Устранение неисправностей","subTitle": "Это приложение не работает должным образом? Здесь можно найти общие решения проблем.","solution": "Решение:",diff --git a/assets/i18n/strings_uk.i18n.json b/assets/i18n/strings_uk.i18n.jsonindex 134938c9..cb96206c 100644--- a/assets/i18n/strings_uk.i18n.json+++ b/assets/i18n/strings_uk.i18n.json@@ -110,7 +110,7 @@"multicastGroupWarning": "Інші пристрої можуть Вас не виявити, оскільки Ви використовуєте іншу групову адресу. (default: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "Усунення несправностей","subTitle": "Цей додаток не працює належним чином? Тут можна знайти загальні рішення проблем.","solution": "Рішення:",diff --git a/assets/i18n/strings_zh-Hans.i18n.json b/assets/i18n/strings_zh-Hans.i18n.jsonindex cb8f7409..f5368831 100644--- a/assets/i18n/strings_zh-Hans.i18n.json+++ b/assets/i18n/strings_zh-Hans.i18n.json@@ -110,7 +110,7 @@"multicastGroupWarning": "由于正在使用自定义多播地址,你可能不会被其他设备检测到。(默认地址:{defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "故障排除","subTitle": "该应用没有按预期工作?您可以在这里找到常用解决方案。","solution": "解决方案:",diff --git a/assets/i18n/strings_zh-Hant_TW.i18n.json b/assets/i18n/strings_zh-Hant_TW.i18n.jsonindex 3091f8fe..36b7f1b1 100644--- a/assets/i18n/strings_zh-Hant_TW.i18n.json+++ b/assets/i18n/strings_zh-Hant_TW.i18n.json@@ -109,7 +109,7 @@"multicastGroupWarning": "您可能無法偵測到其他設備,因為您正在使用自訂多播位址. (預設值: {defaultMulticast})"}},- "troubleshootTab": {+ "troubleshootPage": {"title": "疑難排解","subTitle": "這個應用程式沒有如預期運作?在這裡您可以找到常見的解決方案。","solution": "解決方案:",diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dartindex bfb28176..de78d136 100644--- a/lib/pages/home_page.dart+++ b/lib/pages/home_page.dart@@ -8,7 +8,6 @@ import 'package:localsend_app/init.dart';import 'package:localsend_app/pages/tabs/receive_tab.dart';import 'package:localsend_app/pages/tabs/send_tab.dart';import 'package:localsend_app/pages/tabs/settings_tab.dart';-import 'package:localsend_app/pages/tabs/troubleshoot_tab.dart';import 'package:localsend_app/provider/selection/selected_sending_files_provider.dart';import 'package:localsend_app/theme.dart';import 'package:localsend_app/widget/responsive_builder.dart';@@ -16,8 +15,7 @@ import 'package:localsend_app/widget/responsive_builder.dart';enum HomeTab {receive(Icons.wifi),send(Icons.send),- settings(Icons.settings),- troubleshoot(Icons.healing);+ settings(Icons.settings);const HomeTab(this.icon);@@ -31,8 +29,6 @@ enum HomeTab {return t.sendTab.title;case HomeTab.settings:return t.settingsTab.title;- case HomeTab.troubleshoot:- return t.troubleshootTab.title;}}}@@ -142,7 +138,6 @@ class _HomePageState extends ConsumerState<HomePage> {ReceiveTab(),SendTab(),SettingsTab(),- TroubleshootTab(showTitle: true),],),if (_dragAndDropIndicator)@@ -170,13 +165,7 @@ class _HomePageState extends ConsumerState<HomePage> {? NavigationBar(selectedIndex: sizingInformation.isMobile ? min(_currentTab.index, 2) : _currentTab.index,onDestinationSelected: _goToPage,- destinations: [- HomeTab.receive,- HomeTab.send,- HomeTab.settings,- if (sizingInformation.isTabletOrDesktop)- HomeTab.troubleshoot,- ].map((tab) {+ destinations: HomeTab.values.map((tab) {return NavigationDestination(icon: Icon(tab.icon), label: tab.label);}).toList(),)diff --git a/lib/pages/tabs/send_tab.dart b/lib/pages/tabs/send_tab.dartindex 52a30df6..fa3ef5a7 100644--- a/lib/pages/tabs/send_tab.dart+++ b/lib/pages/tabs/send_tab.dart@@ -29,7 +29,6 @@ import 'package:localsend_app/widget/file_thumbnail.dart';import 'package:localsend_app/widget/list_tile/device_list_tile.dart';import 'package:localsend_app/widget/list_tile/device_placeholder_list_tile.dart';import 'package:localsend_app/widget/opacity_slideshow.dart';-import 'package:localsend_app/widget/responsive_builder.dart';import 'package:localsend_app/widget/responsive_list_view.dart';import 'package:localsend_app/widget/rotating_widget.dart';import 'package:routerino/routerino.dart';@@ -256,24 +255,14 @@ class _SendTabState extends ConsumerState<SendTab> {),);}),- ResponsiveBuilder(- builder: (sizingInformation) {- if (sizingInformation.isMobile) {- return Padding(- padding: const EdgeInsets.only(top: 10),- child: Center(- child: ElevatedButton(- onPressed: () async {- await context.push(() => const TroubleshootPage());- },- child: Text(t.troubleshootTab.title),- ),- ),- );- } else {- return Container();- }- },+ const SizedBox(height: 10),+ Center(+ child: ElevatedButton(+ onPressed: () async {+ await context.push(() => const TroubleshootPage());+ },+ child: Text(t.troubleshootPage.title),+ ),),const SizedBox(height: 20),Padding(diff --git a/lib/pages/tabs/troubleshoot_tab.dart b/lib/pages/tabs/troubleshoot_tab.dartdeleted file mode 100644index ab7e7f52..00000000--- a/lib/pages/tabs/troubleshoot_tab.dart+++ /dev/null@@ -1,214 +0,0 @@-import 'dart:io';--import 'package:flutter/foundation.dart';-import 'package:flutter/material.dart';-import 'package:flutter_riverpod/flutter_riverpod.dart';-import 'package:localsend_app/gen/strings.g.dart';-import 'package:localsend_app/provider/settings_provider.dart';-import 'package:localsend_app/util/cmd_helper.dart';-import 'package:localsend_app/util/platform_check.dart';-import 'package:localsend_app/widget/custom_icon_button.dart';-import 'package:localsend_app/widget/dialogs/not_available_on_platform_dialog.dart';-import 'package:localsend_app/widget/responsive_list_view.dart';--class TroubleshootTab extends ConsumerWidget {- final bool showTitle;-- const TroubleshootTab({required this.showTitle});-- @override- Widget build(BuildContext context, WidgetRef ref) {- final settings = ref.watch(settingsProvider);- return ResponsiveListView(- padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 30),- children: [- if (showTitle)- ...[- Text(t.troubleshootTab.title, style: Theme.of(context).textTheme.titleLarge, textAlign: TextAlign.center),- const SizedBox(height: 20),- ],- Text(t.troubleshootTab.subTitle, textAlign: TextAlign.center),- const SizedBox(height: 5),- _TroubleshootItem(- symptomText: t.troubleshootTab.firewall.symptom,- solutionText: t.troubleshootTab.firewall.solution(port: settings.port),- primaryButton: _FixButton(- label: t.troubleshootTab.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.troubleshootTab.firewall.openFirewall,- onTapMap: {- TargetPlatform.windows: _CommandFixAction(- adminPrivileges: false,- commands: ['wf'],- ),- },- ),- ),- _TroubleshootItem(- symptomText: t.troubleshootTab.noConnection.symptom,- solutionText: t.troubleshootTab.noConnection.solution,- ),- ],- );- }-}--class _TroubleshootItem extends StatefulWidget {- final String symptomText;- final String solutionText;- final _FixButton? primaryButton;- final _FixButton? secondaryButton;-- const _TroubleshootItem({- required this.symptomText,- required this.solutionText,- this.primaryButton,- this.secondaryButton,- });-- @override- State<_TroubleshootItem> createState() => _TroubleshootItemState();-}--class _TroubleshootItemState extends State<_TroubleshootItem> {- bool _showCommands = false;-- @override- Widget build(BuildContext context) {- return Padding(- padding: const EdgeInsets.only(top: 15),- child: Card(- child: Padding(- padding: const EdgeInsets.all(15),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(widget.symptomText, style: Theme.of(context).textTheme.titleMedium),- const SizedBox(height: 10),- Text(t.troubleshootTab.solution),- Text(widget.solutionText),- if (widget.primaryButton != null)- ...[- const SizedBox(height: 10),- Wrap(- runSpacing: 10,- children: [- widget.primaryButton!,- if (widget.secondaryButton != null)- ...[- const SizedBox(width: 10),- widget.secondaryButton!,- ],- if (widget.primaryButton!.onTap?.commands != null)- ...[- const SizedBox(width: 10),- CustomIconButton(- onPressed: () {- setState(() => _showCommands = !_showCommands);- },- child: const Icon(Icons.info),- ),- ],- ],- ),- AnimatedCrossFade(- crossFadeState: _showCommands ? CrossFadeState.showSecond : CrossFadeState.showFirst,- duration: const Duration(milliseconds: 200),- firstChild: Container(),- secondChild: SelectionArea(- child: Column(- children: [- ...?widget.primaryButton?.onTap?.commands?.map((cmd) {- return Padding(- padding: const EdgeInsets.only(top: 10),- child: Text(cmd, style: const TextStyle(fontFamily: 'RobotoMono')),- );- }),- ],- ),- ),- ),- ],- ],- ),- ),- ),- );- }-}--class _FixButton extends StatelessWidget {- final String label;- final Map<TargetPlatform, _FixAction> onTapMap;- final _FixAction? onTap;-- _FixButton({- required this.label,- required this.onTapMap,- }) : onTap = onTapMap[defaultTargetPlatform];-- @override- Widget build(BuildContext context) {- return ElevatedButton(- style: ElevatedButton.styleFrom(- backgroundColor: Theme.of(context).buttonTheme.colorScheme!.primary,- foregroundColor: Theme.of(context).buttonTheme.colorScheme!.onPrimary,- ),- onPressed: () async {- if (onTap != null) {- onTap!.runFix();- } else {- await showDialog(- context: context,- builder: (_) => NotAvailableOnPlatformDialog(platforms: onTapMap.keys.toList()),- );- }- },- child: Text(label),- );- }-}--abstract class _FixAction {- void runFix();-- List<String>? get commands;-}--class _CommandFixAction extends _FixAction {- final bool adminPrivileges;-- @override- final List<String> commands;-- _CommandFixAction({- required this.adminPrivileges,- required this.commands,- });-- @override- void runFix() async {- if (adminPrivileges) {- if (checkPlatform([TargetPlatform.windows])) {- await runWindowsCommandAsAdmin(commands);- } else {- throw 'Admin privileges are only implemented on Windows.';- }- } else {- for (final c in commands) {- await Process.run(c, [], runInShell: true);- }- }- }-}-diff --git a/lib/pages/troubleshoot_page.dart b/lib/pages/troubleshoot_page.dartindex 782722f9..76868d17 100644--- a/lib/pages/troubleshoot_page.dart+++ b/lib/pages/troubleshoot_page.dart@@ -1,18 +1,212 @@+import 'dart:io';++import 'package:flutter/foundation.dart';import 'package:flutter/material.dart';+import 'package:flutter_riverpod/flutter_riverpod.dart';import 'package:localsend_app/gen/strings.g.dart';-import 'package:localsend_app/pages/tabs/troubleshoot_tab.dart';+import 'package:localsend_app/provider/settings_provider.dart';+import 'package:localsend_app/util/cmd_helper.dart';+import 'package:localsend_app/util/platform_check.dart';+import 'package:localsend_app/widget/custom_icon_button.dart';+import 'package:localsend_app/widget/dialogs/not_available_on_platform_dialog.dart';+import 'package:localsend_app/widget/responsive_list_view.dart';-/// This is just a wrapper around [TroubleshootTab].-class TroubleshootPage extends StatelessWidget {- const TroubleshootPage({Key? key}) : super(key: key);+class TroubleshootPage extends ConsumerWidget {+ const TroubleshootPage();@override- Widget build(BuildContext context) {+ Widget build(BuildContext context, WidgetRef ref) {+ final settings = ref.watch(settingsProvider);return Scaffold(appBar: AppBar(- title: Text(t.troubleshootTab.title),+ title: Text(t.troubleshootPage.title),+ ),+ body: ResponsiveListView(+ padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 30),+ 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'],+ ),+ },+ ),+ ),+ _TroubleshootItem(+ symptomText: t.troubleshootPage.noConnection.symptom,+ solutionText: t.troubleshootPage.noConnection.solution,+ ),+ ],),- body: const TroubleshootTab(showTitle: false),);}}++class _TroubleshootItem extends StatefulWidget {+ final String symptomText;+ final String solutionText;+ final _FixButton? primaryButton;+ final _FixButton? secondaryButton;++ const _TroubleshootItem({+ required this.symptomText,+ required this.solutionText,+ this.primaryButton,+ this.secondaryButton,+ });++ @override+ State<_TroubleshootItem> createState() => _TroubleshootItemState();+}++class _TroubleshootItemState extends State<_TroubleshootItem> {+ bool _showCommands = false;++ @override+ Widget build(BuildContext context) {+ return Padding(+ padding: const EdgeInsets.only(top: 15),+ child: Card(+ child: Padding(+ padding: const EdgeInsets.all(15),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(widget.symptomText, style: Theme.of(context).textTheme.titleMedium),+ const SizedBox(height: 10),+ Text(t.troubleshootPage.solution),+ Text(widget.solutionText),+ if (widget.primaryButton != null)+ ...[+ const SizedBox(height: 10),+ Wrap(+ runSpacing: 10,+ children: [+ widget.primaryButton!,+ if (widget.secondaryButton != null)+ ...[+ const SizedBox(width: 10),+ widget.secondaryButton!,+ ],+ if (widget.primaryButton!.onTap?.commands != null)+ ...[+ const SizedBox(width: 10),+ CustomIconButton(+ onPressed: () {+ setState(() => _showCommands = !_showCommands);+ },+ child: const Icon(Icons.info),+ ),+ ],+ ],+ ),+ AnimatedCrossFade(+ crossFadeState: _showCommands ? CrossFadeState.showSecond : CrossFadeState.showFirst,+ duration: const Duration(milliseconds: 200),+ firstChild: Container(),+ secondChild: SelectionArea(+ child: Column(+ children: [+ ...?widget.primaryButton?.onTap?.commands?.map((cmd) {+ return Padding(+ padding: const EdgeInsets.only(top: 10),+ child: Text(cmd, style: const TextStyle(fontFamily: 'RobotoMono')),+ );+ }),+ ],+ ),+ ),+ ),+ ],+ ],+ ),+ ),+ ),+ );+ }+}++class _FixButton extends StatelessWidget {+ final String label;+ final Map<TargetPlatform, _FixAction> onTapMap;+ final _FixAction? onTap;++ _FixButton({+ required this.label,+ required this.onTapMap,+ }) : onTap = onTapMap[defaultTargetPlatform];++ @override+ Widget build(BuildContext context) {+ return ElevatedButton(+ style: ElevatedButton.styleFrom(+ backgroundColor: Theme.of(context).buttonTheme.colorScheme!.primary,+ foregroundColor: Theme.of(context).buttonTheme.colorScheme!.onPrimary,+ ),+ onPressed: () async {+ if (onTap != null) {+ onTap!.runFix();+ } else {+ await showDialog(+ context: context,+ builder: (_) => NotAvailableOnPlatformDialog(platforms: onTapMap.keys.toList()),+ );+ }+ },+ child: Text(label),+ );+ }+}++abstract class _FixAction {+ void runFix();++ List<String>? get commands;+}++class _CommandFixAction extends _FixAction {+ final bool adminPrivileges;++ @override+ final List<String> commands;++ _CommandFixAction({+ required this.adminPrivileges,+ required this.commands,+ });++ @override+ void runFix() async {+ if (adminPrivileges) {+ if (checkPlatform([TargetPlatform.windows])) {+ await runWindowsCommandAsAdmin(commands);+ } else {+ throw 'Admin privileges are only implemented on Windows.';+ }+ } else {+ for (final c in commands) {+ await Process.run(c, [], runInShell: true);+ }+ }+ }+}+diff --git a/pubspec.lock b/pubspec.lockindex a70b07e3..4d432537 100644--- a/pubspec.lock+++ b/pubspec.lock@@ -1187,26 +1187,26 @@ packages:dependency: "direct main"description:name: slang- sha256: "0b00009932e16278eb7e898153538653e5a6eefc88c437e2bd8f3af1de326acf"+ sha256: cf850695aa80d7144bf97be38a7ff46c7aa14ec9277b205a15dfbf427b5a98bcurl: "https://pub.dev"source: hosted- version: "3.14.0"+ version: "3.15.0"slang_build_runner:dependency: "direct dev"description:name: slang_build_runner- sha256: ca0c7ff7b1e3598d229962f475bcd0afaeabb2cfd1d96a2d0423c436461e3f0f+ sha256: b808741d30e0749c8fc80fa19d3e7d3257dc622a54a85cfe94469bc0b5b6b74curl: "https://pub.dev"source: hosted- version: "3.14.0"+ version: "3.15.0"slang_flutter:dependency: "direct main"description:name: slang_flutter- sha256: a85e7787a7f14f3982829e14f7f6bad510744d7a255736979a4c7450427ad615+ sha256: ce5b1caba362a895aabd433a9152ffe826019967d0001f7e9f1cf0b0c5f17f05url: "https://pub.dev"source: hosted- version: "3.14.0"+ version: "3.15.0"source_gen:dependency: transitivedescription:@@ -1601,5 +1601,5 @@ packages:source: hostedversion: "3.1.1"sdks:- dart: ">=2.19.5 <3.0.0"- flutter: ">=3.7.8"+ dart: ">=2.19.6 <3.0.0"+ flutter: ">=3.7.9"diff --git a/pubspec.yaml b/pubspec.yamlindex dc7c7584..28144d75 100644--- a/pubspec.yaml+++ b/pubspec.yaml@@ -41,8 +41,8 @@ dependencies:shared_preferences: 2.0.18shelf: 1.4.0shelf_router: 1.1.3- slang: 3.14.0- slang_flutter: 3.14.0+ slang: 3.15.0+ slang_flutter: 3.15.0tray_manager:# https://github.com/leanflutter/tray_manager/issues/30# The Linux tray manager is disabled for now@@ -68,7 +68,7 @@ dev_dependencies:url: https://github.com/Tienisto/msix.gitref: 5934920205cb2284a510ee2ddc58cf082d37595criverpod_lint: 1.1.6- slang_build_runner: 3.14.0+ slang_build_runner: 3.15.0test: 1.23.1dependency_overrides: