2022-08-29 18:44:45 +02:00
|
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
import 'package:revanced_manager/utils/string.dart';
|
|
|
|
|
|
|
|
part 'patch.g.dart';
|
|
|
|
|
|
|
|
@JsonSerializable()
|
2022-08-06 15:04:18 +02:00
|
|
|
class Patch {
|
|
|
|
final String name;
|
|
|
|
final String description;
|
2022-08-29 18:44:45 +02:00
|
|
|
final String version;
|
|
|
|
final bool excluded;
|
|
|
|
final List<String> dependencies;
|
|
|
|
final List<Package> compatiblePackages;
|
2022-08-06 15:04:18 +02:00
|
|
|
|
|
|
|
Patch({
|
|
|
|
required this.name,
|
|
|
|
required this.description,
|
2022-08-29 18:44:45 +02:00
|
|
|
required this.version,
|
|
|
|
required this.excluded,
|
|
|
|
required this.dependencies,
|
|
|
|
required this.compatiblePackages,
|
2022-08-06 15:04:18 +02:00
|
|
|
});
|
2022-08-29 18:44:45 +02:00
|
|
|
|
|
|
|
factory Patch.fromJson(Map<String, dynamic> json) => _$PatchFromJson(json);
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => _$PatchToJson(this);
|
|
|
|
|
|
|
|
String getSimpleName() {
|
2022-09-01 10:07:13 +02:00
|
|
|
return name
|
|
|
|
.replaceAll('-', ' ')
|
|
|
|
.split('-')
|
|
|
|
.join(' ')
|
|
|
|
.toTitleCase()
|
|
|
|
.replaceFirst('Microg', 'MicroG');
|
2022-08-29 18:44:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@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);
|
2022-08-06 15:04:18 +02:00
|
|
|
}
|