mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 16:30:28 +00:00
Refine contact refresh flow
This commit is contained in:
@@ -1613,14 +1613,9 @@ class AppProvider with ChangeNotifier {
|
||||
debugPrint(
|
||||
'🔄 [AppProvider] Path updated for contact: ${publicKey.sublist(0, 6).map((b) => b.toRadixString(16).padLeft(2, '0')).join(':')}...',
|
||||
);
|
||||
// Trigger a single contact fetch to get the updated path information
|
||||
// This is much more efficient than fetching all contacts
|
||||
// This happens asynchronously to avoid blocking the event handler
|
||||
Future.delayed(const Duration(milliseconds: 100), () {
|
||||
if (connectionProvider.deviceInfo.isConnected) {
|
||||
connectionProvider.getContact(publicKey);
|
||||
}
|
||||
});
|
||||
if (connectionProvider.deviceInfo.isConnected) {
|
||||
unawaited(connectionProvider.getContact(publicKey));
|
||||
}
|
||||
};
|
||||
|
||||
// When an advertisement is received (PUSH_CODE_ADVERT 0x80)
|
||||
@@ -1996,11 +1991,9 @@ class AppProvider with ChangeNotifier {
|
||||
contactsProvider.resetContactRouteLocal(latestContact.publicKey);
|
||||
if (connectionProvider.deviceInfo.isConnected) {
|
||||
await connectionProvider.resetPath(latestContact.publicKey);
|
||||
Future.delayed(const Duration(milliseconds: 150), () {
|
||||
if (connectionProvider.deviceInfo.isConnected) {
|
||||
connectionProvider.getContact(latestContact.publicKey);
|
||||
}
|
||||
});
|
||||
if (connectionProvider.deviceInfo.isConnected) {
|
||||
await connectionProvider.getContact(latestContact.publicKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user