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 {
|
|
|
|
PatchedApplication({
|
|
|
|
required this.name,
|
|
|
|
required this.packageName,
|
2022-10-10 15:15:58 +02:00
|
|
|
required this.originalPackageName,
|
2022-08-14 20:40:34 +02:00
|
|
|
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,
|
2022-09-19 02:44:27 +02:00
|
|
|
this.isFromStorage = false,
|
2022-08-29 16:01:51 +02:00
|
|
|
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);
|
2023-01-30 13:35:06 +01:00
|
|
|
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;
|
2022-08-16 15:06:56 +02:00
|
|
|
|
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
|
|
|
}
|