mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-24 17:49:03 +10:00
fix: Improve error handling when restoring last companion public key and update disconnection message in Dutch localization
This commit is contained in:
@@ -973,12 +973,18 @@ class MeshCoreConnector extends ChangeNotifier {
|
|||||||
final lastCompanionPublicKeyHex = prefs.getString(
|
final lastCompanionPublicKeyHex = prefs.getString(
|
||||||
_lastCompanionPublicKeyPref,
|
_lastCompanionPublicKeyPref,
|
||||||
);
|
);
|
||||||
if (lastCompanionPublicKeyHex == null ||
|
try {
|
||||||
lastCompanionPublicKeyHex.trim().isEmpty) {
|
if (lastCompanionPublicKeyHex == null ||
|
||||||
return;
|
lastCompanionPublicKeyHex.trim().isEmpty) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_selfPublicKey = hexToPubKey(lastCompanionPublicKeyHex);
|
||||||
|
_setScopedStorePublicKey(lastCompanionPublicKeyHex);
|
||||||
|
} catch (e) {
|
||||||
|
_appDebugLogService?.error(
|
||||||
|
'Failed to restore last companion scope with public key hex: $lastCompanionPublicKeyHex, error: $e',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
_selfPublicKey = hexToPubKey(lastCompanionPublicKeyHex);
|
|
||||||
_setScopedStorePublicKey(lastCompanionPublicKeyHex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> loadDiscoveredContactCache() => _loadDiscoveredContactCache();
|
Future<void> loadDiscoveredContactCache() => _loadDiscoveredContactCache();
|
||||||
|
|||||||
@@ -1968,7 +1968,7 @@ class AppLocalizationsNl extends AppLocalizations {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String get dialog_disconnectedMessage =>
|
String get dialog_disconnectedMessage =>
|
||||||
'Je bent verbonden met je companion.';
|
'Je bent losgekoppeld van je companion.';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get dialog_connectCompanion =>
|
String get dialog_connectCompanion =>
|
||||||
|
|||||||
@@ -324,12 +324,12 @@ class _ContactsScreenState extends State<ContactsScreen> {
|
|||||||
Text(context.l10n.contacts_zeroHopAdvert),
|
Text(context.l10n.contacts_zeroHopAdvert),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
onTap: () => {
|
onTap: () async {
|
||||||
connector.sendSelfAdvert(flood: false),
|
await connector.sendSelfAdvert(flood: false);
|
||||||
showDismissibleSnackBar(
|
showDismissibleSnackBar(
|
||||||
context,
|
context,
|
||||||
content: Text(context.l10n.settings_advertisementSent),
|
content: Text(context.l10n.settings_advertisementSent),
|
||||||
),
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
@@ -340,12 +340,12 @@ class _ContactsScreenState extends State<ContactsScreen> {
|
|||||||
Text(context.l10n.contacts_floodAdvert),
|
Text(context.l10n.contacts_floodAdvert),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
onTap: () => {
|
onTap: () async {
|
||||||
connector.sendSelfAdvert(flood: true),
|
await connector.sendSelfAdvert(flood: true);
|
||||||
showDismissibleSnackBar(
|
showDismissibleSnackBar(
|
||||||
context,
|
context,
|
||||||
content: Text(context.l10n.settings_advertisementSent),
|
content: Text(context.l10n.settings_advertisementSent),
|
||||||
),
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
|
|||||||
Reference in New Issue
Block a user