CCExtractor / ultimate_alarm_clock

GNU General Public License v2.0
68 stars 122 forks source link

Bug: AddOrUpdateAlarmController initializing ahead of time causing multiple bugs #549

Closed keyurgit45 closed 2 months ago

keyurgit45 commented 4 months ago

Description

AddOrUpdateAlarmController should be initialised with the AddOrUpdateAlarmView. instead, it is initialising with bottomNavigationBarBindings.

06-04-24-1712414407

The main reason behind this is the InputTimeController. It has a dependency on both the AddOrUpdateAlarmController and TimerController. We are initializing the InputTimeController in the timer view. So when the bottom navigation bar is created, these controllers are initialized.

There can be multiple ways to tackle this issue. I would like to suggest that we decompose the InputTimeController into two classes. Currently, the InputTimeController violates the Single Responsibility Principle (SRP) because it contains the function/logic of the input time widget for both the alarm view and timer view, which require both controllers to be initialized.

Therefore, I will create two controllers named AlarmInputTimeController and TimerInputTimeController, each consisting of their independent logic. By refactoring in this way, the AddOrUpdateAlarmController need not be initialized with bottomNavigationBarBindings; instead, it can be initialized with AddOrUpdateAlarmView.

I suspect that issues #538, #531 and #546 are related to this.

keyurgit45 commented 4 months ago

@MarkisDev If you find my approach suitable, I will proceed with creating a PR for further review.