| 41 | } |
| 42 | |
| 43 | void ChatApp::onCreate(AppContext& appContext) { |
| 44 | isFirstLaunch = !settingsFileExists(); |
| 45 | settings = loadSettings(); |
| 46 | state.setLocalNickname(settings.nickname); |
| 47 | if (!settings.chatChannel.empty()) { |
| 48 | state.setCurrentChannel(settings.chatChannel); |
| 49 | } |
| 50 | enableEspNow(); |
| 51 | |
| 52 | receiveSubscription = service::espnow::subscribeReceiver( |
| 53 | [this](const esp_now_recv_info_t* receiveInfo, const uint8_t* data, int length) { |
| 54 | onReceive(receiveInfo, data, length); |
| 55 | } |
| 56 | ); |
| 57 | } |
| 58 | |
| 59 | void ChatApp::onDestroy(AppContext& appContext) { |
| 60 | service::espnow::unsubscribeReceiver(receiveSubscription); |
no test coverage detected