mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
Implemented reload when pop back from backup controller page
This commit is contained in:
parent
e2904a02a5
commit
fe6f01cc0c
11 changed files with 126 additions and 31 deletions
|
|
@ -2,6 +2,7 @@ import 'dart:convert';
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:immich_mobile/modules/home/models/get_all_asset_respose.model.dart';
|
||||
import 'package:immich_mobile/shared/models/immich_asset.model.dart';
|
||||
import 'package:immich_mobile/shared/services/network.service.dart';
|
||||
|
||||
class AssetService {
|
||||
|
|
@ -17,9 +18,10 @@ class AssetService {
|
|||
} catch (e) {
|
||||
debugPrint("Error getAllAsset ${e.toString()}");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Future<GetAllAssetResponse?> getMoreAsset(String? nextPageKey) async {
|
||||
Future<GetAllAssetResponse?> getOlderAsset(String? nextPageKey) async {
|
||||
try {
|
||||
var res = await _networkService.getRequest(
|
||||
url: "asset/all?nextPageKey=$nextPageKey",
|
||||
|
|
@ -34,5 +36,26 @@ class AssetService {
|
|||
} catch (e) {
|
||||
debugPrint("Error getAllAsset ${e.toString()}");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Future<List<ImmichAsset>> getNewAsset(String latestDate) async {
|
||||
try {
|
||||
var res = await _networkService.getRequest(
|
||||
url: "asset/new?latestDate=$latestDate",
|
||||
);
|
||||
|
||||
List<dynamic> decodedData = jsonDecode(res.toString());
|
||||
|
||||
List<ImmichAsset> result = List.from(decodedData.map((a) => ImmichAsset.fromMap(a)));
|
||||
if (result.isNotEmpty) {
|
||||
return result;
|
||||
}
|
||||
|
||||
return [];
|
||||
} catch (e) {
|
||||
debugPrint("Error getAllAsset ${e.toString()}");
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue