feat: use provided patches.json to load patches

This commit is contained in:
Alberto Ponces 2022-08-29 17:44:45 +01:00
parent 080ceae784
commit 03b45e0db0
11 changed files with 210 additions and 338 deletions

View file

@ -1,15 +1,47 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:revanced_manager/utils/string.dart';
part 'patch.g.dart';
@JsonSerializable()
class Patch {
final String name;
final String simpleName;
final String version;
final String description;
final bool include;
final String version;
final bool excluded;
final List<String> dependencies;
final List<Package> compatiblePackages;
Patch({
required this.name,
required this.simpleName,
required this.version,
required this.description,
required this.include,
required this.version,
required this.excluded,
required this.dependencies,
required this.compatiblePackages,
});
factory Patch.fromJson(Map<String, dynamic> json) => _$PatchFromJson(json);
Map<String, dynamic> toJson() => _$PatchToJson(this);
String getSimpleName() {
return name.replaceAll('-', ' ').split('-').join(' ').toTitleCase();
}
}
@JsonSerializable()
class Package {
final String name;
final List<String> versions;
Package({
required this.name,
required this.versions,
});
factory Package.fromJson(Map<String, dynamic> json) =>
_$PackageFromJson(json);
Map toJson() => _$PackageToJson(this);
}

View file

@ -39,7 +39,7 @@ class PatchedApplication {
factory PatchedApplication.fromJson(Map<String, dynamic> json) =>
_$PatchedApplicationFromJson(json);
Map toJson() => _$PatchedApplicationToJson(this);
Map<String, dynamic> toJson() => _$PatchedApplicationToJson(this);
static Uint8List decodeBase64(String icon) => base64.decode(icon);