revanced-manager/lib/models/patched_application.dart

44 lines
1.1 KiB
Dart
Raw Normal View History

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