Skip to content

Commit

Permalink
Move ui methods to businessManager
Browse files Browse the repository at this point in the history
  • Loading branch information
Artaud committed Aug 24, 2020
1 parent 22ffe87 commit f000d09
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions SleepGarmin-watch2/source/AlarmManager.mc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class AlarmManager {
}

function startAlarmNow() {
self.ctx.state.switchToAlarmScreen();
self.ctx.businessManager.switchToAlarmScreen();
self.ctx.attentionSeeker.startAlarmVibration();
}

Expand All @@ -28,7 +28,7 @@ class AlarmManager {

function stopAlarm() {
self.ctx.attentionSeeker.stopAlarmVibration();
self.ctx.state.backToMainScreen();
self.ctx.businessManager.backToMainScreen();
}


Expand Down
10 changes: 9 additions & 1 deletion SleepGarmin-watch2/source/BusinessManager.mc
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,13 @@ class BusinessManager {
DebugManager.log("BusinessManager exit");
System.exit();
}


function switchToAlarmScreen() {
WatchUi.pushView(new AlarmView(self.ctx), new AlarmDelegate(self.ctx), WatchUi.SLIDE_UP);
}

function backToMainScreen() {
WatchUi.popView(WatchUi.SLIDE_DOWN);
}

}
7 changes: 0 additions & 7 deletions SleepGarmin-watch2/source/State.mc
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,5 @@ class State {
return self.doingAlarm;
}

function switchToAlarmScreen() {
WatchUi.pushView(new AlarmView(self.ctx), new AlarmDelegate(self.ctx), WatchUi.SLIDE_UP);
}

function backToMainScreen() {
WatchUi.popView(WatchUi.SLIDE_DOWN);
}

}

0 comments on commit f000d09

Please sign in to comment.