Skip to content

Commit

Permalink
Remove old flatpak api call
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean 28518 committed Dec 18, 2024
1 parent 6d4a058 commit ef1fd01
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions lib/services/weekly_tasks.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import 'dart:convert';

import 'package:intl/intl.dart';
import 'package:linux_assistant/enums/softwareManagers.dart';
import 'package:linux_assistant/services/config_handler.dart';
import 'package:linux_assistant/services/linux.dart';
import 'package:linux_assistant/services/updater.dart';
import 'package:http/http.dart' as http;
import 'dart:io';

class WeeklyTasks {
/// Seconds
Expand All @@ -22,16 +19,7 @@ class WeeklyTasks {
}

Future newestVersionRunner = _getNewestVersion();

Future flathubIndexRunner;
if (Linux.currentenvironment.installedSoftwareManagers
.contains(SOFTWARE_MANAGERS.FLATPAK)) {
flathubIndexRunner = _getFlathubIndex();
} else {
flathubIndexRunner = Future.delayed(const Duration(seconds: 0));
}
await newestVersionRunner;
await flathubIndexRunner;

String newDate = DateFormat('yyyy-MM-dd').format(DateTime.now());
await ConfigHandler().setValue("last-weekly-task", newDate);
Expand All @@ -49,16 +37,4 @@ class WeeklyTasks {
await ConfigHandler()
.setValue("newest-linux-assistant-version", newestVersion);
}

static Future<void> _getFlathubIndex() async {
http.Response response = await http
.get(Uri.parse("https://flathub.org/api/v1/apps"))
.timeout(const Duration(seconds: _defaultTimeout));

// Write flathubIndexJson into file
String homeDir = Linux.getHomeDirectory();
File flathubIndexFile =
File("$homeDir.config/linux-assistant/flathub_index.json");
await flathubIndexFile.writeAsString(response.body);
}
}

0 comments on commit ef1fd01

Please sign in to comment.