Skip to content

Commit

Permalink
Fix activity time not changing
Browse files Browse the repository at this point in the history
  • Loading branch information
guyluz11 committed Nov 21, 2024
1 parent b25899e commit dac2cc3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/presentation/organisms/timer_organism.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,6 @@ class TimerOrganismState extends State<TimerOrganism> {
TimerState state = TimerStateManager.state;
bool renderSizedBox = false;

void onComplete() {
TimerStateManager.incrementState();
TimerStateManager.iterateOverTimerStates();
setCurrentState();
}

@override
void initState() {
super.initState();
Expand All @@ -188,6 +182,12 @@ class TimerOrganismState extends State<TimerOrganism> {
super.dispose();
}

void onComplete() {
TimerStateManager.incrementState();
TimerStateManager.iterateOverTimerStates();
setCurrentState();
}

Future setCurrentState() async {
if (state == TimerState.work &&
TimerStateManager.state == TimerState.breakTime) {
Expand Down
3 changes: 3 additions & 0 deletions lib/presentation/pages/activity_page.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:infinite_horizons/domain/controllers/controllers.dart';
import 'package:infinite_horizons/domain/objects/work_type_abstract.dart';
import 'package:infinite_horizons/presentation/molecules/molecules.dart';
import 'package:infinite_horizons/presentation/organisms/organisms.dart';

Expand All @@ -26,6 +27,8 @@ class _ActivityPageState extends State<ActivityPage>
@override
void initState() {
super.initState();
TimerStateManager.timerStates = WorkTypeAbstract.instance!.getTimerStates();

WidgetsBinding.instance.addObserver(this);
PlayerController.instance.setIsSound(
PreferencesController.instance.getBool(PreferenceKeys.isSound) ?? true,
Expand Down

0 comments on commit dac2cc3

Please sign in to comment.