mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2025-05-12 13:35:37 +02:00
feat: Show changelogs from the latest to the last used patches version (#2219)
This commit is contained in:
parent
bd96701103
commit
daba737ecb
7 changed files with 54 additions and 23 deletions
|
@ -49,18 +49,24 @@ class GithubAPI {
|
|||
}
|
||||
}
|
||||
|
||||
Future<String?> getManagerChangelogs() async {
|
||||
Future<String?> getChangelogs(bool isPatches) async {
|
||||
final String repoName = isPatches
|
||||
? _managerAPI.getPatchesRepo()
|
||||
: _managerAPI.defaultManagerRepo;
|
||||
try {
|
||||
final response = await _dioGetSynchronously(
|
||||
'/repos/${_managerAPI.defaultManagerRepo}/releases?per_page=50',
|
||||
'/repos/$repoName/releases?per_page=50',
|
||||
);
|
||||
final buffer = StringBuffer();
|
||||
final String currentVersion =
|
||||
await _managerAPI.getCurrentManagerVersion();
|
||||
final String version = isPatches
|
||||
? _managerAPI.getLastUsedPatchesVersion()
|
||||
: await _managerAPI.getCurrentManagerVersion();
|
||||
int releases = 0;
|
||||
for (final release in response.data) {
|
||||
if (release['tag_name'] == currentVersion) {
|
||||
if (release['tag_name'] == version) {
|
||||
if (buffer.isEmpty) {
|
||||
buffer.writeln(release['body']);
|
||||
releases++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -68,6 +74,10 @@ class GithubAPI {
|
|||
continue;
|
||||
}
|
||||
buffer.writeln(release['body']);
|
||||
releases++;
|
||||
if (isPatches && releases == 10) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return buffer.toString();
|
||||
} on Exception catch (e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue