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