2024-09-04 19:01:40 +00:00
|
|
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
|
|
|
2024-12-07 14:08:05 +00:00
|
|
|
import '../models/auth/profile.dart';
|
|
|
|
import 'connection_manager_services.dart';
|
|
|
|
import 'direct_message_services.dart';
|
|
|
|
import 'follow_requests_services.dart';
|
2024-09-04 19:01:40 +00:00
|
|
|
import 'hashtag_service.dart';
|
2024-11-27 02:18:08 +00:00
|
|
|
import 'notification_services.dart';
|
2024-09-04 19:01:40 +00:00
|
|
|
|
|
|
|
part 'cache_clear_service.g.dart';
|
|
|
|
|
|
|
|
@riverpod
|
2024-12-07 14:08:05 +00:00
|
|
|
class ClearCaches extends _$ClearCaches {
|
|
|
|
@override
|
|
|
|
bool build() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cacheClearService() {
|
|
|
|
ref.read(hashtagServiceProvider().notifier).clear();
|
|
|
|
ref.invalidate(notificationsManagerProvider);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool profileCacheClearService(Profile profile) {
|
|
|
|
ref.invalidate(followRequestsProvider(profile));
|
|
|
|
ref.invalidate(directMessageThreadIdsProvider(profile));
|
|
|
|
ref.read(connectionsRepoClearerProvider(profile).notifier).clear();
|
|
|
|
// TODO see what else needs to be cleared out here
|
|
|
|
return true;
|
|
|
|
}
|
2024-09-04 19:01:40 +00:00
|
|
|
}
|