opt.: watch sync mechanism (#817)

* opt.: watch sync mechanism
Fixes #816

* opt.
This commit is contained in:
lollipopkit🏳️‍⚧️
2025-07-17 16:55:56 +08:00
committed by GitHub
parent dbc873c0c0
commit a35d21981b
2 changed files with 95 additions and 14 deletions

View File

@@ -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) {