mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-06-14 22:55:12 +10:00
add auto clock synchronization setting after repeater login
Introduced a new setting for automatic clock synchronization after a successful repeater login. Added localization support for the new feature in multiple languages (Bulgarian, German, English, Spanish, French, Hungarian, Italian, Japanese, Korean, Dutch, Polish, Portuguese, Russian, Slovak, Slovenian, Swedish, Ukrainian, Chinese). Implemented storage service methods to manage the new setting. Updated the repeater settings screen to include a toggle for the new feature. Enhanced the repeater login dialog to trigger clock synchronization automatically if the setting is enabled.
This commit is contained in:
@@ -187,6 +187,29 @@ class _RepeaterLoginDialogState extends State<RepeaterLoginDialog> {
|
||||
await _storage.removeRepeaterPassword(widget.repeater.publicKeyHex);
|
||||
}
|
||||
|
||||
final autoClockSync = await _storage
|
||||
.getRepeaterAutoClockSyncAfterLoginEnabled(
|
||||
widget.repeater.publicKeyHex,
|
||||
);
|
||||
if (autoClockSync) {
|
||||
try {
|
||||
final timestampSeconds =
|
||||
DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
||||
await _connector.sendFrame(
|
||||
buildSendCliCommandFrame(
|
||||
repeater.publicKey,
|
||||
'clock sync',
|
||||
timestampSeconds: timestampSeconds,
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
appLogger.warn(
|
||||
'Auto clock sync failed for ${repeater.name}: $e',
|
||||
tag: 'RepeaterLogin',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (mounted) {
|
||||
Navigator.pop(context, password);
|
||||
Future.microtask(() => widget.onLogin(password));
|
||||
|
||||
Reference in New Issue
Block a user