From 9e9514397ee57e401f2b8f1d67dd846cba2a6ca9 Mon Sep 17 00:00:00 2001 From: eymeric Date: Wed, 21 Feb 2024 15:31:35 +0100 Subject: [PATCH] fix tomuss --- .../lyon1tomussclient/lib/src/model/generated/url.g.dart | 6 ++++-- packages/lyon1tomussclient/lib/src/model/url.dart | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/lyon1tomussclient/lib/src/model/generated/url.g.dart b/packages/lyon1tomussclient/lib/src/model/generated/url.g.dart index 1bcb405f..78a7ac04 100644 --- a/packages/lyon1tomussclient/lib/src/model/generated/url.g.dart +++ b/packages/lyon1tomussclient/lib/src/model/generated/url.g.dart @@ -119,15 +119,17 @@ class URLAdapter extends TypeAdapter { date: fields[102] as DateTime?, position: fields[103] == null ? 0 : fields[103] as double, value: fields[2] == null ? '' : fields[2] as String, - ); + )..isModifiable = fields[3] == null ? false : fields[3] as bool; } @override void write(BinaryWriter writer, URL obj) { writer - ..writeByte(5) + ..writeByte(6) ..writeByte(2) ..write(obj.value) + ..writeByte(3) + ..write(obj.isModifiable) ..writeByte(100) ..write(obj.title) ..writeByte(101) diff --git a/packages/lyon1tomussclient/lib/src/model/url.dart b/packages/lyon1tomussclient/lib/src/model/url.dart index 2d778ebb..f1111a51 100644 --- a/packages/lyon1tomussclient/lib/src/model/url.dart +++ b/packages/lyon1tomussclient/lib/src/model/url.dart @@ -9,14 +9,19 @@ part 'generated/url.g.dart'; class URL extends TeachingUnitElement { @HiveField(2, defaultValue: "") late final String value; + @HiveField(3, defaultValue: false) + late final bool isModifiable; URL.fromJSON(var id, Map json, var stats, var line, var column, String user) : super.fromJson(id, json, stats, line, column, user) { var props = line[id]; + isModifiable = false; if (props is List && props.isNotEmpty) { value = props[0].toString(); } else if (json.containsKey("empty_is")) { value = json["empty_is"]; + } else if (json.containsKey("modifiable")) { + isModifiable = json["modifiable"] != 0; } else { throw ("Couldn't find url in URL object..."); }