| 96 | } |
| 97 | |
| 98 | void showApps() { |
| 99 | lv_obj_clean(contentWrapper); |
| 100 | mutex.lock(); |
| 101 | if (parseJson(cachedAppsJsonFile, entries)) { |
| 102 | std::ranges::sort(entries, [](auto left, auto right) { |
| 103 | return left.appName < right.appName; |
| 104 | }); |
| 105 | |
| 106 | auto* list = lv_list_create(contentWrapper); |
| 107 | lv_obj_set_style_pad_all(list, 0, LV_STATE_DEFAULT); |
| 108 | lv_obj_set_size(list, LV_PCT(100), LV_SIZE_CONTENT); |
| 109 | for (int i = 0; i < entries.size(); i++) { |
| 110 | auto& entry = entries[i]; |
| 111 | LOGGER.info("Adding {}", entry.appName.c_str()); |
| 112 | const char* icon = findAppManifestById(entry.appId) != nullptr ? LV_SYMBOL_OK : nullptr; |
| 113 | auto* entry_button = lv_list_add_button(list, icon, entry.appName.c_str()); |
| 114 | auto int_as_voidptr = reinterpret_cast<void*>(i); |
| 115 | lv_obj_set_user_data(entry_button, int_as_voidptr); |
| 116 | lv_obj_add_event_cb(entry_button, onAppPressed, LV_EVENT_SHORT_CLICKED, this); |
| 117 | } |
| 118 | } else { |
| 119 | showRefreshFailedError("Failed to load content"); |
| 120 | } |
| 121 | mutex.unlock(); |
| 122 | } |
| 123 | |
| 124 | void refresh() { |
| 125 | lv_obj_clean(contentWrapper); |
nothing calls this directly
no test coverage detected