fmidev / weather-app

FMI's official weather application for mobile devices
7 stars 2 forks source link

Save favorites so that widgets can read them #709

Open geosaaga opened 4 days ago

geosaaga commented 4 days ago

Widgets need access to favorites defined in the main app. Save favorites to UserDefaults (iOS) and shared preferences (Android) when favorites are modified and when the app is launched.

react-native-mmkv seems to be the best library to implement this

https://github.com/mrousavy/react-native-mmkv

iOS requires that the main app and widget belong to same app group to share settings.

geosaaga commented 4 days ago

Current widgets read favorites from SQLiteDatabase where react-native-async-storage saves data. Have to keep that working.

geosaaga commented 3 days ago

PR: https://github.com/fmidev/weather-app/pull/712

In the end didn't use react-native-mmkv, because that would have mean bigger changes => integrating mmkv library also to iOS/Android native code.