feat: Implement Discord app UI and settings management

- Added MainUI class for displaying voice state, status icon, and buttons.
- Introduced MainUIHandler to manage UI interactions and bridge communication.
- Created SettingsUI for displaying QR code and configuration instructions.
- Implemented SettingsUIHandler to manage settings and web server interactions.
- Developed WebHandler for handling HTTP requests for settings configuration.
- Updated AppRegistry to initialize with the new Discord app descriptor.
- Enhanced InteractionHandler to support keyboard interactions across app switches.
- Updated UIHandler to manage app switching and rendering of app icons.
- Enabled QR code support in LVGL configuration.
This commit is contained in:
GW_MC
2026-02-02 20:47:27 +08:00
parent 12ad5be48a
commit e467951b8c
28 changed files with 1927 additions and 24 deletions

61
main/ui/apps/iotdis/app.h Normal file
View File

@@ -0,0 +1,61 @@
#pragma once
#include "ui/apps/app.h"
#include "ui/apps/iotdis/settings/settings_handler.h"
#include "ui/apps/iotdis/ui/main_handler.h"
#include "ui/apps/iotdis/ui/settings_handler.h"
#include "io/nvs_handler.h"
#include <string>
#include <memory>
// Forward declarations
class MainUIHandler;
class SettingsUIHandler;
/**
* @brief IotDis (Discord Integration) App
*
* Manages Discord voice state monitoring and control via UDP bridge.
* Features:
* - Real-time voice state monitoring (muted/unmuted)
* - Manual mute/unmute control
* - Settings for bridge IP/port configuration
* - Connection error detection and notification
* - NVS storage for persistent settings
*/
class IotDisApp : public UIApp {
public:
IotDisApp();
~IotDisApp() override;
esp_err_t init(lv_obj_t* container, InteractionHandler* interaction_handler) override;
esp_err_t deinit(void) override;
std::string get_name(void) const override;
bool on_back_button_pressed(void) override;
private:
// UI handlers
std::unique_ptr<MainUIHandler> main_ui_handler_;
std::unique_ptr<SettingsUIHandler> settings_ui_handler_;
// Current page tracking
enum class Page {
MAIN,
SETTINGS
};
Page current_page_;
// Settings handler (shared across handlers)
std::unique_ptr<SettingHandler> setting_handler_;
// Interaction handler (not owned)
InteractionHandler* interaction_handler_;
static constexpr const char* NVS_NAMESPACE = "discord_app";
// Private methods
void show_settings_page();
// UI callback forwarders
static void on_settings_button_clicked_static(lv_event_t* e);
};