From 5e8e4743a72705612ad6550e8722a3e9205f3622 Mon Sep 17 00:00:00 2001 From: Khaled Njim Date: Fri, 1 Mar 2024 11:33:56 +0100 Subject: [PATCH 1/3] LA-1204 quotaId optional and changed isLastChunk to lastChunk --- .../quota_id_nullable_converter.dart | 44 +++++++++++++++++++ .../shared_space_node_nested_response.dart | 4 +- .../src/repository/flow/flow_response.dart | 1 + .../sharedspace/shared_space_node_nested.dart | 2 +- .../shared_space_details_viewmodel.dart | 2 +- 5 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 data/lib/src/network/model/converter/quota_id_nullable_converter.dart diff --git a/data/lib/src/network/model/converter/quota_id_nullable_converter.dart b/data/lib/src/network/model/converter/quota_id_nullable_converter.dart new file mode 100644 index 000000000..b6874326b --- /dev/null +++ b/data/lib/src/network/model/converter/quota_id_nullable_converter.dart @@ -0,0 +1,44 @@ +// LinShare is an open source filesharing software, part of the LinPKI software +// suite, developed by Linagora. +// +// Copyright (C) 2020 LINAGORA +// +// This program is free software: you can redistribute it and/or modify it under the +// terms of the GNU Affero General Public License as published by the Free Software +// Foundation, either version 3 of the License, or (at your option) any later version, +// provided you comply with the Additional Terms applicable for LinShare software by +// Linagora pursuant to Section 7 of the GNU Affero General Public License, +// subsections (b), (c), and (e), pursuant to which you must notably (i) retain the +// display in the interface of the “LinShare™” trademark/logo, the "Libre & Free" mention, +// the words “You are using the Free and Open Source version of LinShare™, powered by +// Linagora © 2009–2020. Contribute to Linshare R&D by subscribing to an Enterprise +// offer!”. You must also retain the latter notice in all asynchronous messages such as +// e-mails sent with the Program, (ii) retain all hypertext links between LinShare and +// http://www.linshare.org, between linagora.com and Linagora, and (iii) refrain from +// infringing Linagora intellectual property rights over its trademarks and commercial +// brands. Other Additional Terms apply, see +// +// for more details. +// This program is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for +// more details. +// You should have received a copy of the GNU Affero General Public License and its +// applicable Additional Terms for LinShare along with this program. If not, see +// for the GNU Affero General Public License version +// 3 and for +// the Additional Terms applicable to LinShare software. +// + +import 'package:domain/domain.dart'; +import 'package:json_annotation/json_annotation.dart'; + +class QuotaIdNullableConverter implements JsonConverter { + const QuotaIdNullableConverter(); + + @override + QuotaId? fromJson(String? json) => json!=null ? QuotaId(json) : QuotaId.initial() ; + + @override + String? toJson(QuotaId? object) => object?.uuid; +} diff --git a/data/lib/src/network/model/response/shared_space_node_nested_response.dart b/data/lib/src/network/model/response/shared_space_node_nested_response.dart index d23c753ed..9b43f8021 100644 --- a/data/lib/src/network/model/response/shared_space_node_nested_response.dart +++ b/data/lib/src/network/model/response/shared_space_node_nested_response.dart @@ -30,6 +30,7 @@ // the Additional Terms applicable to LinShare software. import 'package:data/src/network/model/converter/datetime_converter.dart'; +import 'package:data/src/network/model/converter/quota_id_nullable_converter.dart'; import 'package:data/src/network/model/converter/shared_space_id_nullable_converter.dart'; import 'package:data/src/network/model/converter/quota_id_converter.dart'; import 'package:data/src/network/model/converter/shared_space_id_converter.dart'; @@ -47,6 +48,7 @@ part 'shared_space_node_nested_response.g.dart'; @QuotaIdConverter() @SharedSpaceIdConverter() @SharedSpaceIdNullableConverter() +@QuotaIdNullableConverter() class SharedSpaceNodeNestedResponse extends Equatable { SharedSpaceNodeNestedResponse( this.sharedSpaceId, @@ -73,7 +75,7 @@ class SharedSpaceNodeNestedResponse extends Equatable { final LinShareNodeType? nodeType; @JsonKey(name: Attribute.quotaUuid) - final QuotaId quotaId; + final QuotaId? quotaId; final VersioningParameterDto? versioningParameters; diff --git a/data/lib/src/repository/flow/flow_response.dart b/data/lib/src/repository/flow/flow_response.dart index 8165a06ad..07f3dc70b 100644 --- a/data/lib/src/repository/flow/flow_response.dart +++ b/data/lib/src/repository/flow/flow_response.dart @@ -40,6 +40,7 @@ part 'flow_response.g.dart'; @JsonSerializable() class FlowResponse with EquatableMixin { final int chunkNumber; + @JsonKey(name:"lastChunk") final bool isLastChunk; final bool chunkUploadSuccess; final String? fileName; diff --git a/domain/lib/src/model/sharedspace/shared_space_node_nested.dart b/domain/lib/src/model/sharedspace/shared_space_node_nested.dart index e556a9ac2..fe76e4a85 100644 --- a/domain/lib/src/model/sharedspace/shared_space_node_nested.dart +++ b/domain/lib/src/model/sharedspace/shared_space_node_nested.dart @@ -41,7 +41,7 @@ class SharedSpaceNodeNested extends Equatable { final DateTime modificationDate; final String name; final LinShareNodeType? nodeType; - final QuotaId quotaId; + final QuotaId? quotaId; final VersioningParameter versioningParameters; SharedSpaceNodeNested( diff --git a/lib/presentation/widget/shared_space_details/shared_space_details_viewmodel.dart b/lib/presentation/widget/shared_space_details/shared_space_details_viewmodel.dart index 90be37c9d..79972f205 100644 --- a/lib/presentation/widget/shared_space_details/shared_space_details_viewmodel.dart +++ b/lib/presentation/widget/shared_space_details/shared_space_details_viewmodel.dart @@ -162,7 +162,7 @@ class SharedSpaceDetailsViewModel extends BaseViewModel { await sharedSpaceViewState.fold((_) => null, (success) async { if (success is SharedSpaceDetailViewState) { - store.dispatch(_getAccountQuotaAction(success.sharedSpace.quotaId)); + store.dispatch(_getAccountQuotaAction(success.sharedSpace.quotaId!)); } }); }); From 04fefc649bcef0289d80df66ba1c7326a990d884 Mon Sep 17 00:00:00 2001 From: KhaledNjim Date: Mon, 25 Mar 2024 01:16:58 +0100 Subject: [PATCH 2/3] LA-1204 Added ROOT_Folder to workgroup types --- data/lib/src/network/linshare_http_client.dart | 2 +- .../sharedspacedocument/work_group_node_type.dart | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/data/lib/src/network/linshare_http_client.dart b/data/lib/src/network/linshare_http_client.dart index 437ec1d86..49a0cc1f6 100644 --- a/data/lib/src/network/linshare_http_client.dart +++ b/data/lib/src/network/linshare_http_client.dart @@ -285,7 +285,7 @@ class LinShareHttpClient { } WorkGroupNodeDto _convertToWorkGroupNodeChild(Map nodeChildJson) { - if (nodeChildJson['type'] == WorkGroupNodeType.FOLDER.value) { + if (nodeChildJson['type'] == WorkGroupNodeType.FOLDER.value || nodeChildJson['type'] == WorkGroupNodeType.ROOT_FOLDER.value ) { return WorkGroupNodeFolderDto.fromJson(nodeChildJson); } diff --git a/domain/lib/src/model/sharedspacedocument/work_group_node_type.dart b/domain/lib/src/model/sharedspacedocument/work_group_node_type.dart index ffb781ced..efc4b3c16 100644 --- a/domain/lib/src/model/sharedspacedocument/work_group_node_type.dart +++ b/domain/lib/src/model/sharedspacedocument/work_group_node_type.dart @@ -30,21 +30,19 @@ // the Additional Terms applicable to LinShare software. // -enum WorkGroupNodeType { - FOLDER, - DOCUMENT, - DOCUMENT_REVISION -} +enum WorkGroupNodeType { ROOT_FOLDER, FOLDER, DOCUMENT, DOCUMENT_REVISION } extension WorkGroupNodeTypeExtension on WorkGroupNodeType { String get value { - switch(this) { + switch (this) { case WorkGroupNodeType.FOLDER: return 'FOLDER'; case WorkGroupNodeType.DOCUMENT: return 'DOCUMENT'; case WorkGroupNodeType.DOCUMENT_REVISION: return 'DOCUMENT_REVISION'; + case WorkGroupNodeType.ROOT_FOLDER: + return 'ROOT_FOLDER'; default: return toString(); } From c56abbaa863e06f3d120ac8c77ed5afb087b369a Mon Sep 17 00:00:00 2001 From: KhaledNjim Date: Wed, 27 Mar 2024 03:59:41 +0100 Subject: [PATCH 3/3] Revert "LA-1204 quotaId optional and changed isLastChunk to lastChunk" This reverts commit 5e8e4743a72705612ad6550e8722a3e9205f3622. --- .../quota_id_nullable_converter.dart | 44 ------------------- .../shared_space_node_nested_response.dart | 4 +- .../src/repository/flow/flow_response.dart | 1 - .../sharedspace/shared_space_node_nested.dart | 2 +- .../shared_space_details_viewmodel.dart | 2 +- 5 files changed, 3 insertions(+), 50 deletions(-) delete mode 100644 data/lib/src/network/model/converter/quota_id_nullable_converter.dart diff --git a/data/lib/src/network/model/converter/quota_id_nullable_converter.dart b/data/lib/src/network/model/converter/quota_id_nullable_converter.dart deleted file mode 100644 index b6874326b..000000000 --- a/data/lib/src/network/model/converter/quota_id_nullable_converter.dart +++ /dev/null @@ -1,44 +0,0 @@ -// LinShare is an open source filesharing software, part of the LinPKI software -// suite, developed by Linagora. -// -// Copyright (C) 2020 LINAGORA -// -// This program is free software: you can redistribute it and/or modify it under the -// terms of the GNU Affero General Public License as published by the Free Software -// Foundation, either version 3 of the License, or (at your option) any later version, -// provided you comply with the Additional Terms applicable for LinShare software by -// Linagora pursuant to Section 7 of the GNU Affero General Public License, -// subsections (b), (c), and (e), pursuant to which you must notably (i) retain the -// display in the interface of the “LinShare™” trademark/logo, the "Libre & Free" mention, -// the words “You are using the Free and Open Source version of LinShare™, powered by -// Linagora © 2009–2020. Contribute to Linshare R&D by subscribing to an Enterprise -// offer!”. You must also retain the latter notice in all asynchronous messages such as -// e-mails sent with the Program, (ii) retain all hypertext links between LinShare and -// http://www.linshare.org, between linagora.com and Linagora, and (iii) refrain from -// infringing Linagora intellectual property rights over its trademarks and commercial -// brands. Other Additional Terms apply, see -// -// for more details. -// This program is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for -// more details. -// You should have received a copy of the GNU Affero General Public License and its -// applicable Additional Terms for LinShare along with this program. If not, see -// for the GNU Affero General Public License version -// 3 and for -// the Additional Terms applicable to LinShare software. -// - -import 'package:domain/domain.dart'; -import 'package:json_annotation/json_annotation.dart'; - -class QuotaIdNullableConverter implements JsonConverter { - const QuotaIdNullableConverter(); - - @override - QuotaId? fromJson(String? json) => json!=null ? QuotaId(json) : QuotaId.initial() ; - - @override - String? toJson(QuotaId? object) => object?.uuid; -} diff --git a/data/lib/src/network/model/response/shared_space_node_nested_response.dart b/data/lib/src/network/model/response/shared_space_node_nested_response.dart index 9b43f8021..d23c753ed 100644 --- a/data/lib/src/network/model/response/shared_space_node_nested_response.dart +++ b/data/lib/src/network/model/response/shared_space_node_nested_response.dart @@ -30,7 +30,6 @@ // the Additional Terms applicable to LinShare software. import 'package:data/src/network/model/converter/datetime_converter.dart'; -import 'package:data/src/network/model/converter/quota_id_nullable_converter.dart'; import 'package:data/src/network/model/converter/shared_space_id_nullable_converter.dart'; import 'package:data/src/network/model/converter/quota_id_converter.dart'; import 'package:data/src/network/model/converter/shared_space_id_converter.dart'; @@ -48,7 +47,6 @@ part 'shared_space_node_nested_response.g.dart'; @QuotaIdConverter() @SharedSpaceIdConverter() @SharedSpaceIdNullableConverter() -@QuotaIdNullableConverter() class SharedSpaceNodeNestedResponse extends Equatable { SharedSpaceNodeNestedResponse( this.sharedSpaceId, @@ -75,7 +73,7 @@ class SharedSpaceNodeNestedResponse extends Equatable { final LinShareNodeType? nodeType; @JsonKey(name: Attribute.quotaUuid) - final QuotaId? quotaId; + final QuotaId quotaId; final VersioningParameterDto? versioningParameters; diff --git a/data/lib/src/repository/flow/flow_response.dart b/data/lib/src/repository/flow/flow_response.dart index 07f3dc70b..8165a06ad 100644 --- a/data/lib/src/repository/flow/flow_response.dart +++ b/data/lib/src/repository/flow/flow_response.dart @@ -40,7 +40,6 @@ part 'flow_response.g.dart'; @JsonSerializable() class FlowResponse with EquatableMixin { final int chunkNumber; - @JsonKey(name:"lastChunk") final bool isLastChunk; final bool chunkUploadSuccess; final String? fileName; diff --git a/domain/lib/src/model/sharedspace/shared_space_node_nested.dart b/domain/lib/src/model/sharedspace/shared_space_node_nested.dart index fe76e4a85..e556a9ac2 100644 --- a/domain/lib/src/model/sharedspace/shared_space_node_nested.dart +++ b/domain/lib/src/model/sharedspace/shared_space_node_nested.dart @@ -41,7 +41,7 @@ class SharedSpaceNodeNested extends Equatable { final DateTime modificationDate; final String name; final LinShareNodeType? nodeType; - final QuotaId? quotaId; + final QuotaId quotaId; final VersioningParameter versioningParameters; SharedSpaceNodeNested( diff --git a/lib/presentation/widget/shared_space_details/shared_space_details_viewmodel.dart b/lib/presentation/widget/shared_space_details/shared_space_details_viewmodel.dart index 79972f205..90be37c9d 100644 --- a/lib/presentation/widget/shared_space_details/shared_space_details_viewmodel.dart +++ b/lib/presentation/widget/shared_space_details/shared_space_details_viewmodel.dart @@ -162,7 +162,7 @@ class SharedSpaceDetailsViewModel extends BaseViewModel { await sharedSpaceViewState.fold((_) => null, (success) async { if (success is SharedSpaceDetailViewState) { - store.dispatch(_getAccountQuotaAction(success.sharedSpace.quotaId!)); + store.dispatch(_getAccountQuotaAction(success.sharedSpace.quotaId)); } }); });