refactor(mobile): introduce Album & User classes (#1561)

replace usages of AlbumResponseDto with Album
replace usages of UserResponseDto with User
This commit is contained in:
Fynn Petersen-Frey
2023-02-06 08:13:32 +01:00
committed by GitHub
parent 527aa61a87
commit 2139853dd9
25 changed files with 475 additions and 255 deletions

View File

@@ -18,6 +18,7 @@ import 'package:immich_mobile/modules/home/ui/profile_drawer/profile_drawer.dart
import 'package:immich_mobile/modules/settings/providers/app_settings.provider.dart';
import 'package:immich_mobile/modules/settings/services/app_settings.service.dart';
import 'package:immich_mobile/routing/router.dart';
import 'package:immich_mobile/shared/models/album.dart';
import 'package:immich_mobile/shared/models/asset.dart';
import 'package:immich_mobile/shared/providers/asset.provider.dart';
import 'package:immich_mobile/shared/providers/server_info.provider.dart';
@@ -25,7 +26,6 @@ import 'package:immich_mobile/shared/providers/websocket.provider.dart';
import 'package:immich_mobile/shared/services/share.service.dart';
import 'package:immich_mobile/shared/ui/immich_loading_indicator.dart';
import 'package:immich_mobile/shared/ui/immich_toast.dart';
import 'package:openapi/api.dart';
class HomePage extends HookConsumerWidget {
const HomePage({Key? key}) : super(key: key);
@@ -102,14 +102,14 @@ class HomePage extends HookConsumerWidget {
return assets;
}
void onAddToAlbum(AlbumResponseDto album) async {
void onAddToAlbum(Album album) async {
final Iterable<Asset> assets = remoteOnlySelection();
if (assets.isEmpty) {
return;
}
final result = await albumService.addAdditionalAssetToAlbum(
assets,
album.id,
album,
);
if (result != null) {
@@ -118,7 +118,7 @@ class HomePage extends HookConsumerWidget {
context: context,
msg: "home_page_add_to_album_conflicts".tr(
namedArgs: {
"album": album.albumName,
"album": album.name,
"added": result.successfullyAdded.toString(),
"failed": result.alreadyInAlbum.length.toString()
},
@@ -129,7 +129,7 @@ class HomePage extends HookConsumerWidget {
context: context,
msg: "home_page_add_to_album_success".tr(
namedArgs: {
"album": album.albumName,
"album": album.name,
"added": result.successfullyAdded.toString(),
},
),