| 122 | } |
| 123 | |
| 124 | void refresh() { |
| 125 | lv_obj_clean(contentWrapper); |
| 126 | auto* spinner = lvgl::spinner_create(contentWrapper); |
| 127 | lv_obj_align(spinner, LV_ALIGN_CENTER, 0, 0); |
| 128 | |
| 129 | lv_obj_add_flag(refreshButton, LV_OBJ_FLAG_HIDDEN); |
| 130 | |
| 131 | if (service::wifi::getRadioState() != service::wifi::RadioState::ConnectionActive) { |
| 132 | showNoInternet(); |
| 133 | return; |
| 134 | } |
| 135 | |
| 136 | if (file::isFile(cachedAppsJsonFile)) { |
| 137 | showApps(); |
| 138 | } |
| 139 | |
| 140 | network::http::download( |
| 141 | getAppsJsonUrl(), |
| 142 | CERTIFICATE_PATH, |
| 143 | cachedAppsJsonFile, |
| 144 | [] { |
| 145 | auto app = findAppInstance(); |
| 146 | if (app != nullptr) { |
| 147 | app->onRefreshSuccess(); |
| 148 | } |
| 149 | }, |
| 150 | [](const char* error) { |
| 151 | auto app = findAppInstance(); |
| 152 | if (app != nullptr) { |
| 153 | app->onRefreshError(error); |
| 154 | } |
| 155 | } |
| 156 | ); |
| 157 | } |
| 158 | |
| 159 | public: |
| 160 |
no test coverage detected