2022-08-16 18:36:56 +05:30
|
|
|
import 'dart:typed_data';
|
|
|
|
import 'package:json_annotation/json_annotation.dart';
|
2022-08-14 19:40:34 +01:00
|
|
|
|
2022-08-16 18:36:56 +05:30
|
|
|
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;
|
2022-08-16 18:36:56 +05:30
|
|
|
@JsonKey(
|
|
|
|
fromJson: bytesFromString,
|
|
|
|
toJson: bytesToString,
|
|
|
|
)
|
|
|
|
final Uint8List icon;
|
|
|
|
final DateTime patchDate;
|
2022-08-14 19:40:34 +01:00
|
|
|
final bool isRooted;
|
|
|
|
final bool isFromStorage;
|
2022-08-16 18:36:56 +05:30
|
|
|
final List<String> appliedPatches;
|
2022-08-14 19:40:34 +01:00
|
|
|
|
|
|
|
PatchedApplication({
|
|
|
|
required this.name,
|
|
|
|
required this.packageName,
|
|
|
|
required this.version,
|
|
|
|
required this.apkFilePath,
|
2022-08-16 18:36:56 +05:30
|
|
|
required this.icon,
|
|
|
|
required this.patchDate,
|
2022-08-14 19:40:34 +01:00
|
|
|
required this.isRooted,
|
|
|
|
required this.isFromStorage,
|
2022-08-16 18:36:56 +05:30
|
|
|
this.appliedPatches = const <String>[],
|
2022-08-14 19:40:34 +01:00
|
|
|
});
|
2022-08-16 18:36:56 +05:30
|
|
|
|
|
|
|
factory PatchedApplication.fromJson(Map<String, dynamic> json) =>
|
|
|
|
_$PatchedApplicationFromJson(json);
|
|
|
|
|
|
|
|
Map toJson() => _$PatchedApplicationToJson(this);
|
|
|
|
|
|
|
|
static Uint8List bytesFromString(String pictureUrl) =>
|
|
|
|
Uint8List.fromList(pictureUrl.codeUnits);
|
|
|
|
|
|
|
|
static String bytesToString(Uint8List bytes) => String.fromCharCodes(bytes);
|
2022-08-14 19:40:34 +01:00
|
|
|
}
|