mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-18 15:54:35 +01:00
opt.: watch sync mechanism (#817)
* opt.: watch sync mechanism Fixes #816 * opt.
This commit is contained in:
@@ -114,7 +114,20 @@ class _IosSettingsPageState extends State<IosSettingsPage> {
|
||||
|
||||
final (_, err) = await context.showLoadingDialog(
|
||||
fn: () async {
|
||||
await wc.updateApplicationContext({'urls': result});
|
||||
final data = {'urls': result};
|
||||
|
||||
// Try realtime update (app must be running foreground).
|
||||
try {
|
||||
if (await wc.isReachable) {
|
||||
await wc.sendMessage(data);
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
Loggers.app.warning('Failed to send message to watch', e);
|
||||
}
|
||||
|
||||
// fallback
|
||||
await wc.updateApplicationContext(data);
|
||||
},
|
||||
);
|
||||
if (err == null) {
|
||||
|
||||
Reference in New Issue
Block a user