Files
roro9stack/lib/core/src/app_manager.h
T
twislaandClaude Opus 5.5 51698a8011 M0 step 7: Settings, About, Storage, first-boot setup
- lib/apps_model (host-tested): SettingsMenu (rows, readable values,
  choices, validation messages) and SetupWizard (names, Region
  confirmation, timezone; saves only when finished)
- AppManager: modal Apps that Home/Back can't leave (setup wizard)
- SettingsApp: all settings plus Storage (usage, erase SD behind a
  dialog) and About (version, node id, battery, memory, uptime) pages,
  replacing the temporary Diagnostics App
- SetupApp: first-boot wizard, opened modally until SetupDone
- Node id and default names derived from the MAC like Meshtastic
- Widget demo is now hidden (About, then w)
- lib_ldf_mode = deep+ so libraries see each other's headers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
2026-10-02 13:47:03 +02:00

55 lines
1.5 KiB
C++

#pragma once
#include <vector>
#include "app.h"
namespace roro {
struct AppInfo {
const char* id;
const char* title;
bool hidden; // not listed in the Launcher, but can still be opened
App* app;
};
// Owns which App is in the foreground and routes keys. Home always returns to the Launcher;
// Back is offered to the App first and returns to the Launcher if the App doesn't consume it.
class AppManager {
public:
explicit AppManager(App& launcher);
void registerApp(const AppInfo& info);
std::vector<const AppInfo*> visibleApps() const;
void begin();
bool open(const char* id); // refused while a modal App runs
void home();
// A modal App (e.g. the first-boot wizard) can't be left with Home or Back: those keys go to it,
// and it ends itself with endModal(), which returns to the Launcher.
bool openModal(const char* id);
void endModal();
void handleKey(const KeyEvent& event);
void update(uint32_t nowMs) { foreground_->update(nowMs); }
App& foreground() const { return *foreground_; }
const char* foregroundTitle() const; // nullptr for the Launcher
// True once after the screen needs redrawing (App switch, or the App asked for it).
bool takeRedraw();
private:
void switchTo(App& app);
App* find(const char* id) const;
App& launcher_;
App* foreground_;
std::vector<AppInfo> apps_;
bool redraw_ = true;
bool modal_ = false;
};
} // namespace roro