import 'package:flutter_riverpod/flutter_riverpod.dart';

import 'providers.dart';

/// Whether the player owns the remove-ads entitlement. Seeded from the save
/// repository; [grant] flips it on (after a successful purchase/restore) and
/// persists.
class AdsRemovedNotifier extends Notifier<bool> {
  @override
  bool build() => ref.read(saveRepositoryProvider).adsRemoved;

  Future<void> grant() async {
    if (state) return;
    await ref.read(saveRepositoryProvider).setAdsRemoved(true);
    state = true;
  }
}
