mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2026-01-26 20:41:02 +00:00
fix: improve update manager button
This commit is contained in:
@@ -1,13 +1,23 @@
|
||||
import 'dart:io';
|
||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||
import 'package:github/github.dart';
|
||||
import 'package:revanced_manager/models/patched_application.dart';
|
||||
import 'package:timeago/timeago.dart';
|
||||
|
||||
class GithubAPI {
|
||||
final GitHub _github = GitHub();
|
||||
|
||||
Future<File?> latestRelease(String org, repoName) async {
|
||||
Future<String?> latestReleaseVersion(String org, repoName) async {
|
||||
try {
|
||||
var latestRelease = await _github.repositories.getLatestRelease(
|
||||
RepositorySlug(org, repoName),
|
||||
);
|
||||
return latestRelease.tagName;
|
||||
} on Exception {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Future<File?> latestReleaseFile(String org, repoName) async {
|
||||
try {
|
||||
var latestRelease = await _github.repositories.getLatestRelease(
|
||||
RepositorySlug(org, repoName),
|
||||
@@ -51,15 +61,4 @@ class GithubAPI {
|
||||
return List.empty();
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> hasUpdates(PatchedApplication app, String org, repoName) async {
|
||||
// TODO: get status based on last update time on the folder of this app?
|
||||
return true;
|
||||
}
|
||||
|
||||
Future<String> getChangelog(
|
||||
PatchedApplication app, String org, repoName) async {
|
||||
// TODO: get changelog based on last commits on the folder of this app?
|
||||
return 'fix: incorrect fingerprint version';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'dart:io';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:revanced_manager/constants.dart';
|
||||
import 'package:revanced_manager/services/github_api.dart';
|
||||
|
||||
@@ -6,14 +7,43 @@ class ManagerAPI {
|
||||
final GithubAPI _githubAPI = GithubAPI();
|
||||
|
||||
Future<File?> downloadPatches() async {
|
||||
return await _githubAPI.latestRelease(ghOrg, patchesRepo);
|
||||
return await _githubAPI.latestReleaseFile(ghOrg, patchesRepo);
|
||||
}
|
||||
|
||||
Future<File?> downloadIntegrations() async {
|
||||
return await _githubAPI.latestRelease(ghOrg, integrationsRepo);
|
||||
return await _githubAPI.latestReleaseFile(ghOrg, integrationsRepo);
|
||||
}
|
||||
|
||||
Future<File?> downloadManager() async {
|
||||
return await _githubAPI.latestRelease(ghOrg, managerRepo);
|
||||
return await _githubAPI.latestReleaseFile(
|
||||
'Aunali321',
|
||||
'revanced-manager-flutter',
|
||||
);
|
||||
}
|
||||
|
||||
Future<String?> getLatestPatchesVersion() async {
|
||||
return await _githubAPI.latestReleaseVersion(ghOrg, patchesRepo);
|
||||
}
|
||||
|
||||
Future<String?> getLatestManagerVersion() async {
|
||||
return await _githubAPI.latestReleaseVersion(
|
||||
'Aunali321',
|
||||
'revanced-manager-flutter',
|
||||
);
|
||||
}
|
||||
|
||||
Future<String> getCurrentManagerVersion() async {
|
||||
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
||||
return packageInfo.version;
|
||||
}
|
||||
|
||||
Future<bool> hasAppUpdates(String packageName) async {
|
||||
// TODO: get status based on last update time on the folder of this app?
|
||||
return true;
|
||||
}
|
||||
|
||||
Future<String> getAppChangelog(String packageName) async {
|
||||
// TODO: get changelog based on last commits on the folder of this app?
|
||||
return 'to be implemented';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user