Skip to content

Commit

Permalink
LA-1220 Fix: Fixed wrong file expiration date in mySpace
Browse files Browse the repository at this point in the history
  • Loading branch information
KhaledNjim authored and hoangdat committed Feb 28, 2024
1 parent 9aa14b8 commit a78f621
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

import 'package:data/src/network/model/converter/data_from_json_converter.dart';
import 'package:data/src/network/model/converter/datetime_converter.dart';
import 'package:data/src/network/model/converter/datetime_nullable_converter.dart';
import 'package:data/src/network/model/share/document_details_received_share_dto.dart';
import 'package:domain/domain.dart';
import 'package:json_annotation/json_annotation.dart';
Expand All @@ -43,13 +44,14 @@ part 'document_details_response.g.dart';

@JsonSerializable()
@DatetimeConverter()
@DatetimeNullableConverter()
class DocumentDetailsResponse extends DocumentResponse {
DocumentDetailsResponse(
DocumentId documentId,
String description,
DateTime creationDate,
DateTime modificationDate,
DateTime expirationDate,
DateTime? expirationDate,
bool ciphered,
String name,
int size,
Expand Down Expand Up @@ -82,7 +84,7 @@ class DocumentDetailsResponse extends DocumentResponse {
Map<String, dynamic> toJson() => _$DocumentDetailsResponseToJson(this);

@override
List<Object> get props => [
List<Object?> get props => [
documentId,
description,
creationDate,
Expand Down
6 changes: 4 additions & 2 deletions data/lib/src/network/model/response/document_response.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

import 'package:data/src/network/model/converter/data_from_json_converter.dart';
import 'package:data/src/network/model/converter/datetime_converter.dart';
import 'package:data/src/network/model/converter/datetime_nullable_converter.dart';
import 'package:data/src/util/attribute.dart';
import 'package:domain/domain.dart';
import 'package:equatable/equatable.dart';
Expand All @@ -42,6 +43,7 @@ part 'document_response.g.dart';

@JsonSerializable()
@DatetimeConverter()
@DatetimeNullableConverter()
class DocumentResponse extends Equatable {
DocumentResponse(
this.documentId,
Expand All @@ -63,7 +65,7 @@ class DocumentResponse extends Equatable {
final String description;
final DateTime creationDate;
final DateTime modificationDate;
final DateTime expirationDate;
final DateTime? expirationDate;
final bool ciphered;
final String name;
final int size;
Expand All @@ -79,7 +81,7 @@ class DocumentResponse extends Equatable {
Map<String, dynamic> toJson() => _$DocumentResponseToJson(this);

@override
List<Object> get props => [
List<Object?> get props => [
documentId,
description,
creationDate,
Expand Down
2 changes: 1 addition & 1 deletion domain/lib/src/model/document/document.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Document extends Equatable {
final String description;
final DateTime creationDate;
final DateTime modificationDate;
final DateTime expirationDate;
final DateTime? expirationDate;
final bool ciphered;
final String name;
final int size;
Expand Down
2 changes: 1 addition & 1 deletion domain/lib/src/model/document/document_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class DocumentDetails extends Document {
);

@override
List<Object> get props => [
List<Object?> get props => [
documentId,
description,
creationDate,
Expand Down
4 changes: 2 additions & 2 deletions lib/presentation/model/file/document_presentation_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class DocumentPresentationFile extends Equatable implements PresentationFile {
final String description;
final DateTime creationDate;
final DateTime modificationDate;
final DateTime expirationDate;
final DateTime? expirationDate;
final bool ciphered;
final String name;
final int size;
Expand Down Expand Up @@ -113,7 +113,7 @@ class DocumentPresentationFile extends Equatable implements PresentationFile {
bool isShared() => shared != 0;

@override
List<Object> get props => [
List<Object?> get props => [
documentId,
description,
creationDate,
Expand Down
7 changes: 4 additions & 3 deletions lib/presentation/redux/states/functionality_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import 'package:domain/src/state/failure.dart';
import 'package:domain/src/state/success.dart';
import 'package:flutter/foundation.dart';
import 'package:linshare_flutter_app/presentation/redux/states/linshare_state.dart';
import 'package:collection/collection.dart';

@immutable
class FunctionalityState extends LinShareState {
Expand Down Expand Up @@ -91,9 +92,9 @@ extension FunctionalityStateExtension on FunctionalityState {
bool isUploadRequestEnable() => _isFunctionalityEnable(FunctionalityIdentifier.UPLOAD_REQUEST);

bool _isFunctionalityEnable(FunctionalityIdentifier functionalityIdentifier) {
final functionality = functionalityList.firstWhere(
(element) => (element != null && element.identifier == functionalityIdentifier),
orElse: () => null);
final functionality = functionalityList.firstWhereOrNull(
(element) => (element != null && element.identifier == functionalityIdentifier));

if (functionality != null) {
return functionality.enable;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class _DocumentDetailsWidgetState extends State<DocumentDetailsWidget> {
_documentInformationTile(AppLocalizations.of(context).created,
state.document?.creationDate.getMMMddyyyyFormatString() ?? ''),
_documentInformationTile(AppLocalizations.of(context).expiration,
state.document?.creationDate.getMMMddyyyyFormatString() ?? ''),
state.document?.expirationDate?.getMMMddyyyyFormatString() ?? AppLocalizations.of(context).no_results_found),
],
),
Divider(),
Expand Down

0 comments on commit a78f621

Please sign in to comment.