feat: app owns match/rules/HR and exposes accessors

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-04 10:59:31 +02:00
parent 693bcf9a58
commit 48f7d5c7dc

View File

@@ -3,24 +3,35 @@ import Toybox.Lang;
import Toybox.WatchUi;
class garmin_padelApp extends Application.AppBase {
private var _rules as RulesConfig;
private var _match as PadelMatch;
private var _hr as HeartRateProvider;
function initialize() {
public function initialize() {
AppBase.initialize();
_rules = new RulesConfig();
_match = new PadelMatch(_rules);
_hr = new HeartRateProvider();
}
// onStart() is called on application start up
function onStart(state as Dictionary?) as Void {
public function onStart(state as Dictionary?) as Void {
_hr.onStart();
}
// onStop() is called when your application is exiting
function onStop(state as Dictionary?) as Void {
public function onStop(state as Dictionary?) as Void {
_hr.onStop();
}
// Return the initial view of your application here
function getInitialView() as [Views] or [Views, InputDelegates] {
public function getMatch() as PadelMatch { return _match; }
public function getHeartRate() as HeartRateProvider { return _hr; }
public function resetMatch() as Void {
_match = new PadelMatch(_rules);
}
public function getInitialView() as [Views] or [Views, InputDelegates] {
return [ new garmin_padelView(), new garmin_padelDelegate() ];
}
}
function getApp() as garmin_padelApp {