| 145 | } |
| 146 | |
| 147 | void Audacity40PromoDialog::FetchReleaseInfo() |
| 148 | { |
| 149 | using namespace audacity::network_manager; |
| 150 | |
| 151 | const Request request(GetUpdatesUrl()); |
| 152 | mCurrentResponse = NetworkManager::GetInstance().doGet(request); |
| 153 | |
| 154 | mCurrentResponse->setRequestFinishedCallback([this](IResponse* response) { |
| 155 | if (response->getError() != NetworkError::NoError) |
| 156 | { |
| 157 | BasicUI::CallAfter([this] { |
| 158 | wxLogError("Failed to fetch Audacity 4 release info"); |
| 159 | BasicUI::ShowErrorDialog({}, |
| 160 | XO("Error"), |
| 161 | XO("Unable to fetch Audacity 4 release information. Please try again later."), |
| 162 | wxString(), |
| 163 | BasicUI::ErrorDialogOptions{ BasicUI::ErrorDialogType::ModalError }); |
| 164 | EndModal(wxID_CANCEL); |
| 165 | }); |
| 166 | return; |
| 167 | } |
| 168 | |
| 169 | std::string jsonData = response->readAll<std::string>(); |
| 170 | UpdateFeedMigrationParser parser; |
| 171 | |
| 172 | if (!parser.ParseRelease(jsonData, mReleaseInfo) || !mReleaseInfo.IsValid()) |
| 173 | { |
| 174 | BasicUI::CallAfter([this] { |
| 175 | wxLogError("Failed to parse Audacity 4 release info"); |
| 176 | BasicUI::ShowErrorDialog({}, |
| 177 | XO("Error"), |
| 178 | XO("Unable to parse Audacity 4 release information. Please try again later."), |
| 179 | wxString(), |
| 180 | BasicUI::ErrorDialogOptions{ BasicUI::ErrorDialogType::ModalError }); |
| 181 | EndModal(wxID_CANCEL); |
| 182 | }); |
| 183 | return; |
| 184 | } |
| 185 | |
| 186 | BasicUI::CallAfter([this] { |
| 187 | StartDownload(); |
| 188 | }); |
| 189 | }); |
| 190 | } |
| 191 | |
| 192 | void Audacity40PromoDialog::StartDownload() |
| 193 | { |
nothing calls this directly
no test coverage detected