MCPcopy Create free account
hub / github.com/audacity/audacity / FetchReleaseInfo

Method FetchReleaseInfo

src/update/Audacity40PromoDialog.cpp:147–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147void 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
192void Audacity40PromoDialog::StartDownload()
193{

Callers

nothing calls this directly

Calls 8

CallAfterFunction · 0.85
ShowErrorDialogFunction · 0.85
doGetMethod · 0.80
ParseReleaseMethod · 0.80
wxStringClass · 0.50
getErrorMethod · 0.45
IsValidMethod · 0.45

Tested by

no test coverage detected