ente/lib/services/storage_bonus_service.dart
2023-02-17 14:19:11 +05:30

34 lines
883 B
Dart

import "package:photos/core/network/network.dart";
import "package:photos/gateways/storage_bonus_gw.dart";
import "package:shared_preferences/shared_preferences.dart";
class StorageBonusService {
late StorageBonusGateway gateway;
late SharedPreferences prefs;
final String _showStorageBonus = "showStorageBonus.showBanner";
void init(SharedPreferences preferences) {
prefs = preferences;
gateway = StorageBonusGateway(NetworkClient.instance.enteDio);
}
StorageBonusService._privateConstructor();
static StorageBonusService instance =
StorageBonusService._privateConstructor();
bool shouldShowStorageBonus() {
return prefs.getBool(_showStorageBonus) ?? true;
}
void markStorageBonusAsDone() {
prefs.setBool(_showStorageBonus, false).ignore();
}
// getter for gateway
StorageBonusGateway getGateway() {
return gateway;
}
}