Skip to content

Commit aafd169

Browse files
committed
Cloud UIs page.
1 parent c2e1e3e commit aafd169

File tree

4 files changed

+28
-6
lines changed

4 files changed

+28
-6
lines changed

lib/src/api/models/action/load_from_cloud_storage_action.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,14 @@ class LoadFromCloudStorageAction extends ActionModel
4747
List<WhereQueryFilter>? whereFilters,
4848
List<OrderByQueryFilter>? orderByFilters,
4949
int? limit,
50+
bool useCloudDatabase = true,
5051
}) : super(type: ActionType.loadFromCloudStorage) {
5152
setQueryableMixin(
5253
collectionPath: path,
5354
limit: limit,
5455
whereFilters: whereFilters ?? [],
5556
orderByFilters: orderByFilters ?? [],
56-
useCloudDatabase: true,
57+
useCloudDatabase: useCloudDatabase,
5758
);
5859
}
5960

lib/src/api/models/action/load_from_cloud_storage_action.g.dart

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/api/models/action/set_value_action.dart

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,22 @@ abstract class ValueModel<T extends Object?> with SerializableMixin {
134134

135135
/// Creates a new [ValueModel] instance from a JSON data.
136136
static ValueModel fromJson(Map json) {
137-
final type = ValueType.values.byName(json['type']);
137+
final ValueType type;
138+
if (json['type'] == null) {
139+
// backward compatibility
140+
final value = json['value'];
141+
type = switch (value) {
142+
String() => ValueType.string,
143+
int() => ValueType.int,
144+
double() => ValueType.double,
145+
bool() => ValueType.bool,
146+
Map() when value['value']?['r'] != null => ValueType.color,
147+
Map() when value['value']?['id'] != null => ValueType.paint,
148+
_ => throw 'Invalid value type: $value',
149+
};
150+
} else {
151+
type = ValueType.values.byName(json['type'] ?? 'string');
152+
}
138153
switch (type) {
139154
case ValueType.bool:
140155
return BoolValue.fromJson(json);

lib/src/api/models/icon.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,13 @@ class MultiSourceIconModel with EquatableMixin, SerializableMixin {
188188

189189
/// Factory constructor for creating a new [MultiSourceIconModel] instance
190190
/// from JSON data.
191-
factory MultiSourceIconModel.fromJson(Map json) =>
192-
_$MultiSourceIconModelFromJson(json);
191+
factory MultiSourceIconModel.fromJson(Map json) {
192+
if(json['type'] == 'MATERIAL_ICON') {
193+
// backward compatibility
194+
json['type'] = 'image';
195+
}
196+
return _$MultiSourceIconModelFromJson(json);
197+
}
193198

194199
@override
195200
Map toJson() => _$MultiSourceIconModelToJson(this);

0 commit comments

Comments
 (0)