revanced-manager/lib/models/patched_application.dart

49 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 {
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);
String name;
String packageName;
String originalPackageName;
String version;
final String apkFilePath;
@JsonKey(
fromJson: decodeBase64,
toJson: encodeBase64,
)
Uint8List icon;
DateTime patchDate;
bool isRooted;
bool isFromStorage;
bool hasUpdates;
List<String> appliedPatches;
List<String> changelog;
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
}