mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
Add album list response caching
This commit is contained in:
parent
75d8ca1306
commit
d310c77fc8
7 changed files with 108 additions and 22 deletions
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:hive/hive.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/constants/hive_box.dart';
|
||||
import 'package:immich_mobile/modules/album/services/album_cache.service.dart';
|
||||
import 'package:immich_mobile/modules/home/services/asset_cache.service.dart';
|
||||
import 'package:immich_mobile/modules/login/models/authentication_state.model.dart';
|
||||
import 'package:immich_mobile/modules/login/models/hive_saved_login_info.model.dart';
|
||||
|
|
@ -17,6 +18,7 @@ class AuthenticationNotifier extends StateNotifier<AuthenticationState> {
|
|||
this._backupService,
|
||||
this._apiService,
|
||||
this._assetCacheService,
|
||||
this._albumCacheService,
|
||||
) : super(
|
||||
AuthenticationState(
|
||||
deviceId: "",
|
||||
|
|
@ -44,6 +46,7 @@ class AuthenticationNotifier extends StateNotifier<AuthenticationState> {
|
|||
final BackupService _backupService;
|
||||
final ApiService _apiService;
|
||||
final AssetCacheService _assetCacheService;
|
||||
final AlbumCacheService _albumCacheService;
|
||||
|
||||
Future<bool> login(
|
||||
String email,
|
||||
|
|
@ -155,6 +158,7 @@ class AuthenticationNotifier extends StateNotifier<AuthenticationState> {
|
|||
Hive.box(userInfoBox).delete(accessTokenKey);
|
||||
state = state.copyWith(isAuthenticated: false);
|
||||
_assetCacheService.invalidate();
|
||||
_albumCacheService.invalidate();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -201,5 +205,6 @@ final authenticationProvider =
|
|||
ref.watch(backupServiceProvider),
|
||||
ref.watch(apiServiceProvider),
|
||||
ref.watch(assetCacheServiceProvider),
|
||||
ref.watch(albumCacheServiceProvider),
|
||||
);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue