ente/lib/services/storage_bonus_service.dart

34 lines
883 B
Dart
Raw Normal View History

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;
2023-02-17 08:49:11 +00:00
final String _showStorageBonus = "showStorageBonus.showBanner";
void init(SharedPreferences preferences) {
prefs = preferences;
gateway = StorageBonusGateway(NetworkClient.instance.enteDio);
}
StorageBonusService._privateConstructor();
static StorageBonusService instance =
StorageBonusService._privateConstructor();
2023-02-15 16:47:40 +00:00
2023-02-17 08:49:11 +00:00
bool shouldShowStorageBonus() {
return prefs.getBool(_showStorageBonus) ?? true;
}
void markStorageBonusAsDone() {
prefs.setBool(_showStorageBonus, false).ignore();
}
2023-02-15 16:47:40 +00:00
// getter for gateway
StorageBonusGateway getGateway() {
return gateway;
}
}