InfiniTime icon indicating copy to clipboard operation
InfiniTime copied to clipboard

navigation: fix greying out the app icon if not enabled

Open mmind opened this issue 7 months ago • 4 comments

Commit 0aead42fdf51 ("navigation: Add is available (#1847)") added the ability to draw the app icon in grey and in a disabled state when some prerequisits were not met. Only the Navigation app was using this mechanism due to its icons being stored in the external memory and possibly missing.

Commit 63e0c4f4efb0 ("Application selection at build time") broke this by always setting the state as true: for (const auto& userApp : userApps) { apps[i++] = Screens::Tile::Applications {userApp.icon, userApp.app, true}; }

Fix this by creating an isAvailable() strcuture in the app classes, similar to how the Watchfaces handle the same problem of checking availability.

mmind avatar May 26 '25 08:05 mmind

Build size and comparison to main:

Section Size Difference
text 379204B 224B
data 944B 0B
bss 22536B 0B

Run in InfiniEmu

github-actions[bot] avatar May 27 '25 21:05 github-actions[bot]

Fixing it for just one App feels wrong for me. Would you be interested in implementing the same behavior as done with the Watchfaces?

Having a default isAvailable function returning true, and override it for Apps that need it. In our case just Navigation

NeroBurner avatar May 30 '25 16:05 NeroBurner

@NeroBurner sure, I can do that :-) .

I stumbled upon that thing while doing the other navigation stuff and InfiniSim not showing the flags, but also did not have a grasp on how the whole thing works.

So you're definitly right, doing that only for Navigation does not scale :-) and also thanks for pointing out how things should look correctly.

mmind avatar Jun 01 '25 16:06 mmind

Hopefully that is what you had in mind :-) ... Follows now how the Wachfaces look

mmind avatar Jun 01 '25 20:06 mmind