revanced-manager/lib/models/patched_application.dart

50 lines
1.2 KiB
Dart
Raw Normal View History

2022-08-17 18:07:00 +02:00
import 'dart:convert';
import 'dart:typed_data';
import 'package:json_annotation/json_annotation.dart';
2022-08-14 20:40:34 +02:00
part 'patched_application.g.dart';
@JsonSerializable()
2022-08-14 20:40:34 +02:00
class PatchedApplication {
String name;
String packageName;
String originalPackageName;
String version;
2022-08-14 20:40:34 +02:00
final String apkFilePath;
@JsonKey(
2022-08-17 18:07:00 +02:00
fromJson: decodeBase64,
toJson: encodeBase64,
)
Uint8List icon;
2022-08-18 00:06:02 +02:00
DateTime patchDate;
bool isRooted;
bool isFromStorage;
bool hasUpdates;
2022-08-17 19:44:27 +02:00
List<String> appliedPatches;
List<String> changelog;
2022-08-14 20:40:34 +02:00
PatchedApplication({
required this.name,
required this.packageName,
required this.originalPackageName,
2022-08-14 20:40:34 +02:00
required this.version,
required this.apkFilePath,
required this.icon,
required this.patchDate,
this.isRooted = false,
this.isFromStorage = false,
this.hasUpdates = false,
this.appliedPatches = const [],
this.changelog = const [],
2022-08-14 20:40:34 +02:00
});
factory PatchedApplication.fromJson(Map<String, dynamic> json) =>
_$PatchedApplicationFromJson(json);
Map<String, dynamic> toJson() => _$PatchedApplicationToJson(this);
2022-08-17 18:07:00 +02:00
static Uint8List decodeBase64(String icon) => base64.decode(icon);
2022-08-17 18:07:00 +02:00
static String encodeBase64(Uint8List bytes) => base64.encode(bytes);
2022-08-14 20:40:34 +02:00
}