1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-12 13:09:24 +01:00

Fix Weather notification integration

This commit is contained in:
José Rebelo 2023-07-07 09:03:35 +01:00
parent 708cb0c617
commit 665268c419
2 changed files with 9 additions and 3 deletions

View File

@ -405,14 +405,14 @@
<receiver <receiver
android:name=".externalevents.WeatherNotificationReceiver" android:name=".externalevents.WeatherNotificationReceiver"
android:enabled="true" android:enabled="true"
android:exported="false"> android:exported="true">
<intent-filter> <intent-filter>
<action android:name="ru.gelin.android.weather.notification.ACTION_WEATHER_UPDATE_2" /> <action android:name="ru.gelin.android.weather.notification.ACTION_WEATHER_UPDATE_2" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<activity android:name=".externalevents.WeatherNotificationConfig" <activity android:name=".externalevents.WeatherNotificationConfig"
android:exported="false"> android:exported="true">
<intent-filter> <intent-filter>
<action android:name="ru.gelin.android.weather.notification.ACTION_WEATHER_SKIN_PREFERENCES" /> <action android:name="ru.gelin.android.weather.notification.ACTION_WEATHER_SKIN_PREFERENCES" />
</intent-filter> </intent-filter>

View File

@ -25,6 +25,8 @@ import android.widget.Toast;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList; import java.util.ArrayList;
@ -34,6 +36,8 @@ import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec;
import nodomain.freeyourgadget.gadgetbridge.util.GB; import nodomain.freeyourgadget.gadgetbridge.util.GB;
public class GenericWeatherReceiver extends BroadcastReceiver { public class GenericWeatherReceiver extends BroadcastReceiver {
private static final Logger LOG = LoggerFactory.getLogger(GenericWeatherReceiver.class);
public final static String ACTION_GENERIC_WEATHER = "nodomain.freeyourgadget.gadgetbridge.ACTION_GENERIC_WEATHER"; public final static String ACTION_GENERIC_WEATHER = "nodomain.freeyourgadget.gadgetbridge.ACTION_GENERIC_WEATHER";
public final static String EXTRA_WEATHER_JSON = "WeatherJson"; public final static String EXTRA_WEATHER_JSON = "WeatherJson";
@ -78,6 +82,8 @@ public class GenericWeatherReceiver extends BroadcastReceiver {
} }
} }
LOG.info("Got generic weather for {}", weatherSpec.location);
Weather.getInstance().setWeatherSpec(weatherSpec); Weather.getInstance().setWeatherSpec(weatherSpec);
GBApplication.deviceService().onSendWeather(weatherSpec); GBApplication.deviceService().onSendWeather(weatherSpec);
} catch (Exception e) { } catch (Exception e) {