InfiniTimeOrg / InfiniTime

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

Draft [Help wanted]: Unified app interface #1775

Closed minacode closed 1 year ago

minacode commented 1 year ago

This is an experiment based on #1571. It is about reducing all the different places in the code where apps are declared.

I am not experienced with this, so any input would be really helpful. Maybe we can figure something out together. Take this PR as a basis for discussion. I would like to learn from this. And hopefully we can find a good solution on how to handle apps :relieved:

The idea is to implement an App class that gets inherited by all Screens we consider to be apps. This means all the screens that could one day be loaded dynamically (watch faces maybe their own thing...). For example QuickSettings is not an App, but Twos is.

There are some issues to be resolved with the current state:

  1. The apps are explicitly instanciated in the DisplayApp.cpp and with custom arguments. This PR tries to implement an AppInterface that provides the same way of creation for all apps. Right now, this is done via a Get method that is known to be present with all apps. We can further on reduce the capabilities that we give each app, but I would like to focus on getting this to run the easy way first.
  2. The ApplicationList explicitly lists all the apps and their symbols. This PR implements a GetSymbol method for the App class. This moves the declaration of the symbol inside the app.
  3. All apps are handled individually. This is not fixed right now, but I would like to have an AppController in the later progress that can handle the App objects. The interface of the App class must be enough to do all the things the controller has to do.

I would really like your ideas and feedback! :)

github-actions[bot] commented 1 year ago

Build checks have not completed. Possible reasons for this are:

  1. The checks need to be approved by a maintainer
  2. The branch has conflicts
  3. The firmware build has failed
everypizza1 commented 10 months ago

Did you mean to close this?

minacode commented 10 months ago

Yes, I am working on a newer version which isn't public yet.