diff --git a/README.md b/README.md index 2ca53a4..2dee7c9 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,16 @@ flatpak run io.github.jean28518.Linux-Assistant - English - German +- Italian ## Mission + +## Development + +```bash +# Install flutter + +flutter run +``` diff --git a/lib/content/basic_entries.dart b/lib/content/basic_entries.dart index 3819d6c..3c0a8db 100644 --- a/lib/content/basic_entries.dart +++ b/lib/content/basic_entries.dart @@ -156,5 +156,12 @@ List getBasicEntries(BuildContext context) { color: MintY.currentColor, ), ), + ActionEntry( + name: AppLocalizations.of(context)!.fixPackageManager, + description: AppLocalizations.of(context)!.fixPackageManagerDescription, + action: "fix_package_manager", + iconWidget: Icon(Icons.bug_report, size: 48, color: MintY.currentColor), + keywords: ["fix", "package", "manager", "apt", "dpkg", "rpm", "zypper"], + ), ]; } diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index 1972d3d..ce70207 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -337,6 +337,8 @@ "free": "Frei", "allBiggestFolders": "Alle größten Ordner", "settingUpFirewall": "Konfiguriere Firewall...", + "fixPackageManager": "Paketverwaltung reparieren", + "fixPackageManagerDescription": "Updates oder Installationen können nicht mehr durchgeführt werden? Versuche die automatische Reparatur der Paketverwaltung.", "@helloWorld": { "placeholders": {}, "description": "", diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 885418a..2c2a713 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -337,6 +337,8 @@ "automaticCleanupDescription": "Automatically clean up your storage by deleting temporary files and package caches. Trash cans will also be emptied.", "diskUsage": "Disk usage", "settingUpFirewall": "Configure firewall...", + "fixPackageManager": "Repair package management", + "fixPackageManagerDescription": "Updates or installations can no longer be carried out? Try the automatic repair of the package management.", "@helloWorld": { "placeholders": {}, "description": "The conventional newborn programmer greeting", diff --git a/lib/l10n/app_it.arb b/lib/l10n/app_it.arb index 6fd317e..ae18e98 100644 --- a/lib/l10n/app_it.arb +++ b/lib/l10n/app_it.arb @@ -93,7 +93,7 @@ "teamsDescription": "Software proprietario di comunicazione per team.", "communicationSoftware": "Software di comunicazione", "flatpakIsNotInstalled": "Flatpak non è installato sul tuo sistema.", - "flatpakDescription": "Per un facile accesso a molte app popolari, si consiglia vivamente Flatpak. Flatpak è una nuova utility per la gestione dei pacchetti per Linux. Offre un ambiente sandbox in cui le app possono essere eseguite in isolamento dal resto del sistema. Collegando "Flathub" (il più grande repository per flatpak) puoi accedere a oltre 1800 diverse app Linux. Come svantaggio i Flatpak richiedono più spazio su disco.", + "flatpakDescription": "Per un facile accesso a molte app popolari, si consiglia vivamente Flatpak. Flatpak è una nuova utility per la gestione dei pacchetti per Linux. Offre un ambiente sandbox in cui le app possono essere eseguite in isolamento dal resto del sistema. Collegando 'Flathub' (il più grande repository per flatpak) puoi accedere a oltre 1800 diverse app Linux. Come svantaggio i Flatpak richiedono più spazio su disco.", "skip": "Salta", "settingUpFlatpak": "Configura Flatpak", "officeSelection": "Selezione Ufficio", @@ -112,7 +112,7 @@ "timeToSetupYourComputerDescription": "Configura la tua macchina Linux in base alle tue esigenze.", "activateHotkey": "Attiva il tasto di scelta rapida", "openLinuxAssistantFaster": "Apri l'Assistente Linux più velocemente.", - "openLinuxAssistantFasterDescription": "Puoi aprire Linux Assistant con i tasti {modificatore} + . Se ancora non funziona, chiama "scorciatoia da tastiera" nella ricerca.", + "youCanOpenThisWindowBySearchingForIntroduction": "Puoi riaprire questo sito cercando 'Introduzione a Linux-Assistant'.", + "youCanOpenLinuxAssistantWithHotkey": "Puoi sempre aprire Linux Assistant con la combinazione di tasti {modifier} + . Se ancora non funziona, chiama 'scorciatoia da tastiera' nella ricerca.", "@youCanOpenLinuxAssistantWithHotkey": { "placeholders": { "modifier" : {} @@ -234,7 +234,7 @@ "description": "", "type": "text" }, - "installingXDescription": "Installazione di {app}...\Devi aprire {app} successivamente e separatamente.", + "installingXDescription": "Installazione di {app}...\nDevi aprire {app} successivamente e separatamente.", "@installingXDescription": { "placeholders": { "app" : {} diff --git a/lib/layouts/main_screen/main_search.dart b/lib/layouts/main_screen/main_search.dart index ef87fed..f083151 100644 --- a/lib/layouts/main_screen/main_search.dart +++ b/lib/layouts/main_screen/main_search.dart @@ -369,7 +369,8 @@ class _MainSearchState extends State { // Otherwise check if all keys are contained in name or description for (String key in keys) { if (actionEntry.name.toLowerCase().contains(key) || - actionEntry.description.toLowerCase().contains(key)) { + actionEntry.description.toLowerCase().contains(key) || + actionEntry.keywords.contains(key)) { return true; } } diff --git a/lib/main.dart b/lib/main.dart index ff245af..7ec764f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -82,6 +82,7 @@ class MyApp extends StatelessWidget { supportedLocales: const [ Locale('en', ''), Locale('de', ''), + Locale('it', ''), ], theme: darkTheme ? MintY.themeDark() : MintY.theme(), home: firstPage, diff --git a/lib/services/action_handler.dart b/lib/services/action_handler.dart index a2baf28..70740f3 100644 --- a/lib/services/action_handler.dart +++ b/lib/services/action_handler.dart @@ -364,7 +364,9 @@ class ActionHandler { if (actionEntry.action.startsWith("just_callback")) { callback(); } - } - static void handleRecommendation() {} + if (actionEntry.action.startsWith("fix_package_manager")) { + Linux.fixPackageManager(context); + } + } } diff --git a/lib/services/linux.dart b/lib/services/linux.dart index 16cd0b0..b928f01 100644 --- a/lib/services/linux.dart +++ b/lib/services/linux.dart @@ -2248,4 +2248,57 @@ class Linux { route: route, ))); } + + static String getPATH() { + // Get the PATH variable via the environment + String? output = Platform.environment["PATH"]; + if (output == null || output.isEmpty) { + return "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin"; + } + return output; + } + + static void fixPackageManager(context) { + if (currentenvironment.installedSoftwareManagers + .contains(SOFTWARE_MANAGERS.APT)) { + commandQueue.add(LinuxCommand( + userId: 0, + command: "/usr/bin/dpkg --configure -a", + environment: {"DEBIAN_FRONTEND": "noninteractive", "PATH": getPATH()}, + )); + commandQueue.add(LinuxCommand( + userId: 0, + command: "/usr/bin/apt install -f -y", + environment: {"DEBIAN_FRONTEND": "noninteractive"}, + )); + } + if (currentenvironment.installedSoftwareManagers + .contains(SOFTWARE_MANAGERS.ZYPPER)) { + commandQueue.add(LinuxCommand( + userId: 0, + command: "/usr/bin/zypper --non-interactive --gpg-auto-import-keys ref", + )); + commandQueue.add(LinuxCommand( + userId: 0, + command: "/usr/bin/zypper --non-interactive --gpg-auto-import-keys up", + )); + } + if (currentenvironment.installedSoftwareManagers + .contains(SOFTWARE_MANAGERS.DNF)) { + commandQueue.add(LinuxCommand( + userId: 0, + command: "/usr/bin/dnf check", + )); + commandQueue.add(LinuxCommand( + userId: 0, + command: "/usr/bin/dnf install -y", + )); + } + + Navigator.of(context).push(MaterialPageRoute( + builder: (context) => RunCommandQueue( + title: AppLocalizations.of(context)!.fixPackageManager, + route: MainSearchLoader()), + )); + } }