feature(mobile): sync assets, albums & users to local database on device (#1759)

* feature(mobile): sync assets, albums & users to local database on device

* try to fix tests

* move DB sync operations to new SyncService

* clear db on user logout

* fix reason for endless loading timeline

* fix error when deleting album

* fix thumbnail of device albums

* add a few comments

* fix Hive box not open in album service when loading local assets

* adjust tests to int IDs

* fix bug: show all albums when Recent is selected

* update generated api

* reworked Recents album isAll handling

* guard against wrongly interleaved sync operations

* fix: timeline asset ordering (sort asset state by created at)

* fix: sort assets in albums by created at
This commit is contained in:
Fynn Petersen-Frey 2023-03-03 23:38:30 +01:00 committed by GitHub
parent 8f11529a75
commit 8708867c1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
61 changed files with 9024 additions and 893 deletions

View file

@ -22,6 +22,7 @@ class UserResponseDto {
required this.shouldChangePassword,
required this.isAdmin,
this.deletedAt,
this.updatedAt,
required this.oauthId,
});
@ -49,6 +50,14 @@ class UserResponseDto {
///
DateTime? deletedAt;
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
String? updatedAt;
String oauthId;
@override
@ -62,6 +71,7 @@ class UserResponseDto {
other.shouldChangePassword == shouldChangePassword &&
other.isAdmin == isAdmin &&
other.deletedAt == deletedAt &&
other.updatedAt == updatedAt &&
other.oauthId == oauthId;
@override
@ -76,10 +86,11 @@ class UserResponseDto {
(shouldChangePassword.hashCode) +
(isAdmin.hashCode) +
(deletedAt == null ? 0 : deletedAt!.hashCode) +
(updatedAt == null ? 0 : updatedAt!.hashCode) +
(oauthId.hashCode);
@override
String toString() => 'UserResponseDto[id=$id, email=$email, firstName=$firstName, lastName=$lastName, createdAt=$createdAt, profileImagePath=$profileImagePath, shouldChangePassword=$shouldChangePassword, isAdmin=$isAdmin, deletedAt=$deletedAt, oauthId=$oauthId]';
String toString() => 'UserResponseDto[id=$id, email=$email, firstName=$firstName, lastName=$lastName, createdAt=$createdAt, profileImagePath=$profileImagePath, shouldChangePassword=$shouldChangePassword, isAdmin=$isAdmin, deletedAt=$deletedAt, updatedAt=$updatedAt, oauthId=$oauthId]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -95,6 +106,11 @@ class UserResponseDto {
json[r'deletedAt'] = this.deletedAt!.toUtc().toIso8601String();
} else {
// json[r'deletedAt'] = null;
}
if (this.updatedAt != null) {
json[r'updatedAt'] = this.updatedAt;
} else {
// json[r'updatedAt'] = null;
}
json[r'oauthId'] = this.oauthId;
return json;
@ -128,6 +144,7 @@ class UserResponseDto {
shouldChangePassword: mapValueOfType<bool>(json, r'shouldChangePassword')!,
isAdmin: mapValueOfType<bool>(json, r'isAdmin')!,
deletedAt: mapDateTime(json, r'deletedAt', ''),
updatedAt: mapValueOfType<String>(json, r'updatedAt'),
oauthId: mapValueOfType<String>(json, r'oauthId')!,
);
}