InfiniTimeOrg / InfiniTime

Firmware for Pinetime smartwatch written in C++ and based on FreeRTOS
GNU General Public License v3.0
2.68k stars 916 forks source link

block notifications when flashlight is on - first quick try #1525

Closed rambonette closed 1 year ago

rambonette commented 1 year ago

Premise: I don't know if this is the right approach to accomplish this.

Quick (possible) solution to this #1522 issue/enhancement. Made a quick before/after video comparison to demonstrate the solution.

Before:

before

After:

after

The basic strategy here is to check if settingsController.GetNotificationStatus() is On when Flashlight is toggled, then act accordingly keeping track of the previous notification status with bool notificationsStatus to be able to revert the setting once Flashlight is off.

FintasticMan commented 1 year ago

Looks good! One concern I have is that every change to the settings means a write to the flash storage, and doing that every time the flashlight is turned on or off might not be great for the lifespan of the storage. Maybe it could instead be implemented as an extra check whether the flashlight app is running before sending a notification.

rambonette commented 1 year ago

Thanks @FintasticMan !

Looks good! One concern I have is that every change to the settings means a write to the flash storage, and doing that every time the flashlight is turned on or off might not be great for the lifespan of the storage. Maybe it could instead be implemented as an extra check whether the flashlight app is running before sending a notification.

That's actually a very smart idea. I'll definitely try this reverse approach!

Riksu9000 commented 1 year ago

Considering the before animation is outdated, I think the current behaviour is fine. We shouldn't make unnecessary exceptions for showing notifications, and by having the flashlight turn off, you won't get blinded by the light when you close the notification.