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:
@@ -3,24 +3,35 @@ import Toybox.Lang;
|
|||||||
import Toybox.WatchUi;
|
import Toybox.WatchUi;
|
||||||
|
|
||||||
class garmin_padelApp extends Application.AppBase {
|
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();
|
AppBase.initialize();
|
||||||
|
_rules = new RulesConfig();
|
||||||
|
_match = new PadelMatch(_rules);
|
||||||
|
_hr = new HeartRateProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
// onStart() is called on application start up
|
public function onStart(state as Dictionary?) as Void {
|
||||||
function onStart(state as Dictionary?) as Void {
|
_hr.onStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
// onStop() is called when your application is exiting
|
public function onStop(state as Dictionary?) as Void {
|
||||||
function onStop(state as Dictionary?) as Void {
|
_hr.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the initial view of your application here
|
public function getMatch() as PadelMatch { return _match; }
|
||||||
function getInitialView() as [Views] or [Views, InputDelegates] {
|
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() ];
|
return [ new garmin_padelView(), new garmin_padelDelegate() ];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getApp() as garmin_padelApp {
|
function getApp() as garmin_padelApp {
|
||||||
|
|||||||
Reference in New Issue
Block a user