feat: add more easter eggs
This commit is contained in:
@@ -104,6 +104,28 @@ class RemoteSyncService {
|
||||
/// Null for devices linked before the name was kept.
|
||||
Future<String?> get venueName => secureStorage.read(key: _venueNameKey);
|
||||
|
||||
/// Looks up and keeps the venue's name for a device linked before the
|
||||
/// name was kept. Null when it can't be found, e.g. while offline.
|
||||
Future<String?> fetchVenueName() async {
|
||||
final venueId = await this.venueId;
|
||||
if (venueId == null) return null;
|
||||
|
||||
try {
|
||||
final venues = await apiClient.getVenues();
|
||||
final name = venues
|
||||
.where((venue) => venue.id == venueId)
|
||||
.firstOrNull
|
||||
?.name;
|
||||
if (name != null) {
|
||||
await secureStorage.write(key: _venueNameKey, value: name);
|
||||
}
|
||||
return name;
|
||||
} on Exception catch (e) {
|
||||
debugPrint('RemoteSyncService: fetchVenueName error: $e');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> get isConfigured async => await _credentials() != null;
|
||||
|
||||
Future<String?> get authToken async => (await _credentials())?.token;
|
||||
|
||||
Reference in New Issue
Block a user