Offline support for Embeds blocks
This is an umbrella ticket for the various tasks we want to capture for a better offline support around the embeds blocks.
- [ ] Don't try to fetch inline preview when offline
- [ ] When offline, embed preview placeholder should denote that device is offline so preview is not available
- [ ] Listen to connectivity changes and trigger fetching the preview when device gets online while in the editor
- [ ] Listen to device getting offline and stop any previews still in progress
Thanks for creating this issue @hypest While working on https://github.com/wordpress-mobile/gutenberg-mobile/pull/3921 I ran into related offline support cases. Should the functionality here be prioritized and implemented soon? Currently, I don't see any mechanisms within the editor for monitoring connectivity changes, so I am thinking that connectivity observers would have to be implemented in WP Android and WP iOS, and updates get passed over the bridge.
For iOS I saw that we use the method ReachabilityUtils.isInternetReachable() in different places to determine if the device is offline. Probably we could expose a function in the bridge to check if internet is reachable on both platforms.
Thanks for checking @fluiddot similarly on Android, NetworkUtils.isNetworkAvailable(WordPress.getContext()) is utilized across the codebase to check if the device is offline or not.