flipper-zero-tutorial-app icon indicating copy to clipboard operation
flipper-zero-tutorial-app copied to clipboard

TestAppScene and TestAppView should have the same length

Open MrModd opened this issue 1 year ago • 1 comments

Hello, I think that the view dispatcher uses the index passed to view_dispatcher_add_view() to know which module to use for that view. When you do scene_manager_next_scene() I believe the view dispatcher loads the module that was passed in ..._add_view().

You can see this because if you change the order of one of the two enums the application won't show anything. What's happening is that the ..._on_enter() function is building the elements in a module that the view dispatcher didn't load.

I think that in your case it's working just because it happens that the third value of the TestAppScene enum has the same module of the last value of TestAppView enum.

TL;DR I think that the enum TestAppView is not needed and you should use values from TestAppScene in view_dispatcher_add_view(). Moreover you should do an ..._add_view() for each element of TestAppScene.

MrModd avatar Nov 12 '23 10:11 MrModd