mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-01 06:22:55 +01:00
Huawei: Weather no longer depends on weather start response
This commit is contained in:
parent
0c19010ca2
commit
b43d87f6bc
@ -1838,18 +1838,32 @@ public class HuaweiSupportProvider {
|
|||||||
Weather.Settings weatherSettings = new Weather.Settings();
|
Weather.Settings weatherSettings = new Weather.Settings();
|
||||||
|
|
||||||
SendWeatherStartRequest weatherStartRequest = new SendWeatherStartRequest(this, weatherSettings);
|
SendWeatherStartRequest weatherStartRequest = new SendWeatherStartRequest(this, weatherSettings);
|
||||||
Request lastRequest = weatherStartRequest;
|
try {
|
||||||
|
weatherStartRequest.doPerform();
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO: Use translatable string
|
||||||
|
GB.toast(context, "Failed to send start weather", Toast.LENGTH_SHORT, GB.ERROR, e);
|
||||||
|
LOG.error("Failed to send start weather", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
Request firstRequest = null;
|
||||||
|
Request lastRequest = null;
|
||||||
|
|
||||||
if (getHuaweiCoordinator().supportsWeatherUnit()) {
|
if (getHuaweiCoordinator().supportsWeatherUnit()) {
|
||||||
SendWeatherUnitRequest weatherUnitRequest = new SendWeatherUnitRequest(this);
|
SendWeatherUnitRequest weatherUnitRequest = new SendWeatherUnitRequest(this);
|
||||||
lastRequest.nextRequest(weatherUnitRequest);
|
firstRequest = weatherUnitRequest;
|
||||||
lastRequest = weatherUnitRequest;
|
lastRequest = weatherUnitRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
SendWeatherSupportRequest weatherSupportRequest = new SendWeatherSupportRequest(this, weatherSettings);
|
SendWeatherSupportRequest weatherSupportRequest = new SendWeatherSupportRequest(this, weatherSettings);
|
||||||
lastRequest.nextRequest(weatherSupportRequest);
|
if (firstRequest == null) {
|
||||||
|
firstRequest = weatherSupportRequest;
|
||||||
|
} else {
|
||||||
|
lastRequest.nextRequest(weatherSupportRequest);
|
||||||
|
}
|
||||||
lastRequest = weatherSupportRequest;
|
lastRequest = weatherSupportRequest;
|
||||||
|
|
||||||
|
|
||||||
if (getHuaweiCoordinator().supportsWeatherExtended()) {
|
if (getHuaweiCoordinator().supportsWeatherExtended()) {
|
||||||
SendWeatherExtendedSupportRequest weatherExtendedSupportRequest = new SendWeatherExtendedSupportRequest(this, weatherSettings);
|
SendWeatherExtendedSupportRequest weatherExtendedSupportRequest = new SendWeatherExtendedSupportRequest(this, weatherSettings);
|
||||||
lastRequest.nextRequest(weatherExtendedSupportRequest);
|
lastRequest.nextRequest(weatherExtendedSupportRequest);
|
||||||
@ -1879,7 +1893,7 @@ public class HuaweiSupportProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
weatherStartRequest.doPerform();
|
firstRequest.doPerform();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO: Use translatable string
|
// TODO: Use translatable string
|
||||||
GB.toast(context, "Failed to send weather", Toast.LENGTH_SHORT, GB.ERROR, e);
|
GB.toast(context, "Failed to send weather", Toast.LENGTH_SHORT, GB.ERROR, e);
|
||||||
|
Loading…
Reference in New Issue
Block a user