11import 'dart:convert' ;
22
33import 'package:intl/intl.dart' ;
4- import 'package:linux_assistant/enums/softwareManagers.dart' ;
54import 'package:linux_assistant/services/config_handler.dart' ;
6- import 'package:linux_assistant/services/linux.dart' ;
75import 'package:linux_assistant/services/updater.dart' ;
86import 'package:http/http.dart' as http;
9- import 'dart:io' ;
107
118class WeeklyTasks {
129 /// Seconds
@@ -22,16 +19,7 @@ class WeeklyTasks {
2219 }
2320
2421 Future newestVersionRunner = _getNewestVersion ();
25-
26- Future flathubIndexRunner;
27- if (Linux .currentenvironment.installedSoftwareManagers
28- .contains (SOFTWARE_MANAGERS .FLATPAK )) {
29- flathubIndexRunner = _getFlathubIndex ();
30- } else {
31- flathubIndexRunner = Future .delayed (const Duration (seconds: 0 ));
32- }
3322 await newestVersionRunner;
34- await flathubIndexRunner;
3523
3624 String newDate = DateFormat ('yyyy-MM-dd' ).format (DateTime .now ());
3725 await ConfigHandler ().setValue ("last-weekly-task" , newDate);
@@ -49,16 +37,4 @@ class WeeklyTasks {
4937 await ConfigHandler ()
5038 .setValue ("newest-linux-assistant-version" , newestVersion);
5139 }
52-
53- static Future <void > _getFlathubIndex () async {
54- http.Response response = await http
55- .get (Uri .parse ("https://flathub.org/api/v1/apps" ))
56- .timeout (const Duration (seconds: _defaultTimeout));
57-
58- // Write flathubIndexJson into file
59- String homeDir = Linux .getHomeDirectory ();
60- File flathubIndexFile =
61- File ("$homeDir .config/linux-assistant/flathub_index.json" );
62- await flathubIndexFile.writeAsString (response.body);
63- }
6440}
0 commit comments