Files
swiftcontrol/prop_public/lib/services/bridge_usage_tracker.dart
Jonas Bark 50d9eea27d feat(iap): exempt internal trainer commands from daily limit during free testing
When the active FitnessBikeDefinition handles a trainer action internally
(gear shift, front shift, mode switch, intensity), don't count it against
the daily command limit for a free tester whose bridge session is still
counting down — no Pro on this device, no full version, and the 20-minute
budget not yet exhausted. All other counting paths are unchanged.

The increment now runs after handleTrainerAction so the decision can key
off whether the FBD actually handled the action. Gating lives in the pure,
testable BaseActions.isExemptInternalTrainerAction and is applied in both
the performAction trainer branch and the both-shifters combo path. Bumps
the prop submodule to its 6.3 branch for the new isCountingDown getter.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VRVXtrmcgtKKz46AVDyqQp
2026-06-30 10:17:02 +02:00

22 lines
561 B
Dart

import 'package:flutter/src/foundation/change_notifier.dart';
import 'package:shared_preferences/shared_preferences.dart';
class BridgeUsageTracker {
final SharedPreferences prefs;
final Duration dailyLimit;
BridgeUsageTracker({required this.prefs, required this.dailyLimit});
ValueListenable<Duration> get usedTodayListenable => ValueNotifier(dailyLimit);
bool get isExhausted => false;
bool get isCountingDown => false;
get onBudgetExhausted => null;
void startSession({required bool Function() isActive}) {}
void stopSession() {}
}