Add uncategorized type & fix parsing from string to type

This commit is contained in:
Neeraj Gupta 2022-12-20 15:02:57 +05:30
parent 670fea0abe
commit 8bac31cbb7
No known key found for this signature in database
GPG key ID: 3C5A1684DC1729E1

View file

@ -1,6 +1,7 @@
import 'dart:convert';
import 'dart:core';
import 'package:flutter/foundation.dart';
import 'package:photos/models/magic_metadata.dart';
class Collection {
@ -85,8 +86,15 @@ class Collection {
return CollectionType.folder;
case "favorites":
return CollectionType.favorites;
case "uncategorized":
return CollectionType.uncategorized;
case "album":
return CollectionType.album;
case "unknown":
return CollectionType.unknown;
}
return CollectionType.album;
debugPrint("unexpected collection type $type");
return CollectionType.unknown;
}
static String typeToString(CollectionType type) {
@ -95,8 +103,12 @@ class Collection {
return "folder";
case CollectionType.favorites:
return "favorites";
default:
case CollectionType.album:
return "album";
case CollectionType.uncategorized:
return "uncategorized";
case CollectionType.unknown:
return "unknown";
}
}
@ -187,7 +199,9 @@ class Collection {
enum CollectionType {
folder,
favorites,
uncategorized,
album,
unknown,
}
enum CollectionParticipantRole {