mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-27 14:09:50 +00:00
42 lines
1.1 KiB
Dart
42 lines
1.1 KiB
Dart
|
class ServiceStatus {
|
||
|
final String title;
|
||
|
final String description;
|
||
|
final String? image;
|
||
|
final String? status;
|
||
|
final DateTime date;
|
||
|
|
||
|
ServiceStatus(
|
||
|
{required this.title,
|
||
|
required this.description,
|
||
|
required this.date,
|
||
|
this.image,
|
||
|
this.status});
|
||
|
|
||
|
factory ServiceStatus.fromJson(Map<String, dynamic> json) => ServiceStatus(
|
||
|
title: json['title'] as String? ?? '',
|
||
|
description: json['description'] as String? ?? '',
|
||
|
date: DateTime.tryParse(json['date'] as String? ?? '') ?? DateTime.now(),
|
||
|
image: json['image'] as String?,
|
||
|
status: json['status'] as String?,
|
||
|
);
|
||
|
}
|
||
|
|
||
|
class ServicesResponse {
|
||
|
final List<ServiceStatus> servicesStatus;
|
||
|
final bool hasUpdates;
|
||
|
final String currentSha;
|
||
|
|
||
|
ServicesResponse(this.servicesStatus, this.hasUpdates, this.currentSha);
|
||
|
|
||
|
factory ServicesResponse.fromJson(
|
||
|
Map<String, dynamic> json, bool hasUpdates, String currentSha) {
|
||
|
return ServicesResponse(
|
||
|
(json['notices'] as List? ?? [])
|
||
|
.map((e) => ServiceStatus.fromJson(e as Map<String, dynamic>))
|
||
|
.toList(),
|
||
|
hasUpdates,
|
||
|
currentSha,
|
||
|
);
|
||
|
}
|
||
|
}
|