more UI-as-code (#35516)

This commit is contained in:
Alexandre Ardhuin
2019-09-17 16:23:44 +02:00
committed by GitHub
parent d03aecab58
commit df4bf453ab
117 changed files with 1728 additions and 2132 deletions

View File

@@ -527,20 +527,16 @@ class ArchivePublisher {
// Search for any entries with the same hash and channel and remove them.
final List<dynamic> releases = jsonData['releases'];
final List<Map<String, dynamic>> prunedReleases = <Map<String, dynamic>>[];
for (Map<String, dynamic> entry in releases) {
if (entry['hash'] != newEntry['hash'] || entry['channel'] != newEntry['channel']) {
prunedReleases.add(entry);
}
}
prunedReleases.add(newEntry);
prunedReleases.sort((Map<String, dynamic> a, Map<String, dynamic> b) {
jsonData['releases'] = <Map<String, dynamic>>[
for (Map<String, dynamic> entry in releases)
if (entry['hash'] != newEntry['hash'] || entry['channel'] != newEntry['channel'])
entry,
newEntry,
]..sort((Map<String, dynamic> a, Map<String, dynamic> b) {
final DateTime aDate = DateTime.parse(a['release_date']);
final DateTime bDate = DateTime.parse(b['release_date']);
return bDate.compareTo(aDate);
});
jsonData['releases'] = prunedReleases;
return jsonData;
}