diff --git a/.gitignore b/.gitignore index fa4d28d6..6e4fb526 100644 --- a/.gitignore +++ b/.gitignore @@ -91,3 +91,6 @@ keystore.properties # Cloudflare Wrangler .wrangler + +# Claude Code local working dir (worktrees, jobs, settings) +.claude/ diff --git a/README.md b/README.md index 94d54bac..041ea6e9 100644 --- a/README.md +++ b/README.md @@ -193,6 +193,7 @@ Devices are discovered by scanning for BLE advertisements with known MeshCore de - `WisCore-` - `HT-` - `LowMesh_MC_` + - `NRF52` New device prefixes can be added in `lib/connector/meshcore_uuids.dart`. diff --git a/lib/connector/meshcore_connector.dart b/lib/connector/meshcore_connector.dart index 9a316897..ef9a9e24 100644 --- a/lib/connector/meshcore_connector.dart +++ b/lib/connector/meshcore_connector.dart @@ -160,6 +160,7 @@ class MeshCoreConnector extends ChangeNotifier { {}; // contactPubKeyHex -> Set of "targetHash_emoji" StreamSubscription>? _scanSubscription; + StreamSubscription? _isScanningSubscription; StreamSubscription? _connectionSubscription; StreamSubscription>? _notifySubscription; Timer? _notifyListenersTimer; @@ -199,6 +200,7 @@ class MeshCoreConnector extends ChangeNotifier { double? _selfLongitude; final List _directRepeaters = List.empty(growable: true); bool _isLoadingContacts = false; + bool _hasLoadedContacts = false; bool _isLoadingChannels = false; bool _hasLoadedChannels = false; TimeoutPredictionService? _timeoutPredictionService; @@ -206,6 +208,9 @@ class MeshCoreConnector extends ChangeNotifier { // Intentionally global (not per-contact): tracks overall network activity. // Frequent RX from any source indicates a busy network with more collisions. DateTime _lastRxTime = DateTime.now(); + // Snapshot of _lastRxTime taken before the ACK frame updates it, so that + // onDeliveryObserved records the pre-ACK elapsed time (matching prediction). + DateTime _lastRxBeforeFrame = DateTime.fromMillisecondsSinceEpoch(0); DateTime _lastRadioRxTime = DateTime.fromMillisecondsSinceEpoch(0); DateTime _lastContactMsgRxTime = DateTime.fromMillisecondsSinceEpoch(0); DateTime _lastChannelMsgRxTime = DateTime.fromMillisecondsSinceEpoch(0); @@ -220,10 +225,13 @@ class MeshCoreConnector extends ChangeNotifier { bool _batteryRequested = false; bool _awaitingSelfInfo = false; bool _hasReceivedDeviceInfo = false; + // Initial sync is serialized for predictable progress. Firmware exposes one + // FIFO queued-message stream, so direct/room frames are buffered until after + // contacts are known. bool _pendingInitialChannelSync = false; bool _pendingInitialContactsSync = false; + bool _pendingInitialQueuedMessageSync = false; bool _bleInitialSyncStarted = false; - bool _pendingDeferredChannelSyncAfterContacts = false; bool _webInitialHandshakeRequestSent = false; bool _preserveContactsOnRefresh = false; bool _autoAddUsers = false; @@ -238,13 +246,18 @@ class MeshCoreConnector extends ChangeNotifier { int _advertLocPolicy = 0; int _multiAcks = 0; - static const int _defaultMaxContacts = 32; - static const int _defaultMaxChannels = 8; + static const int _defaultMaxContacts = 350; + static const int _defaultMaxChannels = 40; int _maxContacts = _defaultMaxContacts; int _maxChannels = _defaultMaxChannels; + int? _contactSyncTotal; + int _contactSyncReceived = 0; + bool _contactSyncUsesSinceFilter = false; bool _isSyncingQueuedMessages = false; + bool _deferQueuedContactMessagesUntilContacts = false; + bool _isProcessingDeferredQueuedContactMessages = false; bool _queuedMessageSyncInFlight = false; - bool _didInitialQueueSync = false; + final List _deferredQueuedContactMessageFrames = []; bool _pendingQueueSync = false; Timer? _queueSyncTimeout; int _queueSyncRetries = 0; @@ -318,6 +331,20 @@ class MeshCoreConnector extends ChangeNotifier { String? get deviceId => _deviceId; String get deviceIdLabel => _deviceId ?? 'Unknown'; + /// Stable per-radio key for transport-agnostic per-device settings such as + /// battery chemistry. On BLE this is the existing remoteId (so previously + /// saved settings are preserved); on USB/TCP — where there is no BLE + /// remoteId — it falls back to the node's public key, which identifies the + /// same physical radio across transports. Null until a device identity is + /// known. + String? get batteryDeviceKey { + if (_deviceId != null) return _deviceId; + if (_selfPublicKey != null && _selfPublicKey!.isNotEmpty) { + return selfPublicKeyHex; + } + return null; + } + MeshCoreTransportType get activeTransport => _activeTransport; String? get activeUsbPort => _usbManager.activePortKey; String? get activeUsbPortDisplayLabel => _usbManager.activePortDisplayLabel; @@ -373,7 +400,9 @@ class MeshCoreConnector extends ChangeNotifier { List get channels => List.unmodifiable(_channels); bool get isConnected => _state == MeshCoreConnectionState.connected; bool get isLoadingContacts => _isLoadingContacts; + bool get hasLoadedContacts => _hasLoadedContacts; bool get isLoadingChannels => _isLoadingChannels; + bool get hasLoadedChannels => _hasLoadedChannels; Stream get receivedFrames => _receivedFramesController.stream; Uint8List? get selfPublicKey => _selfPublicKey; String get selfPublicKeyHex => pubKeyToHex(_selfPublicKey ?? Uint8List(0)); @@ -436,7 +465,16 @@ class MeshCoreConnector extends ChangeNotifier { int get maxContacts => _maxContacts; int get maxChannels => _maxChannels; Set get knownContactKeys => Set.unmodifiable(_knownContactKeys); - bool get isSyncingQueuedMessages => _isSyncingQueuedMessages; + double? get contactSyncProgress { + final total = _contactSyncTotal; + if (!_isLoadingContacts || total == null || total <= 0) return null; + return (_contactSyncReceived / total).clamp(0.0, 1.0).toDouble(); + } + + bool get isSyncingQueuedMessages => + _isSyncingQueuedMessages || _isProcessingDeferredQueuedContactMessages; + bool get isShowingQueuedMessageSyncProgress => + _deferQueuedContactMessagesUntilContacts && isSyncingQueuedMessages; bool get isSyncingChannels => _isSyncingChannels; int get channelSyncProgress => _isSyncingChannels && _totalChannelsToRequest > 0 @@ -472,7 +510,7 @@ class MeshCoreConnector extends ChangeNotifier { } String _batteryChemistryForDevice() { - final deviceId = _device?.remoteId.toString(); + final deviceId = batteryDeviceKey; if (deviceId == null || _appSettingsService == null) return 'nmc'; return _appSettingsService!.batteryChemistryForDevice(deviceId); } @@ -487,10 +525,22 @@ class MeshCoreConnector extends ChangeNotifier { if (messages == null) return; final removed = messages.remove(message); if (!removed) return; + _retryService?.untrack(message.messageId); await _messageStore.saveMessages(contactKeyHex, messages); notifyListeners(); } + Future resendMessage(Contact contact, Message message) async { + await deleteMessage(message); + await sendMessage( + contact, + message.text, + originalText: message.originalText, + translatedLanguageCode: message.translatedLanguageCode, + translationModelId: message.translationModelId, + ); + } + Future _loadMessagesForContact(String contactKeyHex) async { if (_loadedConversationKeys.contains(contactKeyHex)) return; _loadedConversationKeys.add(contactKeyHex); @@ -898,11 +948,17 @@ class MeshCoreConnector extends ChangeNotifier { updateMessage: _updateMessage, clearContactPath: clearContactPath, setContactPath: setContactPath, - calculateTimeout: (pathLength, messageBytes, {String? contactKey}) => - calculateTimeout( + calculateTimeout: + ( + pathLength, + messageBytes, { + String? contactKey, + int? deviceTimeoutMs, + }) => calculateTimeout( pathLength: pathLength, messageBytes: messageBytes, contactKey: contactKey, + deviceTimeoutMs: deviceTimeoutMs, ), getSelfPublicKey: () => _selfPublicKey, prepareContactOutboundText: prepareContactOutboundText, @@ -918,7 +974,9 @@ class MeshCoreConnector extends ChangeNotifier { recentSelections: recentSelections, ), onDeliveryObserved: (contactKey, pathLength, messageBytes, tripTimeMs) { - final secSinceRx = DateTime.now().difference(_lastRxTime).inSeconds; + final secSinceRx = DateTime.now() + .difference(_lastRxBeforeFrame) + .inSeconds; _timeoutPredictionService?.recordObservation( contactKey: contactKey, pathLength: pathLength, @@ -1106,19 +1164,31 @@ class MeshCoreConnector extends ChangeNotifier { } } - Future _translateIncomingContactMessage( + Future translateContactMessage( String contactKeyHex, - Message message, - ) async { + Message message, { + bool manualTranslation = false, + }) async { try { + if (message.translatedText?.trim().isNotEmpty == true || + (!manualTranslation && + message.translationStatus != MessageTranslationStatus.none)) { + return null; + } final service = _translationService; if (service == null || - !service.shouldTranslateIncoming( - text: message.text, - isCli: message.isCli, - isOutgoing: message.isOutgoing, - )) { - return; + !(manualTranslation + ? service.canTranslateIncoming( + text: message.text, + isCli: message.isCli, + isOutgoing: message.isOutgoing, + ) + : service.shouldAutoTranslateIncoming( + text: message.text, + isCli: message.isCli, + isOutgoing: message.isOutgoing, + ))) { + return null; } final targetLanguageCode = service.resolvedIncomingLanguageCode( _appSettingsService?.settings.languageOverride, @@ -1128,7 +1198,7 @@ class MeshCoreConnector extends ChangeNotifier { targetLanguageCode: targetLanguageCode, ); if (result == null) { - return; + return null; } final translated = result.status == MessageTranslationStatus.completed ? result.translatedText @@ -1143,24 +1213,38 @@ class MeshCoreConnector extends ChangeNotifier { translationModelId: result.modelId, ), ); + return result; } catch (error) { appLogger.warn('Translation failed for contact message: $error'); + return null; } } - Future _translateIncomingChannelMessage( + Future translateChannelMessage( int channelIndex, - ChannelMessage message, - ) async { + ChannelMessage message, { + bool manualTranslation = false, + }) async { try { + if (message.translatedText?.trim().isNotEmpty == true || + (!manualTranslation && + message.translationStatus != MessageTranslationStatus.none)) { + return null; + } final service = _translationService; if (service == null || - !service.shouldTranslateIncoming( - text: message.text, - isCli: false, - isOutgoing: message.isOutgoing, - )) { - return; + !(manualTranslation + ? service.canTranslateIncoming( + text: message.text, + isCli: false, + isOutgoing: message.isOutgoing, + ) + : service.shouldAutoTranslateIncoming( + text: message.text, + isCli: false, + isOutgoing: message.isOutgoing, + ))) { + return null; } final targetLanguageCode = service.resolvedIncomingLanguageCode( _appSettingsService?.settings.languageOverride, @@ -1170,11 +1254,16 @@ class MeshCoreConnector extends ChangeNotifier { targetLanguageCode: targetLanguageCode, ); if (result == null) { - return; + return null; } - final translated = result.status == MessageTranslationStatus.completed + var translated = result.status == MessageTranslationStatus.completed ? result.translatedText : null; + // Strip replyInfo prefix from translated text to match stored message.text + if (translated != null) { + final regex = RegExp(r'^@\[[^\]]+\]\s+', dotAll: true); + translated = translated.replaceFirst(regex, ''); + } _updateStoredChannelMessage( channelIndex, message.messageId, @@ -1185,8 +1274,10 @@ class MeshCoreConnector extends ChangeNotifier { translationModelId: result.modelId, ), ); + return result; } catch (error) { appLogger.warn('Translation failed for channel message: $error'); + return null; } } @@ -1303,6 +1394,21 @@ class MeshCoreConnector extends ChangeNotifier { }) async { if (_state == MeshCoreConnectionState.scanning) return; + // A BLE scan must never disturb an active (or in-progress) non-BLE + // connection. The connection state enum is shared across transports, so + // entering the `scanning` state while connected over TCP/USB would clobber + // the live `connected` state and later reset it to `disconnected`. + if (_state != MeshCoreConnectionState.disconnected || + _tcpConnector.isConnected || + _usbManager.isConnected) { + _appDebugLogService?.warn( + 'startScan ignored: not idle (state=$_state, ' + 'tcp=${_tcpConnector.isConnected}, usb=${_usbManager.isConnected})', + tag: 'BLE Scan', + ); + return; + } + _scanResults.clear(); _linuxSystemScanResults.clear(); _setState(MeshCoreConnectionState.scanning); @@ -1356,20 +1462,40 @@ class MeshCoreConnector extends ChangeNotifier { }); try { + // Filter by the Nordic UART Service UUID rather than by advertised + // name. All MeshCore-compatible firmware (ESP32 + nRF52) advertises this + // service UUID, so this matches every device regardless of the name it + // chooses to advertise (e.g. community forks like the M5 Cardputer that + // do not use a "MeshCore-" name prefix). This mirrors how the official + // app discovers devices. Note: on Android `withKeywords` cannot be + // combined with any other filter, which is why name keywords are not + // used here. await FlutterBluePlus.startScan( - withKeywords: MeshCoreUuids.deviceNamePrefixes, + withServices: [Guid(MeshCoreUuids.service)], webOptionalServices: [Guid(MeshCoreUuids.service)], timeout: timeout, androidScanMode: AndroidScanMode.lowLatency, ); } catch (error) { _appDebugLogService?.warn('Scan/picker failure: $error', tag: 'BLE Scan'); - _setState(MeshCoreConnectionState.disconnected); + await stopScan(); rethrow; } - await Future.delayed(timeout); - await stopScan(); + // Reset our shared state when the native scan ends — whether it was stopped + // by the user (stopScan), by the platform timeout, or by Bluetooth turning + // off. This replaces a blocking `Future.delayed(timeout)` tail that kept + // startScan() pending for the whole timeout and made Stop appear ineffective. + // `isScanning` is a re-emit stream that replays its latest value on listen, + // so skip(1) to ignore that and only react to a genuine transition to false. + await _isScanningSubscription?.cancel(); + _isScanningSubscription = FlutterBluePlus.isScanning.skip(1).listen(( + scanning, + ) { + if (!scanning && _state == MeshCoreConnectionState.scanning) { + unawaited(stopScan()); + } + }); } Future _loadLinuxSystemDevicesForScan() async { @@ -1377,31 +1503,28 @@ class MeshCoreConnector extends ChangeNotifier { final systemDevices = await FlutterBluePlus.systemDevices([ Guid(MeshCoreUuids.service), ]); + // systemDevices is already filtered by the NUS service UUID above, so no + // additional name-prefix filtering is applied here. This keeps Linux + // discovery name-agnostic and consistent with the main scan path. _linuxSystemScanResults ..clear() ..addAll( - systemDevices - .where( - (device) => MeshCoreUuids.deviceNamePrefixes.any( - device.platformName.startsWith, - ), - ) - .map( - (device) => ScanResult( - device: device, - advertisementData: AdvertisementData( - advName: device.platformName, - txPowerLevel: null, - appearance: null, - connectable: true, - manufacturerData: const >{}, - serviceData: const >{}, - serviceUuids: [Guid(MeshCoreUuids.service)], - ), - rssi: 0, - timeStamp: DateTime.now(), - ), + systemDevices.map( + (device) => ScanResult( + device: device, + advertisementData: AdvertisementData( + advName: device.platformName, + txPowerLevel: null, + appearance: null, + connectable: true, + manufacturerData: const >{}, + serviceData: const >{}, + serviceUuids: [Guid(MeshCoreUuids.service)], ), + rssi: 0, + timeStamp: DateTime.now(), + ), + ), ); _mergeLinuxSystemScanResults(); notifyListeners(); @@ -1446,9 +1569,17 @@ class MeshCoreConnector extends ChangeNotifier { } await _scanSubscription?.cancel(); _scanSubscription = null; + await _isScanningSubscription?.cancel(); + _isScanningSubscription = null; if (_state == MeshCoreConnectionState.scanning) { - _setState(MeshCoreConnectionState.disconnected); + // Restore to `connected` if a non-BLE transport is still live, so a stray + // scan can never tear down the reported connection state. Normally there + // is no live transport here and we fall through to `disconnected`. + final restored = (_tcpConnector.isConnected || _usbManager.isConnected) + ? MeshCoreConnectionState.connected + : MeshCoreConnectionState.disconnected; + _setState(restored); } } @@ -1501,6 +1632,20 @@ class MeshCoreConnector extends ChangeNotifier { await stopScan(); } await Future.delayed(const Duration(milliseconds: 200)); + + // The read pump can fail the instant the port opens (e.g. a device that + // re-enumerates on open). That error is emitted on a broadcast stream + // before the listener below attaches, so it would otherwise be lost and + // the connect would stall until the SELF_INFO timeout. Check transport + // liveness directly and abort fast with the real cause. + if (!_usbManager.isConnected) { + final cause = _usbManager.lastError; + throw StateError( + 'USB device disconnected during connect' + '${cause == null ? '' : ': $cause'}', + ); + } + _usbFrameSubscription = _usbManager.frameStream.listen( _handleFrame, onError: (error, stackTrace) { @@ -1515,6 +1660,8 @@ class MeshCoreConnector extends ChangeNotifier { _setState(MeshCoreConnectionState.connected); _pendingInitialChannelSync = true; + _pendingInitialQueuedMessageSync = true; + _pendingInitialContactsSync = true; _appDebugLogService?.info( 'connectUsb: requesting device info…', tag: 'USB', @@ -1625,6 +1772,8 @@ class MeshCoreConnector extends ChangeNotifier { _setState(MeshCoreConnectionState.connected); _pendingInitialChannelSync = true; + _pendingInitialQueuedMessageSync = true; + _pendingInitialContactsSync = true; await _requestDeviceInfo(); _startBatteryPolling(); if (_radioStatsPollRefCount > 0) _startRadioStatsPolling(); @@ -1686,6 +1835,17 @@ class MeshCoreConnector extends ChangeNotifier { activeTransport == MeshCoreTransportType.tcp; } + /// Fast (non-timeout) connect failures are usually a stale link left over + /// from a previous session and recover on an immediate retry. Timeouts mean + /// the device is likely off or out of range, so retrying would only delay + /// genuine failure feedback. + @visibleForTesting + static bool shouldRetryBleConnectAfterError(String errorText) { + final lowerErrorText = errorText.toLowerCase(); + return !lowerErrorText.contains('timed out') && + !lowerErrorText.contains('timeout'); + } + Future connect( BluetoothDevice device, { String? displayName, @@ -1762,7 +1922,7 @@ class MeshCoreConnector extends ChangeNotifier { .connect( timeout: connectTimeout, mtu: null, - license: License.free, + license: License.nonprofit, ) .timeout( connectTimeout + const Duration(seconds: 2), @@ -1854,18 +2014,71 @@ class MeshCoreConnector extends ChangeNotifier { } } } else { - try { - await device.connect( + Future attemptConnect() { + return device.connect( timeout: connectTimeout, mtu: null, - license: License.free, + license: License.nonprofit, ); + } + + // A previous app session (e.g. killed from the iOS app switcher) can + // leave the OS holding a stale link to the peripheral. Clear it before + // connecting so the fresh attempt doesn't race the stale handle. + if (!PlatformInfo.isWeb && device.isConnected) { + _appDebugLogService?.warn( + 'Device reports an existing connection before connect; clearing stale link', + tag: 'BLE Connect', + ); + try { + await device.disconnect(queue: false); + } catch (cleanupError) { + _appDebugLogService?.warn( + 'Stale-link cleanup disconnect failed (continuing): $cleanupError', + tag: 'BLE Connect', + ); + } + } + + try { + await attemptConnect(); } catch (error) { _appDebugLogService?.error( 'device.connect() failure: $error', tag: 'BLE Connect', ); - rethrow; + if (PlatformInfo.isWeb || + !shouldRetryBleConnectAfterError(error.toString())) { + rethrow; + } + // Fast (non-timeout) failures are usually a stale connection left by + // a previous session; clean up and retry once before surfacing. + _appDebugLogService?.warn( + 'Retrying connect once after clearing possible stale connection', + tag: 'BLE Connect', + ); + try { + await device.disconnect(queue: false); + } catch (cleanupError) { + _appDebugLogService?.warn( + 'Pre-retry cleanup disconnect failed (continuing): $cleanupError', + tag: 'BLE Connect', + ); + } + await Future.delayed(const Duration(milliseconds: 500)); + try { + await attemptConnect(); + _appDebugLogService?.info( + 'Retry connect succeeded after stale-connection cleanup', + tag: 'BLE Connect', + ); + } catch (retryError) { + _appDebugLogService?.error( + 'device.connect() retry failure: $retryError', + tag: 'BLE Connect', + ); + rethrow; + } } } @@ -1914,7 +2127,7 @@ class MeshCoreConnector extends ChangeNotifier { await device.connect( timeout: const Duration(seconds: 15), mtu: null, - license: License.free, + license: License.nonprofit, ); services = await device.discoverServices(); } else { @@ -2259,7 +2472,9 @@ class MeshCoreConnector extends ChangeNotifier { return; } _bleInitialSyncStarted = true; + _pendingInitialChannelSync = true; _pendingInitialContactsSync = true; + _pendingInitialQueuedMessageSync = true; await _requestDeviceInfo(); _startBatteryPolling(); @@ -2274,7 +2489,7 @@ class MeshCoreConnector extends ChangeNotifier { } await syncTime(); - unawaited(getChannels()); + _maybeStartInitialChannelSync(); } void _resetConnectionHandshakeState() { @@ -2287,11 +2502,39 @@ class MeshCoreConnector extends ChangeNotifier { _selfInfoRetryTimer?.cancel(); _selfInfoRetryTimer = null; _hasReceivedDeviceInfo = false; + _resetSyncProgressState(); + _bleInitialSyncStarted = false; + _pathHashByteWidth = 1; + } + + void _resetSyncProgressState() { _pendingInitialChannelSync = false; _pendingInitialContactsSync = false; - _bleInitialSyncStarted = false; - _pendingDeferredChannelSyncAfterContacts = false; - _pathHashByteWidth = 1; + _pendingInitialQueuedMessageSync = false; + _contactSyncTotal = null; + _contactSyncReceived = 0; + _contactSyncUsesSinceFilter = false; + _isLoadingContacts = false; + _hasLoadedContacts = false; + _isLoadingChannels = false; + _hasLoadedChannels = false; + _isSyncingQueuedMessages = false; + _deferQueuedContactMessagesUntilContacts = false; + _isProcessingDeferredQueuedContactMessages = false; + _queuedMessageSyncInFlight = false; + _deferredQueuedContactMessageFrames.clear(); + _pendingQueueSync = false; + _queueSyncTimeout?.cancel(); + _queueSyncTimeout = null; + _queueSyncRetries = 0; + _isSyncingChannels = false; + _channelSyncInFlight = false; + _channelSyncTimeout?.cancel(); + _channelSyncTimeout = null; + _channelSyncRetries = 0; + _nextChannelIndexToRequest = 0; + _totalChannelsToRequest = 0; + _previousChannelsCache.clear(); } bool get _shouldAutoReconnect => @@ -2428,17 +2671,9 @@ class MeshCoreConnector extends ChangeNotifier { _batteryRequested = false; _awaitingSelfInfo = false; _hasReceivedDeviceInfo = false; - _pendingInitialChannelSync = false; - _pendingInitialContactsSync = false; _maxContacts = _defaultMaxContacts; _maxChannels = _defaultMaxChannels; - _isSyncingQueuedMessages = false; - _queuedMessageSyncInFlight = false; - _didInitialQueueSync = false; - _pendingQueueSync = false; - _isSyncingChannels = false; - _channelSyncInFlight = false; - _hasLoadedChannels = false; + _resetSyncProgressState(); _pendingChannelSentQueue.clear(); _pendingGenericAckQueue.clear(); _reactionSendQueueSequence = 0; @@ -2459,41 +2694,62 @@ class MeshCoreConnector extends ChangeNotifier { Uint8List data, { String? channelSendQueueId, bool expectsGenericAck = false, + bool waitForGenericAck = false, }) async { if (!isConnected) { throw Exception("Not connected to a MeshCore device"); } _bleDebugLogService?.logFrame(data, outgoing: true); - if (_activeTransport == MeshCoreTransportType.usb) { - await _usbManager.write(data); - // Brief pause so the device firmware can process each frame before the - // next arrives. Without this, rapid-fire frames over USB can cause the - // device to miss responses (especially on reconnect). - await Future.delayed(const Duration(milliseconds: 10)); - } else if (_activeTransport == MeshCoreTransportType.tcp) { - await _tcpConnector.write(data); - } else { - if (_rxCharacteristic == null) { - throw Exception("MeshCore RX characteristic not available"); - } - // Prefer write without response when supported; fall back to write with response. - final properties = _rxCharacteristic!.properties; - final canWriteWithoutResponse = properties.writeWithoutResponse; - final canWriteWithResponse = properties.write; - if (!canWriteWithoutResponse && !canWriteWithResponse) { - throw Exception("MeshCore RX characteristic does not support write"); - } - await _rxCharacteristic!.write( - data.toList(), - withoutResponse: canWriteWithoutResponse, - ); - } - _trackPendingGenericAck( + final pendingAck = _trackPendingGenericAck( data, channelSendQueueId: channelSendQueueId, - expectsGenericAck: expectsGenericAck, + expectsGenericAck: expectsGenericAck || waitForGenericAck, + waitForAck: waitForGenericAck, ); + + try { + if (_activeTransport == MeshCoreTransportType.usb) { + await _usbManager.write(data); + // Brief pause so the device firmware can process each frame before the + // next arrives. Without this, rapid-fire frames over USB can cause the + // device to miss responses (especially on reconnect). + await Future.delayed(const Duration(milliseconds: 10)); + } else if (_activeTransport == MeshCoreTransportType.tcp) { + await _tcpConnector.write(data); + } else { + if (_rxCharacteristic == null) { + throw Exception("MeshCore RX characteristic not available"); + } + // Prefer write without response when supported; fall back to write with response. + final properties = _rxCharacteristic!.properties; + final canWriteWithoutResponse = properties.writeWithoutResponse; + final canWriteWithResponse = properties.write; + if (!canWriteWithoutResponse && !canWriteWithResponse) { + throw Exception("MeshCore RX characteristic does not support write"); + } + await _rxCharacteristic!.write( + data.toList(), + withoutResponse: canWriteWithoutResponse, + ); + } + } catch (_) { + if (pendingAck != null) { + _pendingGenericAckQueue.remove(pendingAck); + } + rethrow; + } + + if (pendingAck?.completer != null) { + try { + await pendingAck!.completer!.future.timeout(const Duration(seconds: 5)); + } on TimeoutException { + _pendingGenericAckQueue.remove(pendingAck); + throw TimeoutException( + 'Timed out waiting for firmware acknowledgement', + ); + } + } } Future requestBatteryStatus({bool force = false}) async { @@ -2691,10 +2947,14 @@ class MeshCoreConnector extends ChangeNotifier { _isLoadingContacts = true; _preserveContactsOnRefresh = preserveExisting; + _contactSyncTotal = null; + _contactSyncReceived = 0; + _contactSyncUsesSinceFilter = since != null; if (!preserveExisting) { + _hasLoadedContacts = false; _contacts.clear(); - notifyListeners(); } + notifyListeners(); await sendFrame(buildGetContactsFrame(since: since)); } @@ -2721,6 +2981,17 @@ class MeshCoreConnector extends ChangeNotifier { }) async { if (!isConnected || text.isEmpty) return; + final outboundBytes = utf8.encode( + prepareContactOutboundText(contact, text), + ); + if (outboundBytes.length > maxTextPayloadBytes) { + debugPrint( + 'sendMessage: dropping overlong message ' + '(${outboundBytes.length} > $maxTextPayloadBytes bytes)', + ); + return; + } + // Check if this is a reaction - apply locally with pending status and route through retry service final reactionInfo = ReactionHelper.parseReaction(text); if (reactionInfo != null) { @@ -3154,6 +3425,7 @@ class MeshCoreConnector extends ChangeNotifier { await sendFrame(buildRemoveContactFrame(contact.publicKey)); _contacts.removeWhere((c) => c.publicKeyHex == contact.publicKeyHex); _knownContactKeys.remove(contact.publicKeyHex); + unawaited(updateKnownDiscovered()); unawaited(_persistContacts()); _conversations.remove(contact.publicKeyHex); _loadedConversationKeys.remove(contact.publicKeyHex); @@ -3190,9 +3462,11 @@ class MeshCoreConnector extends ChangeNotifier { notifyListeners(); } - Future importDiscoveredContact(Contact contact) async { - if (!isConnected) return; + Future importDiscoveredContact(Contact contact) async { + if (!isConnected) return false; + // Manual saves must bypass the firmware's auto-add discovery policy. + // CMD_IMPORT_CONTACT replays an advert and may remain discovery-only. await sendFrame( buildUpdateContactPathFrame( contact.publicKey, @@ -3205,6 +3479,7 @@ class MeshCoreConnector extends ChangeNotifier { lon: contact.longitude, lastModified: contact.lastSeen, ), + waitForGenericAck: true, ); // Update the discovered contact to mark it as active (imported) @@ -3230,6 +3505,8 @@ class MeshCoreConnector extends ChangeNotifier { ), ); notifyListeners(); + unawaited(_persistDiscoveredContacts()); + return true; } Future clearContactPath(Contact contact) async { @@ -3292,11 +3569,20 @@ class MeshCoreConnector extends ChangeNotifier { Future syncQueuedMessages({bool force = false}) async { if (!isConnected) return; if (!force && _isSyncingQueuedMessages) return; + if (_isProcessingDeferredQueuedContactMessages) { + _pendingQueueSync = true; + return; + } if (_awaitingSelfInfo || _isLoadingContacts) { _pendingQueueSync = true; return; } + if (_isSyncingChannels || _channelSyncInFlight) { + _pendingQueueSync = true; + return; + } _isSyncingQueuedMessages = true; + notifyListeners(); await _requestNextQueuedMessage(); } @@ -3330,6 +3616,8 @@ class MeshCoreConnector extends ChangeNotifier { _isSyncingQueuedMessages = false; _queueSyncTimeout?.cancel(); _queueSyncRetries = 0; + notifyListeners(); + _continueAfterQueuedMessageSync(); } } @@ -3349,17 +3637,17 @@ class MeshCoreConnector extends ChangeNotifier { _queuedMessageSyncInFlight = false; _isSyncingQueuedMessages = false; _queueSyncRetries = 0; + notifyListeners(); + _continueAfterQueuedMessageSync(); } } Future sendCliCommand(String command) async { if (!isConnected) return; - - // CLI commands are sent as UTF-8 text with a special prefix - final commandBytes = utf8.encode(command); - final bytes = Uint8List.fromList([0x01, ...commandBytes, 0x00]); + final selfKey = _selfPublicKey; + if (selfKey == null) return; _lastSentWasCliCommand = true; - await sendFrame(bytes); + await sendFrame(buildSendCliCommandFrame(selfKey, command)); } Future setNodeName(String name) async { @@ -3448,6 +3736,7 @@ class MeshCoreConnector extends ChangeNotifier { _isLoadingChannels = true; _isSyncingChannels = true; + _hasLoadedChannels = false; _previousChannelsCache = List.from(_channels); _channels.clear(); _nextChannelIndexToRequest = 0; @@ -3537,6 +3826,7 @@ class MeshCoreConnector extends ChangeNotifier { _nextChannelIndexToRequest++; _channelSyncRetries = 0; _channelSyncInFlight = false; + notifyListeners(); unawaited(_requestNextChannel()); } } @@ -3572,16 +3862,31 @@ class MeshCoreConnector extends ChangeNotifier { if (completed) { _hasLoadedChannels = true; _previousChannelsCache.clear(); + } else if (_channels.isEmpty && _previousChannelsCache.isNotEmpty) { + // A failed initial sync should not leave the UI empty/spinning forever. + // Restore the pre-sync list so cached channels remain usable. + _channels.addAll(_previousChannelsCache); + _applyChannelOrder(); + _recalculateCachedChannelsUnreadTotal(); } - // Fallback: if contact sync was deferred waiting for channel 0 but - // channel sync finished without triggering it, start contacts now. - if (_pendingInitialContactsSync && isConnected) { - _pendingInitialContactsSync = false; - unawaited(getContacts()); + if (isConnected) { + _startPostChannelInitialQueuedMessageSync(); } // Keep cache on failure/disconnection for future attempts + if (!completed) { + notifyListeners(); + } + } + + void _startPostChannelInitialQueuedMessageSync() { + if (_pendingInitialQueuedMessageSync || _pendingQueueSync) { + _deferQueuedContactMessagesUntilContacts = _pendingInitialContactsSync; + _pendingInitialQueuedMessageSync = false; + _pendingQueueSync = false; + unawaited(syncQueuedMessages(force: true)); + } } Future setChannel(int index, String name, Uint8List psk) async { @@ -3607,6 +3912,7 @@ class MeshCoreConnector extends ChangeNotifier { void _handleFrame(List data) { if (data.isEmpty) return; + _lastRxBeforeFrame = _lastRxTime; _lastRxTime = DateTime.now(); final frame = Uint8List.fromList(data); @@ -3633,6 +3939,20 @@ class MeshCoreConnector extends ChangeNotifier { _contacts.clear(); } _isLoadingContacts = true; + _contactSyncReceived = 0; + // Firmware v3+ includes total contacts after CONTACTS_START. + // Incremental sync reports total contacts, not filtered result count. + if (frame.length >= 5 && !_contactSyncUsesSinceFilter) { + final reader = BufferReader(frame); + reader.skipBytes(1); + _contactSyncTotal = reader.readUInt32LE(); + } else if (!_contactSyncUsesSinceFilter) { + // Older firmwares may omit the count; use the nRF node capacity as + // a conservative progress fallback instead of hiding the progress. + _contactSyncTotal = _defaultMaxContacts; + } else { + _contactSyncTotal = null; + } notifyListeners(); break; case pushCodeAdvert: @@ -3650,7 +3970,9 @@ class MeshCoreConnector extends ChangeNotifier { case respCodeEndOfContacts: debugPrint('Got END_OF_CONTACTS'); _isLoadingContacts = false; + _hasLoadedContacts = true; _preserveContactsOnRefresh = false; + _contactSyncUsesSinceFilter = false; unawaited(updateKnownDiscovered()); notifyListeners(); unawaited(_persistContacts()); @@ -3660,23 +3982,21 @@ class MeshCoreConnector extends ChangeNotifier { !_channelSyncInFlight) { unawaited(_requestNextChannel()); } - if (!_didInitialQueueSync || _pendingQueueSync) { - _didInitialQueueSync = true; + if (_deferQueuedContactMessagesUntilContacts) { + unawaited(_processDeferredQueuedContactMessages()); + } else if (_pendingQueueSync) { _pendingQueueSync = false; unawaited(syncQueuedMessages(force: true)); } - if (_pendingDeferredChannelSyncAfterContacts && - (_activeTransport == MeshCoreTransportType.bluetooth || - _activeTransport == MeshCoreTransportType.usb || - _activeTransport == MeshCoreTransportType.tcp)) { - _pendingDeferredChannelSyncAfterContacts = false; - _pendingInitialChannelSync = false; - unawaited(getChannels()); - } break; case respCodeContactMsgRecv: case respCodeContactMsgRecvV3: - _handleIncomingMessage(frame); + if (_shouldDeferQueuedContactMessage(frame)) { + _deferredQueuedContactMessageFrames.add(Uint8List.fromList(frame)); + _handleQueuedMessageReceived(); + } else { + unawaited(_handleIncomingMessage(frame)); + } break; case respCodeChannelMsgRecv: case respCodeChannelMsgRecvV3: @@ -3745,11 +4065,15 @@ class MeshCoreConnector extends ChangeNotifier { } final failedAck = _pendingGenericAckQueue.removeAt(0); + failedAck.completer?.completeError( + Exception('Firmware rejected command with error code $errCode'), + ); if (failedAck.commandCode != cmdSendChannelTxtMsg || failedAck.channelSendQueueId == null) { return; } _pendingChannelSentQueue.remove(failedAck.channelSendQueueId); + _markPendingChannelMessageFailedById(failedAck.channelSendQueueId!); } void _handlePathUpdated(Uint8List frame) { @@ -3802,8 +4126,8 @@ class MeshCoreConnector extends ChangeNotifier { _advertLocPolicy = reader.readByte(); final telemetryFlag = reader.readByte(); _telemetryModeBase = telemetryFlag & 0x03; - _telemetryModeEnv = telemetryFlag >> 2 & 0x03; - _telemetryModeLoc = telemetryFlag >> 4 & 0x03; + _telemetryModeLoc = telemetryFlag >> 2 & 0x03; + _telemetryModeEnv = telemetryFlag >> 4 & 0x03; _manualAddContacts = reader.readByte() & 0x01 == 0x00; @@ -3860,23 +4184,8 @@ class MeshCoreConnector extends ChangeNotifier { _selfInfoRetryTimer = null; notifyListeners(); - // Auto-fetch contacts after getting self info. On web BLE, defer this - // until after channel 0 so startup writes stay serialized. - if (PlatformInfo.isWeb && - _activeTransport == MeshCoreTransportType.bluetooth) { - _pendingInitialContactsSync = true; - } else if (_activeTransport == MeshCoreTransportType.usb || - _activeTransport == MeshCoreTransportType.tcp) { - _pendingDeferredChannelSyncAfterContacts = true; - getContacts(); - } else { - getContacts(); - } - if (_shouldGateInitialChannelSync && - _activeTransport != MeshCoreTransportType.usb && - _activeTransport != MeshCoreTransportType.tcp) { - _maybeStartInitialChannelSync(); - } + // Start the serialized initial sync pipeline after SELF_INFO. + _maybeStartInitialChannelSync(); } void _handleDeviceInfo(Uint8List frame) { @@ -3916,7 +4225,7 @@ class MeshCoreConnector extends ChangeNotifier { unawaited(loadAllChannelMessages(maxChannels: nextMaxChannels)); if (isConnected && _selfPublicKey != null && - (!_shouldGateInitialChannelSync || !_pendingInitialChannelSync)) { + !_pendingInitialChannelSync) { unawaited(getChannels(maxChannels: nextMaxChannels)); } } @@ -3931,12 +4240,13 @@ class MeshCoreConnector extends ChangeNotifier { if (!_pendingInitialChannelSync || !isConnected) { return; } - if (_selfPublicKey == null || !_hasReceivedDeviceInfo) { + if (_selfPublicKey == null || + (_shouldGateInitialChannelSync && !_hasReceivedDeviceInfo)) { return; } _pendingInitialChannelSync = false; - unawaited(getChannels(maxChannels: _maxChannels)); + unawaited(getChannels(maxChannels: _maxChannels, force: true)); } void _handleNoMoreMessages() { @@ -3945,6 +4255,64 @@ class MeshCoreConnector extends ChangeNotifier { _isSyncingQueuedMessages = false; _queuedMessageSyncInFlight = false; _queueSyncRetries = 0; // Reset retry counter on successful completion + notifyListeners(); + _continueAfterQueuedMessageSync(); + } + + bool _shouldDeferQueuedContactMessage(Uint8List frame) { + if (!_deferQueuedContactMessagesUntilContacts || + !_isSyncingQueuedMessages) { + return false; + } + if (frame.isEmpty) return false; + return frame[0] == respCodeContactMsgRecv || + frame[0] == respCodeContactMsgRecvV3; + } + + void _continueAfterQueuedMessageSync() { + if (!_deferQueuedContactMessagesUntilContacts) return; + if (_pendingInitialContactsSync && isConnected) { + _pendingInitialContactsSync = false; + unawaited(getContacts()); + return; + } + unawaited(_processDeferredQueuedContactMessages()); + } + + Future _processDeferredQueuedContactMessages() async { + if (!_deferQueuedContactMessagesUntilContacts || + _isProcessingDeferredQueuedContactMessages) { + return; + } + if (_deferredQueuedContactMessageFrames.isEmpty) { + _deferQueuedContactMessagesUntilContacts = false; + notifyListeners(); + if (_pendingQueueSync && isConnected) { + _pendingQueueSync = false; + unawaited(syncQueuedMessages(force: true)); + } + return; + } + + _isProcessingDeferredQueuedContactMessages = true; + notifyListeners(); + try { + // Replay direct/room queued messages only after contacts are loaded, so + // sender prefixes can be resolved against the current contact list. + while (_deferredQueuedContactMessageFrames.isNotEmpty) { + final frame = _deferredQueuedContactMessageFrames.removeAt(0); + await _handleIncomingMessage(frame); + } + } finally { + _deferQueuedContactMessagesUntilContacts = false; + _isProcessingDeferredQueuedContactMessages = false; + notifyListeners(); + } + + if (_pendingQueueSync && isConnected) { + _pendingQueueSync = false; + unawaited(syncQueuedMessages(force: true)); + } } void _handleQueuedMessageReceived() { @@ -3953,6 +4321,7 @@ class MeshCoreConnector extends ChangeNotifier { _queueSyncTimeout?.cancel(); // Cancel timeout - message arrived _queuedMessageSyncInFlight = false; _queueSyncRetries = 0; // Reset retry counter on successful message + notifyListeners(); unawaited(_requestNextQueuedMessage()); } @@ -4054,16 +4423,28 @@ class MeshCoreConnector extends ChangeNotifier { // Same as max for flood — firmware uses a single formula return 500 + (16 * airtime); } else { - return airtime * (pathLength + 1); + // Include firmware base (500ms) and per-hop processing (6*airtime+250) + // so ML cannot clamp below a physically plausible round-trip. + return 500 + ((airtime * 6 + 250) * pathLength); } } + /// Hard ceiling on any ML-derived or physics-fallback timeout (ms). + /// Prevents the flood formula (500 + 16·airtime at SF12 ≈ 150s) and an + /// unstable OLS model from producing multi-minute waits. + static const int _hardMaxTimeoutMs = 45000; + /// Calculate timeout for a message based on radio settings and path length. /// Returns timeout in milliseconds, considering number of hops. + /// + /// [deviceTimeoutMs] is the firmware's own est_timeout from RESP_CODE_SENT. + /// When ML is absent it is used as the fallback (clamped to physicsMin). + /// When ML is present it is used as an additional ceiling alongside physicsMax. int calculateTimeout({ required int pathLength, int messageBytes = 100, String? contactKey, + int? deviceTimeoutMs, }) { final airtime = _estimateAirtimeMs(messageBytes); final physicsMin = _physicsMinTimeout(pathLength, airtime); @@ -4078,28 +4459,48 @@ class MeshCoreConnector extends ChangeNotifier { secondsSinceLastRx: secSinceRx, ); if (mlTimeout != null) { + // Use device est_timeout as an additional ceiling when available — + // the firmware computed it from real airtime, so it's better than + // a physics guess built on a 50 ms fallback. + final ceiling = deviceTimeoutMs != null && deviceTimeoutMs > physicsMin + ? deviceTimeoutMs.clamp(physicsMin, _hardMaxTimeoutMs) + : physicsMax; if (pathLength < 0) { // Flood: trust ML, only enforce firmware formula as floor if (mlTimeout < physicsMin) { - return physicsMin; + return physicsMin.clamp(0, _hardMaxTimeoutMs); } } - return mlTimeout.clamp(physicsMin, physicsMax); + return mlTimeout.clamp(physicsMin, ceiling).clamp(0, _hardMaxTimeoutMs); } - // No ML data — use firmware formula - return physicsMax; + // No ML data — prefer device est_timeout (it used real airtime), then physics. + if (deviceTimeoutMs != null && deviceTimeoutMs > 0) { + return deviceTimeoutMs.clamp(physicsMin, _hardMaxTimeoutMs); + } + return physicsMax.clamp(0, _hardMaxTimeoutMs); } void _handleContact(Uint8List frame, {bool isContact = true}) { final contactTmp = Contact.fromFrame(frame); if (contactTmp != null) { + if (isContact && _isLoadingContacts) { + _contactSyncReceived++; + } if (listEquals(contactTmp.publicKey, _selfPublicKey)) { appLogger.info( 'Ignoring contact with self public key: ${contactTmp.name}', tag: 'Connector', ); - removeContact(contactTmp); + notifyListeners(); + unawaited( + removeContact(contactTmp).catchError( + (e) => appLogger.warn( + 'Failed to remove self contact: $e', + tag: 'Connector', + ), + ), + ); return; } final contact = getFromDiscovered(contactTmp); @@ -4162,6 +4563,7 @@ class MeshCoreConnector extends ChangeNotifier { "Discovered contact ${contact.name} (type ${contact.typeLabelRaw}) not added due to auto-add settings", tag: 'Connector', ); + notifyListeners(); return; } } @@ -4370,9 +4772,15 @@ class MeshCoreConnector extends ChangeNotifier { return false; } - void _handleIncomingMessage(Uint8List frame) async { + Future _handleIncomingMessage(Uint8List frame) async { if (_selfPublicKey == null) return; + // If we're syncing the queued messages, advance the queue immediately + // before any potentially long async work (like translation/notifications). + if (_isSyncingQueuedMessages) { + _handleQueuedMessageReceived(); + } + var message = _parseContactMessage(frame); // If message parsing failed due to unknown contact, refresh contacts and retry @@ -4426,49 +4834,61 @@ class MeshCoreConnector extends ChangeNotifier { final existing = _conversations[message.senderKeyHex]; final incomingTimestamp = message.timestamp.millisecondsSinceEpoch; if (existing != null && existing.isNotEmpty) { - final startIndex = existing.length > 10 ? existing.length - 10 : 0; - for (int i = existing.length - 1; i >= startIndex; i--) { - final recent = existing[i]; - if (!recent.isOutgoing && - recent.timestamp.millisecondsSinceEpoch == incomingTimestamp && - recent.text == message.text) { - return; - } + final last = existing.last; + if (!last.isOutgoing && + last.timestamp.millisecondsSinceEpoch == incomingTimestamp && + last.text == message.text) { + return; } } } _addMessage(message.senderKeyHex, message); - if (!message.isOutgoing) { - unawaited( - _translateIncomingContactMessage(message.senderKeyHex, message), - ); - } _maybeIncrementContactUnread(message); notifyListeners(); - // Show notification for new incoming message + // Show notification for new incoming message (run async with translation) if (!message.isOutgoing && !message.isCli && _appSettingsService != null) { final settings = _appSettingsService!.settings; if (settings.notificationsEnabled && settings.notifyOnNewMessage) { - if (contact?.type == advTypeChat) { - _notificationService.showMessageNotification( - contactName: contact?.name ?? 'Unknown', - message: message.text, - contactId: message.senderKeyHex, - badgeCount: getTotalUnreadCount(), + final msg = message; // capture for closure + final c = contact; // capture contact reference + unawaited(() async { + final translationResult = await translateContactMessage( + msg.senderKeyHex, + msg, ); - } else if (contact?.type == advTypeRoom) { - _notificationService.showMessageNotification( - contactName: contact?.name ?? 'Unknown Room', - message: message.text.length > 4 - ? message.text.substring(4) - : message.text, - contactId: message.senderKeyHex, - badgeCount: getTotalUnreadCount(), - ); - } + if (c?.type == advTypeChat) { + final resolvedText = + (translationResult != null && + translationResult.status == + MessageTranslationStatus.completed && + translationResult.translatedText.trim().isNotEmpty) + ? translationResult.translatedText.trim() + : msg.text.trim(); + await _notificationService.showMessageNotification( + contactName: c?.name ?? 'Unknown', + message: resolvedText, + contactId: msg.senderKeyHex, + badgeCount: getTotalUnreadCount(), + ); + } else if (c?.type == advTypeRoom) { + final resolvedText = + (translationResult != null && + translationResult.status == + MessageTranslationStatus.completed && + translationResult.translatedText.trim().isNotEmpty) + ? translationResult.translatedText.trim() + : msg.text.trim(); + await _notificationService.showMessageNotification( + contactName: c?.name ?? 'Unknown Room', + message: resolvedText, + contactId: msg.senderKeyHex, + badgeCount: getTotalUnreadCount(), + ); + } + }()); } } _handleQueuedMessageReceived(); @@ -4511,16 +4931,24 @@ class MeshCoreConnector extends ChangeNotifier { timestampRaw * 1000, ); - if (txtType == 2) { - reader.skipBytes(4); // Skip extra 4 bytes for signed/plain variants + final flags = txtType; + final shiftedType = flags >> 2; + final rawType = flags; + final isSigned = shiftedType == txtTypeSigned || rawType == txtTypeSigned; + final Uint8List? roomAuthorPrefix; + if (isSigned) { + // Room-server pushed posts use signed/plain contact messages where this + // 4-byte "signature" field is actually the original author's pubkey + // prefix. Keep it as metadata; the text starts after these bytes. + roomAuthorPrefix = reader.readBytes(4); + } else { + roomAuthorPrefix = null; } final msgText = reader.readCString(); - final flags = txtType; - final shiftedType = flags >> 2; - final rawType = flags; - final isPlain = shiftedType == txtTypePlain || rawType == txtTypePlain; + final isPlain = + shiftedType == txtTypePlain || rawType == txtTypePlain || isSigned; final isCli = shiftedType == txtTypeCliData || rawType == txtTypeCliData; if (!isPlain && !isCli) { appLogger.warn( @@ -4557,9 +4985,7 @@ class MeshCoreConnector extends ChangeNotifier { status: MessageStatus.delivered, pathLength: pathLength == 0xFF ? 0 : pathLength, pathBytes: Uint8List(0), - fourByteRoomContactKey: msgText.length >= 4 - ? Uint8List.fromList(msgText.substring(0, 4).codeUnits) - : null, + fourByteRoomContactKey: roomAuthorPrefix, ); } catch (e) { appLogger.warn('Error parsing contact direct message: $e'); @@ -4736,6 +5162,7 @@ class MeshCoreConnector extends ChangeNotifier { void _maybeNotifyChannelMessage( ChannelMessage message, { String? channelName, + TranslationResult? translationResult, }) { if (message.isOutgoing || _appSettingsService == null) return; final channelIndex = message.channelIndex; @@ -4749,16 +5176,30 @@ class MeshCoreConnector extends ChangeNotifier { final label = channelName ?? _channelDisplayName(channelIndex); if (_appSettingsService!.isChannelMuted(label)) return; - _notificationService.showChannelMessageNotification( - channelName: label, - senderName: message.senderName, - message: message.text, - channelIndex: channelIndex, - badgeCount: getTotalUnreadCount(), - ); + // Reuse translation result only if completed and non-empty; else use original text + final resolvedText = + (translationResult != null && + translationResult.status == MessageTranslationStatus.completed && + translationResult.translatedText.trim().isNotEmpty) + ? translationResult.translatedText.trim() + : message.text.trim(); + unawaited(() async { + await _notificationService.showChannelMessageNotification( + channelName: label, + senderName: message.senderName, + message: resolvedText, + channelIndex: message.channelIndex, + badgeCount: getTotalUnreadCount(), + ); + }()); } - void _handleIncomingChannelMessage(Uint8List frame) { + void _handleIncomingChannelMessage(Uint8List frame) async { + // If we're syncing the queued messages, advance the queue immediately + // before any potentially long async work (like translation/notifications). + if (_isSyncingQueuedMessages) { + _handleQueuedMessageReceived(); + } final parsed = ChannelMessage.fromFrame(frame); if (parsed != null && parsed.channelIndex != null) { if (_shouldDropSelfChannelMessage(parsed.senderName, parsed.pathBytes)) { @@ -4777,15 +5218,17 @@ class MeshCoreConnector extends ChangeNotifier { pathBytes: message.pathBytes, ); final isNew = _addChannelMessage(message.channelIndex!, message); - if (isNew && !message.isOutgoing) { - unawaited( - _translateIncomingChannelMessage(message.channelIndex!, message), - ); - } _maybeIncrementChannelUnread(message, isNew: isNew); notifyListeners(); - if (isNew) { - _maybeNotifyChannelMessage(message); + if (isNew && !message.isOutgoing) { + final msg = message; // capture for closure + unawaited(() async { + final translationResult = await translateChannelMessage( + msg.channelIndex!, + msg, + ); + _maybeNotifyChannelMessage(msg, translationResult: translationResult); + }()); } _handleQueuedMessageReceived(); } else if (_isSyncingQueuedMessages) { @@ -4793,7 +5236,7 @@ class MeshCoreConnector extends ChangeNotifier { } } - void _handleLogRxData(Uint8List frame) { + void _handleLogRxData(Uint8List frame) async { if (frame.length < 4) return; try { final reader = BufferReader(frame); @@ -4861,16 +5304,24 @@ class MeshCoreConnector extends ChangeNotifier { pathBytes: message.pathBytes, ); final isNew = _addChannelMessage(channel.index, message); - if (isNew && !message.isOutgoing) { - unawaited(_translateIncomingChannelMessage(channel.index, message)); - } _maybeIncrementChannelUnread(message, isNew: isNew); notifyListeners(); if (isNew) { - final label = channel.name.isEmpty - ? 'Channel ${channel.index}' - : channel.name; - _maybeNotifyChannelMessage(message, channelName: label); + // Run translation + notification asynchronously to avoid blocking + unawaited(() async { + final translationResult = await translateChannelMessage( + channel.index, + message, + ); + final label = channel.name.isEmpty + ? 'Channel ${channel.index}' + : channel.name; + _maybeNotifyChannelMessage( + message, + channelName: label, + translationResult: translationResult, + ); + }()); } return; } catch (e) { @@ -4971,12 +5422,37 @@ class MeshCoreConnector extends ChangeNotifier { return false; } + void _markPendingChannelMessageFailedById(String messageId) { + for (final entry in _channelMessages.entries) { + final channelMessages = entry.value; + for (int i = channelMessages.length - 1; i >= 0; i--) { + final message = channelMessages[i]; + if (message.messageId != messageId) { + continue; + } + if (!message.isOutgoing || + message.status != ChannelMessageStatus.pending) { + return; + } + channelMessages[i] = message.copyWith( + status: ChannelMessageStatus.failed, + ); + unawaited( + _channelMessageStore.saveChannelMessages(entry.key, channelMessages), + ); + notifyListeners(); + return; + } + } + } + void _handleOk() { if (_pendingGenericAckQueue.isEmpty) { return; } final pendingAck = _pendingGenericAckQueue.removeAt(0); + pendingAck.completer?.complete(); if (pendingAck.commandCode != cmdSendChannelTxtMsg || pendingAck.channelSendQueueId == null) { return; @@ -5088,14 +5564,7 @@ class MeshCoreConnector extends ChangeNotifier { // Move to next channel _nextChannelIndexToRequest++; - if (PlatformInfo.isWeb && - _activeTransport == MeshCoreTransportType.bluetooth && - channel.index == 0 && - _pendingInitialContactsSync) { - _pendingInitialContactsSync = false; - unawaited(getContacts()); - return; - } + notifyListeners(); unawaited(_requestNextChannel()); return; } else { @@ -5299,6 +5768,9 @@ class MeshCoreConnector extends ChangeNotifier { } messages.add(message); + if (messages.length > _messageWindowSize) { + messages.removeRange(0, messages.length - _messageWindowSize); + } _messageStore.saveMessages(pubKeyHex, messages); notifyListeners(); } @@ -5389,7 +5861,9 @@ class MeshCoreConnector extends ChangeNotifier { ) { if (!isRoomServer) return null; if (!msg.isOutgoing) { - final senderContact = _contacts.cast().firstWhere( + // Saved contacts first, then discovery-only nodes, so reaction matching + // resolves the author's name even when they haven't been saved. + final senderContact = allContactsUnfiltered.cast().firstWhere( (c) => c != null && _matchesPrefix(c.publicKey, msg.fourByteRoomContactKey), @@ -5685,20 +6159,24 @@ class MeshCoreConnector extends ChangeNotifier { bool _isChannelRepeat(ChannelMessage existing, ChannelMessage incoming) { if (existing.text != incoming.text) return false; + // Self-echo: an outgoing message coming back via a repeater. The send is + // delayed by _waitForRadioQuiet (often 10s+) and propagation can add more, + // so the timestamp gap can easily exceed the cross-peer window. + final selfName = _selfName ?? 'Me'; + final isSelfEcho = + existing.isOutgoing && + !incoming.isOutgoing && + (incoming.senderName == selfName || existing.senderName == selfName); + + final windowMs = isSelfEcho ? 10 * 60 * 1000 : 30000; final diffMs = (existing.timestamp.millisecondsSinceEpoch - incoming.timestamp.millisecondsSinceEpoch) .abs(); - if (diffMs > 30000) return false; + if (diffMs > windowMs) return false; if (existing.senderName == incoming.senderName) return true; - - if (existing.isOutgoing && !incoming.isOutgoing) { - final selfName = _selfName ?? 'Me'; - if (incoming.senderName == selfName || existing.senderName == selfName) { - return true; - } - } + if (isSelfEcho) return true; return false; } @@ -5795,14 +6273,9 @@ class MeshCoreConnector extends ChangeNotifier { // Preserve deviceId and displayName for UI display during reconnection // They're only cleared on manual disconnect via disconnect() method _hasReceivedDeviceInfo = false; - _pendingInitialChannelSync = false; - _pendingInitialContactsSync = false; _maxContacts = _defaultMaxContacts; _maxChannels = _defaultMaxChannels; - _isSyncingQueuedMessages = false; - _queuedMessageSyncInFlight = false; - _isSyncingChannels = false; - _channelSyncInFlight = false; + _resetSyncProgressState(); _pendingChannelSentQueue.clear(); _pendingGenericAckQueue.clear(); _reactionSendQueueSequence = 0; @@ -5811,18 +6284,25 @@ class MeshCoreConnector extends ChangeNotifier { _scheduleReconnect(); } - void _trackPendingGenericAck( + _PendingCommandAck? _trackPendingGenericAck( Uint8List data, { String? channelSendQueueId, required bool expectsGenericAck, + required bool waitForAck, }) { - if (!expectsGenericAck || data.isEmpty) return; - _pendingGenericAckQueue.add( - _PendingCommandAck( - commandCode: data[0], - channelSendQueueId: channelSendQueueId, - ), + if (!expectsGenericAck || data.isEmpty) return null; + final pendingAck = _PendingCommandAck( + commandCode: data[0], + channelSendQueueId: channelSendQueueId, + completer: waitForAck ? Completer() : null, ); + if (pendingAck.completer != null) { + // sendFrame awaits this future after transport I/O; attach an error + // handler immediately in case USB returns an error response first. + unawaited(pendingAck.completer!.future.catchError((_) {})); + } + _pendingGenericAckQueue.add(pendingAck); + return pendingAck; } String _nextReactionSendQueueId() { @@ -5935,6 +6415,7 @@ class MeshCoreConnector extends ChangeNotifier { @override void dispose() { _scanSubscription?.cancel(); + _isScanningSubscription?.cancel(); _connectionSubscription?.cancel(); _usbFrameSubscription?.cancel(); _notifySubscription?.cancel(); @@ -5993,82 +6474,6 @@ class MeshCoreConnector extends ChangeNotifier { } } - void importContact(Uint8List frame) { - final packet = BufferReader(frame); - int payloadType = 0; - Uint8List pathBytes = Uint8List(0); - try { - packet.skipBytes(1); // Skip frame type byte - packet.skipBytes(1); // Skip SNR byte - packet.skipBytes(1); // Skip RSSI byte - final header = packet.readByte(); - final routeType = header & 0x03; - payloadType = (header >> 2) & 0x0F; - if (routeType == _routeTransportFlood || - routeType == _routeTransportDirect) { - packet.skipBytes(4); // Skip transport-specific bytes - } - //final payloadVer = (header >> 6) & 0x03; - final pathLenRaw = packet.readByte(); - final pathByteLen = _decodePathByteLen(pathLenRaw); - pathBytes = packet.readBytes(pathByteLen); - } catch (e) { - appLogger.warn('Malformed RX frame: $e', tag: 'Connector'); - return; - } - double? latitude; - double? longitude; - String name = ''; - Uint8List publicKey = Uint8List(0); - int type = 0; - int timestamp = 0; - bool hasLocation = false; - bool hasName = false; - if (payloadType != payloadTypeADVERT) { - appLogger.warn('Unexpected payload type: $payloadType', tag: 'Connector'); - return; - } - try { - publicKey = packet.readBytes(32); - timestamp = packet.readInt32LE(); - //TODO add signature verification - packet.skipBytes(64); // Skip signature for now - final flags = packet.readByte(); - type = flags & 0x0F; - hasLocation = (flags & 0x10) != 0; - // For future use: - //final hasFeature1 = (flags & 0x20) != 0; - //final hasFeature2 = (flags & 0x40) != 0; - hasName = (flags & 0x80) != 0; - if (hasLocation && packet.remaining >= 8) { - latitude = packet.readInt32LE() / 1e6; - longitude = packet.readInt32LE() / 1e6; - } - if (hasName && packet.remaining > 0) { - name = packet.readCString(); - } - } catch (e) { - appLogger.warn('Malformed advert frame: $e', tag: 'Connector'); - return; - } - - importDiscoveredContact( - Contact( - rawPacket: frame, - publicKey: publicKey, - name: name, - type: type, - pathLength: pathBytes.isEmpty ? -1 : pathBytes.length, - path: Uint8List.fromList( - pathBytes.reversed.toList(), - ), // Store path in reverse for easier use in outgoing messages - latitude: latitude, - longitude: longitude, - lastSeen: DateTime.fromMillisecondsSinceEpoch(timestamp * 1000), - ), - ); - } - bool hasValidLocation(double? latitude, double? longitude) { const double epsilon = 1e-6; final lat = latitude ?? 0.0; @@ -6431,6 +6836,11 @@ class _RepeaterAckContext { class _PendingCommandAck { final int commandCode; final String? channelSendQueueId; + final Completer? completer; - _PendingCommandAck({required this.commandCode, this.channelSendQueueId}); + _PendingCommandAck({ + required this.commandCode, + this.channelSendQueueId, + this.completer, + }); } diff --git a/lib/connector/meshcore_connector_usb.dart b/lib/connector/meshcore_connector_usb.dart index 56718bc2..7e44798a 100644 --- a/lib/connector/meshcore_connector_usb.dart +++ b/lib/connector/meshcore_connector_usb.dart @@ -19,6 +19,7 @@ class MeshCoreUsbManager { String? get activePortKey => _activePortKey; String? get activePortDisplayLabel => _activePortLabel ?? _activePortKey; bool get isConnected => _service.isConnected; + Object? get lastError => _service.lastError; Stream get frameStream => _service.frameStream; // --- Configuration --- diff --git a/lib/connector/meshcore_protocol.dart b/lib/connector/meshcore_protocol.dart index f55e9687..7b594894 100644 --- a/lib/connector/meshcore_protocol.dart +++ b/lib/connector/meshcore_protocol.dart @@ -224,6 +224,12 @@ const int reqTypeGetTelemetry = 0x03; const int reqTypeGetAccessList = 0x05; const int reqTypeGetNeighbors = 0x06; +Uint8List buildTelemetryBinaryPayload() { + // Room servers/repeaters read byte 1 as an inverse telemetry permission mask. + // Zero means "request every telemetry field allowed for this contact". + return Uint8List.fromList([reqTypeGetTelemetry, 0x00, 0x00, 0x00, 0x00]); +} + // Repeater response codes const int respServerLoginOk = 0; @@ -451,8 +457,13 @@ String pubKeyToHex(Uint8List pubKey) { // Helper to convert hex string to public key Uint8List hexToPubKey(String hex) { + if (hex.length != pubKeySize * 2) { + throw FormatException( + 'Public key hex must be ${pubKeySize * 2} chars, got ${hex.length}', + ); + } final result = Uint8List(pubKeySize); - for (int i = 0; i < pubKeySize && i * 2 + 1 < hex.length; i++) { + for (int i = 0; i < pubKeySize; i++) { result[i] = int.parse(hex.substring(i * 2, i * 2 + 2), radix: 16); } return result; @@ -945,7 +956,7 @@ Uint8List buildSendTelemetryReq(Uint8List? pubKey) { writer.writeBytes(Uint8List(3)); // reserved bytes writer.writeBytes(pubKey); } else { - writer.writeBytes(Uint8List(4)); // reserved bytes + writer.writeBytes(Uint8List(3)); // reserved bytes } return writer.toBytes(); } diff --git a/lib/connector/meshcore_uuids.dart b/lib/connector/meshcore_uuids.dart index ae6697b6..0a32b2a6 100644 --- a/lib/connector/meshcore_uuids.dart +++ b/lib/connector/meshcore_uuids.dart @@ -3,6 +3,10 @@ class MeshCoreUuids { static const String rxCharacteristic = "6e400002-b5a3-f393-e0a9-e50e24dcca9e"; static const String txCharacteristic = "6e400003-b5a3-f393-e0a9-e50e24dcca9e"; + /// Known advertised-name prefixes used by stock MeshCore firmware builds. + /// Discovery no longer filters on these (it filters on the [service] UUID so + /// that community forks with custom names are still found); kept for + /// reference and possible future display heuristics. static const List deviceNamePrefixes = [ "MeshCore-", "Whisper-", @@ -11,5 +15,6 @@ class MeshCoreUuids { "Lilygo", "HT-", "LowMesh_MC_", + "NRF52", ]; } diff --git a/lib/helpers/cayenne_lpp.dart b/lib/helpers/cayenne_lpp.dart index 07909e63..021e9cc5 100644 --- a/lib/helpers/cayenne_lpp.dart +++ b/lib/helpers/cayenne_lpp.dart @@ -96,6 +96,34 @@ class CayenneLpp { } switch (type) { + case lppDigitalInput: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': buffer.readUInt8(), + }); + break; + case lppDigitalOutput: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': buffer.readUInt8(), + }); + break; + case lppAnalogInput: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': buffer.readInt16BE() / 100, + }); + break; + case lppAnalogOutput: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': buffer.readInt16BE() / 100, + }); + break; case lppGenericSensor: telemetry.add({ 'channel': channel, @@ -131,6 +159,17 @@ class CayenneLpp { 'value': buffer.readUInt8() / 2, }); break; + case lppAccelerometer: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': { + 'x': buffer.readInt16BE() / 1000, + 'y': buffer.readInt16BE() / 1000, + 'z': buffer.readInt16BE() / 1000, + }, + }); + break; case lppBarometricPressure: telemetry.add({ 'channel': channel, @@ -138,6 +177,13 @@ class CayenneLpp { 'value': buffer.readUInt16BE() / 10, }); break; + case lppAltitude: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': buffer.readInt16BE(), + }); + break; case lppVoltage: telemetry.add({ 'channel': channel, @@ -152,6 +198,13 @@ class CayenneLpp { 'value': buffer.readInt16BE() / 1000, }); break; + case lppFrequency: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': buffer.readUInt32BE(), + }); + break; case lppPercentage: telemetry.add({ 'channel': channel, @@ -173,6 +226,56 @@ class CayenneLpp { 'value': buffer.readUInt16BE(), }); break; + case lppDistance: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': buffer.readUInt32BE() / 1000, + }); + break; + case lppEnergy: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': buffer.readUInt32BE() / 1000, + }); + break; + case lppDirection: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': buffer.readUInt16BE(), + }); + break; + case lppUnixTime: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': buffer.readUInt32BE(), + }); + break; + case lppGyrometer: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': { + 'x': buffer.readInt16BE() / 100, + 'y': buffer.readInt16BE() / 100, + 'z': buffer.readInt16BE() / 100, + }, + }); + break; + case lppColour: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': { + 'red': buffer.readUInt8(), + 'green': buffer.readUInt8(), + 'blue': buffer.readUInt8(), + }, + }); + break; case lppGps: telemetry.add({ 'channel': channel, @@ -184,6 +287,24 @@ class CayenneLpp { }, }); break; + case lppSwitch: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': buffer.readUInt8(), + }); + break; + case lppPolyline: + final size = buffer.readUInt8(); + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': { + 'size': size, + 'data': _bytesToHex(_readPolylinePayload(buffer, size)), + }, + }); + break; default: return telemetry; } @@ -216,6 +337,19 @@ class CayenneLpp { ); switch (type) { + case lppDigitalInput: + channelData['values']['digitalInput'] = buffer.readUInt8(); + break; + case lppDigitalOutput: + channelData['values']['digitalOutput'] = buffer.readUInt8(); + break; + case lppAnalogInput: + channelData['values']['analogInput'] = buffer.readInt16BE() / 100.0; + break; + case lppAnalogOutput: + channelData['values']['analogOutput'] = + buffer.readInt16BE() / 100.0; + break; case lppGenericSensor: channelData['values']['generic'] = buffer.readUInt32BE(); break; @@ -231,15 +365,29 @@ class CayenneLpp { case lppRelativeHumidity: channelData['values']['humidity'] = buffer.readUInt8() / 2.0; break; + case lppAccelerometer: + channelData['values']['accelerometer'] = { + 'x': buffer.readInt16BE() / 1000.0, + 'y': buffer.readInt16BE() / 1000.0, + 'z': buffer.readInt16BE() / 1000.0, + }; + break; case lppBarometricPressure: channelData['values']['pressure'] = buffer.readUInt16BE() / 10.0; break; + case lppAltitude: + // MeshCore encodes standalone barometric altitude as LPP type 121. + channelData['values']['altitude'] = buffer.readInt16BE(); + break; case lppVoltage: channelData['values']['voltage'] = buffer.readInt16BE() / 100.0; break; case lppCurrent: channelData['values']['current'] = buffer.readInt16BE() / 1000.0; break; + case lppFrequency: + channelData['values']['frequency'] = buffer.readUInt32BE(); + break; case lppPercentage: channelData['values']['percentage'] = buffer.readUInt8(); break; @@ -249,6 +397,32 @@ class CayenneLpp { case lppPower: channelData['values']['power'] = buffer.readUInt16BE(); break; + case lppDistance: + channelData['values']['distance'] = buffer.readUInt32BE() / 1000.0; + break; + case lppEnergy: + channelData['values']['energy'] = buffer.readUInt32BE() / 1000.0; + break; + case lppDirection: + channelData['values']['direction'] = buffer.readUInt16BE(); + break; + case lppUnixTime: + channelData['values']['time'] = buffer.readUInt32BE(); + break; + case lppGyrometer: + channelData['values']['gyrometer'] = { + 'x': buffer.readInt16BE() / 100.0, + 'y': buffer.readInt16BE() / 100.0, + 'z': buffer.readInt16BE() / 100.0, + }; + break; + case lppColour: + channelData['values']['colour'] = { + 'red': buffer.readUInt8(), + 'green': buffer.readUInt8(), + 'blue': buffer.readUInt8(), + }; + break; case lppGps: channelData['values']['gps'] = { 'latitude': buffer.readInt24BE() / 10000.0, @@ -256,22 +430,48 @@ class CayenneLpp { 'altitude': buffer.readInt24BE() / 100.0, }; break; - // Add more types as needed... + case lppSwitch: + channelData['values']['switch'] = buffer.readUInt8() != 0; + break; + case lppPolyline: + final size = buffer.readUInt8(); + channelData['values']['polyline'] = { + 'size': size, + 'data': _bytesToHex(_readPolylinePayload(buffer, size)), + }; + break; default: - //Stopped parsing to avoid misalignment - return channels.values.toList(); + // Stop parsing to avoid losing alignment on an unknown LPP type. + return _sortedChannelValues(channels); } } - final List> channelsOut = channels.values.toList(); - channelsOut.sort((a, b) => a['channel'].compareTo(b['channel'])); - return channelsOut; + return _sortedChannelValues(channels); } catch (e) { // Handle parsing errors, possibly due to malformed data appLogger.error('Error parsing Cayenne LPP data: $e'); - return < - Map - >[]; // Return an empty list on error to avoid crashing the app + // Preserve any fields parsed before the malformed value. + return _sortedChannelValues(channels); } } + + static Uint8List _readPolylinePayload(BufferReader buffer, int size) { + final declaredPayloadSize = size > 0 ? size - 1 : 0; + final availablePayloadSize = declaredPayloadSize <= buffer.remaining + ? declaredPayloadSize + : buffer.remaining; + return buffer.readBytes(availablePayloadSize); + } + + static List> _sortedChannelValues( + Map> channels, + ) { + final channelsOut = channels.values.toList(); + channelsOut.sort((a, b) => a['channel'].compareTo(b['channel'])); + return channelsOut; + } + + static String _bytesToHex(Uint8List bytes) { + return bytes.map((b) => b.toRadixString(16).padLeft(2, '0')).join(); + } } diff --git a/lib/helpers/contact_ui.dart b/lib/helpers/contact_ui.dart new file mode 100644 index 00000000..9e3b31f7 --- /dev/null +++ b/lib/helpers/contact_ui.dart @@ -0,0 +1,59 @@ +import 'package:flutter/material.dart'; + +import '../connector/meshcore_protocol.dart'; +import '../utils/emoji_utils.dart'; + +IconData contactTypeIcon(int type) { + switch (type) { + case advTypeChat: + return Icons.chat; + case advTypeRepeater: + return Icons.cell_tower; + case advTypeRoom: + return Icons.group; + case advTypeSensor: + return Icons.sensors; + default: + return Icons.device_unknown; + } +} + +Color contactTypeColor(int type) { + switch (type) { + case advTypeChat: + return Colors.blue; + case advTypeRepeater: + return Colors.orange; + case advTypeRoom: + return Colors.purple; + case advTypeSensor: + return Colors.green; + default: + return Colors.grey; + } +} + +Color colorForName(String name) { + const colors = [ + Colors.blue, + Colors.green, + Colors.orange, + Colors.purple, + Colors.pink, + Colors.teal, + Colors.indigo, + Colors.cyan, + Colors.amber, + Colors.deepOrange, + ]; + return colors[name.hashCode.abs() % colors.length]; +} + +String firstCharacterOrEmoji(String name) { + if (name.isEmpty) return '?'; + final emoji = firstEmoji(name); + if (emoji != null) return emoji; + final runes = name.runes.toList(); + if (runes.isEmpty) return '?'; + return String.fromCharCode(runes[0]).toUpperCase(); +} diff --git a/lib/helpers/path_helper.dart b/lib/helpers/path_helper.dart index fe51d636..bd599c00 100644 --- a/lib/helpers/path_helper.dart +++ b/lib/helpers/path_helper.dart @@ -8,24 +8,29 @@ class PathHelper { .join(','); } + static String hopHex(int byte) { + return byte.toRadixString(16).padLeft(2, '0').toUpperCase(); + } + + static String? hopName(int byte, List allContacts) { + final matches = allContacts + .where( + (c) => + c.publicKey.first == byte && + (c.type == advTypeRepeater || c.type == advTypeRoom), + ) + .toList(); + if (matches.isEmpty) return null; + if (matches.length == 1) return matches.first.name; + return matches.map((c) => c.name).join(' | '); + } + static String resolvePathNames( List pathBytes, List allContacts, ) { return pathBytes - .map((b) { - final hex = b.toRadixString(16).padLeft(2, '0').toUpperCase(); - final matches = allContacts - .where( - (c) => - c.publicKey.first == b && - (c.type == advTypeRepeater || c.type == advTypeRoom), - ) - .toList(); - if (matches.isEmpty) return hex; - if (matches.length == 1) return matches.first.name; - return matches.map((c) => c.name).join(' | '); - }) + .map((b) => hopName(b, allContacts) ?? hopHex(b)) .join(' \u2192 '); } } diff --git a/lib/helpers/path_hop_resolver.dart b/lib/helpers/path_hop_resolver.dart new file mode 100644 index 00000000..19f26001 --- /dev/null +++ b/lib/helpers/path_hop_resolver.dart @@ -0,0 +1,70 @@ +import 'package:latlong2/latlong.dart'; + +import '../connector/meshcore_protocol.dart'; +import '../models/contact.dart'; + +class PathHopResolver { + const PathHopResolver._(); + + static List resolve({ + required List pathBytes, + required List contacts, + LatLng? endpoint, + bool resolveFromEnd = false, + }) { + final candidatesByPrefix = >{}; + for (final contact in contacts) { + if (contact.publicKey.isEmpty) continue; + if (contact.type != advTypeRepeater && contact.type != advTypeRoom) { + continue; + } + candidatesByPrefix + .putIfAbsent(contact.publicKey.first, () => []) + .add(contact); + } + for (final candidates in candidatesByPrefix.values) { + candidates.sort((a, b) => b.lastSeen.compareTo(a.lastSeen)); + } + + final resolved = List.filled(pathBytes.length, null); + final indexes = resolveFromEnd + ? List.generate(pathBytes.length, (i) => pathBytes.length - 1 - i) + : List.generate(pathBytes.length, (i) => i); + final distance = Distance(); + var previousPosition = endpoint; + + for (final index in indexes) { + final candidates = candidatesByPrefix[pathBytes[index]]; + if (candidates == null || candidates.isEmpty) continue; + + var bestIndex = 0; + if (previousPosition != null && candidates.length > 1) { + double? nearestDistance; + for (var i = 0; i < candidates.length; i++) { + final position = _positionOf(candidates[i]); + if (position == null) continue; + final candidateDistance = distance(previousPosition, position); + if (nearestDistance == null || candidateDistance < nearestDistance) { + nearestDistance = candidateDistance; + bestIndex = i; + } + } + } + + final contact = candidates.removeAt(bestIndex); + resolved[index] = contact; + previousPosition = _positionOf(contact) ?? previousPosition; + } + + return resolved; + } + + static LatLng? _positionOf(Contact contact) { + if (!contact.hasLocation || + contact.latitude == null || + contact.longitude == null) { + return null; + } + return LatLng(contact.latitude!, contact.longitude!); + } +} diff --git a/lib/helpers/snack_bar_builder.dart b/lib/helpers/snack_bar_builder.dart index d7409b6d..913e783f 100644 --- a/lib/helpers/snack_bar_builder.dart +++ b/lib/helpers/snack_bar_builder.dart @@ -25,7 +25,19 @@ void showDismissibleSnackBar( DismissDirection? dismissDirection, Clip? clipBehavior, }) { - final messenger = ScaffoldMessenger.of(context); + // Callers often reach here after an async gap; the context may already be + // unmounted, or deactivated (popped but not yet disposed) — ancestor + // lookups on a deactivated element throw. Showing nothing is the right + // outcome in both cases. + if (!context.mounted) return; + var isActive = true; + assert(() { + isActive = (context as Element).debugIsActive; + return true; + }()); + if (!isActive) return; + final messenger = ScaffoldMessenger.maybeOf(context); + if (messenger == null) return; messenger.showSnackBar( SnackBar( key: key, diff --git a/lib/l10n/app_bg.arb b/lib/l10n/app_bg.arb index 45536cf6..f288b774 100644 --- a/lib/l10n/app_bg.arb +++ b/lib/l10n/app_bg.arb @@ -33,6 +33,8 @@ "common_remove": "Изтрий", "common_enable": "Активирай", "common_disable": "Деактивирай", + "common_autoRefresh": "Автоматично обновяване", + "common_interval": "Интервал", "common_reboot": "Рестартирай", "common_loading": "Зареждане...", "common_notAvailable": "—", @@ -1280,6 +1282,43 @@ } } }, + "telemetry_digitalInputLabel": "Цифров вход", + "telemetry_digitalOutputLabel": "Цифров изход", + "telemetry_analogInputLabel": "Аналогов вход", + "telemetry_analogOutputLabel": "Аналогов изход", + "telemetry_genericLabel": "Общ сензор", + "telemetry_luminosityLabel": "Осветеност", + "telemetry_presenceLabel": "Присъствие", + "telemetry_humidityLabel": "Влажност", + "telemetry_accelerometerLabel": "Акселерометър", + "telemetry_pressureLabel": "Налягане", + "telemetry_altitudeLabel": "Надморска височина", + "telemetry_frequencyLabel": "Честота", + "telemetry_percentageLabel": "Процент", + "telemetry_concentrationLabel": "Концентрация", + "telemetry_powerLabel": "Мощност", + "telemetry_distanceLabel": "Разстояние", + "telemetry_energyLabel": "Енергия", + "telemetry_directionLabel": "Посока", + "telemetry_timeLabel": "Време", + "telemetry_gyrometerLabel": "Жироскоп", + "telemetry_colourLabel": "Цвят", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Превключвател", + "telemetry_polylineLabel": "Полилиния", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", + "telemetry_autoFetchQuantity": "Брой заявки", + "telemetry_error": "Неуспешно получаване на данни", "telemetry_noData": "Няма налични данни за телеметрията.", "telemetry_channelTitle": "Канал {channel}", "@telemetry_channelTitle": { @@ -2099,6 +2138,9 @@ "translation_composerTitle": "Преведете преди да изпратите", "translation_enableSubtitle": "Превеждайте входящите съобщения и позволявайте предварително превеждане преди изпращане.", "translation_composerSubtitle": "Контролира началния статус на иконата за превод, създадена от композитора.", + "translation_autoIncomingTitle": "Автоматичен превод на съобщения", + "translation_autoIncomingSubtitle": "Превежда автоматично съобщенията за известия, както и за чатове или канали.", + "translation_translateMessage": "Преведи съобщението", "translation_targetLanguage": "Целеви език", "translation_useAppLanguage": "Използвайте езика на приложението", "translation_downloadedModelLabel": "Изтегнат модел", @@ -2311,5 +2353,98 @@ "settings_companionDebugLogSubtitle": "Команди, отговори и сурови данни за протоколите BLE/TCP/USB", "chat_newMessages": "Нови съобщения", "settings_companionDebugLog": "Лог за отстраняване на грешки (за съпътстваща програма)", - "repeater_chanUtil": "Използване на канала" + "repeater_chanUtil": "Използване на канала", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_pending": "Изпращане", + "common_undo": "Отмяни", + "messageStatus_delivered": "Доставен", + "messageStatus_sent": "Изпратено", + "messageStatus_failed": "Не успях да изпратя", + "messageStatus_repeated": "Слушах го многократно", + "contacts_moreOptions": "Повече възможности", + "contacts_searchOpen": "Търсене на контакти", + "contacts_searchClose": "Затвори търсене", + "routing_title": "Маршрутизиране", + "routing_modeAuto": "Автомобил", + "routing_modeFlood": "Наводнение", + "routing_modeManual": "Ръководство", + "routing_modeAutoHint": "Автоматично избира най-известния път, като при липса на информация, използва стратегия за \"запълване\" на празните пространства.", + "routing_modeFloodHint": "Излъчване през всички ретранслатори. Най-надежният начин, но изисква повече време на въздуха.", + "routing_modeManualHint": "Винаги следва точно пътя, който сте определили.", + "routing_currentRoute": "Текущ маршрут", + "routing_directNoHops": "Директ – без превключватели", + "routing_noPathYet": "Все още няма път. Съобщението продължава да се изпраща, докато не бъде открит маршрут.", + "routing_floodBroadcast": "Предаване през всички ретранслатори", + "routing_editPath": "Редактиране на пътя", + "routing_forgetPath": "Забравете за пътя", + "routing_knownPaths": "Известни маршрути", + "routing_knownPathsHint": "Натиснете бутона, за да превключите към него.", + "routing_inUse": "В експлоатация", + "routing_qualityStrong": "Силен първи скок", + "routing_qualityGood": "Добър първи опит", + "routing_qualityFair": "Първият добър скок", + "routing_qualityWorked": "Беше изпълнено/Доведено до край", + "routing_qualityFlood": "Получено чрез информация, разпространена в резултат на навод.", + "routing_qualityUntested": "Не тестван", + "routing_neverWorked": "никога не е потвърдено", + "routing_floodDelivery": "Доставка при навод", + "pathEditor_title": "Създаване на път", + "pathEditor_hopCounter": "{count} от 64 различни вида малц", + "pathEditor_noHops": "Все още няма добавени хмел. Можете да използвате бутоните по-долу, за да ги добавите по ред, или да запазите рецептата без хмел, за да я изпратите директно.", + "pathEditor_addHops": "Добавете хмела в реда, в който е посочено.", + "pathEditor_searchRepeaters": "Търсене на повтори", + "pathEditor_advancedHex": "Разширено: необработен шестничен път", + "pathEditor_hexLabel": "Префикси на шестнадесетична система", + "pathEditor_hexHelper": "Два шест-символни идентификатора на скок, разделени със запетаи", + "pathEditor_invalidTokens": "Невалидно: {tokens}", + "routing_lastWorked": "worked {when}", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "pathEditor_tooManyHops": "Максимум 64 крачета", + "pathEditor_usePath": "Използвайте този маршрут.", + "pathEditor_removeHop": "Премахнете хмела", + "pathEditor_unknownHop": "Неизвестен репитер", + "map_zoomIn": "Увеличи", + "map_zoomOut": "Приближете се по-малко", + "map_centerMap": "Карта на центъра", + "chrome_bluetoothRequiresChromium": "Web Bluetooth изисква браузър, базиран на Chromium.", + "channels_communityShortId": "Идентификационен номер: {id}...", + "pathTrace_legendGpsConfirmed": "GPS потвърдено", + "pathTrace_legendInferred": "Извлечена позиция" } diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index 7f491d4f..47062aa6 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -33,6 +33,8 @@ "common_remove": "Löschen", "common_enable": "Aktivieren", "common_disable": "Deaktivieren", + "common_autoRefresh": "Automatische Aktualisierung", + "common_interval": "Intervall", "common_reboot": "Neustart", "common_loading": "Laden...", "common_notAvailable": "—", @@ -1280,6 +1282,43 @@ } } }, + "telemetry_digitalInputLabel": "Digitaleingang", + "telemetry_digitalOutputLabel": "Digitalausgang", + "telemetry_analogInputLabel": "Analogeingang", + "telemetry_analogOutputLabel": "Analogausgang", + "telemetry_genericLabel": "Allgemeiner Sensor", + "telemetry_luminosityLabel": "Helligkeit", + "telemetry_presenceLabel": "Anwesenheit", + "telemetry_humidityLabel": "Luftfeuchtigkeit", + "telemetry_accelerometerLabel": "Beschleunigungsmesser", + "telemetry_pressureLabel": "Druck", + "telemetry_altitudeLabel": "Höhe", + "telemetry_frequencyLabel": "Frequenz", + "telemetry_percentageLabel": "Prozentsatz", + "telemetry_concentrationLabel": "Konzentration", + "telemetry_powerLabel": "Leistung", + "telemetry_distanceLabel": "Entfernung", + "telemetry_energyLabel": "Energie", + "telemetry_directionLabel": "Richtung", + "telemetry_timeLabel": "Zeit", + "telemetry_gyrometerLabel": "Gyroskop", + "telemetry_colourLabel": "Farbe", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Schalter", + "telemetry_polylineLabel": "Polylinie", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", + "telemetry_autoFetchQuantity": "Anzahl der Anfragen", + "telemetry_error": "Daten konnten nicht abgerufen werden", "telemetry_noData": "Keine Telemetriedaten verfügbar.", "telemetry_channelTitle": "Kanal {channel}", "@telemetry_channelTitle": { @@ -2127,6 +2166,9 @@ "translation_enableSubtitle": "Nachrichten empfangen und übersetzen sowie die Möglichkeit bieten, Nachrichten vor dem Versenden zu übersetzen.", "translation_enableTitle": "Aktivieren Sie die Übersetzung", "translation_composerSubtitle": "Steuert den Standardzustand des Icons für die Übersetzung des Komponisten.", + "translation_autoIncomingTitle": "Nachrichten automatisch übersetzen", + "translation_autoIncomingSubtitle": "Übersetzt Nachrichten für Benachrichtigungen sowie für Chats oder Kanäle automatisch.", + "translation_translateMessage": "Nachricht übersetzen", "translation_targetLanguage": "Zielsprache", "translation_useAppLanguage": "Verwenden Sie die App-Sprache", "translation_downloadedModelLabel": "Heruntergeladenes Modell", @@ -2339,5 +2381,98 @@ "chat_newMessages": "Neue Nachrichten", "settings_companionDebugLog": "Debug-Protokoll für die Begleitsoftware", "settings_companionDebugLogSubtitle": "BLE/TCP/USB-Befehle, Antworten und Rohdaten", - "repeater_chanUtil": "Nutzung des Kanals" + "repeater_chanUtil": "Nutzung des Kanals", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_sent": "Gesendet", + "messageStatus_delivered": "Geliefert", + "common_undo": "Rückgängig machen", + "messageStatus_pending": "Versenden", + "messageStatus_failed": "Nicht gesendet", + "messageStatus_repeated": "Wiederholt gehört", + "contacts_moreOptions": "Weitere Optionen", + "contacts_searchOpen": "Kontakte suchen", + "contacts_searchClose": "Erweiterte Suche", + "routing_title": "Routenplanung", + "routing_modeAuto": "Auto", + "routing_modeFlood": "Überschwemmung", + "routing_modeManual": "Handbuch", + "routing_modeFloodHint": "Übertragung über alle Repeater. Die zuverlässigste Methode, jedoch mit höherem Datenverbrauch.", + "routing_modeAutoHint": "Wählt automatisch den bekanntesten Pfad aus und verwendet eine Flutungsmethode, wenn kein Pfad bekannt ist.", + "routing_modeManualHint": "Sendet immer genau den von Ihnen festgelegten Weg.", + "routing_currentRoute": "Aktuelle Route", + "routing_directNoHops": "Direkt – ohne Zwischenverstärkung", + "routing_noPathYet": "Noch kein Pfad gefunden. Die Nachricht wird gesendet, bis ein Weg entdeckt wurde.", + "routing_floodBroadcast": "Übertragung über jeden Repeater", + "routing_editPath": "Pfad bearbeiten", + "routing_forgetPath": "Vergiss den Weg", + "routing_knownPaths": "Bekannte Routen", + "routing_knownPathsHint": "Wählen Sie den Pfad, um zu diesem zu wechseln.", + "routing_inUse": "Im Gebrauch", + "routing_qualityStrong": "Ein starker erster Sprung", + "routing_qualityGood": "Ein guter erster Schritt", + "routing_qualityFair": "Erster erfolgreicher Schritt", + "routing_qualityWorked": "Hat erfolgreich geliefert", + "routing_qualityFlood": "Information erhalten durch Nachrichten über die Überschwemmung", + "routing_qualityUntested": "Nicht getestet", + "routing_lastWorked": "war beschäftigt {when}", + "routing_neverWorked": "nie bestätigt", + "routing_floodDelivery": "Lieferung bei Überschwemmung", + "pathEditor_title": "Pfad erstellen", + "pathEditor_hopCounter": "{count} von 64 Hopfengewächsen", + "pathEditor_noHops": "Noch keine Hopfen hinzugefügt. Klicken Sie auf die Schaltflächen unten, um sie nacheinander hinzuzufügen, oder speichern Sie die Rezepter ohne Hopfen, um sie direkt zu versenden.", + "pathEditor_addHops": "Fügen Sie die Hopfen in der richtigen Reihenfolge hinzu.", + "pathEditor_searchRepeaters": "Suche nach wiederholten Nachrichten", + "pathEditor_advancedHex": "Fortgeschritten: Roh-Hex-Pfad", + "pathEditor_hexLabel": "Hex-Präfixe", + "pathEditor_hexHelper": "Zwei Hexadezimalzeichen pro Sprung, getrennt durch Kommas", + "pathEditor_invalidTokens": "Ungültig: {tokens}", + "pathEditor_tooManyHops": "Maximal 64 Hopfengreifer", + "pathEditor_usePath": "Verwenden Sie diesen Pfad.", + "pathEditor_removeHop": "Hop entfernen", + "pathEditor_unknownHop": "Unbekannter Repeater", + "map_zoomIn": "Zoomen", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "map_zoomOut": "Auszoomen", + "map_centerMap": "Zentralkarte", + "chrome_bluetoothRequiresChromium": "Web Bluetooth benötigt einen Chromium-Browser.", + "channels_communityShortId": "ID: {id}…", + "pathTrace_legendGpsConfirmed": "GPS-Bestätigung", + "pathTrace_legendInferred": "Abgeleitete Position" } diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 456fab56..705caecb 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -28,6 +28,12 @@ "common_remove": "Remove", "common_enable": "Enable", "common_disable": "Disable", + "common_undo": "Undo", + "messageStatus_sent": "Sent", + "messageStatus_delivered": "Delivered", + "messageStatus_pending": "Sending", + "messageStatus_failed": "Failed to send", + "messageStatus_repeated": "Heard repeated", "common_reboot": "Reboot", "common_loading": "Loading...", "common_notAvailable": "—", @@ -47,6 +53,8 @@ } } }, + "common_autoRefresh": "Autorefresh", + "common_interval": "Interval", "scanner_title": "MeshCore Open", "connectionChoiceUsbLabel": "USB", "connectionChoiceBluetoothLabel": "Bluetooth", @@ -135,6 +143,7 @@ "scanner_chromeRequired": "Chrome Browser Required", "scanner_chromeRequiredMessage": "This web application requires Google Chrome or a Chromium-based browser for Bluetooth support.", "scanner_enableBluetooth": "Enable Bluetooth", + "scanner_bluetoothWebUnsupported": "Bluetooth isn't available in the browser. Connect over USB instead.", "device_quickSwitch": "Quick switch", "device_meshcore": "MeshCore", "settings_title": "Settings", @@ -295,17 +304,6 @@ "appSettings_routeWeightFailureDecrementSubtitle": "Weight removed from a path after failed delivery", "appSettings_maxMessageRetries": "Max Message Retries", "appSettings_maxMessageRetriesSubtitle": "Number of retry attempts before marking a message as failed", - "path_routeWeight": "{weight}/{max}", - "@path_routeWeight": { - "placeholders": { - "weight": { - "type": "String" - }, - "max": { - "type": "String" - } - } - }, "appSettings_battery": "Battery", "appSettings_batteryChemistry": "Battery Chemistry", "appSettings_batteryChemistryPerDevice": "Set per device ({deviceName})", @@ -451,6 +449,9 @@ } }, "contacts_newGroup": "New Group", + "contacts_moreOptions": "More options", + "contacts_searchOpen": "Search contacts", + "contacts_searchClose": "Close search", "contacts_groupName": "Group name", "contacts_groupNameRequired": "Group name is required", "contacts_groupNameReserved": "This group name is reserved", @@ -775,15 +776,6 @@ } }, "debugFrame_hexDump": "Hex Dump:", - "chat_pathManagement": "Path Management", - "chat_ShowAllPaths": "Show all paths", - "chat_routingMode": "Routing mode", - "chat_autoUseSavedPath": "Auto (use saved path)", - "chat_forceFloodMode": "Force Flood Mode", - "chat_recentAckPaths": "Recent ACK Paths (tap to use):", - "chat_pathHistoryFull": "Path history is full. Remove entries to add new ones.", - "chat_hopSingular": "hop", - "chat_hopPlural": "hops", "chat_hopsCount": "{count} {count, plural, =1{hop} other{hops}}", "@chat_hopsCount": { "placeholders": { @@ -792,31 +784,80 @@ } } }, - "chat_successes": "successes", - "chat_score": "Score", "chat_removePath": "Remove path", "chat_noPathHistoryYet": "No path history yet.\nSend a message to discover paths.", - "chat_pathActions": "Path Actions:", - "chat_setCustomPath": "Set Custom Path", - "chat_setCustomPathSubtitle": "Manually specify routing path", - "chat_clearPath": "Clear Path", - "chat_clearPathSubtitle": "Force rediscovery on next send", "chat_pathCleared": "Path cleared. Next message will rediscover route.", - "chat_floodModeSubtitle": "Use routing toggle in app bar", - "chat_floodModeEnabled": "Flood mode enabled. Toggle back via routing icon in app bar.", "chat_fullPath": "Full Path", - "chat_pathDetailsNotAvailable": "Path details not available yet. Try sending a message to refresh.", - "chat_pathSetHops": "Path set: {hopCount} {hopCount, plural, =1{hop} other{hops}} - {status}", - "@chat_pathSetHops": { + "routing_title": "Routing", + "routing_modeAuto": "Auto", + "routing_modeFlood": "Flood", + "routing_modeManual": "Manual", + "routing_modeAutoHint": "Picks the best known path automatically, flooding when none is known.", + "routing_modeFloodHint": "Broadcasts through every repeater. Most reliable, but uses more airtime.", + "routing_modeManualHint": "Always sends along the exact path you set.", + "routing_currentRoute": "Current route", + "routing_directNoHops": "Direct — no repeater hops", + "routing_noPathYet": "No path yet. The next message floods until a route is discovered.", + "routing_floodBroadcast": "Broadcast through every repeater", + "routing_editPath": "Edit path", + "routing_forgetPath": "Forget path", + "routing_knownPaths": "Known paths", + "routing_knownPathsHint": "Tap a path to switch to it.", + "routing_inUse": "In use", + "routing_qualityStrong": "Strong first hop", + "routing_qualityGood": "Good first hop", + "routing_qualityFair": "Fair first hop", + "routing_qualityWorked": "Has delivered", + "routing_qualityFlood": "Heard via flood", + "routing_qualityUntested": "Untested", + "routing_lastWorked": "worked {when}", + "@routing_lastWorked": { "placeholders": { - "hopCount": { - "type": "int" - }, - "status": { + "when": { "type": "String" } } }, + "routing_neverWorked": "never confirmed", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "routing_floodDelivery": "Flood delivery", + "pathEditor_title": "Build Path", + "pathEditor_hopCounter": "{count} of 64 hops", + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "pathEditor_noHops": "No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.", + "pathEditor_addHops": "Add hops in order", + "pathEditor_searchRepeaters": "Search repeaters", + "pathEditor_advancedHex": "Advanced: raw hex path", + "pathEditor_hexLabel": "Hex prefixes", + "pathEditor_hexHelper": "Two hex characters per hop, separated by commas", + "pathEditor_invalidTokens": "Invalid: {tokens}", + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "pathEditor_tooManyHops": "Maximum 64 hops", + "pathEditor_usePath": "Use this path", + "pathEditor_removeHop": "Remove hop", + "pathEditor_unknownHop": "Unknown repeater", "chat_pathSavedLocally": "Saved locally. Connect to sync.", "chat_pathDeviceConfirmed": "Device confirmed.", "chat_pathDeviceNotConfirmed": "Device not confirmed yet.", @@ -860,6 +901,17 @@ }, "chat_invalidLink": "Invalid link format", "map_title": "Node Map", + "map_searchHint": "Search node name or ID", + "map_activity": "Activity", + "map_online": "Online", + "map_recent": "Recent", + "map_stale": "Stale", + "map_visible": "Visible", + "map_hidden": "Hidden", + "map_centerOnNode": "Center on node", + "map_details": "Details", + "map_noGps": "No GPS", + "map_noResults": "No matching nodes", "map_lineOfSight": "Line of Sight", "map_losScreenTitle": "Line of Sight", "map_noNodesWithLocation": "No nodes with location data", @@ -1098,41 +1150,8 @@ "login_failedMessage": "Login failed. Either the password is incorrect or the repeater is unreachable.", "common_reload": "Reload", "common_clear": "Clear", - "path_currentPath": "Current path: {path}", - "@path_currentPath": { - "placeholders": { - "path": { - "type": "String" - } - } - }, - "path_usingHopsPath": "Using {count} {count, plural, =1{hop} other{hops}} path", - "@path_usingHopsPath": { - "placeholders": { - "count": { - "type": "int" - } - } - }, - "path_enterCustomPath": "Enter Custom Path", "path_currentPathLabel": "Current path", - "path_hexPrefixInstructions": "Enter 2-character hex prefixes for each hop, separated by commas.", - "path_hexPrefixExample": "Example: A1,F2,3C (each node uses first byte of its public key)", - "path_labelHexPrefixes": "Path (hex prefixes)", - "path_helperMaxHops": "Max 64 hops. Each prefix is 2 hex characters (1 byte)", - "path_selectFromContacts": "Or select from contacts:", "path_noRepeatersFound": "No repeaters or room servers found.", - "path_customPathsRequire": "Custom paths require intermediate hops that can relay messages.", - "path_invalidHexPrefixes": "Invalid hex prefixes: {prefixes}", - "@path_invalidHexPrefixes": { - "placeholders": { - "prefixes": { - "type": "String" - } - } - }, - "path_tooLong": "Path too long. Maximum 64 hops allowed.", - "path_setPath": "Set Path", "repeater_management": "Repeater Management", "room_management": "Room Server Management", "repeater_guest": "Repeater Information", @@ -1159,9 +1178,6 @@ }, "repeater_statusTitle": "Repeater Status", "repeater_routingMode": "Routing mode", - "repeater_autoUseSavedPath": "Auto (use saved path)", - "repeater_forceFloodMode": "Force Flood Mode", - "repeater_pathManagement": "Path management", "repeater_refresh": "Refresh", "repeater_statusRequestTimeout": "Status request timed out.", "repeater_errorLoadingStatus": "Error loading status: {error}", @@ -1661,6 +1677,120 @@ } } }, + "telemetry_digitalInputLabel": "Digital Input", + "telemetry_digitalOutputLabel": "Digital Output", + "telemetry_analogInputLabel": "Analog Input", + "telemetry_analogOutputLabel": "Analog Output", + "telemetry_genericLabel": "Generic Sensor", + "telemetry_luminosityLabel": "Luminosity", + "telemetry_presenceLabel": "Presence", + "telemetry_humidityLabel": "Humidity", + "telemetry_accelerometerLabel": "Accelerometer", + "telemetry_pressureLabel": "Pressure", + "telemetry_altitudeLabel": "Altitude", + "telemetry_frequencyLabel": "Frequency", + "telemetry_percentageLabel": "Percentage", + "telemetry_concentrationLabel": "Concentration", + "telemetry_powerLabel": "Power", + "telemetry_distanceLabel": "Distance", + "telemetry_energyLabel": "Energy", + "telemetry_directionLabel": "Direction", + "telemetry_timeLabel": "Time", + "telemetry_gyrometerLabel": "Gyrometer", + "telemetry_colourLabel": "Colour", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Switch", + "telemetry_polylineLabel": "Polyline", + "telemetry_altitudeValue": "{meters} m", + "@telemetry_altitudeValue": { + "placeholders": { + "meters": { + "type": "String" + } + } + }, + "telemetry_frequencyValue": "{hertz} Hz", + "@telemetry_frequencyValue": { + "placeholders": { + "hertz": { + "type": "String" + } + } + }, + "telemetry_pressureValue": "{hpa} hPa", + "@telemetry_pressureValue": { + "placeholders": { + "hpa": { + "type": "String" + } + } + }, + "telemetry_luminosityValue": "{lux} lx", + "@telemetry_luminosityValue": { + "placeholders": { + "lux": { + "type": "String" + } + } + }, + "telemetry_powerValue": "{watts} W", + "@telemetry_powerValue": { + "placeholders": { + "watts": { + "type": "String" + } + } + }, + "telemetry_distanceValue": "{meters} m", + "@telemetry_distanceValue": { + "placeholders": { + "meters": { + "type": "String" + } + } + }, + "telemetry_energyValue": "{kilowattHours} kWh", + "@telemetry_energyValue": { + "placeholders": { + "kilowattHours": { + "type": "String" + } + } + }, + "telemetry_directionValue": "{degrees}°", + "@telemetry_directionValue": { + "placeholders": { + "degrees": { + "type": "String" + } + } + }, + "telemetry_concentrationValue": "{ppm} ppm", + "@telemetry_concentrationValue": { + "placeholders": { + "ppm": { + "type": "String" + } + } + }, + "telemetry_percentageValue": "{percent}%", + "@telemetry_percentageValue": { + "placeholders": { + "percent": { + "type": "String" + } + } + }, + "telemetry_analogValue": "{value}", + "@telemetry_analogValue": { + "placeholders": { + "value": { + "type": "String" + } + } + }, + "telemetry_autoFetchQuantity": "Requests quantity", + "telemetry_error": "Unable to retrieve data", "neighbors_receivedData": "Received Neighbors Data", "neighbors_requestTimedOut": "Neighbors request timed out.", "neighbors_errorLoading": "Error loading neighbors: {error}", @@ -2288,6 +2418,9 @@ "translation_enableSubtitle": "Translate incoming messages and allow pre-send translation.", "translation_composerTitle": "Translate before sending", "translation_composerSubtitle": "Controls the default state of the composer translation icon.", + "translation_autoIncomingTitle": "Auto-translate incoming messages", + "translation_autoIncomingSubtitle": "Translates Messages for notification and for chat or channel automatically.", + "translation_translateMessage": "Translate message", "translation_targetLanguage": "Target language", "translation_useAppLanguage": "Use app language", "translation_downloadedModelLabel": "Downloaded model", @@ -2366,5 +2499,101 @@ "contact_typeRepeater": "Repeater", "contact_typeRoom": "Room", "contact_typeSensor": "Sensor", - "contact_typeUnknown": "Unknown" + "contact_typeUnknown": "Unknown", + "map_zoomIn": "Zoom in", + "map_zoomOut": "Zoom out", + "map_centerMap": "Center map", + "chrome_bluetoothRequiresChromium": "Web Bluetooth requires a Chromium browser", + "channels_communityShortId": "ID: {id}...", + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "pathTrace_legendGpsConfirmed": "GPS confirmed", + "pathTrace_legendInferred": "Inferred position", + "pathMap_viewSingle": "Single", + "pathMap_viewCombined": "Combined", + "pathMap_play": "Play", + "pathMap_pause": "Pause", + "pathMap_replay": "Replay", + "pathMap_stepBack": "Previous hop", + "pathMap_stepForward": "Next hop", + "pathMap_animationOn": "Show packet animation", + "pathMap_animationOff": "Hide packet animation", + "pathMap_hopOf": "Hop {current} of {total}", + "@pathMap_hopOf": { + "placeholders": { + "current": { + "type": "int" + }, + "total": { + "type": "int" + } + } + }, + "pathMap_observedPaths": "Observed paths: {count}", + "@pathMap_observedPaths": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "pathMap_primary": "Primary", + "pathMap_alternate": "Alt {index}", + "@pathMap_alternate": { + "placeholders": { + "index": { + "type": "int" + } + } + }, + "pathMap_hopCount": "{count, plural, =1{1 hop} other{{count} hops}}", + "@pathMap_hopCount": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "pathMap_gpsCount": "{confirmed}/{total} GPS", + "@pathMap_gpsCount": { + "placeholders": { + "confirmed": { + "type": "int" + }, + "total": { + "type": "int" + } + } + }, + "pathMap_legendShared": "Shared segment", + "pathMap_legendEstimated": "Estimated segment", + "pathMap_sharedNodeCount": "Used by {count} paths", + "@pathMap_sharedNodeCount": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "pathMap_partialAnimation": "{count, plural, =1{1 hop has no location — the shown path is partial} other{{count} hops have no location — the shown path is partial}}", + "@pathMap_partialAnimation": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "pathMap_showAllPaths": "Show all", + "pathMap_hidePath": "Hide path", + "pathMap_showPath": "Show path", + "pathMap_collapsePanel": "Collapse panel", + "pathMap_expandPanel": "Expand panel", + "pathMap_noLocation": "No location", + "pathMap_followPacket": "Lock view to packet", + "pathMap_unfollowPacket": "Unlock view from packet" } diff --git a/lib/l10n/app_es.arb b/lib/l10n/app_es.arb index d4cf27da..31b6dc7d 100644 --- a/lib/l10n/app_es.arb +++ b/lib/l10n/app_es.arb @@ -33,6 +33,8 @@ "common_remove": "Eliminar", "common_enable": "Activar", "common_disable": "Desactivar", + "common_autoRefresh": "Actualización automática", + "common_interval": "Intervalo", "common_reboot": "Reiniciar", "common_loading": "Cargando...", "common_notAvailable": "—", @@ -1280,6 +1282,43 @@ } } }, + "telemetry_digitalInputLabel": "Entrada digital", + "telemetry_digitalOutputLabel": "Salida digital", + "telemetry_analogInputLabel": "Entrada analógica", + "telemetry_analogOutputLabel": "Salida analógica", + "telemetry_genericLabel": "Sensor genérico", + "telemetry_luminosityLabel": "Luminosidad", + "telemetry_presenceLabel": "Presencia", + "telemetry_humidityLabel": "Humedad", + "telemetry_accelerometerLabel": "Acelerómetro", + "telemetry_pressureLabel": "Presión", + "telemetry_altitudeLabel": "Altitud", + "telemetry_frequencyLabel": "Frecuencia", + "telemetry_percentageLabel": "Porcentaje", + "telemetry_concentrationLabel": "Concentración", + "telemetry_powerLabel": "Potencia", + "telemetry_distanceLabel": "Distancia", + "telemetry_energyLabel": "Energía", + "telemetry_directionLabel": "Dirección", + "telemetry_timeLabel": "Hora", + "telemetry_gyrometerLabel": "Girómetro", + "telemetry_colourLabel": "Color", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Interruptor", + "telemetry_polylineLabel": "Polilínea", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", + "telemetry_autoFetchQuantity": "Número de solicitudes", + "telemetry_error": "No se pudieron obtener los datos", "telemetry_noData": "No hay datos de telemetría disponibles.", "telemetry_channelTitle": "Canal {channel}", "@telemetry_channelTitle": { @@ -2128,6 +2167,9 @@ "translation_enableTitle": "Habilitar la traducción", "translation_composerTitle": "Traducir antes de enviar", "translation_composerSubtitle": "Controla el estado predeterminado del icono de traducción del compositor.", + "translation_autoIncomingTitle": "Traducir mensajes automáticamente", + "translation_autoIncomingSubtitle": "Traduce mensajes para notificaciones y para chats o canales automáticamente.", + "translation_translateMessage": "Traducir mensaje", "translation_targetLanguage": "Idioma de destino", "translation_useAppLanguage": "Utilizar el idioma de la aplicación", "translation_downloadedModelLabel": "Modelo descargado", @@ -2339,5 +2381,98 @@ "chat_newMessages": "Nuevos mensajes", "settings_companionDebugLogSubtitle": "Comandos, respuestas y datos brutos para protocolos BLE/TCP/USB", "chat_markAsUnread": "Marcar como no leído", - "repeater_chanUtil": "Utilización del canal" + "repeater_chanUtil": "Utilización del canal", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_pending": "Enviar", + "common_undo": "Deshacer", + "messageStatus_sent": "Sentido", + "messageStatus_delivered": "Entregado", + "messageStatus_failed": "No se pudo enviar", + "messageStatus_repeated": "Escuché repetidamente", + "contacts_moreOptions": "Más opciones", + "contacts_searchOpen": "Buscar contactos", + "contacts_searchClose": "Búsqueda avanzada", + "routing_title": "Ruteo", + "routing_modeAuto": "Coche", + "routing_modeFlood": "Inundación", + "routing_modeManual": "Manual", + "routing_modeAutoHint": "Selecciona automáticamente la ruta más conocida, y si no hay ninguna ruta conocida, utiliza la ruta más directa.", + "routing_modeFloodHint": "Transmisiones a través de todos los repetidores. Es la opción más fiable, pero utiliza más tiempo de transmisión.", + "routing_modeManualHint": "Siempre sigue exactamente la ruta que usted ha definido.", + "routing_currentRoute": "Ruta actual", + "routing_directNoHops": "Directo — sin saltos de repetidor", + "routing_noPathYet": "Aún no hay un camino definido. El mensaje se envía continuamente hasta que se encuentre una ruta.", + "routing_floodBroadcast": "Transmisión a través de todos los repetidores.", + "routing_editPath": "Editar ruta", + "routing_forgetPath": "Olvídate del camino", + "routing_knownPaths": "Rutas conocidas", + "routing_knownPathsHint": "Seleccione una opción para cambiar a esa.", + "routing_inUse": "En uso", + "routing_qualityStrong": "Primer salto exitoso", + "routing_qualityGood": "Primer paso exitoso", + "routing_qualityWorked": "Ha cumplido", + "routing_qualityFair": "Primer salto de calidad", + "routing_qualityFlood": "Se ha escuchado a través de rumores.", + "routing_qualityUntested": "Sin probar", + "routing_lastWorked": "trabajó {when}", + "routing_neverWorked": "nunca confirmado", + "routing_floodDelivery": "Entrega por inundación", + "pathEditor_title": "Crear ruta", + "pathEditor_hopCounter": "{count} de 64 granos de lúpulo", + "pathEditor_noHops": "Aún no se han añadido lúpulos. Haga clic en los repetidores para añadirlos en el orden deseado, o guarde la receta sin lúpulos para enviarla directamente.", + "pathEditor_addHops": "Añadir los lúpulos en el orden adecuado.", + "pathEditor_searchRepeaters": "Buscar repetidores", + "pathEditor_advancedHex": "Avanzado: ruta hexadecimal sin procesar", + "pathEditor_hexLabel": "Prefijos hexadecimales", + "pathEditor_hexHelper": "Dos caracteres hexadecimales por salto, separados por comas.", + "pathEditor_invalidTokens": "Inválido: {tokens}", + "pathEditor_tooManyHops": "Máximo 64 saltos", + "pathEditor_usePath": "Utilice esta ruta.", + "pathEditor_removeHop": "Eliminar el lúpulo", + "pathEditor_unknownHop": "Repetidor desconocido", + "map_zoomIn": "Acercar", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "map_zoomOut": "Acercar", + "map_centerMap": "Mapa del centro", + "chrome_bluetoothRequiresChromium": "Web Bluetooth requiere un navegador Chromium.", + "channels_communityShortId": "ID: {id}...", + "pathTrace_legendGpsConfirmed": "Confirmado mediante GPS", + "pathTrace_legendInferred": "Posición inferida" } diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb index 7817c20d..76d6244b 100644 --- a/lib/l10n/app_fr.arb +++ b/lib/l10n/app_fr.arb @@ -33,6 +33,8 @@ "common_remove": "Supprimer", "common_enable": "Activer", "common_disable": "Désactiver", + "common_autoRefresh": "Actualisation automatique", + "common_interval": "Intervalle", "common_reboot": "Redémarrer", "common_loading": "Chargement...", "common_notAvailable": "—", @@ -1280,6 +1282,43 @@ } } }, + "telemetry_digitalInputLabel": "Entrée numérique", + "telemetry_digitalOutputLabel": "Sortie numérique", + "telemetry_analogInputLabel": "Entrée analogique", + "telemetry_analogOutputLabel": "Sortie analogique", + "telemetry_genericLabel": "Capteur générique", + "telemetry_luminosityLabel": "Luminosité", + "telemetry_presenceLabel": "Présence", + "telemetry_humidityLabel": "Humidité", + "telemetry_accelerometerLabel": "Accéléromètre", + "telemetry_pressureLabel": "Pression", + "telemetry_altitudeLabel": "Altitude", + "telemetry_frequencyLabel": "Fréquence", + "telemetry_percentageLabel": "Pourcentage", + "telemetry_concentrationLabel": "Concentration", + "telemetry_powerLabel": "Puissance", + "telemetry_distanceLabel": "Distance", + "telemetry_energyLabel": "Énergie", + "telemetry_directionLabel": "Direction", + "telemetry_timeLabel": "Heure", + "telemetry_gyrometerLabel": "Gyromètre", + "telemetry_colourLabel": "Couleur", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Interrupteur", + "telemetry_polylineLabel": "Polyligne", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", + "telemetry_autoFetchQuantity": "Nombre de requêtes", + "telemetry_error": "Impossible de récupérer les données", "telemetry_noData": "Aucune donnée de télémétrie disponible.", "telemetry_channelTitle": "Canal {channel}", "@telemetry_channelTitle": { @@ -2099,6 +2138,9 @@ "translation_title": "Traduction", "translation_enableSubtitle": "Traduire les messages entrants et permettre la traduction avant l'envoi.", "translation_composerSubtitle": "Contrôle l'état par défaut de l'icône de traduction du composant.", + "translation_autoIncomingTitle": "Traduire automatiquement les messages", + "translation_autoIncomingSubtitle": "Traduit automatiquement les messages pour les notifications et pour les discussions ou les canaux.", + "translation_translateMessage": "Traduire le message", "translation_targetLanguage": "Langue cible", "translation_useAppLanguage": "Utiliser la langue de l'application", "translation_downloadedModelLabel": "Modèle téléchargé", @@ -2318,5 +2360,98 @@ "chat_markAsUnread": "Signaler comme non lu", "chat_newMessages": "Nouveaux messages", "settings_companionDebugLogSubtitle": "Commandes, réponses et données brutes pour les protocoles BLE/TCP/USB", - "repeater_chanUtil": "Utilisation du canal" + "repeater_chanUtil": "Utilisation du canal", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "common_undo": "Annuler", + "messageStatus_sent": "Envoyer", + "messageStatus_delivered": "Livré", + "messageStatus_pending": "Envoyer", + "messageStatus_failed": "Échec de l'envoi", + "messageStatus_repeated": "Répété plusieurs fois", + "contacts_searchOpen": "Rechercher des contacts", + "contacts_moreOptions": "Plus d'options", + "contacts_searchClose": "Recherche avancée", + "routing_title": "Planification des itinéraires", + "routing_modeAuto": "Voiture", + "routing_modeFlood": "Inondation", + "routing_modeManual": "Manuel", + "routing_modeFloodHint": "Diffusion via tous les répéteurs. La méthode la plus fiable, mais qui utilise plus de temps d'antenne.", + "routing_modeAutoHint": "Sélectionne automatiquement le chemin le plus connu, et utilise la méthode de \"inondation\" si aucun chemin n'est connu.", + "routing_modeManualHint": "Il suit toujours le chemin précis que vous avez défini.", + "routing_currentRoute": "Itinéraire actuel", + "routing_directNoHops": "Direct — sans relais", + "routing_noPathYet": "Aucune voie encore trouvée. Le message suivant est envoyé jusqu'à ce qu'une route soit découverte.", + "routing_floodBroadcast": "Diffusion via tous les répéteurs", + "routing_editPath": "Modifier le chemin", + "routing_forgetPath": "Oubliez le chemin", + "routing_knownPaths": "Chemins connus", + "routing_knownPathsHint": "Créez un raccourci pour y accéder.", + "routing_inUse": "En cours d'utilisation", + "routing_qualityStrong": "Première étape réussie", + "routing_qualityGood": "Première étape réussie", + "routing_qualityFair": "Première étape réussie", + "routing_qualityWorked": "A livré", + "routing_qualityFlood": "Rapporté par des informations provenant de plusieurs sources.", + "routing_qualityUntested": "Non testé", + "routing_lastWorked": "a travaillé {when}", + "routing_neverWorked": "jamais confirmé", + "routing_floodDelivery": "Livraison en cas de inondation", + "pathEditor_hopCounter": "{count} parmi 64 houblons", + "pathEditor_title": "Créer un chemin", + "pathEditor_noHops": "Aucun houblon ajouté pour le moment. Cliquez sur les répétiteurs ci-dessous pour les ajouter dans l'ordre souhaité, ou enregistrez sans houblon pour envoyer directement.", + "pathEditor_addHops": "Ajoutez les houblons dans l'ordre souhaité.", + "pathEditor_searchRepeaters": "Rechercher des répétiteurs", + "pathEditor_advancedHex": "Avancé : chemin hexadécimal brut", + "pathEditor_hexLabel": "Préfixes hexadécimaux", + "pathEditor_hexHelper": "Deux caractères hexadécimaux par saut, séparés par des virgules.", + "pathEditor_invalidTokens": "Incorrect : {tokens}", + "pathEditor_tooManyHops": "Maximum 64 sauts", + "pathEditor_usePath": "Utilisez ce chemin.", + "pathEditor_removeHop": "Éliminer le haricot", + "pathEditor_unknownHop": "Répéteur non identifié", + "map_zoomIn": "Zoomez", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "map_zoomOut": "Zoomez", + "map_centerMap": "Carte du centre", + "chrome_bluetoothRequiresChromium": "Web Bluetooth nécessite un navigateur Chromium.", + "channels_communityShortId": "ID : {id}…", + "pathTrace_legendGpsConfirmed": "Le GPS a confirmé.", + "pathTrace_legendInferred": "Position déduite" } diff --git a/lib/l10n/app_hu.arb b/lib/l10n/app_hu.arb index 97426183..cd5ed8c8 100644 --- a/lib/l10n/app_hu.arb +++ b/lib/l10n/app_hu.arb @@ -27,6 +27,8 @@ "common_remove": "Eltávolít", "common_enable": "Engedélyezés", "common_disable": "Leteteszt", + "common_autoRefresh": "Automatikus frissítés", + "common_interval": "Intervallum", "common_reboot": "Újraindítás", "common_loading": "Betöltés...", "common_notAvailable": "—", @@ -1466,6 +1468,43 @@ } } }, + "telemetry_digitalInputLabel": "Digitális bemenet", + "telemetry_digitalOutputLabel": "Digitális kimenet", + "telemetry_analogInputLabel": "Analóg bemenet", + "telemetry_analogOutputLabel": "Analóg kimenet", + "telemetry_genericLabel": "Általános érzékelő", + "telemetry_luminosityLabel": "Fényerő", + "telemetry_presenceLabel": "Jelenlét", + "telemetry_humidityLabel": "Páratartalom", + "telemetry_accelerometerLabel": "Gyorsulásmérő", + "telemetry_pressureLabel": "Nyomás", + "telemetry_altitudeLabel": "Magasság", + "telemetry_frequencyLabel": "Frekvencia", + "telemetry_percentageLabel": "Százalék", + "telemetry_concentrationLabel": "Koncentráció", + "telemetry_powerLabel": "Teljesítmény", + "telemetry_distanceLabel": "Távolság", + "telemetry_energyLabel": "Energia", + "telemetry_directionLabel": "Irány", + "telemetry_timeLabel": "Idő", + "telemetry_gyrometerLabel": "Giroszkóp", + "telemetry_colourLabel": "Szín", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Kapcsoló", + "telemetry_polylineLabel": "Töröttvonal", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", + "telemetry_autoFetchQuantity": "Kérések száma", + "telemetry_error": "Nem sikerült lekérni az adatokat", "telemetry_noData": "Nincsenek elérhető telemetriadatok.", "telemetry_channelTitle": "{channel} csatorna", "@telemetry_channelTitle": { @@ -2137,6 +2176,9 @@ "translation_enableSubtitle": "Fordítsa az érkező üzeneteket, és lehetővé tegye a küldés előtti fordítást.", "translation_composerTitle": "Fordítsa el, mielőtt elküldi", "translation_composerSubtitle": "Ellenőrzi a zeneszerző fordítási ikon alapértékét.", + "translation_autoIncomingTitle": "Üzenetek automatikus fordítása", + "translation_autoIncomingSubtitle": "Automatikusan lefordítja az üzeneteket az értesítésekhez, valamint a csevegésekhez vagy csatornákhoz.", + "translation_translateMessage": "Üzenet fordítása", "translation_targetLanguage": "Célnyelv", "translation_useAppLanguage": "Használja az alkalmazás nyelvének beállítását.", "translation_downloadedModelLabel": "Letöltött modell", @@ -2349,5 +2391,98 @@ "chat_newMessages": "Új üzenetek", "settings_companionDebugLog": "Párhuzamos hibakeresési napló", "settings_companionDebugLogSubtitle": "BLE/TCP/USB parancsok, válaszok és alapvető adatok", - "repeater_chanUtil": "Csatorna-használat" + "repeater_chanUtil": "Csatorna-használat", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_delivered": "Szállítva", + "common_undo": "Még egyszer", + "messageStatus_sent": "Elküldve", + "messageStatus_pending": "Elküldés", + "messageStatus_failed": "Nem sikerült elküldeni", + "messageStatus_repeated": "Ismételtem", + "contacts_moreOptions": "További lehetőségek", + "contacts_searchOpen": "Keresssz kapcsolatokat", + "contacts_searchClose": "Teljesítse a keresést", + "routing_title": "Útvonal meghatározás", + "routing_modeAuto": "Autó", + "routing_modeFlood": "Áradás", + "routing_modeManual": "Használati útmutató", + "routing_modeAutoHint": "Automatikusan kiválasztja a legismertebb útvonalat, és ha egyik sem ismert, akkor \"vízzel\" tölti ki.", + "routing_modeFloodHint": "Átvisszaadások minden erősítőn keresztül. A legmegbízhatóbb megoldás, de több időt igényel.", + "routing_modeManualHint": "Mindig pontosan az útvonalat követi, amelyet megad.", + "routing_currentRoute": "Jelenlegi útvonal", + "routing_directNoHops": "Közvetlen – nincs átjáró állomás", + "routing_noPathYet": "Még nincs útvonal. A következő üzenet a keresésig vár.", + "routing_floodBroadcast": "Azonnali továbbítás minden erősítőn keresztül.", + "routing_editPath": "Útvonal szerkesztése", + "routing_forgetPath": "Felejtsd el a útvonalat", + "routing_knownPaths": "Jellegzetes útvonalak", + "routing_knownPathsHint": "Készíts egy útvonalat, hogy átválhass rá.", + "routing_inUse": "Használatban", + "routing_qualityStrong": "Erős első lépés", + "routing_qualityGood": "Jó első lépés", + "routing_qualityFair": "Jó első lépés", + "routing_qualityWorked": "Előállított", + "routing_qualityFlood": "Információt hallottam a katasztrófa miatt.", + "routing_qualityUntested": "Vizsgálatnak nem подвержен", + "routing_neverWorked": "sosem megerősítve", + "routing_floodDelivery": "Vízparti szállítás", + "pathEditor_title": "Út megépítése", + "pathEditor_hopCounter": "{count} db 64-ből", + "pathEditor_noHops": "Még nem adtam hozzá a bazsalikomot. A lent található gombokat használhatod, hogy sorrendben adjd hozzá, vagy mentheted anélkül, hogy bazsalikomot adnál hozzá, hogy közvetlenül elküldd.", + "pathEditor_addHops": "Adja hozzá a bazsaidat a megfelelő sorrendben.", + "pathEditor_searchRepeaters": "Ismétlő eszközök keresése", + "pathEditor_advancedHex": "Haladó szint: alapvető hex-út", + "pathEditor_hexLabel": "Hex előtagok", + "pathEditor_hexHelper": "Két hatjegyű szám minden lépésen, amelyek egymástól elválasztják a kommák.", + "pathEditor_invalidTokens": "Érvénytelen: {tokens}", + "routing_lastWorked": "worked {when}", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "pathEditor_tooManyHops": "A maximális szám 64.", + "pathEditor_usePath": "Használja ezt az útvonalat.", + "pathEditor_removeHop": "Távolítsa el a bazsalikomot", + "pathEditor_unknownHop": "Tudatlan erősítő", + "map_zoomIn": "Nagyítva", + "map_zoomOut": "Kicsökkentett nézet", + "map_centerMap": "Központi tér térkép", + "chrome_bluetoothRequiresChromium": "A Web Bluetooth-hoz egy Chromium-alapú böngésző szükséges.", + "channels_communityShortId": "Az azonosító: {id}...", + "pathTrace_legendGpsConfirmed": "GPS-en megerősítve", + "pathTrace_legendInferred": "Feltehető helyzet" } diff --git a/lib/l10n/app_it.arb b/lib/l10n/app_it.arb index 664bceef..10fc16e4 100644 --- a/lib/l10n/app_it.arb +++ b/lib/l10n/app_it.arb @@ -33,6 +33,8 @@ "common_remove": "Elimina", "common_enable": "Abilita", "common_disable": "Disattivare", + "common_autoRefresh": "Aggiornamento automatico", + "common_interval": "Intervallo", "common_reboot": "Riavvia", "common_loading": "Caricamento...", "common_notAvailable": "—", @@ -1280,6 +1282,43 @@ } } }, + "telemetry_digitalInputLabel": "Ingresso digitale", + "telemetry_digitalOutputLabel": "Uscita digitale", + "telemetry_analogInputLabel": "Ingresso analogico", + "telemetry_analogOutputLabel": "Uscita analogica", + "telemetry_genericLabel": "Sensore generico", + "telemetry_luminosityLabel": "Luminosità", + "telemetry_presenceLabel": "Presenza", + "telemetry_humidityLabel": "Umidità", + "telemetry_accelerometerLabel": "Accelerometro", + "telemetry_pressureLabel": "Pressione", + "telemetry_altitudeLabel": "Altitudine", + "telemetry_frequencyLabel": "Frequenza", + "telemetry_percentageLabel": "Percentuale", + "telemetry_concentrationLabel": "Concentrazione", + "telemetry_powerLabel": "Potenza", + "telemetry_distanceLabel": "Distanza", + "telemetry_energyLabel": "Energia", + "telemetry_directionLabel": "Direzione", + "telemetry_timeLabel": "Ora", + "telemetry_gyrometerLabel": "Giroscopio", + "telemetry_colourLabel": "Colore", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Interruttore", + "telemetry_polylineLabel": "Polilinea", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", + "telemetry_autoFetchQuantity": "Numero di richieste", + "telemetry_error": "Impossibile recuperare i dati", "telemetry_noData": "Nessun dato di telemetria disponibile.", "telemetry_channelTitle": "Canale {channel}", "@telemetry_channelTitle": { @@ -2100,6 +2139,9 @@ "translation_enableTitle": "Abilitare la traduzione", "translation_title": "Traduzione", "translation_composerSubtitle": "Controlla lo stato predefinito dell'icona di traduzione del compositore.", + "translation_autoIncomingTitle": "Traduci automaticamente i messaggi", + "translation_autoIncomingSubtitle": "Traduce automaticamente i messaggi per le notifiche e per le chat o i canali.", + "translation_translateMessage": "Traduci messaggio", "translation_targetLanguage": "Lingua di destinazione", "translation_useAppLanguage": "Utilizza la lingua dell'app", "translation_downloadedModelLabel": "Modello scaricato", @@ -2311,5 +2353,98 @@ "settings_companionDebugLog": "Registro di debug per il supporto", "chat_newMessages": "Nuovi messaggi", "chat_markAsUnread": "Segna come non letto", - "repeater_chanUtil": "Utilizzo del canale" + "repeater_chanUtil": "Utilizzo del canale", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "common_undo": "Annulla", + "messageStatus_delivered": "Consegnato", + "messageStatus_sent": "Invia", + "messageStatus_pending": "Invio", + "messageStatus_failed": "Impossibile inviare", + "messageStatus_repeated": "Sentito ripetutamente", + "contacts_moreOptions": "Ulteriori opzioni", + "contacts_searchOpen": "Cerca contatti", + "contacts_searchClose": "Ricerca avanzata", + "routing_title": "Instradamento", + "routing_modeAuto": "Auto", + "routing_modeFlood": "Inondazione", + "routing_modeManual": "Manuale", + "routing_modeAutoHint": "Seleziona automaticamente il percorso più noto, e in caso di assenza di informazioni, utilizza un percorso casuale.", + "routing_modeFloodHint": "Trasmissioni tramite ogni ripetitore. Il metodo più affidabile, ma richiede più tempo di trasmissione.", + "routing_modeManualHint": "Invia sempre esattamente il percorso che hai definito.", + "routing_currentRoute": "Percorso attuale", + "routing_directNoHops": "Diretto — senza passaggi tramite ripetitori", + "routing_noPathYet": "Al momento non è stata individuata alcuna via. Il messaggio viene inviato ripetutamente finché non viene trovata una rotta.", + "routing_floodBroadcast": "Trasmissione attraverso ogni ripetitore", + "routing_editPath": "Percorso di modifica", + "routing_forgetPath": "Dimentica il percorso", + "routing_knownPaths": "Percorsi noti", + "routing_knownPathsHint": "Seleziona un percorso per accedere a questa opzione.", + "routing_inUse": "In uso", + "routing_qualityStrong": "Primo salto molto deciso", + "routing_qualityGood": "Primo tentativo di successo", + "routing_qualityFair": "Primo salto di qualità", + "routing_qualityWorked": "È stato consegnato", + "routing_qualityFlood": "Ho sentito tramite un messaggio urgente", + "routing_qualityUntested": "Non testato", + "routing_neverWorked": "mai confermato", + "routing_floodDelivery": "Consegna in caso di alluvione", + "pathEditor_title": "Creare percorso", + "pathEditor_hopCounter": "{count} tra 64 varietà di luppolo", + "pathEditor_noHops": "Al momento non ci sono ingredienti aggiuntivi. Per aggiungerli nell'ordine desiderato, cliccate sui ripetitori sottostanti. In alternativa, potete salvare la ricetta senza ingredienti aggiuntivi per inviarla direttamente.", + "pathEditor_addHops": "Aggiungere i luppoli nell'ordine desiderato.", + "pathEditor_searchRepeaters": "Ricerca ripetitori", + "pathEditor_advancedHex": "Avanzato: percorso esadecimale grezzo", + "pathEditor_hexLabel": "Prefissi esadecimali", + "pathEditor_hexHelper": "Due caratteri esadecimali per ogni salto, separati da virgole.", + "pathEditor_invalidTokens": "Non valido: {tokens}", + "routing_lastWorked": "worked {when}", + "pathEditor_tooManyHops": "Massimo 64 orari", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "pathEditor_usePath": "Utilizza questo percorso", + "pathEditor_removeHop": "Rimuovere il luppolo", + "pathEditor_unknownHop": "Ripetitore sconosciuto", + "map_zoomIn": "Ingrandisci", + "map_zoomOut": "Riduci la visualizzazione", + "map_centerMap": "Mappa del centro", + "channels_communityShortId": "ID: {id}...", + "chrome_bluetoothRequiresChromium": "Web Bluetooth richiede un browser basato su Chromium.", + "pathTrace_legendGpsConfirmed": "Il GPS conferma", + "pathTrace_legendInferred": "Posizione dedotta" } diff --git a/lib/l10n/app_ja.arb b/lib/l10n/app_ja.arb index 9d2cef21..4afea945 100644 --- a/lib/l10n/app_ja.arb +++ b/lib/l10n/app_ja.arb @@ -27,6 +27,8 @@ "common_remove": "削除", "common_enable": "有効化する", "common_disable": "無効化する", + "common_autoRefresh": "自動更新", + "common_interval": "間隔", "common_reboot": "再起動", "common_loading": "読み込み中...", "common_notAvailable": "—", @@ -214,7 +216,7 @@ "settings_txPower": "TX 信号電力 (dBm)", "settings_txPowerHelper": "0 - 22", "settings_txPowerInvalid": "無効な送信電力 (0-22 dBm)", - "settings_clientRepeat": "オフグリッド(電力網から孤立した状態)の繰り返し", + "settings_clientRepeat": "オフグリッドリピータ", "settings_clientRepeatSubtitle": "このデバイスが、他のデバイスに対してメッシュパケットを繰り返し送信できるようにする。", "settings_clientRepeatFreqWarning": "オフグリッドでの再送には、433MHz、869MHz、または918MHzの周波数が必要です。", "settings_error": "エラー:{message}", @@ -268,7 +270,7 @@ "appSettings_pathsWillBeCleared": "5回失敗した後、経路が再開されます。", "appSettings_pathsWillNotBeCleared": "パスは自動で削除されません。", "appSettings_autoRouteRotation": "自動ルートの切り替え", - "appSettings_autoRouteRotationSubtitle": "最適なルートと、洪水モードを切り替える", + "appSettings_autoRouteRotationSubtitle": "最適なルートと、フラッドモードを切り替える", "appSettings_autoRouteRotationEnabled": "自動ルートの切り替え機能が有効になっています", "appSettings_autoRouteRotationDisabled": "自動ルートの変更機能が無効になっています。", "appSettings_maxRouteWeight": "最大ルート重量", @@ -308,7 +310,7 @@ "appSettings_batteryLipo": "LiPo (3.0-4.2V)", "appSettings_mapDisplay": "地図の表示", "appSettings_showRepeaters": "繰り返し再生機能", - "appSettings_showRepeatersSubtitle": "地図上にリピーターノードを表示する", + "appSettings_showRepeatersSubtitle": "地図上にリピータノードを表示する", "appSettings_showChatNodes": "チャットノードの表示", "appSettings_showChatNodesSubtitle": "地図上にチャットノードを表示する", "appSettings_showOtherNodes": "他のノードを表示する", @@ -422,7 +424,7 @@ } } }, - "contacts_manageRepeater": "リピーターの管理", + "contacts_manageRepeater": "リピータの管理", "contacts_manageRoom": "ルームサーバーの管理", "contacts_roomLogin": "ルームサーバーへのログイン", "contacts_openChat": "自由な会話", @@ -733,7 +735,7 @@ "chat_ShowAllPaths": "すべての経路を表示", "chat_routingMode": "ルーティングモード", "chat_autoUseSavedPath": "自動 (保存されたパスを使用)", - "chat_forceFloodMode": "強制的に洪水モードを起動", + "chat_forceFloodMode": "強制的にフラッドモードを起動", "chat_recentAckPaths": "最近使用したACKパス(タップして使用):", "chat_pathHistoryFull": "パスの履歴は完全です。エントリを削除して、新しいものを追加できます。", "chat_hopSingular": "ジャンプ", @@ -756,7 +758,7 @@ "chat_clearPathSubtitle": "次回送信時に、以前の情報を再取得する", "chat_pathCleared": "経路が確保されました。次のメッセージでルートを再確認します。", "chat_floodModeSubtitle": "アプリのバーにあるルーティング切り替え機能を使用する", - "chat_floodModeEnabled": "洪水モードが有効になっています。アプリのメニューバーにあるルートアイコンを使用して、モードを切り替えることができます。", + "chat_floodModeEnabled": "フラッドモードが有効になっています。アプリのメニューバーにあるルートアイコンを使用して、モードを切り替えることができます。", "chat_fullPath": "フルパス", "chat_pathDetailsNotAvailable": "経路の詳細については、まだ情報がありません。「リフレッシュ」ボタンを押して、再度お試しください。", "chat_pathSetHops": "Path set: {hopCount} {hopCount, plural, =1{hop} other{hops}} - {status}", @@ -777,7 +779,7 @@ "chat_path": "道", "chat_publicKey": "公開鍵", "chat_compressOutgoingMessages": "送信されるメッセージを圧縮する", - "chat_floodForced": "洪水(強制的な)", + "chat_floodForced": "フラッド(強制的な)", "chat_directForced": "直接的な(強制的な)", "chat_hopsForced": "{count} 本のホップ(強制的に採取)", "@chat_hopsForced": { @@ -787,7 +789,7 @@ } } }, - "chat_floodAuto": "洪水 (自動)", + "chat_floodAuto": "フラッド (自動)", "chat_direct": "直接", "chat_poiShared": "共有されたPOI", "chat_unread": "未読: {count}", @@ -832,7 +834,7 @@ } }, "map_chat": "チャット", - "map_repeater": "繰り返し送信装置", + "map_repeater": "リピータ", "map_room": "部屋", "map_sensor": "センサー", "map_pinDm": "ピン(DM)", @@ -864,7 +866,7 @@ "map_filterNodes": "フィルタノード", "map_nodeTypes": "ノードの種類", "map_chatNodes": "チャットノード", - "map_repeaters": "繰り返し送信装置", + "map_repeaters": "リピータ", "map_otherNodes": "その他のノード", "map_keyPrefix": "主要なプレフィックス", "map_filterByKeyPrefix": "主要なプレフィックスでフィルタリングする", @@ -877,7 +879,7 @@ "map_lastSeenTime": "最後に確認された時間", "map_sharedPin": "共有パスワード", "map_joinRoom": "部屋に参加する", - "map_manageRepeater": "リピーターの管理", + "map_manageRepeater": "リピータの管理", "map_tapToAdd": "ノードをクリックして、パスに追加します。", "map_runTrace": "パスの追跡を実行", "map_removeLast": "最後のものを削除", @@ -1010,12 +1012,12 @@ "login_enterPassword": "パスワードを入力してください", "login_savePassword": "パスワードを保存する", "login_savePasswordSubtitle": "パスワードは、このデバイスに安全に保存されます。", - "login_repeaterDescription": "設定やステータスにアクセスするために、リピーターのパスワードを入力してください。", + "login_repeaterDescription": "設定やステータスにアクセスするために、リピータのパスワードを入力してください。", "login_roomDescription": "設定やステータスへのアクセスには、部屋のパスワードを入力してください。", "login_routing": "経路設定", "login_routingMode": "ルーティングモード", "login_autoUseSavedPath": "自動 (保存されたパスを使用)", - "login_forceFloodMode": "強制的に洪水モードを起動", + "login_forceFloodMode": "強制的にフラッドモードを起動", "login_managePaths": "パスの管理", "login_login": "ログイン", "login_attempt": "試行回数:{current}/{max}", @@ -1064,7 +1066,7 @@ "path_helperMaxHops": "最大64個のホップ。各プレフィックスは2つの16進数文字(1バイト)で構成されています。", "path_selectFromContacts": "または、連絡先リストから選択してください:", "path_noRepeatersFound": "繰り返し機能やルームサーバーは見つかりませんでした。", - "path_customPathsRequire": "カスタムパスには、メッセージを中継できる中間地点が必要です。", + "path_customPathsRequire": "カスタムパスには、メッセージを中継できるリピータが必要です。", "path_invalidHexPrefixes": "無効な16進数プレフィックス: {prefixes}", "@path_invalidHexPrefixes": { "placeholders": { @@ -1075,23 +1077,23 @@ }, "path_tooLong": "経路が長すぎる。最大64回のジャンプのみ許可。", "path_setPath": "パスを設定", - "repeater_management": "リピーター管理", + "repeater_management": "リピータ管理", "room_management": "ルームサーバーの管理", "repeater_managementTools": "管理ツール", "repeater_status": "ステータス", - "repeater_statusSubtitle": "リピーターの状態、統計情報、および隣接するネットワークの情報を表示する", + "repeater_statusSubtitle": "リピータの状態、統計情報、および隣接するネットワークの情報を表示する", "repeater_telemetry": "テレメトリー", "repeater_telemetrySubtitle": "センサーおよびシステムの状態に関するテレメトリの表示", "repeater_cli": "CLI(コマンドラインインターフェース)", - "repeater_cliSubtitle": "リピーターへのコマンドを送信する", + "repeater_cliSubtitle": "リピータへのコマンドを送信する", "repeater_neighbors": "近隣住民", "repeater_neighborsSubtitle": "ゼロホップの隣接ノードを表示する。", "repeater_settings": "設定", - "repeater_settingsSubtitle": "リピーターのパラメータを設定する", + "repeater_settingsSubtitle": "リピータのパラメータを設定する", "repeater_statusTitle": "再送ステータス", "repeater_routingMode": "ルーティングモード", "repeater_autoUseSavedPath": "自動 (保存されたパスを使用)", - "repeater_forceFloodMode": "強制的に洪水モードを起動", + "repeater_forceFloodMode": "強制的にフラッドモードを起動", "repeater_pathManagement": "経路管理", "repeater_refresh": "リフレッシュ", "repeater_statusRequestTimeout": "ステータス情報の取得に失敗しました。", @@ -1136,7 +1138,7 @@ } } }, - "repeater_packetTxTotal": "合計: {total}, 洪水: {flood}, 直接: {direct}", + "repeater_packetTxTotal": "合計: {total}, フラッド: {flood}, 直接: {direct}", "@repeater_packetTxTotal": { "placeholders": { "total": { @@ -1150,7 +1152,7 @@ } } }, - "repeater_packetRxTotal": "合計: {total}, 洪水: {flood}, 直接: {direct}", + "repeater_packetRxTotal": "合計: {total}, フラッド: {flood}, 直接: {direct}", "@repeater_packetRxTotal": { "placeholders": { "total": { @@ -1183,10 +1185,10 @@ } } }, - "repeater_settingsTitle": "リピーター設定", + "repeater_settingsTitle": "リピータ設定", "repeater_basicSettings": "基本設定", - "repeater_repeaterName": "送信装置名", - "repeater_repeaterNameHelper": "このリピーターの名前", + "repeater_repeaterName": "リピータ名", + "repeater_repeaterNameHelper": "このリピータの名前", "repeater_adminPassword": "管理者パスワード", "repeater_adminPasswordHelper": "完全アクセス権のパスワード", "repeater_guestPassword": "ゲスト用のパスワード", @@ -1206,7 +1208,7 @@ "repeater_longitudeHelper": "度分表記(例:-122.4194)", "repeater_features": "特徴", "repeater_packetForwarding": "パケット転送", - "repeater_packetForwardingSubtitle": "リピーターがパケットを転送できるように設定する", + "repeater_packetForwardingSubtitle": "リピータがパケットを転送できるように設定する", "repeater_guestAccess": "ゲストへのアクセス", "repeater_guestAccessSubtitle": "ゲストへの読み取り専用アクセスを許可する", "repeater_privacyMode": "プライバシーモード", @@ -1221,7 +1223,7 @@ } } }, - "repeater_floodAdvertInterval": "洪水に関する広告の表示間隔", + "repeater_floodAdvertInterval": "フラッドに関する広告の表示間隔", "repeater_floodAdvertIntervalHours": "{hours} 時間", "@repeater_floodAdvertIntervalHours": { "placeholders": { @@ -1232,15 +1234,15 @@ }, "repeater_encryptedAdvertInterval": "暗号化された広告表示間", "repeater_dangerZone": "危険区域", - "repeater_rebootRepeater": "リピーターを再起動する", - "repeater_rebootRepeaterSubtitle": "リピーターデバイスを再起動する", - "repeater_rebootRepeaterConfirm": "本当にこのリピーターを再起動したいですか?", + "repeater_rebootRepeater": "リピータを再起動する", + "repeater_rebootRepeaterSubtitle": "リピータデバイスを再起動する", + "repeater_rebootRepeaterConfirm": "本当にこのリピータを再起動したいですか?", "repeater_regenerateIdentityKey": "IDキーの再生成", "repeater_regenerateIdentityKeySubtitle": "新しい公開鍵/秘密鍵のペアを生成する", - "repeater_regenerateIdentityKeyConfirm": "これにより、リピーターには新しい識別情報が割り当てられます。続行しますか?", + "repeater_regenerateIdentityKeyConfirm": "これにより、リピータには新しい識別情報が割り当てられます。続行しますか?", "repeater_eraseFileSystem": "ファイルシステムを削除する", - "repeater_eraseFileSystemSubtitle": "リピーターファイルシステムをフォーマットする", - "repeater_eraseFileSystemConfirm": "警告:この操作により、リピーター内のすべてのデータが消去されます。この操作は元に戻すことができません!", + "repeater_eraseFileSystemSubtitle": "リピータファイルシステムをフォーマットする", + "repeater_eraseFileSystemConfirm": "警告:この操作により、リピータ内のすべてのデータが消去されます。この操作は元に戻すことができません!", "repeater_eraseSerialOnly": "Erase機能は、シリアルコンソール経由でのみ利用可能です。", "repeater_commandSent": "送信されたコマンド: {command}", "@repeater_commandSent": { @@ -1268,7 +1270,7 @@ "repeater_refreshMultiAcks": "複数のACKをリフレッシュする", "repeater_networkHealth": "ネットワークの状態", "repeater_loopDetect": "ループ検出", - "repeater_loopDetectHelper": "ルーティングループに見えるような、洪水パケットを送信する", + "repeater_loopDetectHelper": "ルーティングループを検知する", "repeater_loopDetectOff": "オフ", "repeater_loopDetectMinimal": "最小限の", "repeater_loopDetectModerate": "適度な", @@ -1284,16 +1286,16 @@ } }, "repeater_ownerInfo": "事業者の情報", - "repeater_ownerInfoHelper": "このリピーターに関する公開メタデータ", + "repeater_ownerInfoHelper": "このリピータに関する公開メタデータ", "repeater_refreshOwnerInfo": "オペレーター情報の更新", "repeater_floodMax": "最大ホップ数", - "repeater_floodMaxHelper": "洪水パケットが移動できる最大ホップ数 (0-64)", + "repeater_floodMaxHelper": "フラッドパケットが移動できる最大ホップ数 (0-64)", "repeater_advancedSettings": "高度な", "repeater_advancedSettingsSubtitle": "経験豊富なオペレーター向けの調整ノブ", "repeater_pathHashMode": "パスハッシュモード", - "repeater_pathHashModeHelper": "このリピーターのIDをフローパス/ループ検出タグにエンコードするために使用されるバイト数。 0=1バイト (256個のID、最大64ホップ)、1=2バイト (65,000個のID、最大32ホップ)、2=3バイト (160万個のID、最大21ホップ)。 v1.13およびそれ以前のファームウェアでは、マルチバイトパスがサポートされていません。 v1.14以降のバージョンでは、一度ネットワークが起動されると、パスが一度だけ検出されます。", + "repeater_pathHashModeHelper": "このリピータのIDをフローパス/ループ検出タグにエンコードするために使用されるバイト数。 0=1バイト (256個のID、最大64ホップ)、1=2バイト (65,000個のID、最大32ホップ)、2=3バイト (160万個のID、最大21ホップ)。 v1.13およびそれ以前のファームウェアでは、マルチバイトパスがサポートされていません。 v1.14以降のバージョンでは、一度ネットワークが起動されると、パスが一度だけ検出されます。", "repeater_txDelay": "フロイド・TXでの遅延", - "repeater_txDelayHelper": "洪水時の交通量に対応するための再送信間隔を、パケットの通信時間を掛けた値(0~2、デフォルト0.5)で設定します。値を大きくすると衝突が減りますが、通信速度が遅くなります。", + "repeater_txDelayHelper": "フラッド時の交通量に対応するための再送信間隔を、パケットの通信時間を掛けた値(0~2、デフォルト0.5)で設定します。値を大きくすると衝突が減りますが、通信速度が遅くなります。", "repeater_directTxDelay": "直接的なTX遅延", "repeater_directTxDelayHelper": "直接(フラッドではない)トラフィックに対する再送信間隔を、パケットの空中時間(0~2、デフォルト0.3)の倍数として設定する。", "repeater_intThresh": "干渉閾値", @@ -1301,10 +1303,10 @@ "repeater_agcResetInterval": "AGCのリセット間隔", "repeater_agcResetIntervalHelper": "ラジオの自動ゲイン制御をリセットする頻度について:ゲインが固定状態になった場合に、回復するために、何度リセットするかを設定します。4の倍数でリセットする場合、0を設定すると、定期的なリセットは停止します。", "repeater_actionsTitle": "行動", - "repeater_sendAdvert": "洪水に関する広告を送信", - "repeater_sendAdvertSubtitle": "ネットワークを通じて、洪水に関する広告を放送する", + "repeater_sendAdvert": "フラッドに関する広告を送信", + "repeater_sendAdvertSubtitle": "ネットワークを通じて、フラッドに関する広告を放送する", "repeater_sendAdvertZeroHop": "ゼロホップ形式の広告を送信する", - "repeater_sendAdvertZeroHopSubtitle": "ワンホップでの広告放送(中継なし)", + "repeater_sendAdvertZeroHopSubtitle": "ワンホップでの広告放送(リピータなし)", "repeater_clockSync": "現在、時刻を同期する", "repeater_clockSyncSubtitle": "スマートフォンの時刻をルーターに設定する", "repeater_actionSucceeded": "{action} が成功しました", @@ -1326,7 +1328,7 @@ } } }, - "repeater_settingsSavedRebootNeeded": "設定を保存しました — リピーターを再起動して適用してください", + "repeater_settingsSavedRebootNeeded": "設定を保存しました — リピータを再起動して適用してください", "repeater_settingsPartialFailure": "設定の一部でエラーが発生しました:{failures}", "@repeater_settingsPartialFailure": { "placeholders": { @@ -1365,7 +1367,7 @@ } } }, - "repeater_cliTitle": "リピーターのコマンドラインインターフェース", + "repeater_cliTitle": "リピータのコマンドラインインターフェース", "repeater_debugNextCommand": "次のコマンドのデバッグ", "repeater_commandHelp": "コマンドヘルプ", "repeater_clearHistory": "明確な歴史", @@ -1399,14 +1401,14 @@ "repeater_cliHelpClearStats": "さまざまな統計カウンターをゼロにリセットする。", "repeater_cliHelpSetAf": "空き時間係数を設定します。", "repeater_cliHelpSetTx": "LoRaの送信電力をdBmで設定します。(設定変更後、再起動が必要です)", - "repeater_cliHelpSetRepeat": "このノードに対するリピーターの役割を有効化または無効化します。", + "repeater_cliHelpSetRepeat": "このノードに対するリピータの役割を有効化または無効化します。", "repeater_cliHelpSetAllowReadOnly": "(ルームサーバー設定)「オン」に設定した場合、空白のパスワードでのログインは可能ですが、ルームへの投稿はできません。(閲覧のみ)", - "repeater_cliHelpSetFloodMax": "インバウンドフラッパケットの最大ホップ数を設定します(最大値を超えた場合、パケットは転送されません)。", + "repeater_cliHelpSetFloodMax": "インバウンドフラッドパケットの最大ホップ数を設定します(最大値を超えた場合、パケットは転送されません)。", "repeater_cliHelpSetIntThresh": "干渉閾値を設定します(dB単位)。デフォルト値は14です。0に設定すると、チャンネル間の干渉を検出する機能を無効にします。", "repeater_cliHelpSetAgcResetInterval": "オートゲインコントローラーのリセット間隔を設定します。 0 に設定すると無効化されます。", "repeater_cliHelpSetMultiAcks": "「ダブルACK」機能の有効化または無効化を可能にします。", "repeater_cliHelpSetAdvertInterval": "ローカル(ホップなし)の広告パケットを送信する間隔を分単位で設定します。 0 に設定すると、機能を無効にします。", - "repeater_cliHelpSetFloodAdvertInterval": "洪水広告の送信間隔を時間単位で設定します。0に設定すると、送信を停止します。", + "repeater_cliHelpSetFloodAdvertInterval": "フラッド広告の送信間隔を時間単位で設定します。0に設定すると、送信を停止します。", "repeater_cliHelpSetGuestPassword": "ゲストのパスワードを設定/更新します。(繰り返し利用の場合、ゲストのログインは「統計情報を取得」のリクエストを送信できます)", "repeater_cliHelpSetName": "広告の名前を設定します。", "repeater_cliHelpSetLat": "広告表示の地図の緯度を設定します。(度分秒表記)", @@ -1427,14 +1429,14 @@ "repeater_cliHelpLogStart": "パケットのログ記録を開始し、ファイルシステムに保存する。", "repeater_cliHelpLogStop": "ファイルシステムへのパケットログの記録を停止する。", "repeater_cliHelpLogErase": "ファイルシステムからパケットログを削除する。", - "repeater_cliHelpNeighbors": "ゼロホップ広告を通じて受信した他のリピーターノードの一覧を表示します。各行は、IDプレフィックス(16進数)、タイムスタンプ、SNR(シグナル強度)の情報を4つ含みます。", + "repeater_cliHelpNeighbors": "ゼロホップ広告を通じて受信した他のリピータノードの一覧を表示します。各行は、IDプレフィックス(16進数)、タイムスタンプ、SNR(シグナル強度)の情報を4つ含みます。", "repeater_cliHelpNeighborRemove": "隣接リストから、最初に一致するエントリ(pubkeyプレフィックス(16進数)で特定)を削除します。", - "repeater_cliHelpRegion": "(特定のシリーズのみ)定義されたすべての地域と、現在の洪水許可状況を一覧表示します。", + "repeater_cliHelpRegion": "(特定のシリーズのみ)定義されたすべての地域と、現在のフラッド許可状況を一覧表示します。", "repeater_cliHelpRegionLoad": "注:これは特殊な複数コマンドの呼び出しです。その後の各コマンドは、地域名であり(スペースを使用して親階層を示し、少なくとも1つのスペースが必要です)、空行/コマンドで終了します。", "repeater_cliHelpRegionGet": "指定された名前のプレフィックスを持つ地域を検索します(または、グローバルな範囲の場合は「*」)。結果として、「region-name (parent-name) 'F'」と返答します。", "repeater_cliHelpRegionPut": "指定された名前で、領域の定義を追加または更新します。", "repeater_cliHelpRegionRemove": "指定された名前を持つ領域の定義を削除します。(正確に一致している必要があり、子領域は存在してはなりません)", - "repeater_cliHelpRegionAllowf": "指定された領域に対して、「洪水」アクセス許可を設定します。 (グローバル/従来のスコープには「*」を使用)", + "repeater_cliHelpRegionAllowf": "指定された領域に対して、「フラッド」アクセス許可を設定します。 (グローバル/従来のスコープには「*」を使用)", "repeater_cliHelpRegionDenyf": "指定された領域における「FLOOD」権限を削除します。(注:現時点では、グローバル/従来の範囲での使用は推奨されません!)", "repeater_cliHelpRegionHome": "現在の「ホーム」地域に返信します。(まだ適用されていない、将来利用を予定)", "repeater_cliHelpRegionHomeSet": "「ホーム」地域を設定します。", @@ -1451,7 +1453,7 @@ "repeater_settingsCategory": "設定", "repeater_bridge": "橋", "repeater_logging": "ログ記録", - "repeater_neighborsRepeaterOnly": "近隣住民(リピーターのみ)", + "repeater_neighborsRepeaterOnly": "近隣住民(リピータのみ)", "repeater_regionManagementRepeaterOnly": "地域管理(ブロードキャスト用のみ)", "repeater_regionNote": "地域レベルでの管理のため、地域定義と権限の管理を行うための機能が導入されました。", "repeater_gpsManagement": "GPS管理", @@ -1466,6 +1468,43 @@ } } }, + "telemetry_digitalInputLabel": "デジタル入力", + "telemetry_digitalOutputLabel": "デジタル出力", + "telemetry_analogInputLabel": "アナログ入力", + "telemetry_analogOutputLabel": "アナログ出力", + "telemetry_genericLabel": "汎用センサー", + "telemetry_luminosityLabel": "照度", + "telemetry_presenceLabel": "在室", + "telemetry_humidityLabel": "湿度", + "telemetry_accelerometerLabel": "加速度計", + "telemetry_pressureLabel": "気圧", + "telemetry_altitudeLabel": "高度", + "telemetry_frequencyLabel": "周波数", + "telemetry_percentageLabel": "パーセント", + "telemetry_concentrationLabel": "濃度", + "telemetry_powerLabel": "電力", + "telemetry_distanceLabel": "距離", + "telemetry_energyLabel": "エネルギー", + "telemetry_directionLabel": "方向", + "telemetry_timeLabel": "時刻", + "telemetry_gyrometerLabel": "ジャイロメーター", + "telemetry_colourLabel": "色", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "スイッチ", + "telemetry_polylineLabel": "ポリライン", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", + "telemetry_autoFetchQuantity": "リクエスト数", + "telemetry_error": "データを取得できません", "telemetry_noData": "テレメトリデータは利用できません。", "telemetry_channelTitle": "チャンネル {channel}", "@telemetry_channelTitle": { @@ -1528,7 +1567,7 @@ } } }, - "neighbors_repeatersNeighbors": "繰り返し送信する、近隣", + "neighbors_repeatersNeighbors": "近隣のリピータ", "neighbors_noData": "近隣のデータは利用できません。", "neighbors_unknownContact": "不明な {pubkey}", "@neighbors_unknownContact": { @@ -1549,12 +1588,12 @@ "channelPath_title": "パケットパス", "channelPath_viewMap": "地図を表示する", "channelPath_otherObservedPaths": "観察されたその他の経路", - "channelPath_repeaterHops": "ホップの繰り返し", + "channelPath_repeaterHops": "リピータホップ", "channelPath_noHopDetails": "このパッケージに関する詳細な情報は提供されていません。", "channelPath_messageDetails": "メッセージの詳細", "channelPath_senderLabel": "送信者", "channelPath_timeLabel": "時間", - "channelPath_repeatsLabel": "繰り返し", + "channelPath_repeatsLabel": "リピータ", "channelPath_pathLabel": "{index} 番目の経路", "channelPath_observedLabel": "観察", "channelPath_observedPathTitle": "観察された経路 {index} • {hops}", @@ -1592,7 +1631,7 @@ } }, "channelPath_unknownPath": "不明", - "channelPath_floodPath": "洪水", + "channelPath_floodPath": "フラッド", "channelPath_directPath": "直接", "channelPath_observedZeroOf": "{total}個のホップ", "@channelPath_observedZeroOf": { @@ -1614,7 +1653,7 @@ } }, "channelPath_mapTitle": "経路図", - "channelPath_noRepeaterLocations": "この経路には、中継装置の設置場所がありません。", + "channelPath_noRepeaterLocations": "この経路にリピータの位置情報はありません。", "channelPath_primaryPath": "{index}番目の経路(主要経路)", "@channelPath_primaryPath": { "placeholders": { @@ -1792,7 +1831,7 @@ "listFilter_addToFavorites": "お気に入りに追加", "listFilter_removeFromFavorites": "お気に入りから削除", "listFilter_users": "利用者", - "listFilter_repeaters": "繰り返し送信装置", + "listFilter_repeaters": "リピータ", "listFilter_roomServers": "ルーム用サーバー", "listFilter_unreadOnly": "未読のみ", "listFilter_newGroup": "新しいグループ", @@ -1937,8 +1976,8 @@ }, "contacts_pathTrace": "経路追跡", "contacts_ping": "パング", - "contacts_repeaterPathTrace": "リピーターまでの経路を追跡する", - "contacts_repeaterPing": "PING 繰り返し", + "contacts_repeaterPathTrace": "リピータまでの経路を追跡する", + "contacts_repeaterPing": "リピータにPING", "contacts_roomPathTrace": "部屋のサーバーへの経路を追跡する", "contacts_roomPing": "ピンルーム用サーバー", "contacts_chatTraceRoute": "経路の追跡ルート", @@ -1955,7 +1994,7 @@ "contacts_contactImported": "連絡先が登録されました。", "contacts_contactImportFailed": "連絡先のインポートに失敗しました。", "contacts_zeroHopAdvert": "ゼロホップ広告", - "contacts_floodAdvert": "洪水に関する広告", + "contacts_floodAdvert": "フラッドに関する広告", "contacts_copyAdvertToClipboard": "広告をクリップボードにコピー", "contacts_addContactFromClipboard": "クリップボードから連絡先を追加する", "contacts_ShareContact": "連絡先をクリップボードにコピー", @@ -1998,7 +2037,7 @@ } }, "notification_receivedNewMessage": "新しいメッセージを受信", - "settings_gpxExportRepeaters": "GPX へのエクスポート用リピーター/ルームサーバー", + "settings_gpxExportRepeaters": "GPX へのエクスポート用リピータ/ルームサーバー", "settings_gpxExportRepeatersSubtitle": "GPXファイルに場所情報を付加した、レピーター/ルームサーバーのエクスポート", "settings_gpxExportContacts": "GPX 形式へのエクスポート", "settings_gpxExportContactsSubtitle": "GPXファイルに位置情報を保存して、他の人と共有する。", @@ -2008,20 +2047,20 @@ "settings_gpxExportNoContacts": "エクスポートする連絡先は存在しません。", "settings_gpxExportNotAvailable": "このデバイス/OSではサポートされていません", "settings_gpxExportError": "エクスポート時にエラーが発生しました。", - "settings_gpxExportRepeatersRoom": "中継装置およびルームサーバーの設置場所", + "settings_gpxExportRepeatersRoom": "リピータ/ルームサーバーの位置情報", "settings_gpxExportChat": "関連施設", "settings_gpxExportAllContacts": "すべての連絡先場所", "settings_gpxExportShareText": "meshcore-openからエクスポートされた地図データ", "settings_gpxExportShareSubject": "meshcore-open GPX形式の地図データのエクスポート", - "snrIndicator_nearByRepeaters": "近くの電波中継局", + "snrIndicator_nearByRepeaters": "近くのリピータ", "snrIndicator_lastSeen": "最後に確認された場所", "contactsSettings_title": "連絡先設定", "contactsSettings_autoAddTitle": "自動検出", "contactsSettings_otherTitle": "その他の連絡に関する設定", "contactsSettings_autoAddUsersTitle": "自動でユーザーを追加する", "contactsSettings_autoAddUsersSubtitle": "利用者が自動的に発見したユーザーを追加できるようにする。", - "contactsSettings_autoAddRepeatersTitle": "自動で繰り返し設定", - "contactsSettings_autoAddRepeatersSubtitle": "発見した中継局を、自動的に追加できるようにする。", + "contactsSettings_autoAddRepeatersTitle": "リピータを自動追加", + "contactsSettings_autoAddRepeatersSubtitle": "発見したリピータを、自動的に追加できるようにする。", "contactsSettings_autoAddRoomServersTitle": "自動でルームサーバーを追加", "contactsSettings_autoAddRoomServersSubtitle": "利用者が、発見した部屋のサーバーを自動的に追加できるようにする。", "contactsSettings_autoAddSensorsTitle": "自動でセンサーを追加", @@ -2123,7 +2162,7 @@ "contact_teleLocSubtitle": "位置情報共有を許可する", "contact_teleEnv": "テレメトリ環境", "contact_teleEnvSubtitle": "環境センサーのデータを共有することを許可する", - "map_showOverlaps": "リピーターキーの重複", + "map_showOverlaps": "リピータキーの重複", "map_runTraceWithReturnPath": "元の経路に戻る。", "@translation_downloadFailed": { "placeholders": { @@ -2137,6 +2176,9 @@ "translation_composerTitle": "送信する前に翻訳する", "translation_enableTitle": "翻訳機能を有効にする", "translation_composerSubtitle": "作曲家翻訳アイコンのデフォルト状態を制御する。", + "translation_autoIncomingTitle": "メッセージを自動翻訳", + "translation_autoIncomingSubtitle": "通知やチャット、チャンネルのメッセージを自動的に翻訳します。", + "translation_translateMessage": "メッセージを翻訳", "translation_targetLanguage": "翻訳対象言語", "translation_useAppLanguage": "アプリの言語設定", "translation_downloadedModelLabel": "ダウンロードしたモデル", @@ -2190,7 +2232,7 @@ "repeater_clockSyncAfterLoginSubtitle": "ログインが成功した場合、自動的に「時刻同期」を送信する。", "room_guest": "ルームサーバーに関する情報", "chat_sendMessage": "メッセージを送信する", - "repeater_guest": "繰り返し送信に関する情報", + "repeater_guest": "リピータに関する情報", "repeater_guestTools": "ゲスト向けツール", "repeater_getCategory": "価値を取得する", "repeater_powerMgmt": "電力管理", @@ -2201,7 +2243,7 @@ "repeater_cliHelpStartOta": "サポートされているボードに対して、無線でファームウェアのアップデートを開始します。", "repeater_cliHelpTime": "デバイスのクロックを、指定されたUnixエポックの秒数に設定します。クロックは逆方向に進むことはできません。", "repeater_cliHelpBoard": "製造元の名前/ハードウェア識別子を表示します。", - "repeater_cliHelpDiscoverNeighbors": "近隣のノードに対して、ノードの探索リクエストを送信します。(中継機能のみ)", + "repeater_cliHelpDiscoverNeighbors": "近隣のノードに対して、ノードの探索リクエストを送信します。(リピータ機能のみ)", "repeater_cliHelpPowersaving": "省電力モードがオンになっているかどうかを表示します。", "repeater_cliHelpPowersavingOnOff": "省電力モード(対応している場合)を有効または無効にします。", "repeater_cliHelpErase": "(シリアルモードのみ)デバイスのファイルシステムをフォーマットします。すべての設定と連絡先を消去します。", @@ -2214,10 +2256,10 @@ "repeater_cliHelpSetFreq": "(シリアル設定のみ)特定の周波数のみを素早く設定できます。再起動が必要です。「ラジオ設定」を使用すると、ラジオのすべてのパラメータを設定できます。", "repeater_cliHelpSetBridgeChannel": "(ESPNowブリッジのみ)ブリッジで使用するWi-Fiチャンネル(1~14)を設定します。", "repeater_cliHelpGetName": "設定されたノードの名前を表示します。", - "repeater_cliHelpGetRole": "ファームウェアの役割(リピーター、ルームサーバーなど)を表示します。", + "repeater_cliHelpGetRole": "ファームウェアの役割(リピータ、ルームサーバーなど)を表示します。", "repeater_cliHelpGetPublicKey": "デバイスの公開鍵を表示します。", "repeater_cliHelpGetPrvKey": "(シリアル番号のみ)デバイスのプライベートキーを表示します。機密情報として扱ってください。", - "repeater_cliHelpGetRepeat": "パケット転送(リピーター機能)が有効になっているかどうかを表示します。", + "repeater_cliHelpGetRepeat": "パケット転送(リピータ機能)が有効になっているかどうかを表示します。", "repeater_cliHelpGetTx": "現在のTX(送信)電力のdBm値を表示します。", "repeater_cliHelpGetFreq": "設定された無線周波数をMHzで表示します。", "repeater_cliHelpGetRadio": "以下のすべての無線パラメータを表示: 周波数、帯域幅、スプレッドファクター、符号化レート。", @@ -2229,18 +2271,18 @@ "repeater_cliHelpGetMultiAcks": "ダブルACKモードが有効 (1) か無効 (0) かを示す。", "repeater_cliHelpGetAllowReadOnly": "ゲストによる読み取り専用アクセスが許可されているかどうかを示す。", "repeater_cliHelpGetAdvertInterval": "ローカル広告の時間を分単位で表示します。", - "repeater_cliHelpGetFloodAdvertInterval": "洪水に関する広告の放送時間を時間単位で表示します。", + "repeater_cliHelpGetFloodAdvertInterval": "フラッドに関する広告の放送時間を時間単位で表示します。", "repeater_cliHelpGetGuestPassword": "設定されたゲストパスワードを表示します。", "repeater_cliHelpGetLat": "設定された緯度を表示します。", "repeater_cliHelpGetLon": "設定された経度を表示します。", "repeater_cliHelpGetRxDelay": "rxdelay の基本値を表示します。", - "repeater_cliHelpGetTxDelay": "洪水モードにおける送信遅延の要因を示します。", + "repeater_cliHelpGetTxDelay": "フラッドモードにおける送信遅延の要因を示します。", "repeater_cliHelpGetDirectTxDelay": "ダイレクトモードの遅延要素を示します。", - "repeater_cliHelpGetFloodMax": "最大浸水範囲の回数を表示します。", + "repeater_cliHelpGetFloodMax": "フラッドパケットの最大ホップ数を表示します。", "repeater_cliHelpGetOwnerInfo": "所有者の連絡先情報を表示します。", "repeater_cliHelpGetPathHashMode": "パスハッシュモード(0/1/2)を表示します。", "repeater_cliHelpGetLoopDetect": "ループ検出の感度を示す。", - "repeater_cliHelpGetAcl": "(シリアルのみ)リピーター上のアクセス制御設定を一覧表示します。", + "repeater_cliHelpGetAcl": "(シリアルのみ)リピータ上のアクセス制御設定を一覧表示します。", "repeater_cliHelpGetBridgeEnabled": "橋が有効になっているかどうかを表示します。", "repeater_cliHelpGetBridgeDelay": "橋の遅延時間をミリ秒(ms)で表示します。", "repeater_cliHelpGetBridgeSource": "RX または TX パケットを橋渡ししているかどうかを示す。", @@ -2258,8 +2300,8 @@ "repeater_cliHelpSensorList": "カスタムセンサーの設定をすべてリスト表示し、オプションで指定できる開始インデックスからページ分割して表示します。", "repeater_cliHelpRegionDefault": "現在のデフォルトの地域範囲を表示します。", "repeater_cliHelpRegionDefaultSet": "デフォルトの地域範囲を設定します。「」を使用すると、設定をリセットできます。", - "repeater_cliHelpRegionListAllowed": "洪水時の通行が許可されている地域の一覧", - "repeater_cliHelpRegionListDenied": "洪水による交通を遮断している地域の一覧", + "repeater_cliHelpRegionListAllowed": "フラッド時の通行が許可されている地域の一覧", + "repeater_cliHelpRegionListDenied": "フラッドによる交通を遮断している地域の一覧", "repeater_cliHelpStatsPackets": "(シリアルのみ)パケットレベルの統計情報を表示します。", "repeater_cliHelpStatsRadio": "(シリーズのみ)ラジオの統計情報を表示します。", "repeater_cliHelpStatsCore": "(シリアルのみ)主要なファームウェアの統計情報を表示します。", @@ -2349,5 +2391,98 @@ "settings_companionDebugLog": "同伴デバッグログ", "chat_newMessages": "新しいメッセージ", "chat_markAsUnread": "未読としてマークする", - "repeater_chanUtil": "チャンネルの利用状況" + "repeater_chanUtil": "チャンネルの利用状況", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_delivered": "配達", + "common_undo": "元に戻す", + "messageStatus_pending": "送信", + "messageStatus_sent": "送信", + "messageStatus_failed": "送信できませんでした", + "contacts_moreOptions": "さらに多くの選択肢", + "messageStatus_repeated": "何度も聞いた", + "contacts_searchOpen": "連絡先を検索する", + "contacts_searchClose": "検索を終了", + "routing_modeFlood": "洪水", + "routing_title": "経路設定", + "routing_modeAuto": "自動車", + "routing_modeManual": "マニュアル", + "routing_modeAutoHint": "最も一般的な経路を自動的に選択し、経路が不明な場合は、水没状態にします。", + "routing_modeFloodHint": "すべてのリピーターを通じて放送。最も信頼性が高いですが、より多くの時間を使用します。", + "routing_modeManualHint": "常に、あなたが設定した正確な経路を辿って移動します。", + "routing_currentRoute": "現在までのルート", + "routing_directNoHops": "直接接続—中継装置を経由しない", + "routing_noPathYet": "まだ経路は確立されていません。「次のメッセージを送信し、経路が特定されるまで待ちます」。", + "routing_floodBroadcast": "すべてのリピーターを通じて放送", + "routing_editPath": "パスの編集", + "routing_forgetPath": "道にこだわらない", + "routing_knownPaths": "既知の経路", + "routing_knownPathsHint": "そのアプリケーションに切り替えるためのショートカットを作成します。", + "routing_inUse": "使用中", + "routing_qualityStrong": "最初の段階で大きな成果を上げる", + "routing_qualityGood": "最初の成功", + "routing_qualityFair": "最初の試みは成功を収めた", + "routing_qualityWorked": "完了しました", + "routing_qualityFlood": "氾濫によって伝聞", + "routing_qualityUntested": "未検証", + "routing_lastWorked": "{when}に勤務", + "routing_neverWorked": "確認されていない", + "routing_floodDelivery": "洪水による配送", + "pathEditor_title": "経路の作成", + "pathEditor_hopCounter": "64個のホップのうち、{count}個", + "pathEditor_noHops": "まだホップは追加されていません。ホップを順番に追加するには、以下の「タップ」ボタンをクリックしてください。または、ホップを一切追加せずに直接送信するには、「保存」ボタンをクリックしてください。", + "pathEditor_addHops": "ホップを、指定された順番に加える", + "pathEditor_searchRepeaters": "繰り返し検索", + "pathEditor_advancedHex": "高度なレベル:生のヘックスパス", + "pathEditor_hexLabel": "ヘックスプレフィックス", + "pathEditor_hexHelper": "各ホップごとに2つのハッシュ文字を、カンマで区切って記述", + "pathEditor_invalidTokens": "無効: {tokens}", + "pathEditor_tooManyHops": "最大64段階", + "pathEditor_usePath": "この経路を使用してください", + "pathEditor_removeHop": "ホップを取り除く", + "pathEditor_unknownHop": "不明な増幅器", + "map_zoomIn": "ズームイン", + "map_zoomOut": "ズームアウト", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "map_centerMap": "中心地図", + "chrome_bluetoothRequiresChromium": "Web Bluetooth は、Chromium ブラウザが必要です。", + "channels_communityShortId": "ID: {id}…", + "pathTrace_legendGpsConfirmed": "GPSによる確認", + "pathTrace_legendInferred": "推測される位置" } diff --git a/lib/l10n/app_ko.arb b/lib/l10n/app_ko.arb index d778429b..f6f804e4 100644 --- a/lib/l10n/app_ko.arb +++ b/lib/l10n/app_ko.arb @@ -27,6 +27,8 @@ "common_remove": "제거", "common_enable": "활성화", "common_disable": "비활성화", + "common_autoRefresh": "자동 새로고침", + "common_interval": "간격", "common_reboot": "재부팅", "common_loading": "로딩 중...", "common_notAvailable": "—", @@ -1466,6 +1468,43 @@ } } }, + "telemetry_digitalInputLabel": "디지털 입력", + "telemetry_digitalOutputLabel": "디지털 출력", + "telemetry_analogInputLabel": "아날로그 입력", + "telemetry_analogOutputLabel": "아날로그 출력", + "telemetry_genericLabel": "일반 센서", + "telemetry_luminosityLabel": "조도", + "telemetry_presenceLabel": "존재 감지", + "telemetry_humidityLabel": "습도", + "telemetry_accelerometerLabel": "가속도계", + "telemetry_pressureLabel": "압력", + "telemetry_altitudeLabel": "고도", + "telemetry_frequencyLabel": "주파수", + "telemetry_percentageLabel": "백분율", + "telemetry_concentrationLabel": "농도", + "telemetry_powerLabel": "전력", + "telemetry_distanceLabel": "거리", + "telemetry_energyLabel": "에너지", + "telemetry_directionLabel": "방향", + "telemetry_timeLabel": "시간", + "telemetry_gyrometerLabel": "자이로미터", + "telemetry_colourLabel": "색상", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "스위치", + "telemetry_polylineLabel": "폴리라인", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", + "telemetry_autoFetchQuantity": "요청 수", + "telemetry_error": "데이터를 가져올 수 없습니다", "telemetry_noData": "텔레메트리 데이터는 제공되지 않습니다.", "telemetry_channelTitle": "채널 {channel}", "@telemetry_channelTitle": { @@ -2137,6 +2176,9 @@ "translation_enableTitle": "번역 기능 활성화", "translation_composerTitle": "보내기 전에 번역", "translation_composerSubtitle": "컴포저 번역 아이콘의 기본 상태를 제어합니다.", + "translation_autoIncomingTitle": "메시지 자동 번역", + "translation_autoIncomingSubtitle": "알림과 채팅 또는 채널의 메시지를 자동으로 번역합니다.", + "translation_translateMessage": "메시지 번역", "translation_targetLanguage": "목표 언어", "translation_useAppLanguage": "앱 언어 사용", "translation_downloadedModelLabel": "다운로드한 모델", @@ -2349,5 +2391,98 @@ "chat_newMessages": "새로운 메시지", "settings_companionDebugLogSubtitle": "BLE/TCP/USB 명령어, 응답 및 원시 데이터", "chat_markAsUnread": "미리 읽지 않음으로 표시", - "repeater_chanUtil": "채널 활용도" + "repeater_chanUtil": "채널 활용도", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_pending": "발송", + "messageStatus_sent": "발송", + "messageStatus_delivered": "배송 완료", + "common_undo": "취소", + "messageStatus_failed": "발송 실패", + "messageStatus_repeated": "반복적으로 들었습니다", + "contacts_searchOpen": "연락처 검색", + "contacts_moreOptions": "더 많은 옵션", + "contacts_searchClose": "검색 닫기", + "routing_title": "라우팅", + "routing_modeAuto": "자동", + "routing_modeFlood": "홍수", + "routing_modeManual": "사용 설명서", + "routing_modeAutoHint": "가장 잘 알려진 경로를 자동으로 선택하고, 경로가 없을 경우에는 무작위로 경로를 선택합니다.", + "routing_modeFloodHint": "모든 증폭기를 통해 방송됩니다. 가장 안정적이지만, 더 많은 송출 시간을 사용합니다.", + "routing_modeManualHint": "항상 설정하신 정확한 경로를 따라 이동합니다.", + "routing_currentRoute": "현재 경로", + "routing_directNoHops": "직접 연결 – 중계 장치 사용 없이", + "routing_noPathYet": "아직 경로가 없습니다. 다음 메시지가 도착할 때까지 계속 탐색합니다.", + "routing_floodBroadcast": "모든 증폭기를 통해 방송", + "routing_editPath": "경로 편집", + "routing_forgetPath": "길을 잊어라", + "routing_knownPaths": "알려진 경로", + "routing_knownPathsHint": "해당 항목으로 전환하기 위한 경로를 선택합니다.", + "routing_inUse": "사용 중", + "routing_qualityStrong": "강력한 첫 번째 단계", + "routing_qualityGood": "좋은 첫 시작", + "routing_qualityFair": "처음 시도", + "routing_qualityWorked": "완료됨", + "routing_qualityFlood": "홍수 피해 상황을 통해 들었습니다.", + "routing_qualityUntested": "검증되지 않음", + "routing_lastWorked": "{when}에 일했습니다", + "routing_neverWorked": "확인되지 않음", + "routing_floodDelivery": "홍수 피해 지역 배송", + "pathEditor_title": "경로 만들기", + "pathEditor_hopCounter": "64개의 홉 중 {count}", + "pathEditor_noHops": "현재 홉은 추가되지 않았습니다. 아래의 탭을 사용하여 순서대로 추가하거나, 홉 없이 바로 전송하려면 \"홉 없음\"으로 저장하십시오.", + "pathEditor_addHops": "홉을 순서대로 첨가해주세요.", + "pathEditor_searchRepeaters": "반복 검색", + "pathEditor_advancedHex": "고급: 원시 헥스 경로", + "pathEditor_hexLabel": "헥스 접두사", + "pathEditor_hexHelper": "각 홉마다 2개의 6자리 숫자, 쉼표로 구분", + "pathEditor_invalidTokens": "유효하지 않음: {tokens}", + "pathEditor_tooManyHops": "최대 64개의 홉", + "pathEditor_usePath": "이 경로를 사용하세요", + "pathEditor_removeHop": "홉 제거", + "pathEditor_unknownHop": "알 수 없는 중계기", + "map_zoomIn": "줌 인", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "map_zoomOut": "줌 아웃", + "map_centerMap": "중심 지도", + "chrome_bluetoothRequiresChromium": "웹 블루투스는 크롬 브라우저가 필요합니다.", + "channels_communityShortId": "ID: {id}...", + "pathTrace_legendGpsConfirmed": "GPS 확인 완료", + "pathTrace_legendInferred": "추론된 위치" } diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 159d755c..cd19b2a7 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -298,6 +298,42 @@ abstract class AppLocalizations { /// **'Disable'** String get common_disable; + /// No description provided for @common_undo. + /// + /// In en, this message translates to: + /// **'Undo'** + String get common_undo; + + /// No description provided for @messageStatus_sent. + /// + /// In en, this message translates to: + /// **'Sent'** + String get messageStatus_sent; + + /// No description provided for @messageStatus_delivered. + /// + /// In en, this message translates to: + /// **'Delivered'** + String get messageStatus_delivered; + + /// No description provided for @messageStatus_pending. + /// + /// In en, this message translates to: + /// **'Sending'** + String get messageStatus_pending; + + /// No description provided for @messageStatus_failed. + /// + /// In en, this message translates to: + /// **'Failed to send'** + String get messageStatus_failed; + + /// No description provided for @messageStatus_repeated. + /// + /// In en, this message translates to: + /// **'Heard repeated'** + String get messageStatus_repeated; + /// No description provided for @common_reboot. /// /// In en, this message translates to: @@ -328,6 +364,18 @@ abstract class AppLocalizations { /// **'{percent}%'** String common_percentValue(int percent); + /// No description provided for @common_autoRefresh. + /// + /// In en, this message translates to: + /// **'Autorefresh'** + String get common_autoRefresh; + + /// No description provided for @common_interval. + /// + /// In en, this message translates to: + /// **'Interval'** + String get common_interval; + /// No description provided for @scanner_title. /// /// In en, this message translates to: @@ -646,6 +694,12 @@ abstract class AppLocalizations { /// **'Enable Bluetooth'** String get scanner_enableBluetooth; + /// No description provided for @scanner_bluetoothWebUnsupported. + /// + /// In en, this message translates to: + /// **'Bluetooth isn\'t available in the browser. Connect over USB instead.'** + String get scanner_bluetoothWebUnsupported; + /// No description provided for @device_quickSwitch. /// /// In en, this message translates to: @@ -1522,12 +1576,6 @@ abstract class AppLocalizations { /// **'Number of retry attempts before marking a message as failed'** String get appSettings_maxMessageRetriesSubtitle; - /// No description provided for @path_routeWeight. - /// - /// In en, this message translates to: - /// **'{weight}/{max}'** - String path_routeWeight(String weight, String max); - /// No description provided for @appSettings_battery. /// /// In en, this message translates to: @@ -1870,6 +1918,24 @@ abstract class AppLocalizations { /// **'New Group'** String get contacts_newGroup; + /// No description provided for @contacts_moreOptions. + /// + /// In en, this message translates to: + /// **'More options'** + String get contacts_moreOptions; + + /// No description provided for @contacts_searchOpen. + /// + /// In en, this message translates to: + /// **'Search contacts'** + String get contacts_searchOpen; + + /// No description provided for @contacts_searchClose. + /// + /// In en, this message translates to: + /// **'Close search'** + String get contacts_searchClose; + /// No description provided for @contacts_groupName. /// /// In en, this message translates to: @@ -2698,78 +2764,12 @@ abstract class AppLocalizations { /// **'Hex Dump:'** String get debugFrame_hexDump; - /// No description provided for @chat_pathManagement. - /// - /// In en, this message translates to: - /// **'Path Management'** - String get chat_pathManagement; - - /// No description provided for @chat_ShowAllPaths. - /// - /// In en, this message translates to: - /// **'Show all paths'** - String get chat_ShowAllPaths; - - /// No description provided for @chat_routingMode. - /// - /// In en, this message translates to: - /// **'Routing mode'** - String get chat_routingMode; - - /// No description provided for @chat_autoUseSavedPath. - /// - /// In en, this message translates to: - /// **'Auto (use saved path)'** - String get chat_autoUseSavedPath; - - /// No description provided for @chat_forceFloodMode. - /// - /// In en, this message translates to: - /// **'Force Flood Mode'** - String get chat_forceFloodMode; - - /// No description provided for @chat_recentAckPaths. - /// - /// In en, this message translates to: - /// **'Recent ACK Paths (tap to use):'** - String get chat_recentAckPaths; - - /// No description provided for @chat_pathHistoryFull. - /// - /// In en, this message translates to: - /// **'Path history is full. Remove entries to add new ones.'** - String get chat_pathHistoryFull; - - /// No description provided for @chat_hopSingular. - /// - /// In en, this message translates to: - /// **'hop'** - String get chat_hopSingular; - - /// No description provided for @chat_hopPlural. - /// - /// In en, this message translates to: - /// **'hops'** - String get chat_hopPlural; - /// No description provided for @chat_hopsCount. /// /// In en, this message translates to: /// **'{count} {count, plural, =1{hop} other{hops}}'** String chat_hopsCount(int count); - /// No description provided for @chat_successes. - /// - /// In en, this message translates to: - /// **'successes'** - String get chat_successes; - - /// No description provided for @chat_score. - /// - /// In en, this message translates to: - /// **'Score'** - String get chat_score; - /// No description provided for @chat_removePath. /// /// In en, this message translates to: @@ -2782,71 +2782,251 @@ abstract class AppLocalizations { /// **'No path history yet.\nSend a message to discover paths.'** String get chat_noPathHistoryYet; - /// No description provided for @chat_pathActions. - /// - /// In en, this message translates to: - /// **'Path Actions:'** - String get chat_pathActions; - - /// No description provided for @chat_setCustomPath. - /// - /// In en, this message translates to: - /// **'Set Custom Path'** - String get chat_setCustomPath; - - /// No description provided for @chat_setCustomPathSubtitle. - /// - /// In en, this message translates to: - /// **'Manually specify routing path'** - String get chat_setCustomPathSubtitle; - - /// No description provided for @chat_clearPath. - /// - /// In en, this message translates to: - /// **'Clear Path'** - String get chat_clearPath; - - /// No description provided for @chat_clearPathSubtitle. - /// - /// In en, this message translates to: - /// **'Force rediscovery on next send'** - String get chat_clearPathSubtitle; - /// No description provided for @chat_pathCleared. /// /// In en, this message translates to: /// **'Path cleared. Next message will rediscover route.'** String get chat_pathCleared; - /// No description provided for @chat_floodModeSubtitle. - /// - /// In en, this message translates to: - /// **'Use routing toggle in app bar'** - String get chat_floodModeSubtitle; - - /// No description provided for @chat_floodModeEnabled. - /// - /// In en, this message translates to: - /// **'Flood mode enabled. Toggle back via routing icon in app bar.'** - String get chat_floodModeEnabled; - /// No description provided for @chat_fullPath. /// /// In en, this message translates to: /// **'Full Path'** String get chat_fullPath; - /// No description provided for @chat_pathDetailsNotAvailable. + /// No description provided for @routing_title. /// /// In en, this message translates to: - /// **'Path details not available yet. Try sending a message to refresh.'** - String get chat_pathDetailsNotAvailable; + /// **'Routing'** + String get routing_title; - /// No description provided for @chat_pathSetHops. + /// No description provided for @routing_modeAuto. /// /// In en, this message translates to: - /// **'Path set: {hopCount} {hopCount, plural, =1{hop} other{hops}} - {status}'** - String chat_pathSetHops(int hopCount, String status); + /// **'Auto'** + String get routing_modeAuto; + + /// No description provided for @routing_modeFlood. + /// + /// In en, this message translates to: + /// **'Flood'** + String get routing_modeFlood; + + /// No description provided for @routing_modeManual. + /// + /// In en, this message translates to: + /// **'Manual'** + String get routing_modeManual; + + /// No description provided for @routing_modeAutoHint. + /// + /// In en, this message translates to: + /// **'Picks the best known path automatically, flooding when none is known.'** + String get routing_modeAutoHint; + + /// No description provided for @routing_modeFloodHint. + /// + /// In en, this message translates to: + /// **'Broadcasts through every repeater. Most reliable, but uses more airtime.'** + String get routing_modeFloodHint; + + /// No description provided for @routing_modeManualHint. + /// + /// In en, this message translates to: + /// **'Always sends along the exact path you set.'** + String get routing_modeManualHint; + + /// No description provided for @routing_currentRoute. + /// + /// In en, this message translates to: + /// **'Current route'** + String get routing_currentRoute; + + /// No description provided for @routing_directNoHops. + /// + /// In en, this message translates to: + /// **'Direct — no repeater hops'** + String get routing_directNoHops; + + /// No description provided for @routing_noPathYet. + /// + /// In en, this message translates to: + /// **'No path yet. The next message floods until a route is discovered.'** + String get routing_noPathYet; + + /// No description provided for @routing_floodBroadcast. + /// + /// In en, this message translates to: + /// **'Broadcast through every repeater'** + String get routing_floodBroadcast; + + /// No description provided for @routing_editPath. + /// + /// In en, this message translates to: + /// **'Edit path'** + String get routing_editPath; + + /// No description provided for @routing_forgetPath. + /// + /// In en, this message translates to: + /// **'Forget path'** + String get routing_forgetPath; + + /// No description provided for @routing_knownPaths. + /// + /// In en, this message translates to: + /// **'Known paths'** + String get routing_knownPaths; + + /// No description provided for @routing_knownPathsHint. + /// + /// In en, this message translates to: + /// **'Tap a path to switch to it.'** + String get routing_knownPathsHint; + + /// No description provided for @routing_inUse. + /// + /// In en, this message translates to: + /// **'In use'** + String get routing_inUse; + + /// No description provided for @routing_qualityStrong. + /// + /// In en, this message translates to: + /// **'Strong first hop'** + String get routing_qualityStrong; + + /// No description provided for @routing_qualityGood. + /// + /// In en, this message translates to: + /// **'Good first hop'** + String get routing_qualityGood; + + /// No description provided for @routing_qualityFair. + /// + /// In en, this message translates to: + /// **'Fair first hop'** + String get routing_qualityFair; + + /// No description provided for @routing_qualityWorked. + /// + /// In en, this message translates to: + /// **'Has delivered'** + String get routing_qualityWorked; + + /// No description provided for @routing_qualityFlood. + /// + /// In en, this message translates to: + /// **'Heard via flood'** + String get routing_qualityFlood; + + /// No description provided for @routing_qualityUntested. + /// + /// In en, this message translates to: + /// **'Untested'** + String get routing_qualityUntested; + + /// No description provided for @routing_lastWorked. + /// + /// In en, this message translates to: + /// **'worked {when}'** + String routing_lastWorked(String when); + + /// No description provided for @routing_neverWorked. + /// + /// In en, this message translates to: + /// **'never confirmed'** + String get routing_neverWorked; + + /// No description provided for @routing_deliveryCounts. + /// + /// In en, this message translates to: + /// **'{successes} delivered, {failures} failed'** + String routing_deliveryCounts(int successes, int failures); + + /// No description provided for @routing_floodDelivery. + /// + /// In en, this message translates to: + /// **'Flood delivery'** + String get routing_floodDelivery; + + /// No description provided for @pathEditor_title. + /// + /// In en, this message translates to: + /// **'Build Path'** + String get pathEditor_title; + + /// No description provided for @pathEditor_hopCounter. + /// + /// In en, this message translates to: + /// **'{count} of 64 hops'** + String pathEditor_hopCounter(int count); + + /// No description provided for @pathEditor_noHops. + /// + /// In en, this message translates to: + /// **'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'** + String get pathEditor_noHops; + + /// No description provided for @pathEditor_addHops. + /// + /// In en, this message translates to: + /// **'Add hops in order'** + String get pathEditor_addHops; + + /// No description provided for @pathEditor_searchRepeaters. + /// + /// In en, this message translates to: + /// **'Search repeaters'** + String get pathEditor_searchRepeaters; + + /// No description provided for @pathEditor_advancedHex. + /// + /// In en, this message translates to: + /// **'Advanced: raw hex path'** + String get pathEditor_advancedHex; + + /// No description provided for @pathEditor_hexLabel. + /// + /// In en, this message translates to: + /// **'Hex prefixes'** + String get pathEditor_hexLabel; + + /// No description provided for @pathEditor_hexHelper. + /// + /// In en, this message translates to: + /// **'Two hex characters per hop, separated by commas'** + String get pathEditor_hexHelper; + + /// No description provided for @pathEditor_invalidTokens. + /// + /// In en, this message translates to: + /// **'Invalid: {tokens}'** + String pathEditor_invalidTokens(String tokens); + + /// No description provided for @pathEditor_tooManyHops. + /// + /// In en, this message translates to: + /// **'Maximum 64 hops'** + String get pathEditor_tooManyHops; + + /// No description provided for @pathEditor_usePath. + /// + /// In en, this message translates to: + /// **'Use this path'** + String get pathEditor_usePath; + + /// No description provided for @pathEditor_removeHop. + /// + /// In en, this message translates to: + /// **'Remove hop'** + String get pathEditor_removeHop; + + /// No description provided for @pathEditor_unknownHop. + /// + /// In en, this message translates to: + /// **'Unknown repeater'** + String get pathEditor_unknownHop; /// No description provided for @chat_pathSavedLocally. /// @@ -2980,6 +3160,72 @@ abstract class AppLocalizations { /// **'Node Map'** String get map_title; + /// No description provided for @map_searchHint. + /// + /// In en, this message translates to: + /// **'Search node name or ID'** + String get map_searchHint; + + /// No description provided for @map_activity. + /// + /// In en, this message translates to: + /// **'Activity'** + String get map_activity; + + /// No description provided for @map_online. + /// + /// In en, this message translates to: + /// **'Online'** + String get map_online; + + /// No description provided for @map_recent. + /// + /// In en, this message translates to: + /// **'Recent'** + String get map_recent; + + /// No description provided for @map_stale. + /// + /// In en, this message translates to: + /// **'Stale'** + String get map_stale; + + /// No description provided for @map_visible. + /// + /// In en, this message translates to: + /// **'Visible'** + String get map_visible; + + /// No description provided for @map_hidden. + /// + /// In en, this message translates to: + /// **'Hidden'** + String get map_hidden; + + /// No description provided for @map_centerOnNode. + /// + /// In en, this message translates to: + /// **'Center on node'** + String get map_centerOnNode; + + /// No description provided for @map_details. + /// + /// In en, this message translates to: + /// **'Details'** + String get map_details; + + /// No description provided for @map_noGps. + /// + /// In en, this message translates to: + /// **'No GPS'** + String get map_noGps; + + /// No description provided for @map_noResults. + /// + /// In en, this message translates to: + /// **'No matching nodes'** + String get map_noResults; + /// No description provided for @map_lineOfSight. /// /// In en, this message translates to: @@ -3675,90 +3921,18 @@ abstract class AppLocalizations { /// **'Clear'** String get common_clear; - /// No description provided for @path_currentPath. - /// - /// In en, this message translates to: - /// **'Current path: {path}'** - String path_currentPath(String path); - - /// No description provided for @path_usingHopsPath. - /// - /// In en, this message translates to: - /// **'Using {count} {count, plural, =1{hop} other{hops}} path'** - String path_usingHopsPath(int count); - - /// No description provided for @path_enterCustomPath. - /// - /// In en, this message translates to: - /// **'Enter Custom Path'** - String get path_enterCustomPath; - /// No description provided for @path_currentPathLabel. /// /// In en, this message translates to: /// **'Current path'** String get path_currentPathLabel; - /// No description provided for @path_hexPrefixInstructions. - /// - /// In en, this message translates to: - /// **'Enter 2-character hex prefixes for each hop, separated by commas.'** - String get path_hexPrefixInstructions; - - /// No description provided for @path_hexPrefixExample. - /// - /// In en, this message translates to: - /// **'Example: A1,F2,3C (each node uses first byte of its public key)'** - String get path_hexPrefixExample; - - /// No description provided for @path_labelHexPrefixes. - /// - /// In en, this message translates to: - /// **'Path (hex prefixes)'** - String get path_labelHexPrefixes; - - /// No description provided for @path_helperMaxHops. - /// - /// In en, this message translates to: - /// **'Max 64 hops. Each prefix is 2 hex characters (1 byte)'** - String get path_helperMaxHops; - - /// No description provided for @path_selectFromContacts. - /// - /// In en, this message translates to: - /// **'Or select from contacts:'** - String get path_selectFromContacts; - /// No description provided for @path_noRepeatersFound. /// /// In en, this message translates to: /// **'No repeaters or room servers found.'** String get path_noRepeatersFound; - /// No description provided for @path_customPathsRequire. - /// - /// In en, this message translates to: - /// **'Custom paths require intermediate hops that can relay messages.'** - String get path_customPathsRequire; - - /// No description provided for @path_invalidHexPrefixes. - /// - /// In en, this message translates to: - /// **'Invalid hex prefixes: {prefixes}'** - String path_invalidHexPrefixes(String prefixes); - - /// No description provided for @path_tooLong. - /// - /// In en, this message translates to: - /// **'Path too long. Maximum 64 hops allowed.'** - String get path_tooLong; - - /// No description provided for @path_setPath. - /// - /// In en, this message translates to: - /// **'Set Path'** - String get path_setPath; - /// No description provided for @repeater_management. /// /// In en, this message translates to: @@ -3879,24 +4053,6 @@ abstract class AppLocalizations { /// **'Routing mode'** String get repeater_routingMode; - /// No description provided for @repeater_autoUseSavedPath. - /// - /// In en, this message translates to: - /// **'Auto (use saved path)'** - String get repeater_autoUseSavedPath; - - /// No description provided for @repeater_forceFloodMode. - /// - /// In en, this message translates to: - /// **'Force Flood Mode'** - String get repeater_forceFloodMode; - - /// No description provided for @repeater_pathManagement. - /// - /// In en, this message translates to: - /// **'Path management'** - String get repeater_pathManagement; - /// No description provided for @repeater_refresh. /// /// In en, this message translates to: @@ -5690,6 +5846,228 @@ abstract class AppLocalizations { /// **'{celsius}°C / {fahrenheit}°F'** String telemetry_temperatureValue(String celsius, String fahrenheit); + /// No description provided for @telemetry_digitalInputLabel. + /// + /// In en, this message translates to: + /// **'Digital Input'** + String get telemetry_digitalInputLabel; + + /// No description provided for @telemetry_digitalOutputLabel. + /// + /// In en, this message translates to: + /// **'Digital Output'** + String get telemetry_digitalOutputLabel; + + /// No description provided for @telemetry_analogInputLabel. + /// + /// In en, this message translates to: + /// **'Analog Input'** + String get telemetry_analogInputLabel; + + /// No description provided for @telemetry_analogOutputLabel. + /// + /// In en, this message translates to: + /// **'Analog Output'** + String get telemetry_analogOutputLabel; + + /// No description provided for @telemetry_genericLabel. + /// + /// In en, this message translates to: + /// **'Generic Sensor'** + String get telemetry_genericLabel; + + /// No description provided for @telemetry_luminosityLabel. + /// + /// In en, this message translates to: + /// **'Luminosity'** + String get telemetry_luminosityLabel; + + /// No description provided for @telemetry_presenceLabel. + /// + /// In en, this message translates to: + /// **'Presence'** + String get telemetry_presenceLabel; + + /// No description provided for @telemetry_humidityLabel. + /// + /// In en, this message translates to: + /// **'Humidity'** + String get telemetry_humidityLabel; + + /// No description provided for @telemetry_accelerometerLabel. + /// + /// In en, this message translates to: + /// **'Accelerometer'** + String get telemetry_accelerometerLabel; + + /// No description provided for @telemetry_pressureLabel. + /// + /// In en, this message translates to: + /// **'Pressure'** + String get telemetry_pressureLabel; + + /// No description provided for @telemetry_altitudeLabel. + /// + /// In en, this message translates to: + /// **'Altitude'** + String get telemetry_altitudeLabel; + + /// No description provided for @telemetry_frequencyLabel. + /// + /// In en, this message translates to: + /// **'Frequency'** + String get telemetry_frequencyLabel; + + /// No description provided for @telemetry_percentageLabel. + /// + /// In en, this message translates to: + /// **'Percentage'** + String get telemetry_percentageLabel; + + /// No description provided for @telemetry_concentrationLabel. + /// + /// In en, this message translates to: + /// **'Concentration'** + String get telemetry_concentrationLabel; + + /// No description provided for @telemetry_powerLabel. + /// + /// In en, this message translates to: + /// **'Power'** + String get telemetry_powerLabel; + + /// No description provided for @telemetry_distanceLabel. + /// + /// In en, this message translates to: + /// **'Distance'** + String get telemetry_distanceLabel; + + /// No description provided for @telemetry_energyLabel. + /// + /// In en, this message translates to: + /// **'Energy'** + String get telemetry_energyLabel; + + /// No description provided for @telemetry_directionLabel. + /// + /// In en, this message translates to: + /// **'Direction'** + String get telemetry_directionLabel; + + /// No description provided for @telemetry_timeLabel. + /// + /// In en, this message translates to: + /// **'Time'** + String get telemetry_timeLabel; + + /// No description provided for @telemetry_gyrometerLabel. + /// + /// In en, this message translates to: + /// **'Gyrometer'** + String get telemetry_gyrometerLabel; + + /// No description provided for @telemetry_colourLabel. + /// + /// In en, this message translates to: + /// **'Colour'** + String get telemetry_colourLabel; + + /// No description provided for @telemetry_gpsLabel. + /// + /// In en, this message translates to: + /// **'GPS'** + String get telemetry_gpsLabel; + + /// No description provided for @telemetry_switchLabel. + /// + /// In en, this message translates to: + /// **'Switch'** + String get telemetry_switchLabel; + + /// No description provided for @telemetry_polylineLabel. + /// + /// In en, this message translates to: + /// **'Polyline'** + String get telemetry_polylineLabel; + + /// No description provided for @telemetry_altitudeValue. + /// + /// In en, this message translates to: + /// **'{meters} m'** + String telemetry_altitudeValue(String meters); + + /// No description provided for @telemetry_frequencyValue. + /// + /// In en, this message translates to: + /// **'{hertz} Hz'** + String telemetry_frequencyValue(String hertz); + + /// No description provided for @telemetry_pressureValue. + /// + /// In en, this message translates to: + /// **'{hpa} hPa'** + String telemetry_pressureValue(String hpa); + + /// No description provided for @telemetry_luminosityValue. + /// + /// In en, this message translates to: + /// **'{lux} lx'** + String telemetry_luminosityValue(String lux); + + /// No description provided for @telemetry_powerValue. + /// + /// In en, this message translates to: + /// **'{watts} W'** + String telemetry_powerValue(String watts); + + /// No description provided for @telemetry_distanceValue. + /// + /// In en, this message translates to: + /// **'{meters} m'** + String telemetry_distanceValue(String meters); + + /// No description provided for @telemetry_energyValue. + /// + /// In en, this message translates to: + /// **'{kilowattHours} kWh'** + String telemetry_energyValue(String kilowattHours); + + /// No description provided for @telemetry_directionValue. + /// + /// In en, this message translates to: + /// **'{degrees}°'** + String telemetry_directionValue(String degrees); + + /// No description provided for @telemetry_concentrationValue. + /// + /// In en, this message translates to: + /// **'{ppm} ppm'** + String telemetry_concentrationValue(String ppm); + + /// No description provided for @telemetry_percentageValue. + /// + /// In en, this message translates to: + /// **'{percent}%'** + String telemetry_percentageValue(String percent); + + /// No description provided for @telemetry_analogValue. + /// + /// In en, this message translates to: + /// **'{value}'** + String telemetry_analogValue(String value); + + /// No description provided for @telemetry_autoFetchQuantity. + /// + /// In en, this message translates to: + /// **'Requests quantity'** + String get telemetry_autoFetchQuantity; + + /// No description provided for @telemetry_error. + /// + /// In en, this message translates to: + /// **'Unable to retrieve data'** + String get telemetry_error; + /// No description provided for @neighbors_receivedData. /// /// In en, this message translates to: @@ -7114,6 +7492,24 @@ abstract class AppLocalizations { /// **'Controls the default state of the composer translation icon.'** String get translation_composerSubtitle; + /// No description provided for @translation_autoIncomingTitle. + /// + /// In en, this message translates to: + /// **'Auto-translate incoming messages'** + String get translation_autoIncomingTitle; + + /// No description provided for @translation_autoIncomingSubtitle. + /// + /// In en, this message translates to: + /// **'Translates Messages for notification and for chat or channel automatically.'** + String get translation_autoIncomingSubtitle; + + /// No description provided for @translation_translateMessage. + /// + /// In en, this message translates to: + /// **'Translate message'** + String get translation_translateMessage; + /// No description provided for @translation_targetLanguage. /// /// In en, this message translates to: @@ -7335,6 +7731,210 @@ abstract class AppLocalizations { /// In en, this message translates to: /// **'Unknown'** String get contact_typeUnknown; + + /// No description provided for @map_zoomIn. + /// + /// In en, this message translates to: + /// **'Zoom in'** + String get map_zoomIn; + + /// No description provided for @map_zoomOut. + /// + /// In en, this message translates to: + /// **'Zoom out'** + String get map_zoomOut; + + /// No description provided for @map_centerMap. + /// + /// In en, this message translates to: + /// **'Center map'** + String get map_centerMap; + + /// No description provided for @chrome_bluetoothRequiresChromium. + /// + /// In en, this message translates to: + /// **'Web Bluetooth requires a Chromium browser'** + String get chrome_bluetoothRequiresChromium; + + /// No description provided for @channels_communityShortId. + /// + /// In en, this message translates to: + /// **'ID: {id}...'** + String channels_communityShortId(String id); + + /// No description provided for @pathTrace_legendGpsConfirmed. + /// + /// In en, this message translates to: + /// **'GPS confirmed'** + String get pathTrace_legendGpsConfirmed; + + /// No description provided for @pathTrace_legendInferred. + /// + /// In en, this message translates to: + /// **'Inferred position'** + String get pathTrace_legendInferred; + + /// No description provided for @pathMap_viewSingle. + /// + /// In en, this message translates to: + /// **'Single'** + String get pathMap_viewSingle; + + /// No description provided for @pathMap_viewCombined. + /// + /// In en, this message translates to: + /// **'Combined'** + String get pathMap_viewCombined; + + /// No description provided for @pathMap_play. + /// + /// In en, this message translates to: + /// **'Play'** + String get pathMap_play; + + /// No description provided for @pathMap_pause. + /// + /// In en, this message translates to: + /// **'Pause'** + String get pathMap_pause; + + /// No description provided for @pathMap_replay. + /// + /// In en, this message translates to: + /// **'Replay'** + String get pathMap_replay; + + /// No description provided for @pathMap_stepBack. + /// + /// In en, this message translates to: + /// **'Previous hop'** + String get pathMap_stepBack; + + /// No description provided for @pathMap_stepForward. + /// + /// In en, this message translates to: + /// **'Next hop'** + String get pathMap_stepForward; + + /// No description provided for @pathMap_animationOn. + /// + /// In en, this message translates to: + /// **'Show packet animation'** + String get pathMap_animationOn; + + /// No description provided for @pathMap_animationOff. + /// + /// In en, this message translates to: + /// **'Hide packet animation'** + String get pathMap_animationOff; + + /// No description provided for @pathMap_hopOf. + /// + /// In en, this message translates to: + /// **'Hop {current} of {total}'** + String pathMap_hopOf(int current, int total); + + /// No description provided for @pathMap_observedPaths. + /// + /// In en, this message translates to: + /// **'Observed paths: {count}'** + String pathMap_observedPaths(int count); + + /// No description provided for @pathMap_primary. + /// + /// In en, this message translates to: + /// **'Primary'** + String get pathMap_primary; + + /// No description provided for @pathMap_alternate. + /// + /// In en, this message translates to: + /// **'Alt {index}'** + String pathMap_alternate(int index); + + /// No description provided for @pathMap_hopCount. + /// + /// In en, this message translates to: + /// **'{count, plural, =1{1 hop} other{{count} hops}}'** + String pathMap_hopCount(int count); + + /// No description provided for @pathMap_gpsCount. + /// + /// In en, this message translates to: + /// **'{confirmed}/{total} GPS'** + String pathMap_gpsCount(int confirmed, int total); + + /// No description provided for @pathMap_legendShared. + /// + /// In en, this message translates to: + /// **'Shared segment'** + String get pathMap_legendShared; + + /// No description provided for @pathMap_legendEstimated. + /// + /// In en, this message translates to: + /// **'Estimated segment'** + String get pathMap_legendEstimated; + + /// No description provided for @pathMap_sharedNodeCount. + /// + /// In en, this message translates to: + /// **'Used by {count} paths'** + String pathMap_sharedNodeCount(int count); + + /// No description provided for @pathMap_partialAnimation. + /// + /// In en, this message translates to: + /// **'{count, plural, =1{1 hop has no location — the shown path is partial} other{{count} hops have no location — the shown path is partial}}'** + String pathMap_partialAnimation(int count); + + /// No description provided for @pathMap_showAllPaths. + /// + /// In en, this message translates to: + /// **'Show all'** + String get pathMap_showAllPaths; + + /// No description provided for @pathMap_hidePath. + /// + /// In en, this message translates to: + /// **'Hide path'** + String get pathMap_hidePath; + + /// No description provided for @pathMap_showPath. + /// + /// In en, this message translates to: + /// **'Show path'** + String get pathMap_showPath; + + /// No description provided for @pathMap_collapsePanel. + /// + /// In en, this message translates to: + /// **'Collapse panel'** + String get pathMap_collapsePanel; + + /// No description provided for @pathMap_expandPanel. + /// + /// In en, this message translates to: + /// **'Expand panel'** + String get pathMap_expandPanel; + + /// No description provided for @pathMap_noLocation. + /// + /// In en, this message translates to: + /// **'No location'** + String get pathMap_noLocation; + + /// No description provided for @pathMap_followPacket. + /// + /// In en, this message translates to: + /// **'Lock view to packet'** + String get pathMap_followPacket; + + /// No description provided for @pathMap_unfollowPacket. + /// + /// In en, this message translates to: + /// **'Unlock view from packet'** + String get pathMap_unfollowPacket; } class _AppLocalizationsDelegate diff --git a/lib/l10n/app_localizations_bg.dart b/lib/l10n/app_localizations_bg.dart index 409803b2..69e165ec 100644 --- a/lib/l10n/app_localizations_bg.dart +++ b/lib/l10n/app_localizations_bg.dart @@ -92,6 +92,24 @@ class AppLocalizationsBg extends AppLocalizations { @override String get common_disable => 'Деактивирай'; + @override + String get common_undo => 'Отмяни'; + + @override + String get messageStatus_sent => 'Изпратено'; + + @override + String get messageStatus_delivered => 'Доставен'; + + @override + String get messageStatus_pending => 'Изпращане'; + + @override + String get messageStatus_failed => 'Не успях да изпратя'; + + @override + String get messageStatus_repeated => 'Слушах го многократно'; + @override String get common_reboot => 'Рестартирай'; @@ -111,6 +129,12 @@ class AppLocalizationsBg extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Автоматично обновяване'; + + @override + String get common_interval => 'Интервал'; + @override String get scanner_title => 'MeshCore – Отворена версия'; @@ -294,6 +318,10 @@ class AppLocalizationsBg extends AppLocalizations { @override String get scanner_enableBluetooth => 'Активирайте Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Бързо превключване'; @@ -790,11 +818,6 @@ class AppLocalizationsBg extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Брой опити за повторно изпращане, преди съобщението да бъде маркирано като неуспешно.'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Батерия'; @@ -996,6 +1019,15 @@ class AppLocalizationsBg extends AppLocalizations { @override String get contacts_newGroup => 'Нова група'; + @override + String get contacts_moreOptions => 'Повече възможности'; + + @override + String get contacts_searchOpen => 'Търсене на контакти'; + + @override + String get contacts_searchClose => 'Затвори търсене'; + @override String get contacts_groupName => 'Група'; @@ -1476,35 +1508,6 @@ class AppLocalizationsBg extends AppLocalizations { @override String get debugFrame_hexDump => 'Хексадесетичен Dump:'; - @override - String get chat_pathManagement => 'Управление на пътища'; - - @override - String get chat_ShowAllPaths => 'Покажи всички пътища'; - - @override - String get chat_routingMode => 'Режим на маршрутизиране'; - - @override - String get chat_autoUseSavedPath => 'Автоматично (използвай запазения път)'; - - @override - String get chat_forceFloodMode => 'Принуди режим на наводняване'; - - @override - String get chat_recentAckPaths => - 'Неотдавни ACK пътища (докоснете, за да използвате):'; - - @override - String get chat_pathHistoryFull => - 'Историята на пътя е пълна. Премахнете записи, за да добавите нови.'; - - @override - String get chat_hopSingular => 'скочи'; - - @override - String get chat_hopPlural => 'скоци'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1516,12 +1519,6 @@ class AppLocalizationsBg extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'Успехи'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Премахни пътя'; @@ -1529,52 +1526,146 @@ class AppLocalizationsBg extends AppLocalizations { String get chat_noPathHistoryYet => 'Няма история на пътищата още.\nИзпратете съобщение, за да откриете пътища.'; - @override - String get chat_pathActions => 'Действия по пътя:'; - - @override - String get chat_setCustomPath => 'Задайте персонализиран път'; - - @override - String get chat_setCustomPathSubtitle => 'Ръчно укажете маршрутен път'; - - @override - String get chat_clearPath => 'Почисти Път'; - - @override - String get chat_clearPathSubtitle => - 'Принуди преоткриване при следващо изпращане'; - @override String get chat_pathCleared => 'Пътят е почистен. Следващото съобщение ще открие маршрута отново.'; - @override - String get chat_floodModeSubtitle => - 'Използвайте превключвателя за маршрутизиране в лентата на приложението.'; - - @override - String get chat_floodModeEnabled => - 'Режим на наводнение е активиран. Включете го отново чрез иконката за маршрутизиране в лентата на приложението.'; - @override String get chat_fullPath => 'Пълен път'; @override - String get chat_pathDetailsNotAvailable => - 'Детайлите за пътя все още не са налични. Опитайте да изпратите съобщение, за да освежите.'; + String get routing_title => 'Маршрутизиране'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Пътят е зададен: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Автомобил'; + + @override + String get routing_modeFlood => 'Наводнение'; + + @override + String get routing_modeManual => 'Ръководство'; + + @override + String get routing_modeAutoHint => + 'Автоматично избира най-известния път, като при липса на информация, използва стратегия за \"запълване\" на празните пространства.'; + + @override + String get routing_modeFloodHint => + 'Излъчване през всички ретранслатори. Най-надежният начин, но изисква повече време на въздуха.'; + + @override + String get routing_modeManualHint => + 'Винаги следва точно пътя, който сте определили.'; + + @override + String get routing_currentRoute => 'Текущ маршрут'; + + @override + String get routing_directNoHops => 'Директ – без превключватели'; + + @override + String get routing_noPathYet => + 'Все още няма път. Съобщението продължава да се изпраща, докато не бъде открит маршрут.'; + + @override + String get routing_floodBroadcast => 'Предаване през всички ретранслатори'; + + @override + String get routing_editPath => 'Редактиране на пътя'; + + @override + String get routing_forgetPath => 'Забравете за пътя'; + + @override + String get routing_knownPaths => 'Известни маршрути'; + + @override + String get routing_knownPathsHint => + 'Натиснете бутона, за да превключите към него.'; + + @override + String get routing_inUse => 'В експлоатация'; + + @override + String get routing_qualityStrong => 'Силен първи скок'; + + @override + String get routing_qualityGood => 'Добър първи опит'; + + @override + String get routing_qualityFair => 'Първият добър скок'; + + @override + String get routing_qualityWorked => 'Беше изпълнено/Доведено до край'; + + @override + String get routing_qualityFlood => + 'Получено чрез информация, разпространена в резултат на навод.'; + + @override + String get routing_qualityUntested => 'Не тестван'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'никога не е потвърдено'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Доставка при навод'; + + @override + String get pathEditor_title => 'Създаване на път'; + + @override + String pathEditor_hopCounter(int count) { + return '$count от 64 различни вида малц'; + } + + @override + String get pathEditor_noHops => + 'Все още няма добавени хмел. Можете да използвате бутоните по-долу, за да ги добавите по ред, или да запазите рецептата без хмел, за да я изпратите директно.'; + + @override + String get pathEditor_addHops => 'Добавете хмела в реда, в който е посочено.'; + + @override + String get pathEditor_searchRepeaters => 'Търсене на повтори'; + + @override + String get pathEditor_advancedHex => 'Разширено: необработен шестничен път'; + + @override + String get pathEditor_hexLabel => 'Префикси на шестнадесетична система'; + + @override + String get pathEditor_hexHelper => + 'Два шест-символни идентификатора на скок, разделени със запетаи'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Невалидно: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Максимум 64 крачета'; + + @override + String get pathEditor_usePath => 'Използвайте този маршрут.'; + + @override + String get pathEditor_removeHop => 'Премахнете хмела'; + + @override + String get pathEditor_unknownHop => 'Неизвестен репитер'; + @override String get chat_pathSavedLocally => 'Запазено локално. Свържете се за синхронизиране.'; @@ -1651,6 +1742,39 @@ class AppLocalizationsBg extends AppLocalizations { @override String get map_title => 'Карта на възлите'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Линия на видимост'; @@ -2044,66 +2168,13 @@ class AppLocalizationsBg extends AppLocalizations { @override String get common_clear => 'Изчисти'; - @override - String path_currentPath(String path) { - return 'Текущ път: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Използване на $count $_temp0 път'; - } - - @override - String get path_enterCustomPath => 'Въведете персонализиран път'; - @override String get path_currentPathLabel => 'Текущ път'; - @override - String get path_hexPrefixInstructions => - 'Въведете 2-символни шестнадесетични префикси за всеки хоп, разделени с кама.'; - - @override - String get path_hexPrefixExample => - 'A1,F2,3C (всяка нода използва първия байт от публичния си ключ)'; - - @override - String get path_labelHexPrefixes => 'Пътеки (шестнадесетични префикси)'; - - @override - String get path_helperMaxHops => - 'Максимум 64 скока. Всеки префикс е 2 шестнадесетични знака (1 байт).'; - - @override - String get path_selectFromContacts => 'Изберете от контакти:'; - @override String get path_noRepeatersFound => 'Няма намерени репетитори или сървъри на стаи.'; - @override - String get path_customPathsRequire => - 'Персонализираните пътища изискват междинни скокове, които могат да препращат съобщения.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Невалидни шестнадесетични префикси: $prefixes'; - } - - @override - String get path_tooLong => - 'Пътят е твърде дълъг. Максимум 64 скока са разрешени.'; - - @override - String get path_setPath => 'Задайте път'; - @override String get repeater_management => 'Управление на повторители'; @@ -2170,16 +2241,6 @@ class AppLocalizationsBg extends AppLocalizations { @override String get repeater_routingMode => 'Режим на маршрутизиране'; - @override - String get repeater_autoUseSavedPath => - 'Автоматично (използвай запазения път)'; - - @override - String get repeater_forceFloodMode => 'Принуди режим на наводняване'; - - @override - String get repeater_pathManagement => 'Управление на пътища'; - @override String get repeater_refresh => 'Презареди'; @@ -3276,6 +3337,139 @@ class AppLocalizationsBg extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Цифров вход'; + + @override + String get telemetry_digitalOutputLabel => 'Цифров изход'; + + @override + String get telemetry_analogInputLabel => 'Аналогов вход'; + + @override + String get telemetry_analogOutputLabel => 'Аналогов изход'; + + @override + String get telemetry_genericLabel => 'Общ сензор'; + + @override + String get telemetry_luminosityLabel => 'Осветеност'; + + @override + String get telemetry_presenceLabel => 'Присъствие'; + + @override + String get telemetry_humidityLabel => 'Влажност'; + + @override + String get telemetry_accelerometerLabel => 'Акселерометър'; + + @override + String get telemetry_pressureLabel => 'Налягане'; + + @override + String get telemetry_altitudeLabel => 'Надморска височина'; + + @override + String get telemetry_frequencyLabel => 'Честота'; + + @override + String get telemetry_percentageLabel => 'Процент'; + + @override + String get telemetry_concentrationLabel => 'Концентрация'; + + @override + String get telemetry_powerLabel => 'Мощност'; + + @override + String get telemetry_distanceLabel => 'Разстояние'; + + @override + String get telemetry_energyLabel => 'Енергия'; + + @override + String get telemetry_directionLabel => 'Посока'; + + @override + String get telemetry_timeLabel => 'Време'; + + @override + String get telemetry_gyrometerLabel => 'Жироскоп'; + + @override + String get telemetry_colourLabel => 'Цвят'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Превключвател'; + + @override + String get telemetry_polylineLabel => 'Полилиния'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + + @override + String get telemetry_autoFetchQuantity => 'Брой заявки'; + + @override + String get telemetry_error => 'Неуспешно получаване на данни'; + @override String get neighbors_receivedData => 'Получени данни за съседи'; @@ -4161,6 +4355,16 @@ class AppLocalizationsBg extends AppLocalizations { String get translation_composerSubtitle => 'Контролира началния статус на иконата за превод, създадена от композитора.'; + @override + String get translation_autoIncomingTitle => 'Автоматичен превод на съобщения'; + + @override + String get translation_autoIncomingSubtitle => + 'Превежда автоматично съобщенията за известия, както и за чатове или канали.'; + + @override + String get translation_translateMessage => 'Преведи съобщението'; + @override String get translation_targetLanguage => 'Целеви език'; @@ -4288,4 +4492,135 @@ class AppLocalizationsBg extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Увеличи'; + + @override + String get map_zoomOut => 'Приближете се по-малко'; + + @override + String get map_centerMap => 'Карта на центъра'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth изисква браузър, базиран на Chromium.'; + + @override + String channels_communityShortId(String id) { + return 'Идентификационен номер: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS потвърдено'; + + @override + String get pathTrace_legendInferred => 'Извлечена позиция'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index 9f06906d..0b6e5833 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -92,6 +92,24 @@ class AppLocalizationsDe extends AppLocalizations { @override String get common_disable => 'Deaktivieren'; + @override + String get common_undo => 'Rückgängig machen'; + + @override + String get messageStatus_sent => 'Gesendet'; + + @override + String get messageStatus_delivered => 'Geliefert'; + + @override + String get messageStatus_pending => 'Versenden'; + + @override + String get messageStatus_failed => 'Nicht gesendet'; + + @override + String get messageStatus_repeated => 'Wiederholt gehört'; + @override String get common_reboot => 'Neustart'; @@ -111,6 +129,12 @@ class AppLocalizationsDe extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Automatische Aktualisierung'; + + @override + String get common_interval => 'Intervall'; + @override String get scanner_title => 'MeshCore – Open-Version'; @@ -297,6 +321,10 @@ class AppLocalizationsDe extends AppLocalizations { @override String get scanner_enableBluetooth => 'Bluetooth aktivieren'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Schnelles Umschalten'; @@ -786,11 +814,6 @@ class AppLocalizationsDe extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Anzahl der Versuche, eine Nachricht erneut zu senden, bevor sie als fehlgeschlagen markiert wird.'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Akku'; @@ -992,6 +1015,15 @@ class AppLocalizationsDe extends AppLocalizations { @override String get contacts_newGroup => 'Neue Gruppe'; + @override + String get contacts_moreOptions => 'Weitere Optionen'; + + @override + String get contacts_searchOpen => 'Kontakte suchen'; + + @override + String get contacts_searchClose => 'Erweiterte Suche'; + @override String get contacts_groupName => 'Gruppenname'; @@ -1474,36 +1506,6 @@ class AppLocalizationsDe extends AppLocalizations { @override String get debugFrame_hexDump => 'Hex-Dump:'; - @override - String get chat_pathManagement => 'Pfadverwaltung'; - - @override - String get chat_ShowAllPaths => 'Alle Pfade anzeigen'; - - @override - String get chat_routingMode => 'Routenmodus'; - - @override - String get chat_autoUseSavedPath => - 'Automatisch (gespeicherten Pfad verwenden)'; - - @override - String get chat_forceFloodMode => 'Flut-Modus erzwingen'; - - @override - String get chat_recentAckPaths => - 'Aktuelle ACK-Pfade (antippen, um zu verwenden):'; - - @override - String get chat_pathHistoryFull => - 'Die Pfadhistorie ist voll. Entferne Einträge, um neue hinzuzufügen.'; - - @override - String get chat_hopSingular => 'Sprung'; - - @override - String get chat_hopPlural => 'Sprünge'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1515,12 +1517,6 @@ class AppLocalizationsDe extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'Erfolgreich'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Pfad entfernen'; @@ -1528,51 +1524,148 @@ class AppLocalizationsDe extends AppLocalizations { String get chat_noPathHistoryYet => 'Keine Pfadhistorie vorhanden.\nSende eine Nachricht, um Pfade zu entdecken.'; - @override - String get chat_pathActions => 'Pfadaktionen:'; - - @override - String get chat_setCustomPath => 'Lege benutzerdefinierten Pfad fest'; - - @override - String get chat_setCustomPathSubtitle => 'Manuellen Routenpfad festlegen'; - - @override - String get chat_clearPath => 'Pfad zurücksetzen'; - - @override - String get chat_clearPathSubtitle => - 'Setze Pfad zurück, erkenne neuen Pfad bei nächster Sendung.'; - @override String get chat_pathCleared => 'Pfad zurückgesetzt. Nächste Nachricht wird Route neu entdecken.'; - @override - String get chat_floodModeSubtitle => - 'Verwende den Routingschalter in der App-Leiste'; - - @override - String get chat_floodModeEnabled => 'Flutmodus aktiviert.'; - @override String get chat_fullPath => 'Vollständiger Pfad'; @override - String get chat_pathDetailsNotAvailable => - 'Die Pfaddetails sind noch nicht verfügbar. Versuchen Sie, eine Nachricht zu senden, um zu aktualisieren.'; + String get routing_title => 'Routenplanung'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Pfad gesetzt: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Überschwemmung'; + + @override + String get routing_modeManual => 'Handbuch'; + + @override + String get routing_modeAutoHint => + 'Wählt automatisch den bekanntesten Pfad aus und verwendet eine Flutungsmethode, wenn kein Pfad bekannt ist.'; + + @override + String get routing_modeFloodHint => + 'Übertragung über alle Repeater. Die zuverlässigste Methode, jedoch mit höherem Datenverbrauch.'; + + @override + String get routing_modeManualHint => + 'Sendet immer genau den von Ihnen festgelegten Weg.'; + + @override + String get routing_currentRoute => 'Aktuelle Route'; + + @override + String get routing_directNoHops => 'Direkt – ohne Zwischenverstärkung'; + + @override + String get routing_noPathYet => + 'Noch kein Pfad gefunden. Die Nachricht wird gesendet, bis ein Weg entdeckt wurde.'; + + @override + String get routing_floodBroadcast => 'Übertragung über jeden Repeater'; + + @override + String get routing_editPath => 'Pfad bearbeiten'; + + @override + String get routing_forgetPath => 'Vergiss den Weg'; + + @override + String get routing_knownPaths => 'Bekannte Routen'; + + @override + String get routing_knownPathsHint => + 'Wählen Sie den Pfad, um zu diesem zu wechseln.'; + + @override + String get routing_inUse => 'Im Gebrauch'; + + @override + String get routing_qualityStrong => 'Ein starker erster Sprung'; + + @override + String get routing_qualityGood => 'Ein guter erster Schritt'; + + @override + String get routing_qualityFair => 'Erster erfolgreicher Schritt'; + + @override + String get routing_qualityWorked => 'Hat erfolgreich geliefert'; + + @override + String get routing_qualityFlood => + 'Information erhalten durch Nachrichten über die Überschwemmung'; + + @override + String get routing_qualityUntested => 'Nicht getestet'; + + @override + String routing_lastWorked(String when) { + return 'war beschäftigt $when'; } + @override + String get routing_neverWorked => 'nie bestätigt'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Lieferung bei Überschwemmung'; + + @override + String get pathEditor_title => 'Pfad erstellen'; + + @override + String pathEditor_hopCounter(int count) { + return '$count von 64 Hopfengewächsen'; + } + + @override + String get pathEditor_noHops => + 'Noch keine Hopfen hinzugefügt. Klicken Sie auf die Schaltflächen unten, um sie nacheinander hinzuzufügen, oder speichern Sie die Rezepter ohne Hopfen, um sie direkt zu versenden.'; + + @override + String get pathEditor_addHops => + 'Fügen Sie die Hopfen in der richtigen Reihenfolge hinzu.'; + + @override + String get pathEditor_searchRepeaters => + 'Suche nach wiederholten Nachrichten'; + + @override + String get pathEditor_advancedHex => 'Fortgeschritten: Roh-Hex-Pfad'; + + @override + String get pathEditor_hexLabel => 'Hex-Präfixe'; + + @override + String get pathEditor_hexHelper => + 'Zwei Hexadezimalzeichen pro Sprung, getrennt durch Kommas'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Ungültig: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximal 64 Hopfengreifer'; + + @override + String get pathEditor_usePath => 'Verwenden Sie diesen Pfad.'; + + @override + String get pathEditor_removeHop => 'Hop entfernen'; + + @override + String get pathEditor_unknownHop => 'Unbekannter Repeater'; + @override String get chat_pathSavedLocally => 'Lokal Gespeichert. Bitte Verbinden zum Synchronisieren.'; @@ -1648,6 +1741,39 @@ class AppLocalizationsDe extends AppLocalizations { @override String get map_title => 'Karte'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Sichtlinie'; @@ -2043,65 +2169,13 @@ class AppLocalizationsDe extends AppLocalizations { @override String get common_clear => 'Löschen'; - @override - String path_currentPath(String path) { - return 'Aktiver Pfad: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'Hops', - one: 'Hop', - ); - return 'Verwenden Sie $count $_temp0 Pfad'; - } - - @override - String get path_enterCustomPath => 'Gebe Pfad ein'; - @override String get path_currentPathLabel => 'Aktueller Pfad'; - @override - String get path_hexPrefixInstructions => - 'Gebe für jeden Zwischen-Hop das 2-stellige Hex-Präfix ein, getrennt durch Kommas.'; - - @override - String get path_hexPrefixExample => - 'Beispiel: A1,F2,3C (jeder Knoten verwendet den ersten Byte seines öffentlichen Schlüssels)'; - - @override - String get path_labelHexPrefixes => 'Pfad (Hex-Präfixe)'; - - @override - String get path_helperMaxHops => - 'Max 64 Sprünge. Jede Präfixe ist 2 Hexadezimalzeichen (1 Byte)'; - - @override - String get path_selectFromContacts => 'Oder wähle aus Kontakten aus:'; - @override String get path_noRepeatersFound => 'Keine Repeater oder Raumserver gefunden.'; - @override - String get path_customPathsRequire => - 'Benutzerdefinierte Pfade erfordern Zwischen-Hops, die Nachrichten weiterleiten können.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Ungültige Hexadezimal-Präfixe: $prefixes'; - } - - @override - String get path_tooLong => 'Pfad zu lang. Maximal 64 Hops erlaubt.'; - - @override - String get path_setPath => 'Pfad festlegen'; - @override String get repeater_management => 'Repeater-Verwaltung'; @@ -2166,16 +2240,6 @@ class AppLocalizationsDe extends AppLocalizations { @override String get repeater_routingMode => 'Routenmodus'; - @override - String get repeater_autoUseSavedPath => - 'Automatisch (gespeicherten Pfad verwenden)'; - - @override - String get repeater_forceFloodMode => 'Flut-Modus erzwingen'; - - @override - String get repeater_pathManagement => 'Pfadverwaltung'; - @override String get repeater_refresh => 'Aktualisieren'; @@ -3282,6 +3346,139 @@ class AppLocalizationsDe extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Digitaleingang'; + + @override + String get telemetry_digitalOutputLabel => 'Digitalausgang'; + + @override + String get telemetry_analogInputLabel => 'Analogeingang'; + + @override + String get telemetry_analogOutputLabel => 'Analogausgang'; + + @override + String get telemetry_genericLabel => 'Allgemeiner Sensor'; + + @override + String get telemetry_luminosityLabel => 'Helligkeit'; + + @override + String get telemetry_presenceLabel => 'Anwesenheit'; + + @override + String get telemetry_humidityLabel => 'Luftfeuchtigkeit'; + + @override + String get telemetry_accelerometerLabel => 'Beschleunigungsmesser'; + + @override + String get telemetry_pressureLabel => 'Druck'; + + @override + String get telemetry_altitudeLabel => 'Höhe'; + + @override + String get telemetry_frequencyLabel => 'Frequenz'; + + @override + String get telemetry_percentageLabel => 'Prozentsatz'; + + @override + String get telemetry_concentrationLabel => 'Konzentration'; + + @override + String get telemetry_powerLabel => 'Leistung'; + + @override + String get telemetry_distanceLabel => 'Entfernung'; + + @override + String get telemetry_energyLabel => 'Energie'; + + @override + String get telemetry_directionLabel => 'Richtung'; + + @override + String get telemetry_timeLabel => 'Zeit'; + + @override + String get telemetry_gyrometerLabel => 'Gyroskop'; + + @override + String get telemetry_colourLabel => 'Farbe'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Schalter'; + + @override + String get telemetry_polylineLabel => 'Polylinie'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + + @override + String get telemetry_autoFetchQuantity => 'Anzahl der Anfragen'; + + @override + String get telemetry_error => 'Daten konnten nicht abgerufen werden'; + @override String get neighbors_receivedData => 'Empfangene Nachbarsdaten'; @@ -4176,6 +4373,17 @@ class AppLocalizationsDe extends AppLocalizations { String get translation_composerSubtitle => 'Steuert den Standardzustand des Icons für die Übersetzung des Komponisten.'; + @override + String get translation_autoIncomingTitle => + 'Nachrichten automatisch übersetzen'; + + @override + String get translation_autoIncomingSubtitle => + 'Übersetzt Nachrichten für Benachrichtigungen sowie für Chats oder Kanäle automatisch.'; + + @override + String get translation_translateMessage => 'Nachricht übersetzen'; + @override String get translation_targetLanguage => 'Zielsprache'; @@ -4305,4 +4513,135 @@ class AppLocalizationsDe extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Zoomen'; + + @override + String get map_zoomOut => 'Auszoomen'; + + @override + String get map_centerMap => 'Zentralkarte'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth benötigt einen Chromium-Browser.'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id…'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS-Bestätigung'; + + @override + String get pathTrace_legendInferred => 'Abgeleitete Position'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 6def06b7..39cf3727 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -92,6 +92,24 @@ class AppLocalizationsEn extends AppLocalizations { @override String get common_disable => 'Disable'; + @override + String get common_undo => 'Undo'; + + @override + String get messageStatus_sent => 'Sent'; + + @override + String get messageStatus_delivered => 'Delivered'; + + @override + String get messageStatus_pending => 'Sending'; + + @override + String get messageStatus_failed => 'Failed to send'; + + @override + String get messageStatus_repeated => 'Heard repeated'; + @override String get common_reboot => 'Reboot'; @@ -111,6 +129,12 @@ class AppLocalizationsEn extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Autorefresh'; + + @override + String get common_interval => 'Interval'; + @override String get scanner_title => 'MeshCore Open'; @@ -291,6 +315,10 @@ class AppLocalizationsEn extends AppLocalizations { @override String get scanner_enableBluetooth => 'Enable Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Quick switch'; @@ -771,11 +799,6 @@ class AppLocalizationsEn extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Number of retry attempts before marking a message as failed'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Battery'; @@ -975,6 +998,15 @@ class AppLocalizationsEn extends AppLocalizations { @override String get contacts_newGroup => 'New Group'; + @override + String get contacts_moreOptions => 'More options'; + + @override + String get contacts_searchOpen => 'Search contacts'; + + @override + String get contacts_searchClose => 'Close search'; + @override String get contacts_groupName => 'Group name'; @@ -1446,34 +1478,6 @@ class AppLocalizationsEn extends AppLocalizations { @override String get debugFrame_hexDump => 'Hex Dump:'; - @override - String get chat_pathManagement => 'Path Management'; - - @override - String get chat_ShowAllPaths => 'Show all paths'; - - @override - String get chat_routingMode => 'Routing mode'; - - @override - String get chat_autoUseSavedPath => 'Auto (use saved path)'; - - @override - String get chat_forceFloodMode => 'Force Flood Mode'; - - @override - String get chat_recentAckPaths => 'Recent ACK Paths (tap to use):'; - - @override - String get chat_pathHistoryFull => - 'Path history is full. Remove entries to add new ones.'; - - @override - String get chat_hopSingular => 'hop'; - - @override - String get chat_hopPlural => 'hops'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1485,12 +1489,6 @@ class AppLocalizationsEn extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'successes'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Remove path'; @@ -1498,50 +1496,144 @@ class AppLocalizationsEn extends AppLocalizations { String get chat_noPathHistoryYet => 'No path history yet.\nSend a message to discover paths.'; - @override - String get chat_pathActions => 'Path Actions:'; - - @override - String get chat_setCustomPath => 'Set Custom Path'; - - @override - String get chat_setCustomPathSubtitle => 'Manually specify routing path'; - - @override - String get chat_clearPath => 'Clear Path'; - - @override - String get chat_clearPathSubtitle => 'Force rediscovery on next send'; - @override String get chat_pathCleared => 'Path cleared. Next message will rediscover route.'; - @override - String get chat_floodModeSubtitle => 'Use routing toggle in app bar'; - - @override - String get chat_floodModeEnabled => - 'Flood mode enabled. Toggle back via routing icon in app bar.'; - @override String get chat_fullPath => 'Full Path'; @override - String get chat_pathDetailsNotAvailable => - 'Path details not available yet. Try sending a message to refresh.'; + String get routing_title => 'Routing'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Path set: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Flood'; + + @override + String get routing_modeManual => 'Manual'; + + @override + String get routing_modeAutoHint => + 'Picks the best known path automatically, flooding when none is known.'; + + @override + String get routing_modeFloodHint => + 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + + @override + String get routing_modeManualHint => + 'Always sends along the exact path you set.'; + + @override + String get routing_currentRoute => 'Current route'; + + @override + String get routing_directNoHops => 'Direct — no repeater hops'; + + @override + String get routing_noPathYet => + 'No path yet. The next message floods until a route is discovered.'; + + @override + String get routing_floodBroadcast => 'Broadcast through every repeater'; + + @override + String get routing_editPath => 'Edit path'; + + @override + String get routing_forgetPath => 'Forget path'; + + @override + String get routing_knownPaths => 'Known paths'; + + @override + String get routing_knownPathsHint => 'Tap a path to switch to it.'; + + @override + String get routing_inUse => 'In use'; + + @override + String get routing_qualityStrong => 'Strong first hop'; + + @override + String get routing_qualityGood => 'Good first hop'; + + @override + String get routing_qualityFair => 'Fair first hop'; + + @override + String get routing_qualityWorked => 'Has delivered'; + + @override + String get routing_qualityFlood => 'Heard via flood'; + + @override + String get routing_qualityUntested => 'Untested'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'never confirmed'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Flood delivery'; + + @override + String get pathEditor_title => 'Build Path'; + + @override + String pathEditor_hopCounter(int count) { + return '$count of 64 hops'; + } + + @override + String get pathEditor_noHops => + 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + + @override + String get pathEditor_addHops => 'Add hops in order'; + + @override + String get pathEditor_searchRepeaters => 'Search repeaters'; + + @override + String get pathEditor_advancedHex => 'Advanced: raw hex path'; + + @override + String get pathEditor_hexLabel => 'Hex prefixes'; + + @override + String get pathEditor_hexHelper => + 'Two hex characters per hop, separated by commas'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Invalid: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximum 64 hops'; + + @override + String get pathEditor_usePath => 'Use this path'; + + @override + String get pathEditor_removeHop => 'Remove hop'; + + @override + String get pathEditor_unknownHop => 'Unknown repeater'; + @override String get chat_pathSavedLocally => 'Saved locally. Connect to sync.'; @@ -1615,6 +1707,39 @@ class AppLocalizationsEn extends AppLocalizations { @override String get map_title => 'Node Map'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Line of Sight'; @@ -2003,64 +2128,12 @@ class AppLocalizationsEn extends AppLocalizations { @override String get common_clear => 'Clear'; - @override - String path_currentPath(String path) { - return 'Current path: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Using $count $_temp0 path'; - } - - @override - String get path_enterCustomPath => 'Enter Custom Path'; - @override String get path_currentPathLabel => 'Current path'; - @override - String get path_hexPrefixInstructions => - 'Enter 2-character hex prefixes for each hop, separated by commas.'; - - @override - String get path_hexPrefixExample => - 'Example: A1,F2,3C (each node uses first byte of its public key)'; - - @override - String get path_labelHexPrefixes => 'Path (hex prefixes)'; - - @override - String get path_helperMaxHops => - 'Max 64 hops. Each prefix is 2 hex characters (1 byte)'; - - @override - String get path_selectFromContacts => 'Or select from contacts:'; - @override String get path_noRepeatersFound => 'No repeaters or room servers found.'; - @override - String get path_customPathsRequire => - 'Custom paths require intermediate hops that can relay messages.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Invalid hex prefixes: $prefixes'; - } - - @override - String get path_tooLong => 'Path too long. Maximum 64 hops allowed.'; - - @override - String get path_setPath => 'Set Path'; - @override String get repeater_management => 'Repeater Management'; @@ -2124,15 +2197,6 @@ class AppLocalizationsEn extends AppLocalizations { @override String get repeater_routingMode => 'Routing mode'; - @override - String get repeater_autoUseSavedPath => 'Auto (use saved path)'; - - @override - String get repeater_forceFloodMode => 'Force Flood Mode'; - - @override - String get repeater_pathManagement => 'Path management'; - @override String get repeater_refresh => 'Refresh'; @@ -3213,6 +3277,139 @@ class AppLocalizationsEn extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Digital Input'; + + @override + String get telemetry_digitalOutputLabel => 'Digital Output'; + + @override + String get telemetry_analogInputLabel => 'Analog Input'; + + @override + String get telemetry_analogOutputLabel => 'Analog Output'; + + @override + String get telemetry_genericLabel => 'Generic Sensor'; + + @override + String get telemetry_luminosityLabel => 'Luminosity'; + + @override + String get telemetry_presenceLabel => 'Presence'; + + @override + String get telemetry_humidityLabel => 'Humidity'; + + @override + String get telemetry_accelerometerLabel => 'Accelerometer'; + + @override + String get telemetry_pressureLabel => 'Pressure'; + + @override + String get telemetry_altitudeLabel => 'Altitude'; + + @override + String get telemetry_frequencyLabel => 'Frequency'; + + @override + String get telemetry_percentageLabel => 'Percentage'; + + @override + String get telemetry_concentrationLabel => 'Concentration'; + + @override + String get telemetry_powerLabel => 'Power'; + + @override + String get telemetry_distanceLabel => 'Distance'; + + @override + String get telemetry_energyLabel => 'Energy'; + + @override + String get telemetry_directionLabel => 'Direction'; + + @override + String get telemetry_timeLabel => 'Time'; + + @override + String get telemetry_gyrometerLabel => 'Gyrometer'; + + @override + String get telemetry_colourLabel => 'Colour'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Switch'; + + @override + String get telemetry_polylineLabel => 'Polyline'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + + @override + String get telemetry_autoFetchQuantity => 'Requests quantity'; + + @override + String get telemetry_error => 'Unable to retrieve data'; + @override String get neighbors_receivedData => 'Received Neighbors Data'; @@ -4085,6 +4282,17 @@ class AppLocalizationsEn extends AppLocalizations { String get translation_composerSubtitle => 'Controls the default state of the composer translation icon.'; + @override + String get translation_autoIncomingTitle => + 'Auto-translate incoming messages'; + + @override + String get translation_autoIncomingSubtitle => + 'Translates Messages for notification and for chat or channel automatically.'; + + @override + String get translation_translateMessage => 'Translate message'; + @override String get translation_targetLanguage => 'Target language'; @@ -4210,4 +4418,135 @@ class AppLocalizationsEn extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Zoom in'; + + @override + String get map_zoomOut => 'Zoom out'; + + @override + String get map_centerMap => 'Center map'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth requires a Chromium browser'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + + @override + String get pathTrace_legendInferred => 'Inferred position'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart index bb4f40e8..ef47ff3f 100644 --- a/lib/l10n/app_localizations_es.dart +++ b/lib/l10n/app_localizations_es.dart @@ -92,6 +92,24 @@ class AppLocalizationsEs extends AppLocalizations { @override String get common_disable => 'Desactivar'; + @override + String get common_undo => 'Deshacer'; + + @override + String get messageStatus_sent => 'Sentido'; + + @override + String get messageStatus_delivered => 'Entregado'; + + @override + String get messageStatus_pending => 'Enviar'; + + @override + String get messageStatus_failed => 'No se pudo enviar'; + + @override + String get messageStatus_repeated => 'Escuché repetidamente'; + @override String get common_reboot => 'Reiniciar'; @@ -111,6 +129,12 @@ class AppLocalizationsEs extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Actualización automática'; + + @override + String get common_interval => 'Intervalo'; + @override String get scanner_title => 'MeshCore: Versión abierta'; @@ -295,6 +319,10 @@ class AppLocalizationsEs extends AppLocalizations { @override String get scanner_enableBluetooth => 'Habilitar Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Cambiar rápidamente'; @@ -785,11 +813,6 @@ class AppLocalizationsEs extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Número de intentos de reintento antes de marcar un mensaje como fallido.'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Batería'; @@ -991,6 +1014,15 @@ class AppLocalizationsEs extends AppLocalizations { @override String get contacts_newGroup => 'Nuevo Grupo'; + @override + String get contacts_moreOptions => 'Más opciones'; + + @override + String get contacts_searchOpen => 'Buscar contactos'; + + @override + String get contacts_searchClose => 'Búsqueda avanzada'; + @override String get contacts_groupName => 'Nombre del grupo'; @@ -1473,34 +1505,6 @@ class AppLocalizationsEs extends AppLocalizations { @override String get debugFrame_hexDump => 'Mapeo Hexadecimal:'; - @override - String get chat_pathManagement => 'Gestión de Rutas'; - - @override - String get chat_ShowAllPaths => 'Mostrar todos los caminos'; - - @override - String get chat_routingMode => 'Modo de enrutamiento'; - - @override - String get chat_autoUseSavedPath => 'Auto (usar la ruta guardada)'; - - @override - String get chat_forceFloodMode => 'Modo Inundación Forzado'; - - @override - String get chat_recentAckPaths => 'Rutas de ACK Recientes (tocar para usar):'; - - @override - String get chat_pathHistoryFull => - 'El historial de rutas está completo. Eliminar entradas para añadir nuevas.'; - - @override - String get chat_hopSingular => 'salta'; - - @override - String get chat_hopPlural => 'salta'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1512,12 +1516,6 @@ class AppLocalizationsEs extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'Éxitos'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Eliminar ruta'; @@ -1525,53 +1523,147 @@ class AppLocalizationsEs extends AppLocalizations { String get chat_noPathHistoryYet => 'Aún no hay historial de rutas.\nEnvía un mensaje para descubrir rutas.'; - @override - String get chat_pathActions => 'Acciones de Ruta:'; - - @override - String get chat_setCustomPath => 'Establecer Ruta Personalizada'; - - @override - String get chat_setCustomPathSubtitle => - 'Especificar manualmente la ruta de enrutamiento'; - - @override - String get chat_clearPath => 'Limpiar Ruta'; - - @override - String get chat_clearPathSubtitle => - 'Forzar redescubrimiento en el próximo envío'; - @override String get chat_pathCleared => 'Ruta eliminada. El siguiente mensaje redescubrirá la ruta.'; - @override - String get chat_floodModeSubtitle => - 'Utilizar el interruptor de enrutamiento en la barra de herramientas'; - - @override - String get chat_floodModeEnabled => - 'El modo de inundación está habilitado. Desactívalo mediante el icono de enrutamiento en la barra de herramientas de la aplicación.'; - @override String get chat_fullPath => 'Ruta completa'; @override - String get chat_pathDetailsNotAvailable => - 'Los detalles de la ruta aún no están disponibles. Intenta enviar un mensaje para refrescar.'; + String get routing_title => 'Ruteo'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Ruta establecida: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Coche'; + + @override + String get routing_modeFlood => 'Inundación'; + + @override + String get routing_modeManual => 'Manual'; + + @override + String get routing_modeAutoHint => + 'Selecciona automáticamente la ruta más conocida, y si no hay ninguna ruta conocida, utiliza la ruta más directa.'; + + @override + String get routing_modeFloodHint => + 'Transmisiones a través de todos los repetidores. Es la opción más fiable, pero utiliza más tiempo de transmisión.'; + + @override + String get routing_modeManualHint => + 'Siempre sigue exactamente la ruta que usted ha definido.'; + + @override + String get routing_currentRoute => 'Ruta actual'; + + @override + String get routing_directNoHops => 'Directo — sin saltos de repetidor'; + + @override + String get routing_noPathYet => + 'Aún no hay un camino definido. El mensaje se envía continuamente hasta que se encuentre una ruta.'; + + @override + String get routing_floodBroadcast => + 'Transmisión a través de todos los repetidores.'; + + @override + String get routing_editPath => 'Editar ruta'; + + @override + String get routing_forgetPath => 'Olvídate del camino'; + + @override + String get routing_knownPaths => 'Rutas conocidas'; + + @override + String get routing_knownPathsHint => + 'Seleccione una opción para cambiar a esa.'; + + @override + String get routing_inUse => 'En uso'; + + @override + String get routing_qualityStrong => 'Primer salto exitoso'; + + @override + String get routing_qualityGood => 'Primer paso exitoso'; + + @override + String get routing_qualityFair => 'Primer salto de calidad'; + + @override + String get routing_qualityWorked => 'Ha cumplido'; + + @override + String get routing_qualityFlood => 'Se ha escuchado a través de rumores.'; + + @override + String get routing_qualityUntested => 'Sin probar'; + + @override + String routing_lastWorked(String when) { + return 'trabajó $when'; } + @override + String get routing_neverWorked => 'nunca confirmado'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Entrega por inundación'; + + @override + String get pathEditor_title => 'Crear ruta'; + + @override + String pathEditor_hopCounter(int count) { + return '$count de 64 granos de lúpulo'; + } + + @override + String get pathEditor_noHops => + 'Aún no se han añadido lúpulos. Haga clic en los repetidores para añadirlos en el orden deseado, o guarde la receta sin lúpulos para enviarla directamente.'; + + @override + String get pathEditor_addHops => 'Añadir los lúpulos en el orden adecuado.'; + + @override + String get pathEditor_searchRepeaters => 'Buscar repetidores'; + + @override + String get pathEditor_advancedHex => + 'Avanzado: ruta hexadecimal sin procesar'; + + @override + String get pathEditor_hexLabel => 'Prefijos hexadecimales'; + + @override + String get pathEditor_hexHelper => + 'Dos caracteres hexadecimales por salto, separados por comas.'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Inválido: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Máximo 64 saltos'; + + @override + String get pathEditor_usePath => 'Utilice esta ruta.'; + + @override + String get pathEditor_removeHop => 'Eliminar el lúpulo'; + + @override + String get pathEditor_unknownHop => 'Repetidor desconocido'; + @override String get chat_pathSavedLocally => 'Guardado localmente. Conéctate para sincronizar.'; @@ -1646,6 +1738,39 @@ class AppLocalizationsEs extends AppLocalizations { @override String get map_title => 'Mapa de Nodos'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Línea de visión'; @@ -2039,66 +2164,13 @@ class AppLocalizationsEs extends AppLocalizations { @override String get common_clear => 'Borrar'; - @override - String path_currentPath(String path) { - return 'Ruta actual: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Usando $count $_temp0 ruta'; - } - - @override - String get path_enterCustomPath => 'Introducir Ruta Personalizada'; - @override String get path_currentPathLabel => 'Ruta actual'; - @override - String get path_hexPrefixInstructions => - 'Introduzca los prefijos hexadecimales de 2 caracteres para cada salto, separados por comas.'; - - @override - String get path_hexPrefixExample => - 'Ejemplo: A1,F2,3C (cada nodo utiliza el primer byte de su clave pública).'; - - @override - String get path_labelHexPrefixes => 'Prefijos hexadecimales'; - - @override - String get path_helperMaxHops => - 'Máximo 64 saltos. Cada prefijo tiene 2 caracteres hexadecimales (1 byte).'; - - @override - String get path_selectFromContacts => 'O seleccionar de contactos:'; - @override String get path_noRepeatersFound => 'No se encontraron repetidores ni servidores de sala.'; - @override - String get path_customPathsRequire => - 'Las rutas personalizadas requieren saltos intermedios que pueden transmitir mensajes.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Prefijos hexadecimales inválidos: $prefixes'; - } - - @override - String get path_tooLong => - 'La ruta es demasiado larga. Se permiten un máximo de 64 saltos.'; - - @override - String get path_setPath => 'Establecer Ruta'; - @override String get repeater_management => 'Gestión de Repetidores'; @@ -2163,15 +2235,6 @@ class AppLocalizationsEs extends AppLocalizations { @override String get repeater_routingMode => 'Modo de enrutamiento'; - @override - String get repeater_autoUseSavedPath => 'Auto (usar la ruta guardada)'; - - @override - String get repeater_forceFloodMode => 'Modo Inundación Forzado'; - - @override - String get repeater_pathManagement => 'Gestión de rutas'; - @override String get repeater_refresh => 'Actualizar'; @@ -3270,6 +3333,139 @@ class AppLocalizationsEs extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Entrada digital'; + + @override + String get telemetry_digitalOutputLabel => 'Salida digital'; + + @override + String get telemetry_analogInputLabel => 'Entrada analógica'; + + @override + String get telemetry_analogOutputLabel => 'Salida analógica'; + + @override + String get telemetry_genericLabel => 'Sensor genérico'; + + @override + String get telemetry_luminosityLabel => 'Luminosidad'; + + @override + String get telemetry_presenceLabel => 'Presencia'; + + @override + String get telemetry_humidityLabel => 'Humedad'; + + @override + String get telemetry_accelerometerLabel => 'Acelerómetro'; + + @override + String get telemetry_pressureLabel => 'Presión'; + + @override + String get telemetry_altitudeLabel => 'Altitud'; + + @override + String get telemetry_frequencyLabel => 'Frecuencia'; + + @override + String get telemetry_percentageLabel => 'Porcentaje'; + + @override + String get telemetry_concentrationLabel => 'Concentración'; + + @override + String get telemetry_powerLabel => 'Potencia'; + + @override + String get telemetry_distanceLabel => 'Distancia'; + + @override + String get telemetry_energyLabel => 'Energía'; + + @override + String get telemetry_directionLabel => 'Dirección'; + + @override + String get telemetry_timeLabel => 'Hora'; + + @override + String get telemetry_gyrometerLabel => 'Girómetro'; + + @override + String get telemetry_colourLabel => 'Color'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Interruptor'; + + @override + String get telemetry_polylineLabel => 'Polilínea'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + + @override + String get telemetry_autoFetchQuantity => 'Número de solicitudes'; + + @override + String get telemetry_error => 'No se pudieron obtener los datos'; + @override String get neighbors_receivedData => 'Recibidas Datos de Vecinos'; @@ -4163,6 +4359,17 @@ class AppLocalizationsEs extends AppLocalizations { String get translation_composerSubtitle => 'Controla el estado predeterminado del icono de traducción del compositor.'; + @override + String get translation_autoIncomingTitle => + 'Traducir mensajes automáticamente'; + + @override + String get translation_autoIncomingSubtitle => + 'Traduce mensajes para notificaciones y para chats o canales automáticamente.'; + + @override + String get translation_translateMessage => 'Traducir mensaje'; + @override String get translation_targetLanguage => 'Idioma de destino'; @@ -4292,4 +4499,135 @@ class AppLocalizationsEs extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Acercar'; + + @override + String get map_zoomOut => 'Acercar'; + + @override + String get map_centerMap => 'Mapa del centro'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth requiere un navegador Chromium.'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'Confirmado mediante GPS'; + + @override + String get pathTrace_legendInferred => 'Posición inferida'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index 44e40657..46f8cf2f 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -92,6 +92,24 @@ class AppLocalizationsFr extends AppLocalizations { @override String get common_disable => 'Désactiver'; + @override + String get common_undo => 'Annuler'; + + @override + String get messageStatus_sent => 'Envoyer'; + + @override + String get messageStatus_delivered => 'Livré'; + + @override + String get messageStatus_pending => 'Envoyer'; + + @override + String get messageStatus_failed => 'Échec de l\'envoi'; + + @override + String get messageStatus_repeated => 'Répété plusieurs fois'; + @override String get common_reboot => 'Redémarrer'; @@ -111,6 +129,12 @@ class AppLocalizationsFr extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Actualisation automatique'; + + @override + String get common_interval => 'Intervalle'; + @override String get scanner_title => 'MeshCore Open'; @@ -297,6 +321,10 @@ class AppLocalizationsFr extends AppLocalizations { @override String get scanner_enableBluetooth => 'Activer le Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Basculement rapide'; @@ -791,11 +819,6 @@ class AppLocalizationsFr extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Nombre de tentatives de relance avant de marquer un message comme ayant échoué.'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Batterie'; @@ -997,6 +1020,15 @@ class AppLocalizationsFr extends AppLocalizations { @override String get contacts_newGroup => 'Nouveau Groupe'; + @override + String get contacts_moreOptions => 'Plus d\'options'; + + @override + String get contacts_searchOpen => 'Rechercher des contacts'; + + @override + String get contacts_searchClose => 'Recherche avancée'; + @override String get contacts_groupName => 'Nom du groupe'; @@ -1479,35 +1511,6 @@ class AppLocalizationsFr extends AppLocalizations { @override String get debugFrame_hexDump => 'Vidéo de Dump Hexadécimal :'; - @override - String get chat_pathManagement => 'Gestion des chemins'; - - @override - String get chat_ShowAllPaths => 'Afficher tous les chemins'; - - @override - String get chat_routingMode => 'Mode de routage'; - - @override - String get chat_autoUseSavedPath => 'Auto (utiliser le chemin sauvegardé)'; - - @override - String get chat_forceFloodMode => 'Mode tout le réseau forcé'; - - @override - String get chat_recentAckPaths => - 'Chemins ACK récents (touchez pour utiliser) :'; - - @override - String get chat_pathHistoryFull => - 'L\'historique du chemin est plein. Supprimez les entrées pour en ajouter de nouvelles.'; - - @override - String get chat_hopSingular => 'saut'; - - @override - String get chat_hopPlural => 'sauts'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1519,12 +1522,6 @@ class AppLocalizationsFr extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'Succès'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Supprimer le chemin'; @@ -1532,53 +1529,146 @@ class AppLocalizationsFr extends AppLocalizations { String get chat_noPathHistoryYet => 'Aucune historique de parcours disponible.\nEnvoyez un message pour découvrir les parcours.'; - @override - String get chat_pathActions => 'Actions du chemin :'; - - @override - String get chat_setCustomPath => 'Définir un chemin personnalisé'; - - @override - String get chat_setCustomPathSubtitle => - 'Spécifier manuellement le chemin de routage'; - - @override - String get chat_clearPath => 'Effacer le chemin'; - - @override - String get chat_clearPathSubtitle => - 'Forcer la redécouverte lors de la prochaine envoi'; - @override String get chat_pathCleared => 'Le chemin est dégagé. Le prochain message redécouvrira le tracé.'; - @override - String get chat_floodModeSubtitle => - 'Désactive l\'apprentissage du chemin (à éviter). Utiliser le commutateur de routage dans la barre d\'application pour rebasculer en mode auto par la suite.'; - - @override - String get chat_floodModeEnabled => - 'Le mode envoi à tout le réseau est activé. Changer via l\'icône de routage dans la barre d\'outils.'; - @override String get chat_fullPath => 'Chemin complet'; @override - String get chat_pathDetailsNotAvailable => - 'Les détails du chemin ne sont pas encore disponibles. Essayez d\'envoyer un message pour rafraîchir.'; + String get routing_title => 'Planification des itinéraires'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Chemin défini : $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Voiture'; + + @override + String get routing_modeFlood => 'Inondation'; + + @override + String get routing_modeManual => 'Manuel'; + + @override + String get routing_modeAutoHint => + 'Sélectionne automatiquement le chemin le plus connu, et utilise la méthode de \"inondation\" si aucun chemin n\'est connu.'; + + @override + String get routing_modeFloodHint => + 'Diffusion via tous les répéteurs. La méthode la plus fiable, mais qui utilise plus de temps d\'antenne.'; + + @override + String get routing_modeManualHint => + 'Il suit toujours le chemin précis que vous avez défini.'; + + @override + String get routing_currentRoute => 'Itinéraire actuel'; + + @override + String get routing_directNoHops => 'Direct — sans relais'; + + @override + String get routing_noPathYet => + 'Aucune voie encore trouvée. Le message suivant est envoyé jusqu\'à ce qu\'une route soit découverte.'; + + @override + String get routing_floodBroadcast => 'Diffusion via tous les répéteurs'; + + @override + String get routing_editPath => 'Modifier le chemin'; + + @override + String get routing_forgetPath => 'Oubliez le chemin'; + + @override + String get routing_knownPaths => 'Chemins connus'; + + @override + String get routing_knownPathsHint => 'Créez un raccourci pour y accéder.'; + + @override + String get routing_inUse => 'En cours d\'utilisation'; + + @override + String get routing_qualityStrong => 'Première étape réussie'; + + @override + String get routing_qualityGood => 'Première étape réussie'; + + @override + String get routing_qualityFair => 'Première étape réussie'; + + @override + String get routing_qualityWorked => 'A livré'; + + @override + String get routing_qualityFlood => + 'Rapporté par des informations provenant de plusieurs sources.'; + + @override + String get routing_qualityUntested => 'Non testé'; + + @override + String routing_lastWorked(String when) { + return 'a travaillé $when'; } + @override + String get routing_neverWorked => 'jamais confirmé'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Livraison en cas de inondation'; + + @override + String get pathEditor_title => 'Créer un chemin'; + + @override + String pathEditor_hopCounter(int count) { + return '$count parmi 64 houblons'; + } + + @override + String get pathEditor_noHops => + 'Aucun houblon ajouté pour le moment. Cliquez sur les répétiteurs ci-dessous pour les ajouter dans l\'ordre souhaité, ou enregistrez sans houblon pour envoyer directement.'; + + @override + String get pathEditor_addHops => + 'Ajoutez les houblons dans l\'ordre souhaité.'; + + @override + String get pathEditor_searchRepeaters => 'Rechercher des répétiteurs'; + + @override + String get pathEditor_advancedHex => 'Avancé : chemin hexadécimal brut'; + + @override + String get pathEditor_hexLabel => 'Préfixes hexadécimaux'; + + @override + String get pathEditor_hexHelper => + 'Deux caractères hexadécimaux par saut, séparés par des virgules.'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Incorrect : $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximum 64 sauts'; + + @override + String get pathEditor_usePath => 'Utilisez ce chemin.'; + + @override + String get pathEditor_removeHop => 'Éliminer le haricot'; + + @override + String get pathEditor_unknownHop => 'Répéteur non identifié'; + @override String get chat_pathSavedLocally => 'Sauvegardé localement. Connectez-vous pour synchroniser.'; @@ -1655,6 +1745,39 @@ class AppLocalizationsFr extends AppLocalizations { @override String get map_title => 'Carte des nœuds'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Ligne de vue'; @@ -2050,66 +2173,13 @@ class AppLocalizationsFr extends AppLocalizations { @override String get common_clear => 'Effacer'; - @override - String path_currentPath(String path) { - return 'Chemin actuel : $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Utiliser $count $_temp0 chemin'; - } - - @override - String get path_enterCustomPath => 'Entrer un chemin personnalisé'; - @override String get path_currentPathLabel => 'Chemin actuel'; - @override - String get path_hexPrefixInstructions => - 'Entrez les préfixes hexadécimaux de 2 caractères pour chaque saut, séparés par des virgules.'; - - @override - String get path_hexPrefixExample => - 'Exemple : A1,F2,3C (chaque nœud utilise le premier octet de sa clé publique).'; - - @override - String get path_labelHexPrefixes => 'Préfixes hexadécimaux'; - - @override - String get path_helperMaxHops => - 'Max 64 sauts. Chaque préfixe fait 2 caractères hexadécimaux (1 octet)'; - - @override - String get path_selectFromContacts => 'Sélectionner à partir des contacts :'; - @override String get path_noRepeatersFound => 'Aucun répéteur ou room server n\'a été trouvé.'; - @override - String get path_customPathsRequire => - 'Les chemins personnalisés nécessitent des sauts intermédiaires qui peuvent transmettre des messages.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Préfixes hexadécimaux invalides : $prefixes'; - } - - @override - String get path_tooLong => - 'Le chemin est trop long. Maximum 64 sauts autorisés.'; - - @override - String get path_setPath => 'Définir le chemin'; - @override String get repeater_management => 'Gestion des répéteurs'; @@ -2175,16 +2245,6 @@ class AppLocalizationsFr extends AppLocalizations { @override String get repeater_routingMode => 'Mode de routage'; - @override - String get repeater_autoUseSavedPath => - 'Auto (utiliser le chemin sauvegardé)'; - - @override - String get repeater_forceFloodMode => 'Mode tout le réseau forcé'; - - @override - String get repeater_pathManagement => 'Gestion des chemins'; - @override String get repeater_refresh => 'Rafraîchir'; @@ -3293,6 +3353,139 @@ class AppLocalizationsFr extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Entrée numérique'; + + @override + String get telemetry_digitalOutputLabel => 'Sortie numérique'; + + @override + String get telemetry_analogInputLabel => 'Entrée analogique'; + + @override + String get telemetry_analogOutputLabel => 'Sortie analogique'; + + @override + String get telemetry_genericLabel => 'Capteur générique'; + + @override + String get telemetry_luminosityLabel => 'Luminosité'; + + @override + String get telemetry_presenceLabel => 'Présence'; + + @override + String get telemetry_humidityLabel => 'Humidité'; + + @override + String get telemetry_accelerometerLabel => 'Accéléromètre'; + + @override + String get telemetry_pressureLabel => 'Pression'; + + @override + String get telemetry_altitudeLabel => 'Altitude'; + + @override + String get telemetry_frequencyLabel => 'Fréquence'; + + @override + String get telemetry_percentageLabel => 'Pourcentage'; + + @override + String get telemetry_concentrationLabel => 'Concentration'; + + @override + String get telemetry_powerLabel => 'Puissance'; + + @override + String get telemetry_distanceLabel => 'Distance'; + + @override + String get telemetry_energyLabel => 'Énergie'; + + @override + String get telemetry_directionLabel => 'Direction'; + + @override + String get telemetry_timeLabel => 'Heure'; + + @override + String get telemetry_gyrometerLabel => 'Gyromètre'; + + @override + String get telemetry_colourLabel => 'Couleur'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Interrupteur'; + + @override + String get telemetry_polylineLabel => 'Polyligne'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + + @override + String get telemetry_autoFetchQuantity => 'Nombre de requêtes'; + + @override + String get telemetry_error => 'Impossible de récupérer les données'; + @override String get neighbors_receivedData => 'Données des voisins reçues'; @@ -4193,6 +4386,17 @@ class AppLocalizationsFr extends AppLocalizations { String get translation_composerSubtitle => 'Contrôle l\'état par défaut de l\'icône de traduction du composant.'; + @override + String get translation_autoIncomingTitle => + 'Traduire automatiquement les messages'; + + @override + String get translation_autoIncomingSubtitle => + 'Traduit automatiquement les messages pour les notifications et pour les discussions ou les canaux.'; + + @override + String get translation_translateMessage => 'Traduire le message'; + @override String get translation_targetLanguage => 'Langue cible'; @@ -4321,4 +4525,135 @@ class AppLocalizationsFr extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Zoomez'; + + @override + String get map_zoomOut => 'Zoomez'; + + @override + String get map_centerMap => 'Carte du centre'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth nécessite un navigateur Chromium.'; + + @override + String channels_communityShortId(String id) { + return 'ID : $id…'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'Le GPS a confirmé.'; + + @override + String get pathTrace_legendInferred => 'Position déduite'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_hu.dart b/lib/l10n/app_localizations_hu.dart index 298a6fd6..01c06a91 100644 --- a/lib/l10n/app_localizations_hu.dart +++ b/lib/l10n/app_localizations_hu.dart @@ -92,6 +92,24 @@ class AppLocalizationsHu extends AppLocalizations { @override String get common_disable => 'Leteteszt'; + @override + String get common_undo => 'Még egyszer'; + + @override + String get messageStatus_sent => 'Elküldve'; + + @override + String get messageStatus_delivered => 'Szállítva'; + + @override + String get messageStatus_pending => 'Elküldés'; + + @override + String get messageStatus_failed => 'Nem sikerült elküldeni'; + + @override + String get messageStatus_repeated => 'Ismételtem'; + @override String get common_reboot => 'Újraindítás'; @@ -111,6 +129,12 @@ class AppLocalizationsHu extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Automatikus frissítés'; + + @override + String get common_interval => 'Intervallum'; + @override String get scanner_title => 'MeshCore nyitott'; @@ -294,6 +318,10 @@ class AppLocalizationsHu extends AppLocalizations { @override String get scanner_enableBluetooth => 'Engedje be a Bluetooth funkciót'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Gyors váltás'; @@ -789,11 +817,6 @@ class AppLocalizationsHu extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'A próbálkozások száma, mielőtt egy üzenetet hibásnak jelölünk.'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Akku'; @@ -997,6 +1020,15 @@ class AppLocalizationsHu extends AppLocalizations { @override String get contacts_newGroup => 'Új csoport'; + @override + String get contacts_moreOptions => 'További lehetőségek'; + + @override + String get contacts_searchOpen => 'Keresssz kapcsolatokat'; + + @override + String get contacts_searchClose => 'Teljesítse a keresést'; + @override String get contacts_groupName => 'Csoport neve'; @@ -1482,36 +1514,6 @@ class AppLocalizationsHu extends AppLocalizations { @override String get debugFrame_hexDump => 'Hex-dump:'; - @override - String get chat_pathManagement => 'Útvonal-kezelés'; - - @override - String get chat_ShowAllPaths => 'Mutasson meg minden útvonalat'; - - @override - String get chat_routingMode => 'Útvonal-kezelési mód'; - - @override - String get chat_autoUseSavedPath => - 'Automatikus (az eddigi útvonal használata)'; - - @override - String get chat_forceFloodMode => 'Erőforrás-alapú áramlás mód'; - - @override - String get chat_recentAckPaths => - 'Legutóbbi használt útvonalak (gombra kattintva):'; - - @override - String get chat_pathHistoryFull => - 'Az előző lépések listája teljes. Törölj ki a bejegyzéseket, hogy újokat hozzáadhatsd.'; - - @override - String get chat_hopSingular => 'ugor'; - - @override - String get chat_hopPlural => 'babér'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1523,12 +1525,6 @@ class AppLocalizationsHu extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'sikerek'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Törölje a elérési útvonalat'; @@ -1536,52 +1532,148 @@ class AppLocalizationsHu extends AppLocalizations { String get chat_noPathHistoryYet => 'Még nincs útvonal-történet.\nKüldjön egy üzenetet, hogy megtudja a lehetséges útvonalakat.'; - @override - String get chat_pathActions => 'Céltúrások:'; - - @override - String get chat_setCustomPath => 'Beállítsd a saját útvonalat'; - - @override - String get chat_setCustomPathSubtitle => 'Kézzel megadott útvonal'; - - @override - String get chat_clearPath => 'Egyértelmű út'; - - @override - String get chat_clearPathSubtitle => - 'A parancs új küldéskor újra kell aktivizálnia.'; - @override String get chat_pathCleared => 'Útvonal cleared. A következő üzenet újból feltérképezheti az útvonalat.'; - @override - String get chat_floodModeSubtitle => - 'Használja a \"útvonal\" kapcsolót az alkalmazás sávjában.'; - - @override - String get chat_floodModeEnabled => - 'Árvízvédelmi mód bekapcsolva. A visszaállítás a alkalmazásban található útvonal ikon segítségével.'; - @override String get chat_fullPath => 'Teljes elérési út'; @override - String get chat_pathDetailsNotAvailable => - 'Az útvonal részletei még nem elérhetők. Próbálja meg küldeni egy üzenetet, hogy frissítse az információkat.'; + String get routing_title => 'Útvonal meghatározás'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Path set: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Autó'; + + @override + String get routing_modeFlood => 'Áradás'; + + @override + String get routing_modeManual => 'Használati útmutató'; + + @override + String get routing_modeAutoHint => + 'Automatikusan kiválasztja a legismertebb útvonalat, és ha egyik sem ismert, akkor \"vízzel\" tölti ki.'; + + @override + String get routing_modeFloodHint => + 'Átvisszaadások minden erősítőn keresztül. A legmegbízhatóbb megoldás, de több időt igényel.'; + + @override + String get routing_modeManualHint => + 'Mindig pontosan az útvonalat követi, amelyet megad.'; + + @override + String get routing_currentRoute => 'Jelenlegi útvonal'; + + @override + String get routing_directNoHops => 'Közvetlen – nincs átjáró állomás'; + + @override + String get routing_noPathYet => + 'Még nincs útvonal. A következő üzenet a keresésig vár.'; + + @override + String get routing_floodBroadcast => + 'Azonnali továbbítás minden erősítőn keresztül.'; + + @override + String get routing_editPath => 'Útvonal szerkesztése'; + + @override + String get routing_forgetPath => 'Felejtsd el a útvonalat'; + + @override + String get routing_knownPaths => 'Jellegzetes útvonalak'; + + @override + String get routing_knownPathsHint => + 'Készíts egy útvonalat, hogy átválhass rá.'; + + @override + String get routing_inUse => 'Használatban'; + + @override + String get routing_qualityStrong => 'Erős első lépés'; + + @override + String get routing_qualityGood => 'Jó első lépés'; + + @override + String get routing_qualityFair => 'Jó első lépés'; + + @override + String get routing_qualityWorked => 'Előállított'; + + @override + String get routing_qualityFlood => + 'Információt hallottam a katasztrófa miatt.'; + + @override + String get routing_qualityUntested => 'Vizsgálatnak nem подвержен'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'sosem megerősítve'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Vízparti szállítás'; + + @override + String get pathEditor_title => 'Út megépítése'; + + @override + String pathEditor_hopCounter(int count) { + return '$count db 64-ből'; + } + + @override + String get pathEditor_noHops => + 'Még nem adtam hozzá a bazsalikomot. A lent található gombokat használhatod, hogy sorrendben adjd hozzá, vagy mentheted anélkül, hogy bazsalikomot adnál hozzá, hogy közvetlenül elküldd.'; + + @override + String get pathEditor_addHops => + 'Adja hozzá a bazsaidat a megfelelő sorrendben.'; + + @override + String get pathEditor_searchRepeaters => 'Ismétlő eszközök keresése'; + + @override + String get pathEditor_advancedHex => 'Haladó szint: alapvető hex-út'; + + @override + String get pathEditor_hexLabel => 'Hex előtagok'; + + @override + String get pathEditor_hexHelper => + 'Két hatjegyű szám minden lépésen, amelyek egymástól elválasztják a kommák.'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Érvénytelen: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'A maximális szám 64.'; + + @override + String get pathEditor_usePath => 'Használja ezt az útvonalat.'; + + @override + String get pathEditor_removeHop => 'Távolítsa el a bazsalikomot'; + + @override + String get pathEditor_unknownHop => 'Tudatlan erősítő'; + @override String get chat_pathSavedLocally => 'Helyileg mentve. Kapcsolódjon a szinkronizáláshoz.'; @@ -1656,6 +1748,39 @@ class AppLocalizationsHu extends AppLocalizations { @override String get map_title => 'Grafikus ábrázás'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Látási vonal'; @@ -2052,67 +2177,13 @@ class AppLocalizationsHu extends AppLocalizations { @override String get common_clear => 'Egyértelmű'; - @override - String path_currentPath(String path) { - return 'Jelenlegi útvonal: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'ugrások', - one: 'ugrás', - ); - return '$count $_temp0 útvonal használata'; - } - - @override - String get path_enterCustomPath => 'Adja meg a saját elérési útvonalat'; - @override String get path_currentPathLabel => 'Jelenlegi útvonal'; - @override - String get path_hexPrefixInstructions => - 'Adja meg a 2 karakteres hexadecimális előtagokat minden lépéshez, tagolva kommával.'; - - @override - String get path_hexPrefixExample => - 'Példa: A1, F2, 3C (minden csomó az első részét használja a nyilvános kulcsából)'; - - @override - String get path_labelHexPrefixes => 'Út (hex-prefixek)'; - - @override - String get path_helperMaxHops => - 'A maximális hossz 64 karakter. Minden előző rész 2 hatos számjegyből áll (1 bájt).'; - - @override - String get path_selectFromContacts => - 'Válasszon a kontaktlista elembek közül:'; - @override String get path_noRepeatersFound => 'Nincs megtalálva semmilyen ismétlődő vagy helyiség-szolgáltató szervert.'; - @override - String get path_customPathsRequire => - 'Az egyedi útvonalaknak szükségük van átjáró pontokra, amelyek képesek üzeneteket továbbítani.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Érvénytelen hexadecimális előtagok: $prefixes'; - } - - @override - String get path_tooLong => - 'Az út túl hosszú. A maximális engedélyezett lépések száma 64.'; - - @override - String get path_setPath => 'Útvonal meghatározása'; - @override String get repeater_management => 'Adatkapcsolás kezelése'; @@ -2178,16 +2249,6 @@ class AppLocalizationsHu extends AppLocalizations { @override String get repeater_routingMode => 'Útvonal-kezelési mód'; - @override - String get repeater_autoUseSavedPath => - 'Automatikus (az eddigi útvonal használata)'; - - @override - String get repeater_forceFloodMode => 'Erőforrás-alapú áramlás mód'; - - @override - String get repeater_pathManagement => 'Útvonal-kezelés'; - @override String get repeater_refresh => 'Újrafriszol'; @@ -3286,6 +3347,139 @@ class AppLocalizationsHu extends AppLocalizations { return '$celsius °C / $fahrenheit °F'; } + @override + String get telemetry_digitalInputLabel => 'Digitális bemenet'; + + @override + String get telemetry_digitalOutputLabel => 'Digitális kimenet'; + + @override + String get telemetry_analogInputLabel => 'Analóg bemenet'; + + @override + String get telemetry_analogOutputLabel => 'Analóg kimenet'; + + @override + String get telemetry_genericLabel => 'Általános érzékelő'; + + @override + String get telemetry_luminosityLabel => 'Fényerő'; + + @override + String get telemetry_presenceLabel => 'Jelenlét'; + + @override + String get telemetry_humidityLabel => 'Páratartalom'; + + @override + String get telemetry_accelerometerLabel => 'Gyorsulásmérő'; + + @override + String get telemetry_pressureLabel => 'Nyomás'; + + @override + String get telemetry_altitudeLabel => 'Magasság'; + + @override + String get telemetry_frequencyLabel => 'Frekvencia'; + + @override + String get telemetry_percentageLabel => 'Százalék'; + + @override + String get telemetry_concentrationLabel => 'Koncentráció'; + + @override + String get telemetry_powerLabel => 'Teljesítmény'; + + @override + String get telemetry_distanceLabel => 'Távolság'; + + @override + String get telemetry_energyLabel => 'Energia'; + + @override + String get telemetry_directionLabel => 'Irány'; + + @override + String get telemetry_timeLabel => 'Idő'; + + @override + String get telemetry_gyrometerLabel => 'Giroszkóp'; + + @override + String get telemetry_colourLabel => 'Szín'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Kapcsoló'; + + @override + String get telemetry_polylineLabel => 'Töröttvonal'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + + @override + String get telemetry_autoFetchQuantity => 'Kérések száma'; + + @override + String get telemetry_error => 'Nem sikerült lekérni az adatokat'; + @override String get neighbors_receivedData => 'Kapott szomszédok adatait'; @@ -4181,6 +4375,16 @@ class AppLocalizationsHu extends AppLocalizations { String get translation_composerSubtitle => 'Ellenőrzi a zeneszerző fordítási ikon alapértékét.'; + @override + String get translation_autoIncomingTitle => 'Üzenetek automatikus fordítása'; + + @override + String get translation_autoIncomingSubtitle => + 'Automatikusan lefordítja az üzeneteket az értesítésekhez, valamint a csevegésekhez vagy csatornákhoz.'; + + @override + String get translation_translateMessage => 'Üzenet fordítása'; + @override String get translation_targetLanguage => 'Célnyelv'; @@ -4309,4 +4513,135 @@ class AppLocalizationsHu extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Nagyítva'; + + @override + String get map_zoomOut => 'Kicsökkentett nézet'; + + @override + String get map_centerMap => 'Központi tér térkép'; + + @override + String get chrome_bluetoothRequiresChromium => + 'A Web Bluetooth-hoz egy Chromium-alapú böngésző szükséges.'; + + @override + String channels_communityShortId(String id) { + return 'Az azonosító: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS-en megerősítve'; + + @override + String get pathTrace_legendInferred => 'Feltehető helyzet'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index e3f7ee58..de44f72f 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -92,6 +92,24 @@ class AppLocalizationsIt extends AppLocalizations { @override String get common_disable => 'Disattivare'; + @override + String get common_undo => 'Annulla'; + + @override + String get messageStatus_sent => 'Invia'; + + @override + String get messageStatus_delivered => 'Consegnato'; + + @override + String get messageStatus_pending => 'Invio'; + + @override + String get messageStatus_failed => 'Impossibile inviare'; + + @override + String get messageStatus_repeated => 'Sentito ripetutamente'; + @override String get common_reboot => 'Riavvia'; @@ -111,6 +129,12 @@ class AppLocalizationsIt extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Aggiornamento automatico'; + + @override + String get common_interval => 'Intervallo'; + @override String get scanner_title => 'MeshCore Open'; @@ -297,6 +321,10 @@ class AppLocalizationsIt extends AppLocalizations { @override String get scanner_enableBluetooth => 'Abilita il Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Passa velocemente'; @@ -788,11 +816,6 @@ class AppLocalizationsIt extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Numero di tentativi di riprova prima di considerare un messaggio come fallito.'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Batteria'; @@ -993,6 +1016,15 @@ class AppLocalizationsIt extends AppLocalizations { @override String get contacts_newGroup => 'Nuovo Gruppo'; + @override + String get contacts_moreOptions => 'Ulteriori opzioni'; + + @override + String get contacts_searchOpen => 'Cerca contatti'; + + @override + String get contacts_searchClose => 'Ricerca avanzata'; + @override String get contacts_groupName => 'Nome gruppo'; @@ -1475,34 +1507,6 @@ class AppLocalizationsIt extends AppLocalizations { @override String get debugFrame_hexDump => 'Dumpa Esadecimale:'; - @override - String get chat_pathManagement => 'Gestione Percorsi'; - - @override - String get chat_ShowAllPaths => 'Mostra tutti i percorsi'; - - @override - String get chat_routingMode => 'Modalità di routing'; - - @override - String get chat_autoUseSavedPath => 'Utilizza il percorso salvato'; - - @override - String get chat_forceFloodMode => 'Modalità Inondamento Forzato'; - - @override - String get chat_recentAckPaths => 'Percorsi ACK Recenti (tocca per usare):'; - - @override - String get chat_pathHistoryFull => - 'La cronologia del percorso è piena. Rimuovi gli elementi per aggiungere nuovi.'; - - @override - String get chat_hopSingular => 'salta'; - - @override - String get chat_hopPlural => 'salta'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1514,12 +1518,6 @@ class AppLocalizationsIt extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'successi'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Rimuovi percorso'; @@ -1527,53 +1525,148 @@ class AppLocalizationsIt extends AppLocalizations { String get chat_noPathHistoryYet => 'Non c\'è ancora una cronologia del percorso.\nInvia un messaggio per scoprire i percorsi.'; - @override - String get chat_pathActions => 'Azioni Percorso:'; - - @override - String get chat_setCustomPath => 'Imposta Percorso Personalizzato'; - - @override - String get chat_setCustomPathSubtitle => - 'Specifica manualmente il percorso di routing'; - - @override - String get chat_clearPath => 'Cancella Percorso'; - - @override - String get chat_clearPathSubtitle => - 'Riprova la scoperta alla prossima invio'; - @override String get chat_pathCleared => 'Percorso sgomberato. Il prossimo messaggio riidentifierà il percorso.'; - @override - String get chat_floodModeSubtitle => - 'Utilizza l\'interruttore di routing nella barra delle applicazioni'; - - @override - String get chat_floodModeEnabled => - 'Modalità alluvione abilitata. Disattivala tramite l\'icona di routing nella barra in alto.'; - @override String get chat_fullPath => 'Percorso Completo'; @override - String get chat_pathDetailsNotAvailable => - 'I dettagli del percorso non sono ancora disponibili. Prova a inviare un messaggio per ricaricare.'; + String get routing_title => 'Instradamento'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Percorso impostato: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Inondazione'; + + @override + String get routing_modeManual => 'Manuale'; + + @override + String get routing_modeAutoHint => + 'Seleziona automaticamente il percorso più noto, e in caso di assenza di informazioni, utilizza un percorso casuale.'; + + @override + String get routing_modeFloodHint => + 'Trasmissioni tramite ogni ripetitore. Il metodo più affidabile, ma richiede più tempo di trasmissione.'; + + @override + String get routing_modeManualHint => + 'Invia sempre esattamente il percorso che hai definito.'; + + @override + String get routing_currentRoute => 'Percorso attuale'; + + @override + String get routing_directNoHops => + 'Diretto — senza passaggi tramite ripetitori'; + + @override + String get routing_noPathYet => + 'Al momento non è stata individuata alcuna via. Il messaggio viene inviato ripetutamente finché non viene trovata una rotta.'; + + @override + String get routing_floodBroadcast => + 'Trasmissione attraverso ogni ripetitore'; + + @override + String get routing_editPath => 'Percorso di modifica'; + + @override + String get routing_forgetPath => 'Dimentica il percorso'; + + @override + String get routing_knownPaths => 'Percorsi noti'; + + @override + String get routing_knownPathsHint => + 'Seleziona un percorso per accedere a questa opzione.'; + + @override + String get routing_inUse => 'In uso'; + + @override + String get routing_qualityStrong => 'Primo salto molto deciso'; + + @override + String get routing_qualityGood => 'Primo tentativo di successo'; + + @override + String get routing_qualityFair => 'Primo salto di qualità'; + + @override + String get routing_qualityWorked => 'È stato consegnato'; + + @override + String get routing_qualityFlood => 'Ho sentito tramite un messaggio urgente'; + + @override + String get routing_qualityUntested => 'Non testato'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'mai confermato'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Consegna in caso di alluvione'; + + @override + String get pathEditor_title => 'Creare percorso'; + + @override + String pathEditor_hopCounter(int count) { + return '$count tra 64 varietà di luppolo'; + } + + @override + String get pathEditor_noHops => + 'Al momento non ci sono ingredienti aggiuntivi. Per aggiungerli nell\'ordine desiderato, cliccate sui ripetitori sottostanti. In alternativa, potete salvare la ricetta senza ingredienti aggiuntivi per inviarla direttamente.'; + + @override + String get pathEditor_addHops => + 'Aggiungere i luppoli nell\'ordine desiderato.'; + + @override + String get pathEditor_searchRepeaters => 'Ricerca ripetitori'; + + @override + String get pathEditor_advancedHex => 'Avanzato: percorso esadecimale grezzo'; + + @override + String get pathEditor_hexLabel => 'Prefissi esadecimali'; + + @override + String get pathEditor_hexHelper => + 'Due caratteri esadecimali per ogni salto, separati da virgole.'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Non valido: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Massimo 64 orari'; + + @override + String get pathEditor_usePath => 'Utilizza questo percorso'; + + @override + String get pathEditor_removeHop => 'Rimuovere il luppolo'; + + @override + String get pathEditor_unknownHop => 'Ripetitore sconosciuto'; + @override String get chat_pathSavedLocally => 'Salvatato localmente. Connetti per sincronizzare.'; @@ -1649,6 +1742,39 @@ class AppLocalizationsIt extends AppLocalizations { @override String get map_title => 'Mappa Nodi'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Linea di vista'; @@ -2041,66 +2167,13 @@ class AppLocalizationsIt extends AppLocalizations { @override String get common_clear => 'Cancella'; - @override - String path_currentPath(String path) { - return 'Percorso corrente: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Utilizzare $count $_temp0 percorso'; - } - - @override - String get path_enterCustomPath => 'Inserisci percorso personalizzato'; - @override String get path_currentPathLabel => 'Percorso corrente'; - @override - String get path_hexPrefixInstructions => - 'Inserire i prefissi esadecimali a 2 caratteri per ogni salto, separati da virgole.'; - - @override - String get path_hexPrefixExample => - 'Esempio: A1,F2,3C (ogni nodo utilizza il primo byte della sua chiave pubblica)'; - - @override - String get path_labelHexPrefixes => 'Prefisso esadecimale (percorso)'; - - @override - String get path_helperMaxHops => - 'Massimo 64 salti. Ogni prefisso è composto da 2 caratteri esadecimali (1 byte)'; - - @override - String get path_selectFromContacts => 'Seleziona da contatti:'; - @override String get path_noRepeatersFound => 'Non sono stati trovati ripetitori o server di stanza.'; - @override - String get path_customPathsRequire => - 'I percorsi personalizzati richiedono salti intermedi che possono inoltrare messaggi.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Prefissi esadecimali non validi: $prefixes'; - } - - @override - String get path_tooLong => - 'Il percorso è troppo lungo. Massimo 64 salti consentiti.'; - - @override - String get path_setPath => 'Imposta Percorso'; - @override String get repeater_management => 'Gestione Ripetitori'; @@ -2167,15 +2240,6 @@ class AppLocalizationsIt extends AppLocalizations { @override String get repeater_routingMode => 'Modalità di routing'; - @override - String get repeater_autoUseSavedPath => 'Percorso salvato automatico'; - - @override - String get repeater_forceFloodMode => 'Modalità Inondamento Forzato'; - - @override - String get repeater_pathManagement => 'Gestione dei percorsi'; - @override String get repeater_refresh => 'Aggiorna'; @@ -3276,6 +3340,139 @@ class AppLocalizationsIt extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Ingresso digitale'; + + @override + String get telemetry_digitalOutputLabel => 'Uscita digitale'; + + @override + String get telemetry_analogInputLabel => 'Ingresso analogico'; + + @override + String get telemetry_analogOutputLabel => 'Uscita analogica'; + + @override + String get telemetry_genericLabel => 'Sensore generico'; + + @override + String get telemetry_luminosityLabel => 'Luminosità'; + + @override + String get telemetry_presenceLabel => 'Presenza'; + + @override + String get telemetry_humidityLabel => 'Umidità'; + + @override + String get telemetry_accelerometerLabel => 'Accelerometro'; + + @override + String get telemetry_pressureLabel => 'Pressione'; + + @override + String get telemetry_altitudeLabel => 'Altitudine'; + + @override + String get telemetry_frequencyLabel => 'Frequenza'; + + @override + String get telemetry_percentageLabel => 'Percentuale'; + + @override + String get telemetry_concentrationLabel => 'Concentrazione'; + + @override + String get telemetry_powerLabel => 'Potenza'; + + @override + String get telemetry_distanceLabel => 'Distanza'; + + @override + String get telemetry_energyLabel => 'Energia'; + + @override + String get telemetry_directionLabel => 'Direzione'; + + @override + String get telemetry_timeLabel => 'Ora'; + + @override + String get telemetry_gyrometerLabel => 'Giroscopio'; + + @override + String get telemetry_colourLabel => 'Colore'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Interruttore'; + + @override + String get telemetry_polylineLabel => 'Polilinea'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + + @override + String get telemetry_autoFetchQuantity => 'Numero di richieste'; + + @override + String get telemetry_error => 'Impossibile recuperare i dati'; + @override String get neighbors_receivedData => 'Ricevute dati vicini'; @@ -4169,6 +4366,17 @@ class AppLocalizationsIt extends AppLocalizations { String get translation_composerSubtitle => 'Controlla lo stato predefinito dell\'icona di traduzione del compositore.'; + @override + String get translation_autoIncomingTitle => + 'Traduci automaticamente i messaggi'; + + @override + String get translation_autoIncomingSubtitle => + 'Traduce automaticamente i messaggi per le notifiche e per le chat o i canali.'; + + @override + String get translation_translateMessage => 'Traduci messaggio'; + @override String get translation_targetLanguage => 'Lingua di destinazione'; @@ -4297,4 +4505,135 @@ class AppLocalizationsIt extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Ingrandisci'; + + @override + String get map_zoomOut => 'Riduci la visualizzazione'; + + @override + String get map_centerMap => 'Mappa del centro'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth richiede un browser basato su Chromium.'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'Il GPS conferma'; + + @override + String get pathTrace_legendInferred => 'Posizione dedotta'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index 263a906e..0e6f5922 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -92,6 +92,24 @@ class AppLocalizationsJa extends AppLocalizations { @override String get common_disable => '無効化する'; + @override + String get common_undo => '元に戻す'; + + @override + String get messageStatus_sent => '送信'; + + @override + String get messageStatus_delivered => '配達'; + + @override + String get messageStatus_pending => '送信'; + + @override + String get messageStatus_failed => '送信できませんでした'; + + @override + String get messageStatus_repeated => '何度も聞いた'; + @override String get common_reboot => '再起動'; @@ -111,6 +129,12 @@ class AppLocalizationsJa extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => '自動更新'; + + @override + String get common_interval => '間隔'; + @override String get scanner_title => 'MeshCore オープン'; @@ -284,6 +308,10 @@ class AppLocalizationsJa extends AppLocalizations { @override String get scanner_enableBluetooth => 'Bluetoothを有効にする'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => '素早い切り替え'; @@ -553,7 +581,7 @@ class AppLocalizationsJa extends AppLocalizations { String get settings_txPowerInvalid => '無効な送信電力 (0-22 dBm)'; @override - String get settings_clientRepeat => 'オフグリッド(電力網から孤立した状態)の繰り返し'; + String get settings_clientRepeat => 'オフグリッドリピータ'; @override String get settings_clientRepeatSubtitle => @@ -703,7 +731,7 @@ class AppLocalizationsJa extends AppLocalizations { String get appSettings_autoRouteRotation => '自動ルートの切り替え'; @override - String get appSettings_autoRouteRotationSubtitle => '最適なルートと、洪水モードを切り替える'; + String get appSettings_autoRouteRotationSubtitle => '最適なルートと、フラッドモードを切り替える'; @override String get appSettings_autoRouteRotationEnabled => '自動ルートの切り替え機能が有効になっています'; @@ -745,11 +773,6 @@ class AppLocalizationsJa extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'メッセージを「失敗」とマークするまでの、再試行回数'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'バッテリー'; @@ -780,7 +803,7 @@ class AppLocalizationsJa extends AppLocalizations { String get appSettings_showRepeaters => '繰り返し再生機能'; @override - String get appSettings_showRepeatersSubtitle => '地図上にリピーターノードを表示する'; + String get appSettings_showRepeatersSubtitle => '地図上にリピータノードを表示する'; @override String get appSettings_showChatNodes => 'チャットノードの表示'; @@ -919,7 +942,7 @@ class AppLocalizationsJa extends AppLocalizations { } @override - String get contacts_manageRepeater => 'リピーターの管理'; + String get contacts_manageRepeater => 'リピータの管理'; @override String get contacts_manageRoom => 'ルームサーバーの管理'; @@ -944,6 +967,15 @@ class AppLocalizationsJa extends AppLocalizations { @override String get contacts_newGroup => '新しいグループ'; + @override + String get contacts_moreOptions => 'さらに多くの選択肢'; + + @override + String get contacts_searchOpen => '連絡先を検索する'; + + @override + String get contacts_searchClose => '検索を終了'; + @override String get contacts_groupName => 'グループ名'; @@ -1410,33 +1442,6 @@ class AppLocalizationsJa extends AppLocalizations { @override String get debugFrame_hexDump => 'ヘックスダンプ:'; - @override - String get chat_pathManagement => '経路管理'; - - @override - String get chat_ShowAllPaths => 'すべての経路を表示'; - - @override - String get chat_routingMode => 'ルーティングモード'; - - @override - String get chat_autoUseSavedPath => '自動 (保存されたパスを使用)'; - - @override - String get chat_forceFloodMode => '強制的に洪水モードを起動'; - - @override - String get chat_recentAckPaths => '最近使用したACKパス(タップして使用):'; - - @override - String get chat_pathHistoryFull => 'パスの履歴は完全です。エントリを削除して、新しいものを追加できます。'; - - @override - String get chat_hopSingular => 'ジャンプ'; - - @override - String get chat_hopPlural => 'ホップ'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1448,61 +1453,146 @@ class AppLocalizationsJa extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => '成功事例'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'パスを削除する'; @override String get chat_noPathHistoryYet => 'まだ履歴はありません。\nパスを特定するためにメッセージを送信してください。'; - @override - String get chat_pathActions => 'パスの操作:'; - - @override - String get chat_setCustomPath => 'カスタムパスを設定'; - - @override - String get chat_setCustomPathSubtitle => '手動で経路を指定する'; - - @override - String get chat_clearPath => '明確な道'; - - @override - String get chat_clearPathSubtitle => '次回送信時に、以前の情報を再取得する'; - @override String get chat_pathCleared => '経路が確保されました。次のメッセージでルートを再確認します。'; - @override - String get chat_floodModeSubtitle => 'アプリのバーにあるルーティング切り替え機能を使用する'; - - @override - String get chat_floodModeEnabled => - '洪水モードが有効になっています。アプリのメニューバーにあるルートアイコンを使用して、モードを切り替えることができます。'; - @override String get chat_fullPath => 'フルパス'; @override - String get chat_pathDetailsNotAvailable => - '経路の詳細については、まだ情報がありません。「リフレッシュ」ボタンを押して、再度お試しください。'; + String get routing_title => '経路設定'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Path set: $hopCount $_temp0 - $status'; + String get routing_modeAuto => '自動車'; + + @override + String get routing_modeFlood => '洪水'; + + @override + String get routing_modeManual => 'マニュアル'; + + @override + String get routing_modeAutoHint => '最も一般的な経路を自動的に選択し、経路が不明な場合は、水没状態にします。'; + + @override + String get routing_modeFloodHint => + 'すべてのリピーターを通じて放送。最も信頼性が高いですが、より多くの時間を使用します。'; + + @override + String get routing_modeManualHint => '常に、あなたが設定した正確な経路を辿って移動します。'; + + @override + String get routing_currentRoute => '現在までのルート'; + + @override + String get routing_directNoHops => '直接接続—中継装置を経由しない'; + + @override + String get routing_noPathYet => + 'まだ経路は確立されていません。「次のメッセージを送信し、経路が特定されるまで待ちます」。'; + + @override + String get routing_floodBroadcast => 'すべてのリピーターを通じて放送'; + + @override + String get routing_editPath => 'パスの編集'; + + @override + String get routing_forgetPath => '道にこだわらない'; + + @override + String get routing_knownPaths => '既知の経路'; + + @override + String get routing_knownPathsHint => 'そのアプリケーションに切り替えるためのショートカットを作成します。'; + + @override + String get routing_inUse => '使用中'; + + @override + String get routing_qualityStrong => '最初の段階で大きな成果を上げる'; + + @override + String get routing_qualityGood => '最初の成功'; + + @override + String get routing_qualityFair => '最初の試みは成功を収めた'; + + @override + String get routing_qualityWorked => '完了しました'; + + @override + String get routing_qualityFlood => '氾濫によって伝聞'; + + @override + String get routing_qualityUntested => '未検証'; + + @override + String routing_lastWorked(String when) { + return '$whenに勤務'; } + @override + String get routing_neverWorked => '確認されていない'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => '洪水による配送'; + + @override + String get pathEditor_title => '経路の作成'; + + @override + String pathEditor_hopCounter(int count) { + return '64個のホップのうち、$count個'; + } + + @override + String get pathEditor_noHops => + 'まだホップは追加されていません。ホップを順番に追加するには、以下の「タップ」ボタンをクリックしてください。または、ホップを一切追加せずに直接送信するには、「保存」ボタンをクリックしてください。'; + + @override + String get pathEditor_addHops => 'ホップを、指定された順番に加える'; + + @override + String get pathEditor_searchRepeaters => '繰り返し検索'; + + @override + String get pathEditor_advancedHex => '高度なレベル:生のヘックスパス'; + + @override + String get pathEditor_hexLabel => 'ヘックスプレフィックス'; + + @override + String get pathEditor_hexHelper => '各ホップごとに2つのハッシュ文字を、カンマで区切って記述'; + + @override + String pathEditor_invalidTokens(String tokens) { + return '無効: $tokens'; + } + + @override + String get pathEditor_tooManyHops => '最大64段階'; + + @override + String get pathEditor_usePath => 'この経路を使用してください'; + + @override + String get pathEditor_removeHop => 'ホップを取り除く'; + + @override + String get pathEditor_unknownHop => '不明な増幅器'; + @override String get chat_pathSavedLocally => 'ローカルで保存。同期のために接続する。'; @@ -1525,7 +1615,7 @@ class AppLocalizationsJa extends AppLocalizations { String get chat_compressOutgoingMessages => '送信されるメッセージを圧縮する'; @override - String get chat_floodForced => '洪水(強制的な)'; + String get chat_floodForced => 'フラッド(強制的な)'; @override String get chat_directForced => '直接的な(強制的な)'; @@ -1536,7 +1626,7 @@ class AppLocalizationsJa extends AppLocalizations { } @override - String get chat_floodAuto => '洪水 (自動)'; + String get chat_floodAuto => 'フラッド (自動)'; @override String get chat_direct => '直接'; @@ -1575,6 +1665,39 @@ class AppLocalizationsJa extends AppLocalizations { @override String get map_title => 'ノードマップ'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => '視界'; @@ -1601,7 +1724,7 @@ class AppLocalizationsJa extends AppLocalizations { String get map_chat => 'チャット'; @override - String get map_repeater => '繰り返し送信装置'; + String get map_repeater => 'リピータ'; @override String get map_room => '部屋'; @@ -1696,13 +1819,13 @@ class AppLocalizationsJa extends AppLocalizations { String get map_chatNodes => 'チャットノード'; @override - String get map_repeaters => '繰り返し送信装置'; + String get map_repeaters => 'リピータ'; @override String get map_otherNodes => 'その他のノード'; @override - String get map_showOverlaps => 'リピーターキーの重複'; + String get map_showOverlaps => 'リピータキーの重複'; @override String get map_keyPrefix => '主要なプレフィックス'; @@ -1741,7 +1864,7 @@ class AppLocalizationsJa extends AppLocalizations { String get map_joinRoom => '部屋に参加する'; @override - String get map_manageRepeater => 'リピーターの管理'; + String get map_manageRepeater => 'リピータの管理'; @override String get map_tapToAdd => 'ノードをクリックして、パスに追加します。'; @@ -1914,7 +2037,7 @@ class AppLocalizationsJa extends AppLocalizations { @override String get login_repeaterDescription => - '設定やステータスにアクセスするために、リピーターのパスワードを入力してください。'; + '設定やステータスにアクセスするために、リピータのパスワードを入力してください。'; @override String get login_roomDescription => '設定やステータスへのアクセスには、部屋のパスワードを入力してください。'; @@ -1929,7 +2052,7 @@ class AppLocalizationsJa extends AppLocalizations { String get login_autoUseSavedPath => '自動 (保存されたパスを使用)'; @override - String get login_forceFloodMode => '強制的に洪水モードを起動'; + String get login_forceFloodMode => '強制的にフラッドモードを起動'; @override String get login_managePaths => 'パスの管理'; @@ -1957,70 +2080,20 @@ class AppLocalizationsJa extends AppLocalizations { @override String get common_clear => '明確'; - @override - String path_currentPath(String path) { - return '現在のパス: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'ホップ', - one: 'ホップ', - ); - return '$count $_temp0のパスを使用'; - } - - @override - String get path_enterCustomPath => 'カスタムパスを入力'; - @override String get path_currentPathLabel => '現在の経路'; - @override - String get path_hexPrefixInstructions => - '各ホップに対して、2文字の16進数プレフィックスをカンマで区切って入力してください。'; - - @override - String get path_hexPrefixExample => '例:A1, F2, 3C (各ノードは、自身の公開鍵の最初のバイトを使用)'; - - @override - String get path_labelHexPrefixes => 'パス (ヘックスプレフィックス)'; - - @override - String get path_helperMaxHops => - '最大64個のホップ。各プレフィックスは2つの16進数文字(1バイト)で構成されています。'; - - @override - String get path_selectFromContacts => 'または、連絡先リストから選択してください:'; - @override String get path_noRepeatersFound => '繰り返し機能やルームサーバーは見つかりませんでした。'; @override - String get path_customPathsRequire => 'カスタムパスには、メッセージを中継できる中間地点が必要です。'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return '無効な16進数プレフィックス: $prefixes'; - } - - @override - String get path_tooLong => '経路が長すぎる。最大64回のジャンプのみ許可。'; - - @override - String get path_setPath => 'パスを設定'; - - @override - String get repeater_management => 'リピーター管理'; + String get repeater_management => 'リピータ管理'; @override String get room_management => 'ルームサーバーの管理'; @override - String get repeater_guest => '繰り返し送信に関する情報'; + String get repeater_guest => 'リピータに関する情報'; @override String get room_guest => 'ルームサーバーに関する情報'; @@ -2035,7 +2108,7 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_status => 'ステータス'; @override - String get repeater_statusSubtitle => 'リピーターの状態、統計情報、および隣接するネットワークの情報を表示する'; + String get repeater_statusSubtitle => 'リピータの状態、統計情報、および隣接するネットワークの情報を表示する'; @override String get repeater_telemetry => 'テレメトリー'; @@ -2047,7 +2120,7 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_cli => 'CLI(コマンドラインインターフェース)'; @override - String get repeater_cliSubtitle => 'リピーターへのコマンドを送信する'; + String get repeater_cliSubtitle => 'リピータへのコマンドを送信する'; @override String get repeater_neighbors => '近隣住民'; @@ -2059,7 +2132,7 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_settings => '設定'; @override - String get repeater_settingsSubtitle => 'リピーターのパラメータを設定する'; + String get repeater_settingsSubtitle => 'リピータのパラメータを設定する'; @override String get repeater_clockSyncAfterLogin => 'ログイン後、時計の時刻を同期する'; @@ -2074,15 +2147,6 @@ class AppLocalizationsJa extends AppLocalizations { @override String get repeater_routingMode => 'ルーティングモード'; - @override - String get repeater_autoUseSavedPath => '自動 (保存されたパスを使用)'; - - @override - String get repeater_forceFloodMode => '強制的に洪水モードを起動'; - - @override - String get repeater_pathManagement => '経路管理'; - @override String get repeater_refresh => 'リフレッシュ'; @@ -2157,12 +2221,12 @@ class AppLocalizationsJa extends AppLocalizations { @override String repeater_packetTxTotal(int total, String flood, String direct) { - return '合計: $total, 洪水: $flood, 直接: $direct'; + return '合計: $total, フラッド: $flood, 直接: $direct'; } @override String repeater_packetRxTotal(int total, String flood, String direct) { - return '合計: $total, 洪水: $flood, 直接: $direct'; + return '合計: $total, フラッド: $flood, 直接: $direct'; } @override @@ -2176,16 +2240,16 @@ class AppLocalizationsJa extends AppLocalizations { } @override - String get repeater_settingsTitle => 'リピーター設定'; + String get repeater_settingsTitle => 'リピータ設定'; @override String get repeater_basicSettings => '基本設定'; @override - String get repeater_repeaterName => '送信装置名'; + String get repeater_repeaterName => 'リピータ名'; @override - String get repeater_repeaterNameHelper => 'このリピーターの名前'; + String get repeater_repeaterNameHelper => 'このリピータの名前'; @override String get repeater_adminPassword => '管理者パスワード'; @@ -2245,7 +2309,7 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_packetForwarding => 'パケット転送'; @override - String get repeater_packetForwardingSubtitle => 'リピーターがパケットを転送できるように設定する'; + String get repeater_packetForwardingSubtitle => 'リピータがパケットを転送できるように設定する'; @override String get repeater_guestAccess => 'ゲストへのアクセス'; @@ -2271,7 +2335,7 @@ class AppLocalizationsJa extends AppLocalizations { } @override - String get repeater_floodAdvertInterval => '洪水に関する広告の表示間隔'; + String get repeater_floodAdvertInterval => 'フラッドに関する広告の表示間隔'; @override String repeater_floodAdvertIntervalHours(int hours) { @@ -2285,13 +2349,13 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_dangerZone => '危険区域'; @override - String get repeater_rebootRepeater => 'リピーターを再起動する'; + String get repeater_rebootRepeater => 'リピータを再起動する'; @override - String get repeater_rebootRepeaterSubtitle => 'リピーターデバイスを再起動する'; + String get repeater_rebootRepeaterSubtitle => 'リピータデバイスを再起動する'; @override - String get repeater_rebootRepeaterConfirm => '本当にこのリピーターを再起動したいですか?'; + String get repeater_rebootRepeaterConfirm => '本当にこのリピータを再起動したいですか?'; @override String get repeater_regenerateIdentityKey => 'IDキーの再生成'; @@ -2301,17 +2365,17 @@ class AppLocalizationsJa extends AppLocalizations { @override String get repeater_regenerateIdentityKeyConfirm => - 'これにより、リピーターには新しい識別情報が割り当てられます。続行しますか?'; + 'これにより、リピータには新しい識別情報が割り当てられます。続行しますか?'; @override String get repeater_eraseFileSystem => 'ファイルシステムを削除する'; @override - String get repeater_eraseFileSystemSubtitle => 'リピーターファイルシステムをフォーマットする'; + String get repeater_eraseFileSystemSubtitle => 'リピータファイルシステムをフォーマットする'; @override String get repeater_eraseFileSystemConfirm => - '警告:この操作により、リピーター内のすべてのデータが消去されます。この操作は元に戻すことができません!'; + '警告:この操作により、リピータ内のすべてのデータが消去されます。この操作は元に戻すことができません!'; @override String get repeater_eraseSerialOnly => 'Erase機能は、シリアルコンソール経由でのみ利用可能です。'; @@ -2357,7 +2421,7 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_loopDetect => 'ループ検出'; @override - String get repeater_loopDetectHelper => 'ルーティングループに見えるような、洪水パケットを送信する'; + String get repeater_loopDetectHelper => 'ルーティングループを検知する'; @override String get repeater_loopDetectOff => 'オフ'; @@ -2386,7 +2450,7 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_ownerInfo => '事業者の情報'; @override - String get repeater_ownerInfoHelper => 'このリピーターに関する公開メタデータ'; + String get repeater_ownerInfoHelper => 'このリピータに関する公開メタデータ'; @override String get repeater_refreshOwnerInfo => 'オペレーター情報の更新'; @@ -2395,7 +2459,7 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_floodMax => '最大ホップ数'; @override - String get repeater_floodMaxHelper => '洪水パケットが移動できる最大ホップ数 (0-64)'; + String get repeater_floodMaxHelper => 'フラッドパケットが移動できる最大ホップ数 (0-64)'; @override String get repeater_advancedSettings => '高度な'; @@ -2408,14 +2472,14 @@ class AppLocalizationsJa extends AppLocalizations { @override String get repeater_pathHashModeHelper => - 'このリピーターのIDをフローパス/ループ検出タグにエンコードするために使用されるバイト数。 0=1バイト (256個のID、最大64ホップ)、1=2バイト (65,000個のID、最大32ホップ)、2=3バイト (160万個のID、最大21ホップ)。 v1.13およびそれ以前のファームウェアでは、マルチバイトパスがサポートされていません。 v1.14以降のバージョンでは、一度ネットワークが起動されると、パスが一度だけ検出されます。'; + 'このリピータのIDをフローパス/ループ検出タグにエンコードするために使用されるバイト数。 0=1バイト (256個のID、最大64ホップ)、1=2バイト (65,000個のID、最大32ホップ)、2=3バイト (160万個のID、最大21ホップ)。 v1.13およびそれ以前のファームウェアでは、マルチバイトパスがサポートされていません。 v1.14以降のバージョンでは、一度ネットワークが起動されると、パスが一度だけ検出されます。'; @override String get repeater_txDelay => 'フロイド・TXでの遅延'; @override String get repeater_txDelayHelper => - '洪水時の交通量に対応するための再送信間隔を、パケットの通信時間を掛けた値(0~2、デフォルト0.5)で設定します。値を大きくすると衝突が減りますが、通信速度が遅くなります。'; + 'フラッド時の交通量に対応するための再送信間隔を、パケットの通信時間を掛けた値(0~2、デフォルト0.5)で設定します。値を大きくすると衝突が減りますが、通信速度が遅くなります。'; @override String get repeater_directTxDelay => '直接的なTX遅延'; @@ -2442,16 +2506,16 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_actionsTitle => '行動'; @override - String get repeater_sendAdvert => '洪水に関する広告を送信'; + String get repeater_sendAdvert => 'フラッドに関する広告を送信'; @override - String get repeater_sendAdvertSubtitle => 'ネットワークを通じて、洪水に関する広告を放送する'; + String get repeater_sendAdvertSubtitle => 'ネットワークを通じて、フラッドに関する広告を放送する'; @override String get repeater_sendAdvertZeroHop => 'ゼロホップ形式の広告を送信する'; @override - String get repeater_sendAdvertZeroHopSubtitle => 'ワンホップでの広告放送(中継なし)'; + String get repeater_sendAdvertZeroHopSubtitle => 'ワンホップでの広告放送(リピータなし)'; @override String get repeater_clockSync => '現在、時刻を同期する'; @@ -2471,7 +2535,7 @@ class AppLocalizationsJa extends AppLocalizations { @override String get repeater_settingsSavedRebootNeeded => - '設定を保存しました — リピーターを再起動して適用してください'; + '設定を保存しました — リピータを再起動して適用してください'; @override String repeater_settingsPartialFailure(String failures) { @@ -2512,7 +2576,7 @@ class AppLocalizationsJa extends AppLocalizations { } @override - String get repeater_cliTitle => 'リピーターのコマンドラインインターフェース'; + String get repeater_cliTitle => 'リピータのコマンドラインインターフェース'; @override String get repeater_debugNextCommand => '次のコマンドのデバッグ'; @@ -2603,7 +2667,7 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_cliHelpSetTx => 'LoRaの送信電力をdBmで設定します。(設定変更後、再起動が必要です)'; @override - String get repeater_cliHelpSetRepeat => 'このノードに対するリピーターの役割を有効化または無効化します。'; + String get repeater_cliHelpSetRepeat => 'このノードに対するリピータの役割を有効化または無効化します。'; @override String get repeater_cliHelpSetAllowReadOnly => @@ -2611,7 +2675,7 @@ class AppLocalizationsJa extends AppLocalizations { @override String get repeater_cliHelpSetFloodMax => - 'インバウンドフラッパケットの最大ホップ数を設定します(最大値を超えた場合、パケットは転送されません)。'; + 'インバウンドフラッドパケットの最大ホップ数を設定します(最大値を超えた場合、パケットは転送されません)。'; @override String get repeater_cliHelpSetIntThresh => @@ -2630,7 +2694,7 @@ class AppLocalizationsJa extends AppLocalizations { @override String get repeater_cliHelpSetFloodAdvertInterval => - '洪水広告の送信間隔を時間単位で設定します。0に設定すると、送信を停止します。'; + 'フラッド広告の送信間隔を時間単位で設定します。0に設定すると、送信を停止します。'; @override String get repeater_cliHelpSetGuestPassword => @@ -2704,7 +2768,7 @@ class AppLocalizationsJa extends AppLocalizations { @override String get repeater_cliHelpNeighbors => - 'ゼロホップ広告を通じて受信した他のリピーターノードの一覧を表示します。各行は、IDプレフィックス(16進数)、タイムスタンプ、SNR(シグナル強度)の情報を4つ含みます。'; + 'ゼロホップ広告を通じて受信した他のリピータノードの一覧を表示します。各行は、IDプレフィックス(16進数)、タイムスタンプ、SNR(シグナル強度)の情報を4つ含みます。'; @override String get repeater_cliHelpNeighborRemove => @@ -2712,7 +2776,7 @@ class AppLocalizationsJa extends AppLocalizations { @override String get repeater_cliHelpRegion => - '(特定のシリーズのみ)定義されたすべての地域と、現在の洪水許可状況を一覧表示します。'; + '(特定のシリーズのみ)定義されたすべての地域と、現在のフラッド許可状況を一覧表示します。'; @override String get repeater_cliHelpRegionLoad => @@ -2731,7 +2795,7 @@ class AppLocalizationsJa extends AppLocalizations { @override String get repeater_cliHelpRegionAllowf => - '指定された領域に対して、「洪水」アクセス許可を設定します。 (グローバル/従来のスコープには「*」を使用)'; + '指定された領域に対して、「フラッド」アクセス許可を設定します。 (グローバル/従来のスコープには「*」を使用)'; @override String get repeater_cliHelpRegionDenyf => @@ -2787,7 +2851,7 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_logging => 'ログ記録'; @override - String get repeater_neighborsRepeaterOnly => '近隣住民(リピーターのみ)'; + String get repeater_neighborsRepeaterOnly => '近隣住民(リピータのみ)'; @override String get repeater_regionManagementRepeaterOnly => '地域管理(ブロードキャスト用のみ)'; @@ -2832,7 +2896,7 @@ class AppLocalizationsJa extends AppLocalizations { @override String get repeater_cliHelpDiscoverNeighbors => - '近隣のノードに対して、ノードの探索リクエストを送信します。(中継機能のみ)'; + '近隣のノードに対して、ノードの探索リクエストを送信します。(リピータ機能のみ)'; @override String get repeater_cliHelpPowersaving => '省電力モードがオンになっているかどうかを表示します。'; @@ -2881,7 +2945,7 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_cliHelpGetName => '設定されたノードの名前を表示します。'; @override - String get repeater_cliHelpGetRole => 'ファームウェアの役割(リピーター、ルームサーバーなど)を表示します。'; + String get repeater_cliHelpGetRole => 'ファームウェアの役割(リピータ、ルームサーバーなど)を表示します。'; @override String get repeater_cliHelpGetPublicKey => 'デバイスの公開鍵を表示します。'; @@ -2891,7 +2955,7 @@ class AppLocalizationsJa extends AppLocalizations { '(シリアル番号のみ)デバイスのプライベートキーを表示します。機密情報として扱ってください。'; @override - String get repeater_cliHelpGetRepeat => 'パケット転送(リピーター機能)が有効になっているかどうかを表示します。'; + String get repeater_cliHelpGetRepeat => 'パケット転送(リピータ機能)が有効になっているかどうかを表示します。'; @override String get repeater_cliHelpGetTx => '現在のTX(送信)電力のdBm値を表示します。'; @@ -2930,7 +2994,7 @@ class AppLocalizationsJa extends AppLocalizations { @override String get repeater_cliHelpGetFloodAdvertInterval => - '洪水に関する広告の放送時間を時間単位で表示します。'; + 'フラッドに関する広告の放送時間を時間単位で表示します。'; @override String get repeater_cliHelpGetGuestPassword => '設定されたゲストパスワードを表示します。'; @@ -2945,13 +3009,13 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_cliHelpGetRxDelay => 'rxdelay の基本値を表示します。'; @override - String get repeater_cliHelpGetTxDelay => '洪水モードにおける送信遅延の要因を示します。'; + String get repeater_cliHelpGetTxDelay => 'フラッドモードにおける送信遅延の要因を示します。'; @override String get repeater_cliHelpGetDirectTxDelay => 'ダイレクトモードの遅延要素を示します。'; @override - String get repeater_cliHelpGetFloodMax => '最大浸水範囲の回数を表示します。'; + String get repeater_cliHelpGetFloodMax => 'フラッドパケットの最大ホップ数を表示します。'; @override String get repeater_cliHelpGetOwnerInfo => '所有者の連絡先情報を表示します。'; @@ -2963,7 +3027,7 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_cliHelpGetLoopDetect => 'ループ検出の感度を示す。'; @override - String get repeater_cliHelpGetAcl => '(シリアルのみ)リピーター上のアクセス制御設定を一覧表示します。'; + String get repeater_cliHelpGetAcl => '(シリアルのみ)リピータ上のアクセス制御設定を一覧表示します。'; @override String get repeater_cliHelpGetBridgeEnabled => '橋が有効になっているかどうかを表示します。'; @@ -3026,10 +3090,10 @@ class AppLocalizationsJa extends AppLocalizations { 'デフォルトの地域範囲を設定します。「」を使用すると、設定をリセットできます。'; @override - String get repeater_cliHelpRegionListAllowed => '洪水時の通行が許可されている地域の一覧'; + String get repeater_cliHelpRegionListAllowed => 'フラッド時の通行が許可されている地域の一覧'; @override - String get repeater_cliHelpRegionListDenied => '洪水による交通を遮断している地域の一覧'; + String get repeater_cliHelpRegionListDenied => 'フラッドによる交通を遮断している地域の一覧'; @override String get repeater_cliHelpStatsPackets => '(シリアルのみ)パケットレベルの統計情報を表示します。'; @@ -3094,6 +3158,139 @@ class AppLocalizationsJa extends AppLocalizations { return '$celsius℃ / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'デジタル入力'; + + @override + String get telemetry_digitalOutputLabel => 'デジタル出力'; + + @override + String get telemetry_analogInputLabel => 'アナログ入力'; + + @override + String get telemetry_analogOutputLabel => 'アナログ出力'; + + @override + String get telemetry_genericLabel => '汎用センサー'; + + @override + String get telemetry_luminosityLabel => '照度'; + + @override + String get telemetry_presenceLabel => '在室'; + + @override + String get telemetry_humidityLabel => '湿度'; + + @override + String get telemetry_accelerometerLabel => '加速度計'; + + @override + String get telemetry_pressureLabel => '気圧'; + + @override + String get telemetry_altitudeLabel => '高度'; + + @override + String get telemetry_frequencyLabel => '周波数'; + + @override + String get telemetry_percentageLabel => 'パーセント'; + + @override + String get telemetry_concentrationLabel => '濃度'; + + @override + String get telemetry_powerLabel => '電力'; + + @override + String get telemetry_distanceLabel => '距離'; + + @override + String get telemetry_energyLabel => 'エネルギー'; + + @override + String get telemetry_directionLabel => '方向'; + + @override + String get telemetry_timeLabel => '時刻'; + + @override + String get telemetry_gyrometerLabel => 'ジャイロメーター'; + + @override + String get telemetry_colourLabel => '色'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'スイッチ'; + + @override + String get telemetry_polylineLabel => 'ポリライン'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + + @override + String get telemetry_autoFetchQuantity => 'リクエスト数'; + + @override + String get telemetry_error => 'データを取得できません'; + @override String get neighbors_receivedData => '近隣住民のデータを受信'; @@ -3106,7 +3303,7 @@ class AppLocalizationsJa extends AppLocalizations { } @override - String get neighbors_repeatersNeighbors => '繰り返し送信する、近隣'; + String get neighbors_repeatersNeighbors => '近隣のリピータ'; @override String get neighbors_noData => '近隣のデータは利用できません。'; @@ -3131,7 +3328,7 @@ class AppLocalizationsJa extends AppLocalizations { String get channelPath_otherObservedPaths => '観察されたその他の経路'; @override - String get channelPath_repeaterHops => 'ホップの繰り返し'; + String get channelPath_repeaterHops => 'リピータホップ'; @override String get channelPath_noHopDetails => 'このパッケージに関する詳細な情報は提供されていません。'; @@ -3146,7 +3343,7 @@ class AppLocalizationsJa extends AppLocalizations { String get channelPath_timeLabel => '時間'; @override - String get channelPath_repeatsLabel => '繰り返し'; + String get channelPath_repeatsLabel => 'リピータ'; @override String channelPath_pathLabel(int index) { @@ -3178,7 +3375,7 @@ class AppLocalizationsJa extends AppLocalizations { String get channelPath_unknownPath => '不明'; @override - String get channelPath_floodPath => '洪水'; + String get channelPath_floodPath => 'フラッド'; @override String get channelPath_directPath => '直接'; @@ -3197,7 +3394,7 @@ class AppLocalizationsJa extends AppLocalizations { String get channelPath_mapTitle => '経路図'; @override - String get channelPath_noRepeaterLocations => 'この経路には、中継装置の設置場所がありません。'; + String get channelPath_noRepeaterLocations => 'この経路にリピータの位置情報はありません。'; @override String channelPath_primaryPath(int index) { @@ -3417,7 +3614,7 @@ class AppLocalizationsJa extends AppLocalizations { String get listFilter_users => '利用者'; @override - String get listFilter_repeaters => '繰り返し送信装置'; + String get listFilter_repeaters => 'リピータ'; @override String get listFilter_roomServers => 'ルーム用サーバー'; @@ -3617,10 +3814,10 @@ class AppLocalizationsJa extends AppLocalizations { String get contacts_ping => 'パング'; @override - String get contacts_repeaterPathTrace => 'リピーターまでの経路を追跡する'; + String get contacts_repeaterPathTrace => 'リピータまでの経路を追跡する'; @override - String get contacts_repeaterPing => 'PING 繰り返し'; + String get contacts_repeaterPing => 'リピータにPING'; @override String get contacts_roomPathTrace => '部屋のサーバーへの経路を追跡する'; @@ -3652,7 +3849,7 @@ class AppLocalizationsJa extends AppLocalizations { String get contacts_zeroHopAdvert => 'ゼロホップ広告'; @override - String get contacts_floodAdvert => '洪水に関する広告'; + String get contacts_floodAdvert => 'フラッドに関する広告'; @override String get contacts_copyAdvertToClipboard => '広告をクリップボードにコピー'; @@ -3723,7 +3920,7 @@ class AppLocalizationsJa extends AppLocalizations { String get notification_receivedNewMessage => '新しいメッセージを受信'; @override - String get settings_gpxExportRepeaters => 'GPX へのエクスポート用リピーター/ルームサーバー'; + String get settings_gpxExportRepeaters => 'GPX へのエクスポート用リピータ/ルームサーバー'; @override String get settings_gpxExportRepeatersSubtitle => @@ -3756,7 +3953,7 @@ class AppLocalizationsJa extends AppLocalizations { String get settings_gpxExportError => 'エクスポート時にエラーが発生しました。'; @override - String get settings_gpxExportRepeatersRoom => '中継装置およびルームサーバーの設置場所'; + String get settings_gpxExportRepeatersRoom => 'リピータ/ルームサーバーの位置情報'; @override String get settings_gpxExportChat => '関連施設'; @@ -3772,7 +3969,7 @@ class AppLocalizationsJa extends AppLocalizations { 'meshcore-open GPX形式の地図データのエクスポート'; @override - String get snrIndicator_nearByRepeaters => '近くの電波中継局'; + String get snrIndicator_nearByRepeaters => '近くのリピータ'; @override String get snrIndicator_lastSeen => '最後に確認された場所'; @@ -3794,11 +3991,11 @@ class AppLocalizationsJa extends AppLocalizations { '利用者が自動的に発見したユーザーを追加できるようにする。'; @override - String get contactsSettings_autoAddRepeatersTitle => '自動で繰り返し設定'; + String get contactsSettings_autoAddRepeatersTitle => 'リピータを自動追加'; @override String get contactsSettings_autoAddRepeatersSubtitle => - '発見した中継局を、自動的に追加できるようにする。'; + '発見したリピータを、自動的に追加できるようにする。'; @override String get contactsSettings_autoAddRoomServersTitle => '自動でルームサーバーを追加'; @@ -3941,6 +4138,16 @@ class AppLocalizationsJa extends AppLocalizations { @override String get translation_composerSubtitle => '作曲家翻訳アイコンのデフォルト状態を制御する。'; + @override + String get translation_autoIncomingTitle => 'メッセージを自動翻訳'; + + @override + String get translation_autoIncomingSubtitle => + '通知やチャット、チャンネルのメッセージを自動的に翻訳します。'; + + @override + String get translation_translateMessage => 'メッセージを翻訳'; + @override String get translation_targetLanguage => '翻訳対象言語'; @@ -4063,4 +4270,135 @@ class AppLocalizationsJa extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'ズームイン'; + + @override + String get map_zoomOut => 'ズームアウト'; + + @override + String get map_centerMap => '中心地図'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth は、Chromium ブラウザが必要です。'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id…'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPSによる確認'; + + @override + String get pathTrace_legendInferred => '推測される位置'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index f9c0d760..302ff925 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -92,6 +92,24 @@ class AppLocalizationsKo extends AppLocalizations { @override String get common_disable => '비활성화'; + @override + String get common_undo => '취소'; + + @override + String get messageStatus_sent => '발송'; + + @override + String get messageStatus_delivered => '배송 완료'; + + @override + String get messageStatus_pending => '발송'; + + @override + String get messageStatus_failed => '발송 실패'; + + @override + String get messageStatus_repeated => '반복적으로 들었습니다'; + @override String get common_reboot => '재부팅'; @@ -111,6 +129,12 @@ class AppLocalizationsKo extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => '자동 새로고침'; + + @override + String get common_interval => '간격'; + @override String get scanner_title => 'MeshCore 공개'; @@ -283,6 +307,10 @@ class AppLocalizationsKo extends AppLocalizations { @override String get scanner_enableBluetooth => '블루투스 활성화'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => '빠른 전환'; @@ -743,11 +771,6 @@ class AppLocalizationsKo extends AppLocalizations { @override String get appSettings_maxMessageRetriesSubtitle => '메시지를 실패로 처리하기 전 시도 횟수'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => '배터리'; @@ -939,6 +962,15 @@ class AppLocalizationsKo extends AppLocalizations { @override String get contacts_newGroup => '새로운 그룹'; + @override + String get contacts_moreOptions => '더 많은 옵션'; + + @override + String get contacts_searchOpen => '연락처 검색'; + + @override + String get contacts_searchClose => '검색 닫기'; + @override String get contacts_groupName => '그룹 이름'; @@ -1405,34 +1437,6 @@ class AppLocalizationsKo extends AppLocalizations { @override String get debugFrame_hexDump => '헥스 덤프:'; - @override - String get chat_pathManagement => '경로 관리'; - - @override - String get chat_ShowAllPaths => '모든 경로 표시'; - - @override - String get chat_routingMode => '라우팅 방식'; - - @override - String get chat_autoUseSavedPath => '자동 (저장된 경로 사용)'; - - @override - String get chat_forceFloodMode => '강수 모드 활성화'; - - @override - String get chat_recentAckPaths => '최근 사용한 ACK 경로 (사용하려면 탭):'; - - @override - String get chat_pathHistoryFull => - '이력 기록은 이미 가득 차 있습니다. 항목을 삭제하여 새로운 항목을 추가할 수 있습니다.'; - - @override - String get chat_hopSingular => '점프'; - - @override - String get chat_hopPlural => '홉'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1444,61 +1448,146 @@ class AppLocalizationsKo extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => '성공 사례'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => '경로 제거'; @override String get chat_noPathHistoryYet => '아직 경로 기록이 없습니다.\n경로를 찾기 위해 메시지를 보내세요.'; - @override - String get chat_pathActions => '경로 작업:'; - - @override - String get chat_setCustomPath => '사용자 지정 경로 설정'; - - @override - String get chat_setCustomPathSubtitle => '수동으로 경로를 지정'; - - @override - String get chat_clearPath => '명확한 길'; - - @override - String get chat_clearPathSubtitle => '다음 전송 시, 강제 재전송 설정'; - @override String get chat_pathCleared => '경로가 확보되었습니다. 다음 메시지는 경로를 다시 찾을 것입니다.'; - @override - String get chat_floodModeSubtitle => '앱 바에서 라우팅 스위치를 사용'; - - @override - String get chat_floodModeEnabled => - '홍수 모드 활성화됨. 앱 바의 경로 아이콘을 사용하여 다시 전환할 수 있습니다.'; - @override String get chat_fullPath => '전체 경로'; @override - String get chat_pathDetailsNotAvailable => - '경로 정보는 아직 제공되지 않습니다. 메시지를 보내어 다시 시도해 보세요.'; + String get routing_title => '라우팅'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Path set: $hopCount $_temp0 - $status'; + String get routing_modeAuto => '자동'; + + @override + String get routing_modeFlood => '홍수'; + + @override + String get routing_modeManual => '사용 설명서'; + + @override + String get routing_modeAutoHint => + '가장 잘 알려진 경로를 자동으로 선택하고, 경로가 없을 경우에는 무작위로 경로를 선택합니다.'; + + @override + String get routing_modeFloodHint => + '모든 증폭기를 통해 방송됩니다. 가장 안정적이지만, 더 많은 송출 시간을 사용합니다.'; + + @override + String get routing_modeManualHint => '항상 설정하신 정확한 경로를 따라 이동합니다.'; + + @override + String get routing_currentRoute => '현재 경로'; + + @override + String get routing_directNoHops => '직접 연결 – 중계 장치 사용 없이'; + + @override + String get routing_noPathYet => '아직 경로가 없습니다. 다음 메시지가 도착할 때까지 계속 탐색합니다.'; + + @override + String get routing_floodBroadcast => '모든 증폭기를 통해 방송'; + + @override + String get routing_editPath => '경로 편집'; + + @override + String get routing_forgetPath => '길을 잊어라'; + + @override + String get routing_knownPaths => '알려진 경로'; + + @override + String get routing_knownPathsHint => '해당 항목으로 전환하기 위한 경로를 선택합니다.'; + + @override + String get routing_inUse => '사용 중'; + + @override + String get routing_qualityStrong => '강력한 첫 번째 단계'; + + @override + String get routing_qualityGood => '좋은 첫 시작'; + + @override + String get routing_qualityFair => '처음 시도'; + + @override + String get routing_qualityWorked => '완료됨'; + + @override + String get routing_qualityFlood => '홍수 피해 상황을 통해 들었습니다.'; + + @override + String get routing_qualityUntested => '검증되지 않음'; + + @override + String routing_lastWorked(String when) { + return '$when에 일했습니다'; } + @override + String get routing_neverWorked => '확인되지 않음'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => '홍수 피해 지역 배송'; + + @override + String get pathEditor_title => '경로 만들기'; + + @override + String pathEditor_hopCounter(int count) { + return '64개의 홉 중 $count'; + } + + @override + String get pathEditor_noHops => + '현재 홉은 추가되지 않았습니다. 아래의 탭을 사용하여 순서대로 추가하거나, 홉 없이 바로 전송하려면 \"홉 없음\"으로 저장하십시오.'; + + @override + String get pathEditor_addHops => '홉을 순서대로 첨가해주세요.'; + + @override + String get pathEditor_searchRepeaters => '반복 검색'; + + @override + String get pathEditor_advancedHex => '고급: 원시 헥스 경로'; + + @override + String get pathEditor_hexLabel => '헥스 접두사'; + + @override + String get pathEditor_hexHelper => '각 홉마다 2개의 6자리 숫자, 쉼표로 구분'; + + @override + String pathEditor_invalidTokens(String tokens) { + return '유효하지 않음: $tokens'; + } + + @override + String get pathEditor_tooManyHops => '최대 64개의 홉'; + + @override + String get pathEditor_usePath => '이 경로를 사용하세요'; + + @override + String get pathEditor_removeHop => '홉 제거'; + + @override + String get pathEditor_unknownHop => '알 수 없는 중계기'; + @override String get chat_pathSavedLocally => '로컬에 저장. 동기화 연결'; @@ -1571,6 +1660,39 @@ class AppLocalizationsKo extends AppLocalizations { @override String get map_title => '노드 매핑'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => '시야'; @@ -1952,64 +2074,12 @@ class AppLocalizationsKo extends AppLocalizations { @override String get common_clear => '명확하게'; - @override - String path_currentPath(String path) { - return '현재 경로: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Using $count $_temp0 path'; - } - - @override - String get path_enterCustomPath => '사용자 지정 경로 입력'; - @override String get path_currentPathLabel => '현재 경로'; - @override - String get path_hexPrefixInstructions => - '각 단계에 대한 2자리 헥사데진 접두사를 쉼표로 구분하여 입력하세요.'; - - @override - String get path_hexPrefixExample => - '예시: A1, F2, 3C (각 노드는 자신의 공개 키의 첫 번째 바이트를 사용)'; - - @override - String get path_labelHexPrefixes => '경로 (헥스 접두사)'; - - @override - String get path_helperMaxHops => - '최대 64개의 홉. 각 접두사는 2개의 16진수 문자(1바이트)로 구성됩니다.'; - - @override - String get path_selectFromContacts => '또 연락처 목록에서 선택:'; - @override String get path_noRepeatersFound => '반복 장치 또는 서버는 찾을 수 없습니다.'; - @override - String get path_customPathsRequire => - '사용자 정의 경로에는 메시지를 전달할 수 있는 중간 경로가 필요합니다.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return '유효하지 않은 16진수 접두사: $prefixes'; - } - - @override - String get path_tooLong => '경로가 너무 길어. 최대 64개의 연결만 허용됩니다.'; - - @override - String get path_setPath => '경로 설정'; - @override String get repeater_management => '리피터 관리'; @@ -2071,15 +2141,6 @@ class AppLocalizationsKo extends AppLocalizations { @override String get repeater_routingMode => '라우팅 방식'; - @override - String get repeater_autoUseSavedPath => '자동 (저장된 경로 사용)'; - - @override - String get repeater_forceFloodMode => '강수 모드 활성화'; - - @override - String get repeater_pathManagement => '경로 관리'; - @override String get repeater_refresh => '새롭게'; @@ -3096,6 +3157,139 @@ class AppLocalizationsKo extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => '디지털 입력'; + + @override + String get telemetry_digitalOutputLabel => '디지털 출력'; + + @override + String get telemetry_analogInputLabel => '아날로그 입력'; + + @override + String get telemetry_analogOutputLabel => '아날로그 출력'; + + @override + String get telemetry_genericLabel => '일반 센서'; + + @override + String get telemetry_luminosityLabel => '조도'; + + @override + String get telemetry_presenceLabel => '존재 감지'; + + @override + String get telemetry_humidityLabel => '습도'; + + @override + String get telemetry_accelerometerLabel => '가속도계'; + + @override + String get telemetry_pressureLabel => '압력'; + + @override + String get telemetry_altitudeLabel => '고도'; + + @override + String get telemetry_frequencyLabel => '주파수'; + + @override + String get telemetry_percentageLabel => '백분율'; + + @override + String get telemetry_concentrationLabel => '농도'; + + @override + String get telemetry_powerLabel => '전력'; + + @override + String get telemetry_distanceLabel => '거리'; + + @override + String get telemetry_energyLabel => '에너지'; + + @override + String get telemetry_directionLabel => '방향'; + + @override + String get telemetry_timeLabel => '시간'; + + @override + String get telemetry_gyrometerLabel => '자이로미터'; + + @override + String get telemetry_colourLabel => '색상'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => '스위치'; + + @override + String get telemetry_polylineLabel => '폴리라인'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + + @override + String get telemetry_autoFetchQuantity => '요청 수'; + + @override + String get telemetry_error => '데이터를 가져올 수 없습니다'; + @override String get neighbors_receivedData => '이웃 정보 수집'; @@ -3942,6 +4136,16 @@ class AppLocalizationsKo extends AppLocalizations { @override String get translation_composerSubtitle => '컴포저 번역 아이콘의 기본 상태를 제어합니다.'; + @override + String get translation_autoIncomingTitle => '메시지 자동 번역'; + + @override + String get translation_autoIncomingSubtitle => + '알림과 채팅 또는 채널의 메시지를 자동으로 번역합니다.'; + + @override + String get translation_translateMessage => '메시지 번역'; + @override String get translation_targetLanguage => '목표 언어'; @@ -4064,4 +4268,134 @@ class AppLocalizationsKo extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => '줌 인'; + + @override + String get map_zoomOut => '줌 아웃'; + + @override + String get map_centerMap => '중심 지도'; + + @override + String get chrome_bluetoothRequiresChromium => '웹 블루투스는 크롬 브라우저가 필요합니다.'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS 확인 완료'; + + @override + String get pathTrace_legendInferred => '추론된 위치'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_nl.dart b/lib/l10n/app_localizations_nl.dart index ad140bf3..9a8f1615 100644 --- a/lib/l10n/app_localizations_nl.dart +++ b/lib/l10n/app_localizations_nl.dart @@ -92,6 +92,24 @@ class AppLocalizationsNl extends AppLocalizations { @override String get common_disable => 'Uitschakelen'; + @override + String get common_undo => 'Achterhalen/Annuleren'; + + @override + String get messageStatus_sent => 'Verzonden'; + + @override + String get messageStatus_delivered => 'Leverd'; + + @override + String get messageStatus_pending => 'Verzenden'; + + @override + String get messageStatus_failed => 'Niet verzonden'; + + @override + String get messageStatus_repeated => 'Hearsay, herhaald'; + @override String get common_reboot => 'Herstarten'; @@ -111,6 +129,12 @@ class AppLocalizationsNl extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Automatisch vernieuwen'; + + @override + String get common_interval => 'Tijdsinterval'; + @override String get scanner_title => 'MeshCore Open'; @@ -293,6 +317,10 @@ class AppLocalizationsNl extends AppLocalizations { @override String get scanner_enableBluetooth => 'Activeer Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Snelle overschakeling'; @@ -780,11 +808,6 @@ class AppLocalizationsNl extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Aantal pogingen om een bericht opnieuw te versturen voordat het als mislukt wordt gemarkeerd'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Batterij'; @@ -985,6 +1008,15 @@ class AppLocalizationsNl extends AppLocalizations { @override String get contacts_newGroup => 'Nieuwe Groep'; + @override + String get contacts_moreOptions => 'Meer opties'; + + @override + String get contacts_searchOpen => 'Zoek contactpersonen'; + + @override + String get contacts_searchClose => 'Zoeken'; + @override String get contacts_groupName => 'Groepnaam'; @@ -1462,34 +1494,6 @@ class AppLocalizationsNl extends AppLocalizations { @override String get debugFrame_hexDump => 'Hex-dump:'; - @override - String get chat_pathManagement => 'Beheer van Paden'; - - @override - String get chat_ShowAllPaths => 'Toon alle paden'; - - @override - String get chat_routingMode => 'Routeerwijze'; - - @override - String get chat_autoUseSavedPath => 'Automatisch (gebruik opgeslagen pad)'; - - @override - String get chat_forceFloodMode => 'Dwing Floodsmodus'; - - @override - String get chat_recentAckPaths => 'Recente ACK Paden (tik om te gebruiken):'; - - @override - String get chat_pathHistoryFull => - 'De voorgeschiedenis is vol. Verwijder vermeldingen om er nieuwe aan toe te voegen.'; - - @override - String get chat_hopSingular => 'Hop'; - - @override - String get chat_hopPlural => 'hoppen'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1501,12 +1505,6 @@ class AppLocalizationsNl extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'Succesvol'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Pad verwijderen'; @@ -1514,52 +1512,144 @@ class AppLocalizationsNl extends AppLocalizations { String get chat_noPathHistoryYet => 'Geen geschiedenis van paden nog beschikbaar.\nVerzend een bericht om paden te ontdekken.'; - @override - String get chat_pathActions => 'Padacties:'; - - @override - String get chat_setCustomPath => 'Stel aangepaste pad in'; - - @override - String get chat_setCustomPathSubtitle => 'Handmatig routepad specificeren'; - - @override - String get chat_clearPath => 'Duidelijke Pad'; - - @override - String get chat_clearPathSubtitle => - 'Dwing herontdekking bij volgende verzending'; - @override String get chat_pathCleared => 'Pad is vrijgegeven. Volgende bericht herontdekt route.'; - @override - String get chat_floodModeSubtitle => - 'Gebruik de route-schakelaar in de app-balk'; - - @override - String get chat_floodModeEnabled => - 'Floodmodus is ingeschakeld. Schakel dit uit via het route-icoon in de app-balk.'; - @override String get chat_fullPath => 'Volledige Pad'; @override - String get chat_pathDetailsNotAvailable => - 'De paddetails zijn nog niet beschikbaar. Probeer een bericht te sturen om te vernieuwen.'; + String get routing_title => 'Routeplanning'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Pad ingesteld: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Overstroming'; + + @override + String get routing_modeManual => 'Handleiding'; + + @override + String get routing_modeAutoHint => + 'Selecteert automatisch het bekendste pad, en gebruikt een flood-algoritme als er geen bekend pad is.'; + + @override + String get routing_modeFloodHint => + 'Uitzendingen via elke zender. De meest betrouwbare methode, maar vereist meer uitzendtijd.'; + + @override + String get routing_modeManualHint => + 'Stuurt altijd de exacte route die u heeft aangegeven.'; + + @override + String get routing_currentRoute => 'Huidige route'; + + @override + String get routing_directNoHops => 'Direct – zonder tussenliggende schakels'; + + @override + String get routing_noPathYet => + 'Er is nog geen route gevonden. De berichten blijven binnenkomen totdat een route is ontdekt.'; + + @override + String get routing_floodBroadcast => 'Uitgestoten via elke zender.'; + + @override + String get routing_editPath => 'Pad bewerken'; + + @override + String get routing_forgetPath => 'Vergeet het pad'; + + @override + String get routing_knownPaths => 'Bekende routes'; + + @override + String get routing_knownPathsHint => 'Maak een route om er naartoe te gaan.'; + + @override + String get routing_inUse => 'In gebruik'; + + @override + String get routing_qualityStrong => 'Sterke eerste sprong'; + + @override + String get routing_qualityGood => 'Een goede eerste stap'; + + @override + String get routing_qualityFair => 'Een goede eerste hop'; + + @override + String get routing_qualityWorked => 'Is geleverd'; + + @override + String get routing_qualityFlood => 'Hears via een overstroming'; + + @override + String get routing_qualityUntested => 'Niet getest'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'nooit bevestigd'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes zijn behaald, $failures zijn mislukt'; + } + + @override + String get routing_floodDelivery => 'Levering bij overstroming'; + + @override + String get pathEditor_title => 'Pad creëren'; + + @override + String pathEditor_hopCounter(int count) { + return '$count van 64 hopgranen'; + } + + @override + String get pathEditor_noHops => + 'Er zijn nog geen hop toegevoegd. Klik op de onderstaande knoppen om ze in de juiste volgorde toe te voegen, of sla de bestelling op zonder hop om deze direct te versturen.'; + + @override + String get pathEditor_addHops => 'Voeg hop toe in de juiste volgorde.'; + + @override + String get pathEditor_searchRepeaters => 'Zoek naar herhaaldelijke zenders'; + + @override + String get pathEditor_advancedHex => 'Geavanceerd: ruwe hex-pad'; + + @override + String get pathEditor_hexLabel => 'Hex-voorkanten'; + + @override + String get pathEditor_hexHelper => + 'Twee hex-tekens per stap, gescheiden door komma\'s'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Ongeldig: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximaal 64 hopken'; + + @override + String get pathEditor_usePath => 'Gebruik deze route.'; + + @override + String get pathEditor_removeHop => 'Verwijder de hop'; + + @override + String get pathEditor_unknownHop => 'Onbekend type zender'; + @override String get chat_pathSavedLocally => 'Opgeslagen lokaal. Verbinden om te synchroniseren.'; @@ -1635,6 +1725,39 @@ class AppLocalizationsNl extends AppLocalizations { @override String get map_title => 'Kaart van de knopen'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Zichtlijn'; @@ -2028,65 +2151,12 @@ class AppLocalizationsNl extends AppLocalizations { @override String get common_clear => 'Schoonmaken'; - @override - String path_currentPath(String path) { - return 'Huidige pad: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Gebruik $count $_temp0 pad'; - } - - @override - String get path_enterCustomPath => 'Voer aangepaste pad in'; - @override String get path_currentPathLabel => 'Huidige pad'; - @override - String get path_hexPrefixInstructions => - 'Voer 2-letter hex-voorgiffen voor elke hop in, gescheiden door komma\'s.'; - - @override - String get path_hexPrefixExample => - 'Voorbeeld: A1,F2,3C (elke node gebruikt het eerste byte van zijn openbare sleutel)'; - - @override - String get path_labelHexPrefixes => 'Pad (hex-voorkeursletters)'; - - @override - String get path_helperMaxHops => - 'Maximaal 64 sprongen. Elke prefix is 2 hexadecimale tekens (1 byte)'; - - @override - String get path_selectFromContacts => 'Of select contacten:'; - @override String get path_noRepeatersFound => 'Geen repeaters of roomservers gevonden.'; - @override - String get path_customPathsRequire => - 'Aangepaste paden vereisen tussentse overstappen die berichten kunnen doorgeven.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Ongeldige hex-voorkeursletters: $prefixes'; - } - - @override - String get path_tooLong => - 'Pad is te lang. Maximaal 64 sprongen zijn toegestaan.'; - - @override - String get path_setPath => 'Stel Pad in'; - @override String get repeater_management => 'Beheer Repeaters'; @@ -2151,16 +2221,6 @@ class AppLocalizationsNl extends AppLocalizations { @override String get repeater_routingMode => 'Routeerwijze'; - @override - String get repeater_autoUseSavedPath => - 'Automatisch (gebruik opgeslagen pad)'; - - @override - String get repeater_forceFloodMode => 'Dwing Floodmodus Af'; - - @override - String get repeater_pathManagement => 'Beheer van paden'; - @override String get repeater_refresh => 'Vernieuwen'; @@ -3256,6 +3316,139 @@ class AppLocalizationsNl extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Digitale ingang'; + + @override + String get telemetry_digitalOutputLabel => 'Digitale uitgang'; + + @override + String get telemetry_analogInputLabel => 'Analoge ingang'; + + @override + String get telemetry_analogOutputLabel => 'Analoge uitgang'; + + @override + String get telemetry_genericLabel => 'Algemene sensor'; + + @override + String get telemetry_luminosityLabel => 'Lichtsterkte'; + + @override + String get telemetry_presenceLabel => 'Aanwezigheid'; + + @override + String get telemetry_humidityLabel => 'Luchtvochtigheid'; + + @override + String get telemetry_accelerometerLabel => 'Versnellingsmeter'; + + @override + String get telemetry_pressureLabel => 'Druk'; + + @override + String get telemetry_altitudeLabel => 'Hoogte'; + + @override + String get telemetry_frequencyLabel => 'Frequentie'; + + @override + String get telemetry_percentageLabel => 'Percentage'; + + @override + String get telemetry_concentrationLabel => 'Concentratie'; + + @override + String get telemetry_powerLabel => 'Vermogen'; + + @override + String get telemetry_distanceLabel => 'Afstand'; + + @override + String get telemetry_energyLabel => 'Energie'; + + @override + String get telemetry_directionLabel => 'Richting'; + + @override + String get telemetry_timeLabel => 'Tijd'; + + @override + String get telemetry_gyrometerLabel => 'Gyrometer'; + + @override + String get telemetry_colourLabel => 'Kleur'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Schakelaar'; + + @override + String get telemetry_polylineLabel => 'Polylijn'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + + @override + String get telemetry_autoFetchQuantity => 'Aantal aanvragen'; + + @override + String get telemetry_error => 'Kan gegevens niet ophalen'; + @override String get neighbors_receivedData => 'Ontvangen Buurdata'; @@ -4146,6 +4339,16 @@ class AppLocalizationsNl extends AppLocalizations { String get translation_composerSubtitle => 'Stelt de standaardstatus van het pictogram voor de vertaling van de componist in.'; + @override + String get translation_autoIncomingTitle => 'Berichten automatisch vertalen'; + + @override + String get translation_autoIncomingSubtitle => + 'Vertaalt berichten automatisch voor meldingen en voor chats of kanalen.'; + + @override + String get translation_translateMessage => 'Bericht vertalen'; + @override String get translation_targetLanguage => 'Doeltaal'; @@ -4273,4 +4476,135 @@ class AppLocalizationsNl extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Inzoomen'; + + @override + String get map_zoomOut => 'Inzoomen'; + + @override + String get map_centerMap => 'Centraal overzicht'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth vereist een Chromium-browser.'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS-locatie bevestigd'; + + @override + String get pathTrace_legendInferred => 'Afgeleide positie'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_pl.dart b/lib/l10n/app_localizations_pl.dart index 6c7c3696..2ec5378b 100644 --- a/lib/l10n/app_localizations_pl.dart +++ b/lib/l10n/app_localizations_pl.dart @@ -92,6 +92,24 @@ class AppLocalizationsPl extends AppLocalizations { @override String get common_disable => 'Wyłącz'; + @override + String get common_undo => 'Wycofaj'; + + @override + String get messageStatus_sent => 'Wysłane'; + + @override + String get messageStatus_delivered => 'Dostarczone'; + + @override + String get messageStatus_pending => 'Wysyłanie'; + + @override + String get messageStatus_failed => 'Nie udało się wysłać'; + + @override + String get messageStatus_repeated => 'Usłyszałem to wielokrotnie'; + @override String get common_reboot => 'Uruchom ponownie'; @@ -111,6 +129,12 @@ class AppLocalizationsPl extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Automatyczne odświeżanie'; + + @override + String get common_interval => 'Interwał'; + @override String get scanner_title => 'MeshCore – wersja open source'; @@ -298,6 +322,10 @@ class AppLocalizationsPl extends AppLocalizations { @override String get scanner_enableBluetooth => 'Włącz Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Szybka zmiana'; @@ -790,11 +818,6 @@ class AppLocalizationsPl extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Liczba prób ponownego wysłania wiadomości przed oznaczaniem jej jako nieudanej'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Bateria'; @@ -1003,6 +1026,15 @@ class AppLocalizationsPl extends AppLocalizations { @override String get contacts_newGroup => 'Nowa Grupa'; + @override + String get contacts_moreOptions => 'Więcej opcji'; + + @override + String get contacts_searchOpen => 'Wyszukaj kontakty'; + + @override + String get contacts_searchClose => 'Zaawansowane wyszukiwanie'; + @override String get contacts_groupName => 'Nazwa grupy'; @@ -1485,35 +1517,6 @@ class AppLocalizationsPl extends AppLocalizations { @override String get debugFrame_hexDump => 'Zrzut hex:'; - @override - String get chat_pathManagement => 'Zarządzanie ścieżkami'; - - @override - String get chat_ShowAllPaths => 'Pokaż wszystkie ścieżki'; - - @override - String get chat_routingMode => 'Tryb routingu'; - - @override - String get chat_autoUseSavedPath => 'Automatyczne (użyj zapisanej ścieżki)'; - - @override - String get chat_forceFloodMode => 'Wymuś tryb zalewowy'; - - @override - String get chat_recentAckPaths => - 'Ostatnie ścieżki ACK (naciśnij, aby użyć):'; - - @override - String get chat_pathHistoryFull => - 'Historia ścieżek jest pełna. Usuń wpisy, aby dodać nowe.'; - - @override - String get chat_hopSingular => 'skok'; - - @override - String get chat_hopPlural => 'skoki'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1527,12 +1530,6 @@ class AppLocalizationsPl extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'Sukcesy'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Usuń ścieżkę'; @@ -1540,52 +1537,148 @@ class AppLocalizationsPl extends AppLocalizations { String get chat_noPathHistoryYet => 'Brak historii ścieżek.\nWyślij wiadomość, aby odkryć ścieżki.'; - @override - String get chat_pathActions => 'Działania ścieżki:'; - - @override - String get chat_setCustomPath => 'Ustaw ścieżkę niestandardową'; - - @override - String get chat_setCustomPathSubtitle => 'Ręcznie określ trasę.'; - - @override - String get chat_clearPath => 'Wyczyść Ścieżkę'; - - @override - String get chat_clearPathSubtitle => - 'Wymuś ponowne wyznaczenie trasy przy następnym wysłaniu'; - @override String get chat_pathCleared => 'Ścieżka wyczyszczona. Następna wiadomość odnajdzie trasę.'; - @override - String get chat_floodModeSubtitle => - 'Użyj przełącznika routingu w pasku narzędzi.'; - - @override - String get chat_floodModeEnabled => - 'Tryb zalewowy włączony. Przełącz z powrotem ikoną routingu w pasku aplikacji.'; - @override String get chat_fullPath => 'Pełna ścieżka'; @override - String get chat_pathDetailsNotAvailable => - 'Szczegóły ścieżki jeszcze niedostępne. Spróbuj wysłać wiadomość, aby odświeżyć.'; + String get routing_title => 'Planowanie tras'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Ścieżka ustawiona: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Samochód'; + + @override + String get routing_modeFlood => 'Powódź'; + + @override + String get routing_modeManual => 'Instrukcja obsługi'; + + @override + String get routing_modeAutoHint => + 'Automatycznie wybiera najpopularniejszą ścieżkę, a w przypadku braku znanej, przechodzi do trybu \"przepływu\".'; + + @override + String get routing_modeFloodHint => + 'Transmisje za pośrednictwem każdego repeatera. Najbardziej niezawodna metoda, ale zużywa więcej czasu transmisji.'; + + @override + String get routing_modeManualHint => + 'Zawsze prowadzi dokładnie po trasie, którą określiłeś.'; + + @override + String get routing_currentRoute => 'Obecna trasa'; + + @override + String get routing_directNoHops => + 'Bezpośrednio – bez pośrednictwa repeaterów'; + + @override + String get routing_noPathYet => + 'Na razie nie ma żadnej ścieżki. Komunikacja trwa do momentu, gdy zostanie odkryta trasa.'; + + @override + String get routing_floodBroadcast => + 'Transmisja za pośrednictwem każdego urządzenia powielającego'; + + @override + String get routing_editPath => 'Edytuj ścieżkę'; + + @override + String get routing_forgetPath => 'Zapomnij o ścieżce'; + + @override + String get routing_knownPaths => 'Znane trasy'; + + @override + String get routing_knownPathsHint => + 'Wybierz ścieżkę, aby przełączyć się na nią.'; + + @override + String get routing_inUse => 'W użyciu'; + + @override + String get routing_qualityStrong => 'Silny pierwszy skok'; + + @override + String get routing_qualityGood => 'Świetny początek'; + + @override + String get routing_qualityFair => 'Świetny pierwszy krzak'; + + @override + String get routing_qualityWorked => 'Zostało dostarczone'; + + @override + String get routing_qualityFlood => 'Usłyszano dzięki doniesieniom'; + + @override + String get routing_qualityUntested => 'Nieużywany'; + + @override + String routing_lastWorked(String when) { + return 'pracował $when'; } + @override + String get routing_neverWorked => 'nigdy nie zostało potwierdzone'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Dostawa w przypadku powodzi'; + + @override + String get pathEditor_title => 'Stworzenie ścieżki'; + + @override + String pathEditor_hopCounter(int count) { + return '$count z 64 rodzajów chmielu'; + } + + @override + String get pathEditor_noHops => + 'Na razie nie dodano żadnych chmielu. Aby dodać je w odpowiedniej kolejności, kliknij w odpowiednie przyciski poniżej, lub zapisz przepis bez chmielu, aby wysłać go bezpośrednio.'; + + @override + String get pathEditor_addHops => 'Dodawaj chmiel zgodnie z kolejnością.'; + + @override + String get pathEditor_searchRepeaters => 'Funkcje powtarzania'; + + @override + String get pathEditor_advancedHex => + 'Zaawansowane: ścieżka w formacie szesnastkowym'; + + @override + String get pathEditor_hexLabel => 'Prefiksy heksadecymalne'; + + @override + String get pathEditor_hexHelper => + 'Dwa znaki szesnastkowe na każdym kroku, oddzielone przecinkami'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Nieprawidłowe: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maksymalnie 64 hopów'; + + @override + String get pathEditor_usePath => 'Użyj tej ścieżki.'; + + @override + String get pathEditor_removeHop => 'Usuń dziką psiankę'; + + @override + String get pathEditor_unknownHop => 'Nieznany repeater'; + @override String get chat_pathSavedLocally => 'Zapisano lokalnie. Połącz się, aby zsynchronizować.'; @@ -1661,6 +1754,39 @@ class AppLocalizationsPl extends AppLocalizations { @override String get map_title => 'Mapa węzłów'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Linia wzroku'; @@ -2055,68 +2181,13 @@ class AppLocalizationsPl extends AppLocalizations { @override String get common_clear => 'Wyczyść'; - @override - String path_currentPath(String path) { - return 'Aktualna ścieżka: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'skoków', - many: 'skoków', - few: 'skoki', - one: 'skok', - ); - return 'Użyj ścieżki $count $_temp0.'; - } - - @override - String get path_enterCustomPath => 'Wprowadź własną ścieżkę'; - @override String get path_currentPathLabel => 'Aktualna ścieżka'; - @override - String get path_hexPrefixInstructions => - 'Wprowadź 2-znakowe prefiksy szesnastkowe dla każdego skoku, oddzielone przecinkami.'; - - @override - String get path_hexPrefixExample => - 'A1,F2,3C (każdy węzeł używa pierwszego bajtu swojego klucza publicznego)'; - - @override - String get path_labelHexPrefixes => 'Ścieżka (prefiksy hex)'; - - @override - String get path_helperMaxHops => - 'Maksymalnie 64 skoki. Każdy prefiks ma 2 znaki szesnastkowe (1 bajt).'; - - @override - String get path_selectFromContacts => 'Albo wybierz z kontaktów:'; - @override String get path_noRepeatersFound => 'Nie znaleziono przekaźników ani serwerów pokoi.'; - @override - String get path_customPathsRequire => - 'Dostosowane ścieżki wymagają pośrednich skoków, które mogą przekazywać wiadomości.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Nieprawidłowe prefiksy szesnastkowe: $prefixes'; - } - - @override - String get path_tooLong => - 'Ścieżka jest zbyt długa. Dozwolonych skoków wynosi 64.'; - - @override - String get path_setPath => 'Ustaw Ścieżkę'; - @override String get repeater_management => 'Zarządzanie przekaźnikami'; @@ -2181,16 +2252,6 @@ class AppLocalizationsPl extends AppLocalizations { @override String get repeater_routingMode => 'Tryb routingu'; - @override - String get repeater_autoUseSavedPath => - 'Automatycznie (użyj zapisanej ścieżki)'; - - @override - String get repeater_forceFloodMode => 'Wymuś tryb zalewowy'; - - @override - String get repeater_pathManagement => 'Zarządzanie ścieżkami'; - @override String get repeater_refresh => 'Odśwież'; @@ -3288,6 +3349,139 @@ class AppLocalizationsPl extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Wejście cyfrowe'; + + @override + String get telemetry_digitalOutputLabel => 'Wyjście cyfrowe'; + + @override + String get telemetry_analogInputLabel => 'Wejście analogowe'; + + @override + String get telemetry_analogOutputLabel => 'Wyjście analogowe'; + + @override + String get telemetry_genericLabel => 'Czujnik ogólny'; + + @override + String get telemetry_luminosityLabel => 'Jasność'; + + @override + String get telemetry_presenceLabel => 'Obecność'; + + @override + String get telemetry_humidityLabel => 'Wilgotność'; + + @override + String get telemetry_accelerometerLabel => 'Akcelerometr'; + + @override + String get telemetry_pressureLabel => 'Ciśnienie'; + + @override + String get telemetry_altitudeLabel => 'Wysokość'; + + @override + String get telemetry_frequencyLabel => 'Częstotliwość'; + + @override + String get telemetry_percentageLabel => 'Procent'; + + @override + String get telemetry_concentrationLabel => 'Stężenie'; + + @override + String get telemetry_powerLabel => 'Moc'; + + @override + String get telemetry_distanceLabel => 'Odległość'; + + @override + String get telemetry_energyLabel => 'Energia'; + + @override + String get telemetry_directionLabel => 'Kierunek'; + + @override + String get telemetry_timeLabel => 'Czas'; + + @override + String get telemetry_gyrometerLabel => 'Żyrometr'; + + @override + String get telemetry_colourLabel => 'Kolor'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Przełącznik'; + + @override + String get telemetry_polylineLabel => 'Polilinia'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + + @override + String get telemetry_autoFetchQuantity => 'Liczba żądań'; + + @override + String get telemetry_error => 'Nie udało się pobrać danych'; + @override String get neighbors_receivedData => 'Otrzymano dane sąsiedztwa'; @@ -4184,6 +4378,17 @@ class AppLocalizationsPl extends AppLocalizations { String get translation_composerSubtitle => 'Kontroluje domyślny stan ikony tłumaczenia w edytorze.'; + @override + String get translation_autoIncomingTitle => + 'Automatycznie tłumacz wiadomości'; + + @override + String get translation_autoIncomingSubtitle => + 'Automatycznie tłumaczy wiadomości do powiadomień oraz do czatów lub kanałów.'; + + @override + String get translation_translateMessage => 'Przetłumacz wiadomość'; + @override String get translation_targetLanguage => 'Język docelowy'; @@ -4309,4 +4514,135 @@ class AppLocalizationsPl extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Przybliż'; + + @override + String get map_zoomOut => 'Przybliż z powrotem'; + + @override + String get map_centerMap => 'Mapa centrum'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth wymaga przeglądarki Chromium.'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS potwierdzone'; + + @override + String get pathTrace_legendInferred => 'Wywnioskowana pozycja'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index e6fd49e3..3eae0e3c 100644 --- a/lib/l10n/app_localizations_pt.dart +++ b/lib/l10n/app_localizations_pt.dart @@ -92,6 +92,24 @@ class AppLocalizationsPt extends AppLocalizations { @override String get common_disable => 'Desativar'; + @override + String get common_undo => 'Desfazer'; + + @override + String get messageStatus_sent => 'Enviado'; + + @override + String get messageStatus_delivered => 'Entregue'; + + @override + String get messageStatus_pending => 'Enviar'; + + @override + String get messageStatus_failed => 'Falhou ao enviar'; + + @override + String get messageStatus_repeated => 'Ouvi repetidamente'; + @override String get common_reboot => 'Reiniciar'; @@ -111,6 +129,12 @@ class AppLocalizationsPt extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Atualização automática'; + + @override + String get common_interval => 'Intervalo'; + @override String get scanner_title => 'MeshCore: Versão aberta'; @@ -296,6 +320,10 @@ class AppLocalizationsPt extends AppLocalizations { @override String get scanner_enableBluetooth => 'Ative o Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Mudar rapidamente'; @@ -787,11 +815,6 @@ class AppLocalizationsPt extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Número de tentativas de reenvio antes de classificar uma mensagem como falha.'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Bateria'; @@ -993,6 +1016,15 @@ class AppLocalizationsPt extends AppLocalizations { @override String get contacts_newGroup => 'Novo Grupo'; + @override + String get contacts_moreOptions => 'Mais opções'; + + @override + String get contacts_searchOpen => 'Pesquisar contatos'; + + @override + String get contacts_searchClose => 'Pesquisa avançada'; + @override String get contacts_groupName => 'Nome do grupo'; @@ -1472,34 +1504,6 @@ class AppLocalizationsPt extends AppLocalizations { @override String get debugFrame_hexDump => 'Espaço Hexadecimal:'; - @override - String get chat_pathManagement => 'Gerenciamento de Caminhos'; - - @override - String get chat_ShowAllPaths => 'Mostrar todos os caminhos'; - - @override - String get chat_routingMode => 'Modo de roteamento'; - - @override - String get chat_autoUseSavedPath => 'Auto (usar caminho salvo)'; - - @override - String get chat_forceFloodMode => 'Modo de Inundação Forçado'; - - @override - String get chat_recentAckPaths => 'Rotas de ACK Recentes (toque para usar):'; - - @override - String get chat_pathHistoryFull => - 'O histórico está cheio. Remova entradas para adicionar novas.'; - - @override - String get chat_hopSingular => 'pule'; - - @override - String get chat_hopPlural => 'salta'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1511,12 +1515,6 @@ class AppLocalizationsPt extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'Sucessos'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Remover caminho'; @@ -1524,53 +1522,148 @@ class AppLocalizationsPt extends AppLocalizations { String get chat_noPathHistoryYet => 'Ainda não há histórico de caminhos.\nEnvie uma mensagem para descobrir caminhos.'; - @override - String get chat_pathActions => 'Ações do Caminho:'; - - @override - String get chat_setCustomPath => 'Definir Caminho Personalizado'; - - @override - String get chat_setCustomPathSubtitle => - 'Especifique manualmente o caminho de roteamento'; - - @override - String get chat_clearPath => 'Limpar Caminho'; - - @override - String get chat_clearPathSubtitle => - 'Forçar a descoberta na próxima transmissão'; - @override String get chat_pathCleared => 'Caminho limpo. A próxima mensagem redescobrirá a rota.'; - @override - String get chat_floodModeSubtitle => - 'Use a chave de roteamento na barra de ferramentas'; - - @override - String get chat_floodModeEnabled => - 'Modo de inundação ativado. Desative-o novamente através do ícone de roteamento na barra de ferramentas.'; - @override String get chat_fullPath => 'Caminho Completo'; @override - String get chat_pathDetailsNotAvailable => - 'Os detalhes do caminho ainda não estão disponíveis. Tente enviar uma mensagem para atualizar.'; + String get routing_title => 'Rotas'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Caminho definido: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Carro'; + + @override + String get routing_modeFlood => 'Inundação'; + + @override + String get routing_modeManual => 'Manual'; + + @override + String get routing_modeAutoHint => + 'Seleciona automaticamente o caminho mais conhecido, e, se nenhum caminho conhecido for encontrado, utiliza a estratégia de \"inundação\".'; + + @override + String get routing_modeFloodHint => + 'Transmissão através de todos os repetidores. É a opção mais confiável, mas utiliza mais tempo de transmissão.'; + + @override + String get routing_modeManualHint => + 'Sempre segue exatamente o caminho que você define.'; + + @override + String get routing_currentRoute => 'Rota atual'; + + @override + String get routing_directNoHops => 'Direto – sem saltos de repetidor'; + + @override + String get routing_noPathYet => + 'Ainda não há um caminho definido. A mensagem continua a ser enviada até que uma rota seja encontrada.'; + + @override + String get routing_floodBroadcast => + 'Transmissão através de todos os repetidores'; + + @override + String get routing_editPath => 'Editar caminho'; + + @override + String get routing_forgetPath => 'Esqueça o caminho'; + + @override + String get routing_knownPaths => 'Rotas conhecidas'; + + @override + String get routing_knownPathsHint => + 'Toque em um caminho para alternar para ele.'; + + @override + String get routing_inUse => 'Em uso'; + + @override + String get routing_qualityStrong => 'Primeiro salto notável'; + + @override + String get routing_qualityGood => 'Primeiro salto bem-sucedido'; + + @override + String get routing_qualityFair => 'Primeira etapa bem-sucedida'; + + @override + String get routing_qualityWorked => 'Foi entregue'; + + @override + String get routing_qualityFlood => + 'Informação obtida através de relatos generalizados.'; + + @override + String get routing_qualityUntested => 'Não testado'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'nunca confirmado'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => + 'Entrega em áreas afetadas por inundações'; + + @override + String get pathEditor_title => 'Criar Caminho'; + + @override + String pathEditor_hopCounter(int count) { + return '$count de 64 gramas de lúpulo'; + } + + @override + String get pathEditor_noHops => + 'Ainda não há lúpulos adicionados. Clique nos repetidores abaixo para adicioná-los na ordem desejada, ou salve sem adicionar lúpulos para enviar diretamente.'; + + @override + String get pathEditor_addHops => 'Adicione os lúpulos na seguinte ordem.'; + + @override + String get pathEditor_searchRepeaters => 'Encontrar repetidores'; + + @override + String get pathEditor_advancedHex => 'Avançado: caminho hexadecimal bruto'; + + @override + String get pathEditor_hexLabel => 'Prefixos hexadecimais'; + + @override + String get pathEditor_hexHelper => + 'Dois caracteres hexadecimais por salto, separados por vírgulas.'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Inválido: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Máximo de 64 saltos'; + + @override + String get pathEditor_usePath => 'Utilize este caminho.'; + + @override + String get pathEditor_removeHop => 'Remova o lúpulo'; + + @override + String get pathEditor_unknownHop => 'Repetidor desconhecido'; + @override String get chat_pathSavedLocally => 'Salvo localmente. Conectar para sincronizar.'; @@ -1645,6 +1738,39 @@ class AppLocalizationsPt extends AppLocalizations { @override String get map_title => 'Mapa de Nós'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Linha de visão'; @@ -2038,66 +2164,13 @@ class AppLocalizationsPt extends AppLocalizations { @override String get common_clear => 'Limpar'; - @override - String path_currentPath(String path) { - return 'Caminho atual: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Usando $count $_temp0 caminho'; - } - - @override - String get path_enterCustomPath => 'Insira Caminho Personalizado'; - @override String get path_currentPathLabel => 'Caminho atual'; - @override - String get path_hexPrefixInstructions => - 'Insira os prefixos hexadecimais de 2 caracteres para cada salto, separados por vírgulas.'; - - @override - String get path_hexPrefixExample => - 'A1,F2,3C (cada nó usa o primeiro byte de sua chave pública)'; - - @override - String get path_labelHexPrefixes => 'Prefixo Hexadecimal'; - - @override - String get path_helperMaxHops => - 'Máximo de 64 saltos. Cada prefixo tem 2 caracteres hexadecimais (1 byte)'; - - @override - String get path_selectFromContacts => 'Ou selecione de contatos:'; - @override String get path_noRepeatersFound => 'Não foram encontrados repetidores ou servidores de sala.'; - @override - String get path_customPathsRequire => - 'Caminhos personalizados exigem saltos intermediários que podem transmitir mensagens.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Prefixos hexadecimais inválidos: $prefixes'; - } - - @override - String get path_tooLong => - 'Caminho muito longo. Máximo de 64 saltos permitidos.'; - - @override - String get path_setPath => 'Definir Caminho'; - @override String get repeater_management => 'Gerenciamento de Repetidor'; @@ -2162,15 +2235,6 @@ class AppLocalizationsPt extends AppLocalizations { @override String get repeater_routingMode => 'Modo de roteamento'; - @override - String get repeater_autoUseSavedPath => 'Auto (usar caminho salvo)'; - - @override - String get repeater_forceFloodMode => 'Modo de Inundação Forçado'; - - @override - String get repeater_pathManagement => 'Gerenciamento de caminhos'; - @override String get repeater_refresh => 'Atualizar'; @@ -3269,6 +3333,139 @@ class AppLocalizationsPt extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Entrada digital'; + + @override + String get telemetry_digitalOutputLabel => 'Saída digital'; + + @override + String get telemetry_analogInputLabel => 'Entrada analógica'; + + @override + String get telemetry_analogOutputLabel => 'Saída analógica'; + + @override + String get telemetry_genericLabel => 'Sensor genérico'; + + @override + String get telemetry_luminosityLabel => 'Luminosidade'; + + @override + String get telemetry_presenceLabel => 'Presença'; + + @override + String get telemetry_humidityLabel => 'Humidade'; + + @override + String get telemetry_accelerometerLabel => 'Acelerómetro'; + + @override + String get telemetry_pressureLabel => 'Pressão'; + + @override + String get telemetry_altitudeLabel => 'Altitude'; + + @override + String get telemetry_frequencyLabel => 'Frequência'; + + @override + String get telemetry_percentageLabel => 'Percentagem'; + + @override + String get telemetry_concentrationLabel => 'Concentração'; + + @override + String get telemetry_powerLabel => 'Potência'; + + @override + String get telemetry_distanceLabel => 'Distância'; + + @override + String get telemetry_energyLabel => 'Energia'; + + @override + String get telemetry_directionLabel => 'Direção'; + + @override + String get telemetry_timeLabel => 'Hora'; + + @override + String get telemetry_gyrometerLabel => 'Girómetro'; + + @override + String get telemetry_colourLabel => 'Cor'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Interruptor'; + + @override + String get telemetry_polylineLabel => 'Polilinha'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + + @override + String get telemetry_autoFetchQuantity => 'Número de solicitações'; + + @override + String get telemetry_error => 'Não foi possível obter os dados'; + @override String get neighbors_receivedData => 'Dados dos Vizinhos Recebidos'; @@ -4159,6 +4356,17 @@ class AppLocalizationsPt extends AppLocalizations { String get translation_composerSubtitle => 'Controla o estado padrão do ícone de tradução do compositor.'; + @override + String get translation_autoIncomingTitle => + 'Traduzir mensagens automaticamente'; + + @override + String get translation_autoIncomingSubtitle => + 'Traduz automaticamente mensagens para notificações e para chats ou canais.'; + + @override + String get translation_translateMessage => 'Traduzir mensagem'; + @override String get translation_targetLanguage => 'Língua-alvo'; @@ -4285,4 +4493,135 @@ class AppLocalizationsPt extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Ampliar'; + + @override + String get map_zoomOut => 'Ampliar'; + + @override + String get map_centerMap => 'Mapa do centro'; + + @override + String get chrome_bluetoothRequiresChromium => + 'O Web Bluetooth requer um navegador Chromium.'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS confirmado'; + + @override + String get pathTrace_legendInferred => 'Posição inferida'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index 25452003..b61320c9 100644 --- a/lib/l10n/app_localizations_ru.dart +++ b/lib/l10n/app_localizations_ru.dart @@ -92,6 +92,24 @@ class AppLocalizationsRu extends AppLocalizations { @override String get common_disable => 'Выключить'; + @override + String get common_undo => 'Отменить'; + + @override + String get messageStatus_sent => 'Отправлено'; + + @override + String get messageStatus_delivered => 'Доставлено'; + + @override + String get messageStatus_pending => 'Отправка'; + + @override + String get messageStatus_failed => 'Не удалось отправить'; + + @override + String get messageStatus_repeated => 'Услышал несколько раз'; + @override String get common_reboot => 'Перезагрузить'; @@ -111,6 +129,12 @@ class AppLocalizationsRu extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Автообновление'; + + @override + String get common_interval => 'Интервал'; + @override String get scanner_title => 'MeshCore Open'; @@ -296,6 +320,10 @@ class AppLocalizationsRu extends AppLocalizations { @override String get scanner_enableBluetooth => 'Включите Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Быстрое переключение'; @@ -789,11 +817,6 @@ class AppLocalizationsRu extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Количество попыток повторной отправки сообщения перед тем, как пометить его как неудачное.'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Батарея'; @@ -994,6 +1017,15 @@ class AppLocalizationsRu extends AppLocalizations { @override String get contacts_newGroup => 'Новая группа'; + @override + String get contacts_moreOptions => 'Больше вариантов'; + + @override + String get contacts_searchOpen => 'Найти контакты'; + + @override + String get contacts_searchClose => 'Закрыть поиск'; + @override String get contacts_groupName => 'Имя группы'; @@ -1473,35 +1505,6 @@ class AppLocalizationsRu extends AppLocalizations { @override String get debugFrame_hexDump => 'Шестнадцатеричный дамп:'; - @override - String get chat_pathManagement => 'Управление маршрутами'; - - @override - String get chat_ShowAllPaths => 'Показать все пути'; - - @override - String get chat_routingMode => 'Режим маршрутизации'; - - @override - String get chat_autoUseSavedPath => 'Авто (использовать сохранённый маршрут)'; - - @override - String get chat_forceFloodMode => 'Принудительный режим рассылки'; - - @override - String get chat_recentAckPaths => - 'Недавние подтверждённые маршруты (нажмите, чтобы использовать):'; - - @override - String get chat_pathHistoryFull => - 'История маршрутов заполнена. Удалите записи, чтобы добавить новые.'; - - @override - String get chat_hopSingular => 'хоп'; - - @override - String get chat_hopPlural => 'хопов'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1515,12 +1518,6 @@ class AppLocalizationsRu extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'успешно'; - - @override - String get chat_score => 'Оценка'; - @override String get chat_removePath => 'Удалить маршрут'; @@ -1528,54 +1525,150 @@ class AppLocalizationsRu extends AppLocalizations { String get chat_noPathHistoryYet => 'История маршрутов пока пуста.\nОтправьте сообщение, чтобы обнаружить маршруты.'; - @override - String get chat_pathActions => 'Действия с маршрутом:'; - - @override - String get chat_setCustomPath => 'Указать маршрут вручную'; - - @override - String get chat_setCustomPathSubtitle => 'Вручную задать маршрут передачи'; - - @override - String get chat_clearPath => 'Очистить маршрут'; - - @override - String get chat_clearPathSubtitle => - 'Принудительно обновить маршрут при следующей отправке'; - @override String get chat_pathCleared => 'Маршрут очищен. Следующее сообщение обновит маршрут.'; - @override - String get chat_floodModeSubtitle => - 'Используйте переключатель маршрутизации в панели приложения'; - - @override - String get chat_floodModeEnabled => - 'Режим рассылки включён. Отключите через значок маршрутизации в панели приложения.'; - @override String get chat_fullPath => 'Полный маршрут'; @override - String get chat_pathDetailsNotAvailable => - 'Детали маршрута ещё недоступны. Попробуйте отправить сообщение для обновления.'; + String get routing_title => 'Маршрутизация'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'хопов', - many: 'хопов', - few: 'хопа', - one: 'хоп', - ); - return 'Маршрут установлен: $hopCount $_temp0 — $status'; + String get routing_modeAuto => 'Авто'; + + @override + String get routing_modeFlood => 'Наводнение'; + + @override + String get routing_modeManual => 'Инструкция'; + + @override + String get routing_modeAutoHint => + 'Автоматически выбирает наиболее известный путь, и если такой путь неизвестен, использует алгоритм поиска пути.'; + + @override + String get routing_modeFloodHint => + 'Передача сигнала через все ретрансляторы. Самый надежный способ, но требует больше времени на передачу.'; + + @override + String get routing_modeManualHint => + 'Всегда следует точно по указанному вами маршруту.'; + + @override + String get routing_currentRoute => 'Текущий маршрут'; + + @override + String get routing_directNoHops => + 'Прямое соединение – без использования ретрансляторов'; + + @override + String get routing_noPathYet => + 'Пока нет пути. Следующее сообщение будет отправлено до тех пор, пока не будет обнаружен маршрут.'; + + @override + String get routing_floodBroadcast => 'Транслируется через все ретрансляторы'; + + @override + String get routing_editPath => 'Изменить путь'; + + @override + String get routing_forgetPath => 'Забудьте о маршруте'; + + @override + String get routing_knownPaths => 'Известные маршруты'; + + @override + String get routing_knownPathsHint => + 'Создайте маршрут для переключения на этот пункт.'; + + @override + String get routing_inUse => 'В эксплуатации'; + + @override + String get routing_qualityStrong => 'Сильный первый скачок'; + + @override + String get routing_qualityGood => 'Хорошее начало'; + + @override + String get routing_qualityFair => 'Первый хороший урожай'; + + @override + String get routing_qualityWorked => 'Осуществлено'; + + @override + String get routing_qualityFlood => + 'Узнал из новостей, распространяющихся в интернете.'; + + @override + String get routing_qualityUntested => 'Непроверенный'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'никогда не было подтверждено'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Доставка при затоплении'; + + @override + String get pathEditor_title => 'Создать маршрут'; + + @override + String pathEditor_hopCounter(int count) { + return '$count из 64 хмеля'; + } + + @override + String get pathEditor_noHops => + 'На данный момент хмель еще не добавлен. Чтобы добавить его, нажмите на соответствующие кнопки ниже в нужном порядке, или сохраните рецепт без хмеля, чтобы отправить его напрямую.'; + + @override + String get pathEditor_addHops => + 'Добавляйте хмель в соответствии с указанным порядком.'; + + @override + String get pathEditor_searchRepeaters => 'Поиск повторителей'; + + @override + String get pathEditor_advancedHex => + 'Продвинутый уровень: прямой путь в шестнадцатеричном формате'; + + @override + String get pathEditor_hexLabel => 'Префиксы шестнадцатеричной системы'; + + @override + String get pathEditor_hexHelper => + 'Два шестнадцатеричных символа на каждом шаге, разделенные запятыми.'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Неверно: $tokens'; + } + + @override + String get pathEditor_tooManyHops => + 'Максимальное количество ингредиентов – 64'; + + @override + String get pathEditor_usePath => 'Используйте этот путь'; + + @override + String get pathEditor_removeHop => 'Удалить хмель'; + + @override + String get pathEditor_unknownHop => 'Неизвестный ретранслятор'; + @override String get chat_pathSavedLocally => 'Сохранено локально. Подключитесь для синхронизации.'; @@ -1650,6 +1743,39 @@ class AppLocalizationsRu extends AppLocalizations { @override String get map_title => 'Карта нод'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Линия видимости'; @@ -2043,66 +2169,12 @@ class AppLocalizationsRu extends AppLocalizations { @override String get common_clear => 'Очистить'; - @override - String path_currentPath(String path) { - return 'Текущий маршрут: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'хопов', - many: 'хопов', - few: 'хопа', - one: 'хоп', - ); - return 'Используется маршрут из $count $_temp0'; - } - - @override - String get path_enterCustomPath => 'Введите маршрут вручную'; - @override String get path_currentPathLabel => 'Текущий маршрут'; - @override - String get path_hexPrefixInstructions => - 'Введите 2-символьные шестнадцатеричные префиксы для каждого хопа, разделённые запятыми.'; - - @override - String get path_hexPrefixExample => - 'Пример: A1,F2,3C (каждый узел использует первый байт своего публичного ключа)'; - - @override - String get path_labelHexPrefixes => 'Маршрут (шестнадцатеричные префиксы)'; - - @override - String get path_helperMaxHops => - 'Максимум 64 хопа. Каждый префикс — 2 шестнадцатеричных символа (1 байт)'; - - @override - String get path_selectFromContacts => 'Или выберите из контактов:'; - @override String get path_noRepeatersFound => 'Репитеры или серверы комнат не найдены.'; - @override - String get path_customPathsRequire => - 'Пользовательские маршруты требуют промежуточных узлов, способных ретранслировать сообщения.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Недопустимые шестнадцатеричные префиксы: $prefixes'; - } - - @override - String get path_tooLong => 'Маршрут слишком длинный. Максимум 64 хопа.'; - - @override - String get path_setPath => 'Установить маршрут'; - @override String get repeater_management => 'Управление репитером'; @@ -2167,16 +2239,6 @@ class AppLocalizationsRu extends AppLocalizations { @override String get repeater_routingMode => 'Режим маршрутизации'; - @override - String get repeater_autoUseSavedPath => - 'Авто (использовать сохранённый маршрут)'; - - @override - String get repeater_forceFloodMode => 'Принудительный режим рассылки'; - - @override - String get repeater_pathManagement => 'Управление маршрутами'; - @override String get repeater_refresh => 'Обновить'; @@ -3277,6 +3339,139 @@ class AppLocalizationsRu extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Цифровой вход'; + + @override + String get telemetry_digitalOutputLabel => 'Цифровой выход'; + + @override + String get telemetry_analogInputLabel => 'Аналоговый вход'; + + @override + String get telemetry_analogOutputLabel => 'Аналоговый выход'; + + @override + String get telemetry_genericLabel => 'Общий датчик'; + + @override + String get telemetry_luminosityLabel => 'Освещённость'; + + @override + String get telemetry_presenceLabel => 'Присутствие'; + + @override + String get telemetry_humidityLabel => 'Влажность'; + + @override + String get telemetry_accelerometerLabel => 'Акселерометр'; + + @override + String get telemetry_pressureLabel => 'Давление'; + + @override + String get telemetry_altitudeLabel => 'Высота'; + + @override + String get telemetry_frequencyLabel => 'Частота'; + + @override + String get telemetry_percentageLabel => 'Процент'; + + @override + String get telemetry_concentrationLabel => 'Концентрация'; + + @override + String get telemetry_powerLabel => 'Мощность'; + + @override + String get telemetry_distanceLabel => 'Расстояние'; + + @override + String get telemetry_energyLabel => 'Энергия'; + + @override + String get telemetry_directionLabel => 'Направление'; + + @override + String get telemetry_timeLabel => 'Время'; + + @override + String get telemetry_gyrometerLabel => 'Гирометр'; + + @override + String get telemetry_colourLabel => 'Цвет'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Переключатель'; + + @override + String get telemetry_polylineLabel => 'Полилиния'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters м'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Гц'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa гПа'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux лк'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts Вт'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters м'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours кВт⋅ч'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + + @override + String get telemetry_autoFetchQuantity => 'Количество запросов'; + + @override + String get telemetry_error => 'Не удалось получить данные'; + @override String get neighbors_receivedData => 'Полученные данные о соседях'; @@ -4177,6 +4372,17 @@ class AppLocalizationsRu extends AppLocalizations { String get translation_composerSubtitle => 'Управляет исходным состоянием значка перевода, предоставляемого редактором.'; + @override + String get translation_autoIncomingTitle => + 'Автоматически переводить сообщения'; + + @override + String get translation_autoIncomingSubtitle => + 'Автоматически переводит сообщения для уведомлений, а также для чатов и каналов.'; + + @override + String get translation_translateMessage => 'Перевести сообщение'; + @override String get translation_targetLanguage => 'Целевой язык'; @@ -4303,4 +4509,135 @@ class AppLocalizationsRu extends AppLocalizations { @override String get contact_typeUnknown => 'Неизвестно'; + + @override + String get map_zoomIn => 'Увеличить масштаб'; + + @override + String get map_zoomOut => 'Увеличить масштаб'; + + @override + String get map_centerMap => 'Карта центра'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Для работы Web Bluetooth требуется браузер на основе Chromium.'; + + @override + String channels_communityShortId(String id) { + return 'Идентификатор: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS подтверждено'; + + @override + String get pathTrace_legendInferred => 'Выведенная позиция'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_sk.dart b/lib/l10n/app_localizations_sk.dart index 91461385..71286d55 100644 --- a/lib/l10n/app_localizations_sk.dart +++ b/lib/l10n/app_localizations_sk.dart @@ -92,6 +92,24 @@ class AppLocalizationsSk extends AppLocalizations { @override String get common_disable => 'Zakázať'; + @override + String get common_undo => 'Zrušiť'; + + @override + String get messageStatus_sent => 'Odoslané'; + + @override + String get messageStatus_delivered => 'Doručené'; + + @override + String get messageStatus_pending => 'Odoslanie'; + + @override + String get messageStatus_failed => 'Neúspešné odeslanie'; + + @override + String get messageStatus_repeated => 'Slyšal som to opakovane'; + @override String get common_reboot => 'Restartovať'; @@ -111,6 +129,12 @@ class AppLocalizationsSk extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Automatické obnovenie'; + + @override + String get common_interval => 'Časový interval'; + @override String get scanner_title => 'MeshCore – Verzia pre verejnosť'; @@ -295,6 +319,10 @@ class AppLocalizationsSk extends AppLocalizations { @override String get scanner_enableBluetooth => 'Povolte Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Rýchle prepínač'; @@ -776,11 +804,6 @@ class AppLocalizationsSk extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Počet pokusov o odošleť pred označením správy ako neúspešnej'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Batéria'; @@ -982,6 +1005,15 @@ class AppLocalizationsSk extends AppLocalizations { @override String get contacts_newGroup => 'Nová skupina'; + @override + String get contacts_moreOptions => 'Ďalšie možnosti'; + + @override + String get contacts_searchOpen => 'Vyhľadajte kontakty'; + + @override + String get contacts_searchClose => 'Zavrieť vyhľadávanie'; + @override String get contacts_groupName => 'Názov skupiny'; @@ -1463,35 +1495,6 @@ class AppLocalizationsSk extends AppLocalizations { @override String get debugFrame_hexDump => 'Hexová analýza:'; - @override - String get chat_pathManagement => 'Správa ciest'; - - @override - String get chat_ShowAllPaths => 'Zobraziť všetky cesty'; - - @override - String get chat_routingMode => 'Režim trasy'; - - @override - String get chat_autoUseSavedPath => 'Použiť uloženú cestu'; - - @override - String get chat_forceFloodMode => - 'Zavrieť režim núdzového povodňového režimu'; - - @override - String get chat_recentAckPaths => 'Nedávne cesty ACK (klepni na použitie):'; - - @override - String get chat_pathHistoryFull => - 'História ciest je plná. Odstráňte záznamy, aby ste mohli pridať nové.'; - - @override - String get chat_hopSingular => 'Skok'; - - @override - String get chat_hopPlural => 'Skákať'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1503,12 +1506,6 @@ class AppLocalizationsSk extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'Úspechy'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Odstrániť cestu'; @@ -1516,52 +1513,148 @@ class AppLocalizationsSk extends AppLocalizations { String get chat_noPathHistoryYet => 'Zatiaľ žiadna história trás.\nPošlite správu a objavte trasy.'; - @override - String get chat_pathActions => 'Cesty:'; - - @override - String get chat_setCustomPath => 'Nastaviť vlastnú cestu'; - - @override - String get chat_setCustomPathSubtitle => 'Ručne zadajte trasu.'; - - @override - String get chat_clearPath => 'Vyčistiš cestu'; - - @override - String get chat_clearPathSubtitle => - 'Znovu nájsť vynútene pri nasledujúcej pošlite'; - @override String get chat_pathCleared => 'Cesta vyčistená. Nasledujúce prepočetné získa trasu znova.'; - @override - String get chat_floodModeSubtitle => - 'Použite prepínanie trasy v navigačnom paneli.'; - - @override - String get chat_floodModeEnabled => - 'Odosporňovacia prevádzka je zapnutá. Vypnite ju znova cez ikonu routovania v navigačnom páse.'; - @override String get chat_fullPath => 'Celá cesta'; @override - String get chat_pathDetailsNotAvailable => - 'Podrobnosti o ceste zatiaľ dostupné nie sú. Skúste poslať správu na obnovenie.'; + String get routing_title => 'Navigácia'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Cesta nastavená: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Povodňová vlna'; + + @override + String get routing_modeManual => 'Ručná príručka'; + + @override + String get routing_modeAutoHint => + 'Automaticky vyberá najznámejší trasa, a ak žiadna nie je známa, použije náhodnú trasu.'; + + @override + String get routing_modeFloodHint => + 'Prenos prostredníctvom všetkých opakovačov. Najspoľahlivejší spôsob, ale vyžaduje viac času vysielania.'; + + @override + String get routing_modeManualHint => + 'Vždy dodáva presne podľa zadaného trasy.'; + + @override + String get routing_currentRoute => 'Aktuálna trasa'; + + @override + String get routing_directNoHops => 'Priamo – bez prechodných trás'; + + @override + String get routing_noPathYet => + 'Zatiaľ neexistuje žiadna cesta. Nasledujúce správy budú pokračovať, kým sa nenájde trasa.'; + + @override + String get routing_floodBroadcast => + 'Prenos prostredníctvom každého opakovača'; + + @override + String get routing_editPath => 'Upraviť trasu'; + + @override + String get routing_forgetPath => 'Zabudnite na trasu'; + + @override + String get routing_knownPaths => 'Známe cesty'; + + @override + String get routing_knownPathsHint => + 'Kliknite na cestu, aby ste sa k nej presunuli.'; + + @override + String get routing_inUse => 'V prevádzke'; + + @override + String get routing_qualityStrong => 'Silný prvý krok'; + + @override + String get routing_qualityGood => 'Úspešný prvý krok'; + + @override + String get routing_qualityFair => 'Prvá, spravodlivá fáza'; + + @override + String get routing_qualityWorked => 'Dosiahnutý úspech'; + + @override + String get routing_qualityFlood => + 'Zistil som to z informácií, ktoré som získal v dôsledku povodňovej situácie.'; + + @override + String get routing_qualityUntested => 'Neotestované'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'nikedy nebolo potvrdené'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Doručenie v prípade povodní'; + + @override + String get pathEditor_title => 'Vytvorenie cesty'; + + @override + String pathEditor_hopCounter(int count) { + return '$count z 64 chmelových zŕš'; + } + + @override + String get pathEditor_noHops => + 'Zatiaľ žiadne chmel. Kliknite na opakované, aby ste ich pridali postupne, alebo uložte bez chmelu, aby ste ho mohli poslať priamo.'; + + @override + String get pathEditor_addHops => 'Pridávajte chmel podľa zadaného poriadku.'; + + @override + String get pathEditor_searchRepeaters => 'Hľadať opakované'; + + @override + String get pathEditor_advancedHex => 'Pokročilé: pôvodná hexová cesta'; + + @override + String get pathEditor_hexLabel => 'Prefiksy pre hexadecimálne čísla'; + + @override + String get pathEditor_hexHelper => + 'Dve hexové čísla na každý krok, oddelené čiarkami'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Neplatné: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximálne 64 krokov'; + + @override + String get pathEditor_usePath => 'Použite túto cestu'; + + @override + String get pathEditor_removeHop => 'Odstráňte chmel'; + + @override + String get pathEditor_unknownHop => + 'Neznáme zariadenie na opakované vysielanie'; + @override String get chat_pathSavedLocally => 'Uložené lokálne. Spojte sa na synchronizáciu.'; @@ -1637,6 +1730,39 @@ class AppLocalizationsSk extends AppLocalizations { @override String get map_title => 'Mapa uzlov'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Úroveň výhľadu'; @@ -2029,66 +2155,13 @@ class AppLocalizationsSk extends AppLocalizations { @override String get common_clear => 'Zmazať'; - @override - String path_currentPath(String path) { - return 'Aktívna cesta: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Používa $count $_temp0 cestu'; - } - - @override - String get path_enterCustomPath => 'Zadajte vlastný priebeh'; - @override String get path_currentPathLabel => 'Aktuálny priebeh'; - @override - String get path_hexPrefixInstructions => - 'Zadajte 2-miestne hexové predpony pre každú fázu, oddelené čiarkami.'; - - @override - String get path_hexPrefixExample => - 'A1,F2,3C (každý uzel používa prvý bajt svojho verejného kľúča)'; - - @override - String get path_labelHexPrefixes => 'Cesty (hexové predpony)'; - - @override - String get path_helperMaxHops => - 'Max 64 skokov. Každý prefix je 2 hexadecimálne znaky (1 bajt).'; - - @override - String get path_selectFromContacts => 'Vyberte sa z kontaktov:'; - @override String get path_noRepeatersFound => 'Nenašli sa žiadne opakovače ani serverové miestnosti.'; - @override - String get path_customPathsRequire => - 'Vlastné cesty vyžadujú medziletoch, ktoré môžu prenášať správky.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Neplatné hexové predpony: $prefixes'; - } - - @override - String get path_tooLong => - 'Cesta je príliš dlhá. Umožnené je maximum 64 skokov.'; - - @override - String get path_setPath => 'Nastaviť cestu'; - @override String get repeater_management => 'Správa opakérov'; @@ -2153,16 +2226,6 @@ class AppLocalizationsSk extends AppLocalizations { @override String get repeater_routingMode => 'Režim trasy'; - @override - String get repeater_autoUseSavedPath => 'Použiť uloženú cestu'; - - @override - String get repeater_forceFloodMode => - 'Zavrieť režim núdzového povodňového režimu'; - - @override - String get repeater_pathManagement => 'Správa trás'; - @override String get repeater_refresh => 'Obnoviť'; @@ -3255,6 +3318,139 @@ class AppLocalizationsSk extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Digitálny vstup'; + + @override + String get telemetry_digitalOutputLabel => 'Digitálny výstup'; + + @override + String get telemetry_analogInputLabel => 'Analógový vstup'; + + @override + String get telemetry_analogOutputLabel => 'Analógový výstup'; + + @override + String get telemetry_genericLabel => 'Všeobecný senzor'; + + @override + String get telemetry_luminosityLabel => 'Osvetlenie'; + + @override + String get telemetry_presenceLabel => 'Prítomnosť'; + + @override + String get telemetry_humidityLabel => 'Vlhkosť'; + + @override + String get telemetry_accelerometerLabel => 'Akcelerometer'; + + @override + String get telemetry_pressureLabel => 'Tlak'; + + @override + String get telemetry_altitudeLabel => 'Nadmorská výška'; + + @override + String get telemetry_frequencyLabel => 'Frekvencia'; + + @override + String get telemetry_percentageLabel => 'Percento'; + + @override + String get telemetry_concentrationLabel => 'Koncentrácia'; + + @override + String get telemetry_powerLabel => 'Výkon'; + + @override + String get telemetry_distanceLabel => 'Vzdialenosť'; + + @override + String get telemetry_energyLabel => 'Energia'; + + @override + String get telemetry_directionLabel => 'Smer'; + + @override + String get telemetry_timeLabel => 'Čas'; + + @override + String get telemetry_gyrometerLabel => 'Gyrometer'; + + @override + String get telemetry_colourLabel => 'Farba'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Prepínač'; + + @override + String get telemetry_polylineLabel => 'Lomená čiara'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + + @override + String get telemetry_autoFetchQuantity => 'Počet požiadaviek'; + + @override + String get telemetry_error => 'Nepodarilo sa získať údaje'; + @override String get neighbors_receivedData => 'Obdielo dáta suseda'; @@ -4141,6 +4337,16 @@ class AppLocalizationsSk extends AppLocalizations { String get translation_composerSubtitle => 'Riadi výchoce stav ikony pre preklad, ktorú používa program.'; + @override + String get translation_autoIncomingTitle => 'Automaticky prekladať správy'; + + @override + String get translation_autoIncomingSubtitle => + 'Automaticky prekladá správy pre upozornenia aj pre čet alebo kanál.'; + + @override + String get translation_translateMessage => 'Preložiť správu'; + @override String get translation_targetLanguage => 'Cieľový jazyk'; @@ -4269,4 +4475,135 @@ class AppLocalizationsSk extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Zväčšiť'; + + @override + String get map_zoomOut => 'Zmenť zamer zblízka'; + + @override + String get map_centerMap => 'Mapa centra'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth vyžaduje prehliadač Chromium.'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS potvrdilo'; + + @override + String get pathTrace_legendInferred => 'Odvodená poloha'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_sl.dart b/lib/l10n/app_localizations_sl.dart index 48103647..8f09c5ce 100644 --- a/lib/l10n/app_localizations_sl.dart +++ b/lib/l10n/app_localizations_sl.dart @@ -92,6 +92,25 @@ class AppLocalizationsSl extends AppLocalizations { @override String get common_disable => 'Izklopiti'; + @override + String get common_undo => 'Preobrn'; + + @override + String get messageStatus_sent => 'Pošljeno'; + + @override + String get messageStatus_delivered => 'Dostavljeno'; + + @override + String get messageStatus_pending => 'Pošiljanje'; + + @override + String get messageStatus_failed => + 'Uspešno ni bilo mogo, da se sporočilo pošlje'; + + @override + String get messageStatus_repeated => 'Slišal sem večkrat'; + @override String get common_reboot => 'Ponoviti'; @@ -111,6 +130,12 @@ class AppLocalizationsSl extends AppLocalizations { return '$percent %'; } + @override + String get common_autoRefresh => 'Samodejno osveževanje'; + + @override + String get common_interval => 'Časovni interval'; + @override String get scanner_title => 'MeshCore – Odprto'; @@ -293,6 +318,10 @@ class AppLocalizationsSl extends AppLocalizations { @override String get scanner_enableBluetooth => 'Omogočite Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Hitro preklop'; @@ -777,11 +806,6 @@ class AppLocalizationsSl extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Število poskusov ponovnega poslanja, preden se sporočilo označuje kot neuspešno'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Baterija'; @@ -981,6 +1005,15 @@ class AppLocalizationsSl extends AppLocalizations { @override String get contacts_newGroup => 'Nova skupina'; + @override + String get contacts_moreOptions => 'Več možnosti'; + + @override + String get contacts_searchOpen => 'Iskanje kontaktov'; + + @override + String get contacts_searchClose => 'Izklopi iskanje'; + @override String get contacts_groupName => 'Ime skupine'; @@ -1460,34 +1493,6 @@ class AppLocalizationsSl extends AppLocalizations { @override String get debugFrame_hexDump => 'Izpis heksadecimalnih vrednosti:'; - @override - String get chat_pathManagement => 'Upravljanje poti'; - - @override - String get chat_ShowAllPaths => 'Prikaži vse poti'; - - @override - String get chat_routingMode => 'Navodilo za usmerjevalni način'; - - @override - String get chat_autoUseSavedPath => 'Avto (uporabi shranjeno pot)'; - - @override - String get chat_forceFloodMode => 'Nasilje obvezati v način'; - - @override - String get chat_recentAckPaths => 'Nedavni poti ACK (tap za uporabo):'; - - @override - String get chat_pathHistoryFull => - 'Zapiske o poti so popolni. Izbriši vnose, da dodaš nove.'; - - @override - String get chat_hopSingular => 'skok'; - - @override - String get chat_hopPlural => 'skokov'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1499,12 +1504,6 @@ class AppLocalizationsSl extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'Uspešni'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Izbriši pot'; @@ -1512,51 +1511,144 @@ class AppLocalizationsSl extends AppLocalizations { String get chat_noPathHistoryYet => 'Ni shranjenih poti.\nPošlji sporočilo za odkrivanje poti.'; - @override - String get chat_pathActions => 'Potni ukazi:'; - - @override - String get chat_setCustomPath => 'Nastavi Prilozeno Pot'; - - @override - String get chat_setCustomPathSubtitle => 'Ročno določite potniško pot.'; - - @override - String get chat_clearPath => 'Počisti pot'; - - @override - String get chat_clearPathSubtitle => 'Ob naslednji pošiljanju znova zbrati.'; - @override String get chat_pathCleared => 'Pot je očiščena. Naslednje sporočilo bo ponovno odkril pot.'; - @override - String get chat_floodModeSubtitle => - 'Uporabi tipko usmerjevanja v meniju aplikacije.'; - - @override - String get chat_floodModeEnabled => - 'Narejena je bila omrežna modaliteta. Vklopi jo znova preko ikone v meniju aplikacije.'; - @override String get chat_fullPath => 'Polna pot'; @override - String get chat_pathDetailsNotAvailable => - 'Podrobnosti poti zaenkrat niso na voljo. Poskusite poslati sporočilo za osvežitev.'; + String get routing_title => 'Navigacija'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Pot nastavljen: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Avto'; + + @override + String get routing_modeFlood => 'Poplavo'; + + @override + String get routing_modeManual => 'Navodilo'; + + @override + String get routing_modeAutoHint => + 'Samodejno izbere najbolj poznano pot, in sicer, ko ni na voljo nobena.'; + + @override + String get routing_modeFloodHint => + 'Prenosi preko vseh repetitorjev. Najzanesljivejši način, vendar zahteva več časa.'; + + @override + String get routing_modeManualHint => + 'Vedno sledi natančni poti, ki jo ste določili.'; + + @override + String get routing_currentRoute => 'Trenutna pot'; + + @override + String get routing_directNoHops => 'Neposredno – brez prehodov'; + + @override + String get routing_noPathYet => + 'Žep trenutno ni mogoče najti. Naslednje sporočilo bo posredovano, dokler ne bo ugotovljeno, kje je pot.'; + + @override + String get routing_floodBroadcast => 'Prenos preko vseh repetitiv'; + + @override + String get routing_editPath => 'Uredi pot'; + + @override + String get routing_forgetPath => 'Pozabi na pot'; + + @override + String get routing_knownPaths => 'Poznati poti'; + + @override + String get routing_knownPathsHint => 'Kliknite na pot, da jo izberete.'; + + @override + String get routing_inUse => 'V uporabi'; + + @override + String get routing_qualityStrong => 'Močan prvi korak'; + + @override + String get routing_qualityGood => 'Prva uspešna faza'; + + @override + String get routing_qualityFair => 'Prva, uspešna faza'; + + @override + String get routing_qualityWorked => 'Izpolnil'; + + @override + String get routing_qualityFlood => 'Slišano preko poplave'; + + @override + String get routing_qualityUntested => 'Ne preizkušen'; + + @override + String routing_lastWorked(String when) { + return 'delal/a $when'; } + @override + String get routing_neverWorked => 'nikoli ni bilo potrjeno'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Dostava zaradi poplave'; + + @override + String get pathEditor_title => 'Izgradnja poti'; + + @override + String pathEditor_hopCounter(int count) { + return '$count od 64 različnih sort hropa'; + } + + @override + String get pathEditor_noHops => + 'Še niso dodani hmelji. Za dodajanje hmelja v vrstnem redu kliknite na povezavo spodaj, ali pa shranite brez dodanega hmelja, da ga lahko posredujete neposredno.'; + + @override + String get pathEditor_addHops => 'Dodajte suho travo v skladu s postopkom.'; + + @override + String get pathEditor_searchRepeaters => 'Iskanje ponovitev'; + + @override + String get pathEditor_advancedHex => 'Napredno: surovi šestnajstni pot'; + + @override + String get pathEditor_hexLabel => 'Predfiks za heksadecimalno šifro'; + + @override + String get pathEditor_hexHelper => + 'Dva šestbitna znaka na vsak skok, ločena z vejico'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Neveljaven: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Največ 64 hopov'; + + @override + String get pathEditor_usePath => 'Uporabite to poto'; + + @override + String get pathEditor_removeHop => 'Odstranite hmelj'; + + @override + String get pathEditor_unknownHop => 'Neznani ponovitelj'; + @override String get chat_pathSavedLocally => 'Shrano lokalno. Povežite se za sinhronizacijo.'; @@ -1631,6 +1723,39 @@ class AppLocalizationsSl extends AppLocalizations { @override String get map_title => 'Mapa omrežja'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Linija vida'; @@ -2026,65 +2151,13 @@ class AppLocalizationsSl extends AppLocalizations { @override String get common_clear => 'Ponoviti'; - @override - String path_currentPath(String path) { - return 'Trenutna pot: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Uporablja $count $_temp0 pot'; - } - - @override - String get path_enterCustomPath => 'Vnesite prilagojeno pot'; - @override String get path_currentPathLabel => 'Trenutna pot'; - @override - String get path_hexPrefixInstructions => - 'Vnesite 2-karakterne heksadecimalne prefixe za vsako skopo, ločeno z zvezekami.'; - - @override - String get path_hexPrefixExample => - 'Primer: A1,F2,3C (vsak notranji element uporablja prvi bajt svojega javnega ključa)'; - - @override - String get path_labelHexPrefixes => 'Pot (heksafixne skrajšave)'; - - @override - String get path_helperMaxHops => - 'Maksimalno 64 skokov. Vsak prefiks je 2 heksadecimalna znamenja (1 bajt).'; - - @override - String get path_selectFromContacts => 'Izberi iz kontaktov:'; - @override String get path_noRepeatersFound => 'Ne najdenih ponoviteljev ali strežnikov sob.'; - @override - String get path_customPathsRequire => - 'Prilojene poti zahtevajo medhodne prenose, ki lahko prenašajo sporočila.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Neveljačni šesteročlenski prefiksi: $prefixes'; - } - - @override - String get path_tooLong => 'Pot je prevelika. Dovoljeno največ 64 skokov.'; - - @override - String get path_setPath => 'Nastavi Pot'; - @override String get repeater_management => 'Upravljanje ponovitve'; @@ -2150,15 +2223,6 @@ class AppLocalizationsSl extends AppLocalizations { @override String get repeater_routingMode => 'Navodilo za usmerjevalni način'; - @override - String get repeater_autoUseSavedPath => 'Avto (uporabi shranjeno pot)'; - - @override - String get repeater_forceFloodMode => 'Nasilje obvezati v način'; - - @override - String get repeater_pathManagement => 'Upravljanje poti'; - @override String get repeater_refresh => 'Ponovno obnavljati'; @@ -3250,6 +3314,139 @@ class AppLocalizationsSl extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Digitalni vhod'; + + @override + String get telemetry_digitalOutputLabel => 'Digitalni izhod'; + + @override + String get telemetry_analogInputLabel => 'Analogni vhod'; + + @override + String get telemetry_analogOutputLabel => 'Analogni izhod'; + + @override + String get telemetry_genericLabel => 'Splošni senzor'; + + @override + String get telemetry_luminosityLabel => 'Osvetljenost'; + + @override + String get telemetry_presenceLabel => 'Prisotnost'; + + @override + String get telemetry_humidityLabel => 'Vlažnost'; + + @override + String get telemetry_accelerometerLabel => 'Merilnik pospeška'; + + @override + String get telemetry_pressureLabel => 'Tlak'; + + @override + String get telemetry_altitudeLabel => 'Nadmorska višina'; + + @override + String get telemetry_frequencyLabel => 'Frekvenca'; + + @override + String get telemetry_percentageLabel => 'Odstotek'; + + @override + String get telemetry_concentrationLabel => 'Koncentracija'; + + @override + String get telemetry_powerLabel => 'Moč'; + + @override + String get telemetry_distanceLabel => 'Razdalja'; + + @override + String get telemetry_energyLabel => 'Energija'; + + @override + String get telemetry_directionLabel => 'Smer'; + + @override + String get telemetry_timeLabel => 'Čas'; + + @override + String get telemetry_gyrometerLabel => 'Žiroskop'; + + @override + String get telemetry_colourLabel => 'Barva'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Stikalo'; + + @override + String get telemetry_polylineLabel => 'Polilinija'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + + @override + String get telemetry_autoFetchQuantity => 'Število zahtev'; + + @override + String get telemetry_error => 'Podatkov ni bilo mogoče pridobiti'; + @override String get neighbors_receivedData => 'Prejeto podatke o sosedih'; @@ -4139,6 +4336,16 @@ class AppLocalizationsSl extends AppLocalizations { String get translation_composerSubtitle => 'Ureja privzeto stanje ikone za prevod, ki jo uporablja avtor.'; + @override + String get translation_autoIncomingTitle => 'Samodejno prevajaj sporočila'; + + @override + String get translation_autoIncomingSubtitle => + 'Samodejno prevaja sporočila za obvestila ter za klepete ali kanale.'; + + @override + String get translation_translateMessage => 'Prevedi sporočilo'; + @override String get translation_targetLanguage => 'Ciljna jezika'; @@ -4267,4 +4474,135 @@ class AppLocalizationsSl extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Povečaj'; + + @override + String get map_zoomOut => 'Povečajte pogled'; + + @override + String get map_centerMap => 'Krajšarska karta'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth zahteva brskalnik Chromium.'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS potrdilo'; + + @override + String get pathTrace_legendInferred => 'Izpeljana lokacija'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_sv.dart b/lib/l10n/app_localizations_sv.dart index 7453c18f..4a281eef 100644 --- a/lib/l10n/app_localizations_sv.dart +++ b/lib/l10n/app_localizations_sv.dart @@ -92,6 +92,24 @@ class AppLocalizationsSv extends AppLocalizations { @override String get common_disable => 'Inaktivera'; + @override + String get common_undo => 'Ångra'; + + @override + String get messageStatus_sent => 'Sen'; + + @override + String get messageStatus_delivered => 'Levererad'; + + @override + String get messageStatus_pending => 'Skicka'; + + @override + String get messageStatus_failed => 'Misslyckades med att skicka'; + + @override + String get messageStatus_repeated => 'Hördes upprepade gånger'; + @override String get common_reboot => 'Start om'; @@ -111,6 +129,12 @@ class AppLocalizationsSv extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Automatisk uppdatering'; + + @override + String get common_interval => 'Intervall'; + @override String get scanner_title => 'MeshCore – Öppen version'; @@ -292,6 +316,10 @@ class AppLocalizationsSv extends AppLocalizations { @override String get scanner_enableBluetooth => 'Aktivera Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Snabb växling'; @@ -771,11 +799,6 @@ class AppLocalizationsSv extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Antal försök att skicka om ett meddelande innan det markeras som misslyckat.'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Batteri'; @@ -976,6 +999,15 @@ class AppLocalizationsSv extends AppLocalizations { @override String get contacts_newGroup => 'Ny grupp'; + @override + String get contacts_moreOptions => 'Fler alternativ'; + + @override + String get contacts_searchOpen => 'Sök efter kontakter'; + + @override + String get contacts_searchClose => 'Avancerad sökning'; + @override String get contacts_groupName => 'Gruppnamn'; @@ -1454,35 +1486,6 @@ class AppLocalizationsSv extends AppLocalizations { @override String get debugFrame_hexDump => 'Hexdump:'; - @override - String get chat_pathManagement => 'Stigarhantering'; - - @override - String get chat_ShowAllPaths => 'Visa alla vägar'; - - @override - String get chat_routingMode => 'Ruttläge'; - - @override - String get chat_autoUseSavedPath => 'Automatisk (använd sparad sökväg)'; - - @override - String get chat_forceFloodMode => 'Tvinga Översvämningsläge'; - - @override - String get chat_recentAckPaths => - 'Nyligen Ack-vägar (tryck för att använda):'; - - @override - String get chat_pathHistoryFull => - 'Historisk sökväg är full. Ta bort poster för att lägga till nya.'; - - @override - String get chat_hopSingular => 'hoppa'; - - @override - String get chat_hopPlural => 'hoppar'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1494,12 +1497,6 @@ class AppLocalizationsSv extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'framgångar'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Ta bort sökväg'; @@ -1507,50 +1504,144 @@ class AppLocalizationsSv extends AppLocalizations { String get chat_noPathHistoryYet => 'Ingen historik ännu.\nSkicka ett meddelande för att upptäcka spår.'; - @override - String get chat_pathActions => 'Stigar:'; - - @override - String get chat_setCustomPath => 'Ange anpassad sökväg'; - - @override - String get chat_setCustomPathSubtitle => 'Ange ruttväg manuellt'; - - @override - String get chat_clearPath => 'Rensa Vägen'; - - @override - String get chat_clearPathSubtitle => 'Tvinga fram omstart vid nästa sändning'; - @override String get chat_pathCleared => 'Routen är nu fri. Nästa meddelande kommer att upptäcka rutten igen.'; - @override - String get chat_floodModeSubtitle => 'Använd routningsomkopplaren i appraden'; - - @override - String get chat_floodModeEnabled => - 'Översvämningsläge aktiverat. Stäng av via ruttikonen i appraden.'; - @override String get chat_fullPath => 'Fullständig sökväg'; @override - String get chat_pathDetailsNotAvailable => - 'Stigaruppgifterna är ännu inte tillgängliga. Försök att skicka ett meddelande för att uppdatera.'; + String get routing_title => 'Ruttplanering'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hoppar', - one: 'hopp', - ); - return 'Sökväg inställd: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Bil'; + + @override + String get routing_modeFlood => 'Översvämning'; + + @override + String get routing_modeManual => 'Instruktioner'; + + @override + String get routing_modeAutoHint => + 'Väljer automatiskt den bästa kända vägen, och använder en \"flooding\"-strategi om ingen väg är känd.'; + + @override + String get routing_modeFloodHint => + 'Sändningar via alla repetrar. Det mest pålitliga alternativet, men kräver mer sändtid.'; + + @override + String get routing_modeManualHint => + 'Skickar alltid den exakta väg du har angivit.'; + + @override + String get routing_currentRoute => 'Nuvarande rutt'; + + @override + String get routing_directNoHops => 'Direkt – utan mellanliggande routrar'; + + @override + String get routing_noPathYet => + 'Ingen väg hittad ännu. Nästa meddelande skickas tills en rutt har upptäckts.'; + + @override + String get routing_floodBroadcast => 'Sändas via alla repetrar'; + + @override + String get routing_editPath => 'Redigera sökväg'; + + @override + String get routing_forgetPath => 'Glöm vägen'; + + @override + String get routing_knownPaths => 'Kända vägar'; + + @override + String get routing_knownPathsHint => 'Välj en väg för att byta till den.'; + + @override + String get routing_inUse => 'I användning'; + + @override + String get routing_qualityStrong => 'En stark start'; + + @override + String get routing_qualityGood => 'Bra första steg'; + + @override + String get routing_qualityFair => 'Bra första hopp'; + + @override + String get routing_qualityWorked => 'Har levererat'; + + @override + String get routing_qualityFlood => 'Fått information via nyhetsflöde'; + + @override + String get routing_qualityUntested => 'Ej testat'; + + @override + String routing_lastWorked(String when) { + return 'arbetade $when'; } + @override + String get routing_neverWorked => 'aldrig bekräftat'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Leverans vid översvämningsområde'; + + @override + String get pathEditor_title => 'Skapa väg'; + + @override + String pathEditor_hopCounter(int count) { + return '$count av 64 humlor'; + } + + @override + String get pathEditor_noHops => + 'Inga humle än. Använd knapparna nedan för att lägga till dem i rätt ordning, eller spara utan humle för att skicka direkt.'; + + @override + String get pathEditor_addHops => 'Tillsätt humlen i rätt ordning.'; + + @override + String get pathEditor_searchRepeaters => 'Sök efter återupptagna samtal'; + + @override + String get pathEditor_advancedHex => 'Avancerat: rå hex-sökväg'; + + @override + String get pathEditor_hexLabel => 'Hex-prefikser'; + + @override + String get pathEditor_hexHelper => + 'Två hex-tecken per steg, separerade med kommatecken.'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Ogiltigt: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximalt 64 humlörter'; + + @override + String get pathEditor_usePath => 'Använd denna väg'; + + @override + String get pathEditor_removeHop => 'Ta bort humlen'; + + @override + String get pathEditor_unknownHop => 'Okänd förstärkare'; + @override String get chat_pathSavedLocally => 'Sparat lokalt. Anslut för att synkronisera.'; @@ -1625,6 +1716,39 @@ class AppLocalizationsSv extends AppLocalizations { @override String get map_title => 'Nodkarta'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Synlinje'; @@ -2015,65 +2139,13 @@ class AppLocalizationsSv extends AppLocalizations { @override String get common_clear => 'Rensa'; - @override - String path_currentPath(String path) { - return 'Nuvarande sökväg: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Använda $count $_temp0 sökväg'; - } - - @override - String get path_enterCustomPath => 'Ange anpassad sökväg'; - @override String get path_currentPathLabel => 'Nuvarande sökväg'; - @override - String get path_hexPrefixInstructions => - 'Ange 2-tecknets hex-prefett för varje hopp, åtskilda med komma.'; - - @override - String get path_hexPrefixExample => - 'Exempel: A1,F2,3C (varje nod använder det första bytet av sitt publika nyckel)'; - - @override - String get path_labelHexPrefixes => 'Hexprefixer'; - - @override - String get path_helperMaxHops => - 'Max 64 hopp. Varje prefix är 2 hex-tecken (1 byte)'; - - @override - String get path_selectFromContacts => 'Välj istället från kontakter:'; - @override String get path_noRepeatersFound => 'Inga återuppspelare eller rumsservrar hittades.'; - @override - String get path_customPathsRequire => - 'Anpassade sökvägar kräver mellansteg som kan vidarebefordra meddelanden.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Ogiltiga hex-prefikser: $prefixes'; - } - - @override - String get path_tooLong => 'Sökvägen är för lång. Max 64 hopp tillåtna.'; - - @override - String get path_setPath => 'Ange Sökväg'; - @override String get repeater_management => 'Återuppspelarens Hantering'; @@ -2138,15 +2210,6 @@ class AppLocalizationsSv extends AppLocalizations { @override String get repeater_routingMode => 'Ruttläge'; - @override - String get repeater_autoUseSavedPath => 'Automatisk (använd sparad sökväg)'; - - @override - String get repeater_forceFloodMode => 'Tvinga Översvämningsläge'; - - @override - String get repeater_pathManagement => 'Stigarhantering'; - @override String get repeater_refresh => 'Uppdatera'; @@ -3231,6 +3294,139 @@ class AppLocalizationsSv extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Digital ingång'; + + @override + String get telemetry_digitalOutputLabel => 'Digital utgång'; + + @override + String get telemetry_analogInputLabel => 'Analog ingång'; + + @override + String get telemetry_analogOutputLabel => 'Analog utgång'; + + @override + String get telemetry_genericLabel => 'Allmän sensor'; + + @override + String get telemetry_luminosityLabel => 'Ljusstyrka'; + + @override + String get telemetry_presenceLabel => 'Närvaro'; + + @override + String get telemetry_humidityLabel => 'Luftfuktighet'; + + @override + String get telemetry_accelerometerLabel => 'Accelerometer'; + + @override + String get telemetry_pressureLabel => 'Tryck'; + + @override + String get telemetry_altitudeLabel => 'Höjd'; + + @override + String get telemetry_frequencyLabel => 'Frekvens'; + + @override + String get telemetry_percentageLabel => 'Procent'; + + @override + String get telemetry_concentrationLabel => 'Koncentration'; + + @override + String get telemetry_powerLabel => 'Effekt'; + + @override + String get telemetry_distanceLabel => 'Avstånd'; + + @override + String get telemetry_energyLabel => 'Energi'; + + @override + String get telemetry_directionLabel => 'Riktning'; + + @override + String get telemetry_timeLabel => 'Tid'; + + @override + String get telemetry_gyrometerLabel => 'Gyrometer'; + + @override + String get telemetry_colourLabel => 'Färg'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Brytare'; + + @override + String get telemetry_polylineLabel => 'Polylinje'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + + @override + String get telemetry_autoFetchQuantity => 'Antal förfrågningar'; + + @override + String get telemetry_error => 'Det gick inte att hämta data'; + @override String get neighbors_receivedData => 'Mottagna grannars data'; @@ -4113,6 +4309,17 @@ class AppLocalizationsSv extends AppLocalizations { String get translation_composerSubtitle => 'Styr standardtillståndet för kompositorns översättningsikon.'; + @override + String get translation_autoIncomingTitle => + 'Översätt meddelanden automatiskt'; + + @override + String get translation_autoIncomingSubtitle => + 'Översätter meddelanden automatiskt för aviseringar och för chattar eller kanaler.'; + + @override + String get translation_translateMessage => 'Översätt meddelande'; + @override String get translation_targetLanguage => 'Målmedvetet språk'; @@ -4241,4 +4448,135 @@ class AppLocalizationsSv extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Zooma in'; + + @override + String get map_zoomOut => 'Zooma ut'; + + @override + String get map_centerMap => 'Kartöversikt'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth kräver en Chromium-baserad webbläsare.'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS-verifierat'; + + @override + String get pathTrace_legendInferred => 'Antagen position'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_uk.dart b/lib/l10n/app_localizations_uk.dart index 9c30fd8e..6471e563 100644 --- a/lib/l10n/app_localizations_uk.dart +++ b/lib/l10n/app_localizations_uk.dart @@ -92,6 +92,24 @@ class AppLocalizationsUk extends AppLocalizations { @override String get common_disable => 'Вимкнути'; + @override + String get common_undo => 'Скасувати'; + + @override + String get messageStatus_sent => 'Надіслано'; + + @override + String get messageStatus_delivered => 'Доставлено'; + + @override + String get messageStatus_pending => 'Надсилання'; + + @override + String get messageStatus_failed => 'Не вдалося надіслати'; + + @override + String get messageStatus_repeated => 'Почув неодноразово'; + @override String get common_reboot => 'Перезавантажити'; @@ -111,6 +129,12 @@ class AppLocalizationsUk extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Автооновлення'; + + @override + String get common_interval => 'Інтервал'; + @override String get scanner_title => 'MeshCore: Відкритий доступ'; @@ -295,6 +319,10 @@ class AppLocalizationsUk extends AppLocalizations { @override String get scanner_enableBluetooth => 'Увімкніть Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Швидке перемикання'; @@ -783,11 +811,6 @@ class AppLocalizationsUk extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Кількість спроб повторного відправлення повідомлення перед тим, як позначити його як невдале'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Батарея'; @@ -989,6 +1012,15 @@ class AppLocalizationsUk extends AppLocalizations { @override String get contacts_newGroup => 'Нова група'; + @override + String get contacts_moreOptions => 'Більше можливостей'; + + @override + String get contacts_searchOpen => 'Пошук контактів'; + + @override + String get contacts_searchClose => 'Закрити пошук'; + @override String get contacts_groupName => 'Назва групи'; @@ -1468,35 +1500,6 @@ class AppLocalizationsUk extends AppLocalizations { @override String get debugFrame_hexDump => 'Дамп Hex:'; - @override - String get chat_pathManagement => 'Керування шляхами'; - - @override - String get chat_ShowAllPaths => 'Показати всі шляхи'; - - @override - String get chat_routingMode => 'Режим маршрутизації'; - - @override - String get chat_autoUseSavedPath => 'Авто (використовувати збережений шлях)'; - - @override - String get chat_forceFloodMode => 'Примусово через всю мережу'; - - @override - String get chat_recentAckPaths => - 'Підтверджені шляхи (натисніть, щоб використати):'; - - @override - String get chat_pathHistoryFull => - 'Історія шляхів заповнена. Видаліть записи, щоб додати нові.'; - - @override - String get chat_hopSingular => 'Перехід'; - - @override - String get chat_hopPlural => 'переходів'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1510,12 +1513,6 @@ class AppLocalizationsUk extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'Успішно'; - - @override - String get chat_score => 'Оцінка'; - @override String get chat_removePath => 'Видалити шлях'; @@ -1523,54 +1520,148 @@ class AppLocalizationsUk extends AppLocalizations { String get chat_noPathHistoryYet => 'Історія шляхів недоступна.\nНадішліть повідомлення, щоб виявити шляхи.'; - @override - String get chat_pathActions => 'Дії зі шляхом:'; - - @override - String get chat_setCustomPath => 'Встановити власний шлях'; - - @override - String get chat_setCustomPathSubtitle => 'Вказати шлях маршрутизації вручну'; - - @override - String get chat_clearPath => 'Очистити шлях'; - - @override - String get chat_clearPathSubtitle => - 'Примусово повторити пошук при наступному надсиланні'; - @override String get chat_pathCleared => 'Шлях очищено. Наступне повідомлення оновить маршрут.'; - @override - String get chat_floodModeSubtitle => - 'Використовувати перемикач маршрутизації в панелі застосунку'; - - @override - String get chat_floodModeEnabled => - 'Увімкнено режим «через всю мережу». Перемикайте через іконку маршрутизації на панелі інструментів.'; - @override String get chat_fullPath => 'Повний шлях'; @override - String get chat_pathDetailsNotAvailable => - 'Деталі шляху ще недоступні. Спробуйте надіслати повідомлення для оновлення.'; + String get routing_title => 'Маршрутизація'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'переходів', - many: 'переходів', - few: 'переходи', - one: 'перехід', - ); - return 'Шлях встановлено: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Автомобіль'; + + @override + String get routing_modeFlood => 'Повені'; + + @override + String get routing_modeManual => 'Інструкція'; + + @override + String get routing_modeAutoHint => + 'Автоматично обирає найкращий відомий шлях, та у разі відсутності відомого шляху, використовує алгоритм \"занурення\".'; + + @override + String get routing_modeFloodHint => + 'Передавання через усі ретранслятори. Найбільш надійний спосіб, але потребує більше часу.'; + + @override + String get routing_modeManualHint => + 'Завжди доставляє точно за вказаним вами маршрутом.'; + + @override + String get routing_currentRoute => 'Поточний маршрут'; + + @override + String get routing_directNoHops => + 'Пряме з\'єднання – без проміжних ретрансляторів'; + + @override + String get routing_noPathYet => + 'Поки що немає жодного шляху. Повідомлення продовжуються надходити, поки не буде знайдено маршрут.'; + + @override + String get routing_floodBroadcast => 'Поширення через усі ретранслятори'; + + @override + String get routing_editPath => 'Редагувати шлях'; + + @override + String get routing_forgetPath => 'Забудь про шлях'; + + @override + String get routing_knownPaths => 'Відомі маршрути'; + + @override + String get routing_knownPathsHint => + 'Виберіть опцію, щоб переключитися на неї.'; + + @override + String get routing_inUse => 'У робочому стані'; + + @override + String get routing_qualityStrong => 'Сильний перший стрибок'; + + @override + String get routing_qualityGood => 'Чудова перша спроба'; + + @override + String get routing_qualityFair => 'Перший, але вдалий, крок'; + + @override + String get routing_qualityWorked => 'Доставлено'; + + @override + String get routing_qualityFlood => 'Дізнався через новини'; + + @override + String get routing_qualityUntested => 'Не протестовано'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'ніколи не підтверджено'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Доставка під час повені'; + + @override + String get pathEditor_title => 'Створити маршрут'; + + @override + String pathEditor_hopCounter(int count) { + return '$count з 64 штук хмелю'; + } + + @override + String get pathEditor_noHops => + 'Ще не додано хміль. Натисніть на відповідні кнопки, щоб додати його в потрібному порядку, або збережіть рецепт без хмілю, щоб відправити його безпосередньо.'; + + @override + String get pathEditor_addHops => 'Додавайте хміль у наступній послідовності.'; + + @override + String get pathEditor_searchRepeaters => 'Пошук повторювачів'; + + @override + String get pathEditor_advancedHex => + 'Просунутий рівень: пряма шлях у форматі шестнадцяткової системи.'; + + @override + String get pathEditor_hexLabel => + 'Префікси для шестнадцяткової системи числення'; + + @override + String get pathEditor_hexHelper => + 'Два шестизначні символи на кожний крок, розділені комами'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Неправильно: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Максимум 64 хмелеві колоди'; + + @override + String get pathEditor_usePath => 'Використовуйте цей шлях'; + + @override + String get pathEditor_removeHop => 'Видалити хміль'; + + @override + String get pathEditor_unknownHop => 'Невідомий ретранслятор'; + @override String get chat_pathSavedLocally => 'Збережено локально. Підключіться для синхронізації.'; @@ -1645,6 +1736,39 @@ class AppLocalizationsUk extends AppLocalizations { @override String get map_title => 'Карта вузлів'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Пряма видимість'; @@ -2037,67 +2161,13 @@ class AppLocalizationsUk extends AppLocalizations { @override String get common_clear => 'Очистити'; - @override - String path_currentPath(String path) { - return 'Поточний шлях: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'переходами', - many: 'переходами', - few: 'переходами', - one: 'переходом', - ); - return 'Використання шляху з $count $_temp0'; - } - - @override - String get path_enterCustomPath => 'Ввести власний шлях'; - @override String get path_currentPathLabel => 'Поточний шлях'; - @override - String get path_hexPrefixInstructions => - 'Введіть 2-символьні hex-префікси для кожного переходу, розділені комами.'; - - @override - String get path_hexPrefixExample => - 'Приклад: A1,F2,3C (кожен вузол використовує перший байт свого відкритого ключа).'; - - @override - String get path_labelHexPrefixes => 'Hex-префікси'; - - @override - String get path_helperMaxHops => - 'Макс. 64 переходи. Кожен префікс — 2 шістнадцяткові символи (1 байт)'; - - @override - String get path_selectFromContacts => 'Вибрати з контактів:'; - @override String get path_noRepeatersFound => 'Ретрансляторів або серверів кімнат не знайдено.'; - @override - String get path_customPathsRequire => - 'Власні шляхи вимагають проміжних вузлів, які можуть передавати повідомлення.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Некоректні hex-префікси: $prefixes'; - } - - @override - String get path_tooLong => 'Шлях занадто довгий. Максимум 64 переходи.'; - - @override - String get path_setPath => 'Встановити шлях'; - @override String get repeater_management => 'Керування ретранслятором'; @@ -2162,16 +2232,6 @@ class AppLocalizationsUk extends AppLocalizations { @override String get repeater_routingMode => 'Режим маршрутизації'; - @override - String get repeater_autoUseSavedPath => - 'Авто (використовувати збережений шлях)'; - - @override - String get repeater_forceFloodMode => 'Примусово через всю мережу'; - - @override - String get repeater_pathManagement => 'Керування шляхами'; - @override String get repeater_refresh => 'Оновити'; @@ -3274,6 +3334,139 @@ class AppLocalizationsUk extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Цифровий вхід'; + + @override + String get telemetry_digitalOutputLabel => 'Цифровий вихід'; + + @override + String get telemetry_analogInputLabel => 'Аналоговий вхід'; + + @override + String get telemetry_analogOutputLabel => 'Аналоговий вихід'; + + @override + String get telemetry_genericLabel => 'Загальний датчик'; + + @override + String get telemetry_luminosityLabel => 'Освітленість'; + + @override + String get telemetry_presenceLabel => 'Присутність'; + + @override + String get telemetry_humidityLabel => 'Вологість'; + + @override + String get telemetry_accelerometerLabel => 'Акселерометр'; + + @override + String get telemetry_pressureLabel => 'Тиск'; + + @override + String get telemetry_altitudeLabel => 'Висота'; + + @override + String get telemetry_frequencyLabel => 'Частота'; + + @override + String get telemetry_percentageLabel => 'Відсоток'; + + @override + String get telemetry_concentrationLabel => 'Концентрація'; + + @override + String get telemetry_powerLabel => 'Потужність'; + + @override + String get telemetry_distanceLabel => 'Відстань'; + + @override + String get telemetry_energyLabel => 'Енергія'; + + @override + String get telemetry_directionLabel => 'Напрямок'; + + @override + String get telemetry_timeLabel => 'Час'; + + @override + String get telemetry_gyrometerLabel => 'Гірометр'; + + @override + String get telemetry_colourLabel => 'Колір'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Перемикач'; + + @override + String get telemetry_polylineLabel => 'Полілінія'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters м'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Гц'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa гПа'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux лк'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts Вт'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters м'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours кВт⋅год'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + + @override + String get telemetry_autoFetchQuantity => 'Кількість запитів'; + + @override + String get telemetry_error => 'Не вдалося отримати дані'; + @override String get neighbors_receivedData => 'Дані сусідів отримано'; @@ -4176,6 +4369,17 @@ class AppLocalizationsUk extends AppLocalizations { String get translation_composerSubtitle => 'Контролює стан ікон перекладу, який використовується за замовчуванням.'; + @override + String get translation_autoIncomingTitle => + 'Автоматично перекладати повідомлення'; + + @override + String get translation_autoIncomingSubtitle => + 'Автоматично перекладає повідомлення для сповіщень, а також для чатів і каналів.'; + + @override + String get translation_translateMessage => 'Перекласти повідомлення'; + @override String get translation_targetLanguage => 'Цільова мова'; @@ -4304,4 +4508,135 @@ class AppLocalizationsUk extends AppLocalizations { @override String get contact_typeUnknown => 'Невідомо'; + + @override + String get map_zoomIn => 'Увійти в режим збільшення'; + + @override + String get map_zoomOut => 'Видалити зум'; + + @override + String get map_centerMap => 'Карта центру'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth вимагає браузера на основі Chromium'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS підтверджено'; + + @override + String get pathTrace_legendInferred => 'Висновок щодо положення'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index d2304a66..9add4a3e 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -92,6 +92,24 @@ class AppLocalizationsZh extends AppLocalizations { @override String get common_disable => '禁用'; + @override + String get common_undo => '撤销'; + + @override + String get messageStatus_sent => '发送'; + + @override + String get messageStatus_delivered => '已送达'; + + @override + String get messageStatus_pending => '发送'; + + @override + String get messageStatus_failed => '发送失败'; + + @override + String get messageStatus_repeated => '多次听到'; + @override String get common_reboot => '重启'; @@ -111,6 +129,12 @@ class AppLocalizationsZh extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => '自动刷新'; + + @override + String get common_interval => '间隔'; + @override String get scanner_title => '连接设备'; @@ -281,6 +305,10 @@ class AppLocalizationsZh extends AppLocalizations { @override String get scanner_enableBluetooth => '启用蓝牙'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => '快速切换'; @@ -729,11 +757,6 @@ class AppLocalizationsZh extends AppLocalizations { @override String get appSettings_maxMessageRetriesSubtitle => '在将消息标记为失败之前,允许尝试的次数'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => '电池'; @@ -925,6 +948,15 @@ class AppLocalizationsZh extends AppLocalizations { @override String get contacts_newGroup => '新建群聊'; + @override + String get contacts_moreOptions => '更多选择'; + + @override + String get contacts_searchOpen => '搜索联系人'; + + @override + String get contacts_searchClose => '高级搜索'; + @override String get contacts_groupName => '群聊名称'; @@ -1391,85 +1423,149 @@ class AppLocalizationsZh extends AppLocalizations { @override String get debugFrame_hexDump => '十六进制数据:'; - @override - String get chat_pathManagement => '路径管理'; - - @override - String get chat_ShowAllPaths => '显示所有路径'; - - @override - String get chat_routingMode => '路由模式'; - - @override - String get chat_autoUseSavedPath => '自动(使用保存的路径)'; - - @override - String get chat_forceFloodMode => '强制泛洪模式'; - - @override - String get chat_recentAckPaths => '最近使用的 ACK 路径(点击使用):'; - - @override - String get chat_pathHistoryFull => '路径历史已满,请删除后再添加。'; - - @override - String get chat_hopSingular => '跳'; - - @override - String get chat_hopPlural => '跳'; - @override String chat_hopsCount(int count) { return '$count 跳'; } - @override - String get chat_successes => '成功'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => '移除路径'; @override String get chat_noPathHistoryYet => '暂无路径历史。\n发送消息以探索路径。'; - @override - String get chat_pathActions => '路径操作:'; - - @override - String get chat_setCustomPath => '设置自定义路径'; - - @override - String get chat_setCustomPathSubtitle => '手动指定路由路径'; - - @override - String get chat_clearPath => '清除路径'; - - @override - String get chat_clearPathSubtitle => '清除当前路径,下次发送将重新尝试。'; - @override String get chat_pathCleared => '路径已清除。下一条消息将重新路由。'; - @override - String get chat_floodModeSubtitle => '在应用栏中切换路由模式。'; - - @override - String get chat_floodModeEnabled => '泛洪模式已启用。可通过应用栏的路由图标切换。'; - @override String get chat_fullPath => '完整路径'; @override - String get chat_pathDetailsNotAvailable => '路径信息暂不可用,请尝试发送消息刷新。'; + String get routing_title => '路由'; @override - String chat_pathSetHops(int hopCount, String status) { - return '路径设置:$hopCount 跳 - $status'; + String get routing_modeAuto => '汽车'; + + @override + String get routing_modeFlood => '洪水'; + + @override + String get routing_modeManual => '手册'; + + @override + String get routing_modeAutoHint => '自动选择已知最佳路径,当没有已知路径时,则进行“洪水”搜索。'; + + @override + String get routing_modeFloodHint => '通过所有中继站进行广播。 这种方式最可靠,但占用更多的时间。'; + + @override + String get routing_modeManualHint => '总是按照您设置的路径进行导航。'; + + @override + String get routing_currentRoute => '当前路线'; + + @override + String get routing_directNoHops => '直接连接— 无中继跳'; + + @override + String get routing_noPathYet => '目前还没有找到路径。直到找到路径,才会收到后续消息。'; + + @override + String get routing_floodBroadcast => '通过所有中继器进行广播'; + + @override + String get routing_editPath => '编辑路径'; + + @override + String get routing_forgetPath => '忘记原路'; + + @override + String get routing_knownPaths => '已知的路径'; + + @override + String get routing_knownPathsHint => '点击该路径以切换到它。'; + + @override + String get routing_inUse => '使用中'; + + @override + String get routing_qualityStrong => '强劲的初始阶段'; + + @override + String get routing_qualityGood => '不错的开端'; + + @override + String get routing_qualityFair => '第一次尝试,结果良好'; + + @override + String get routing_qualityWorked => '已完成'; + + @override + String get routing_qualityFlood => '通过新闻报道'; + + @override + String get routing_qualityUntested => '未经测试'; + + @override + String routing_lastWorked(String when) { + return '工作于 $when'; } + @override + String get routing_neverWorked => '从未得到证实'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => '洪水配送'; + + @override + String get pathEditor_title => '构建路径'; + + @override + String pathEditor_hopCounter(int count) { + return '$count of 64 hops'; + } + + @override + String get pathEditor_noHops => + '目前还没有添加任何啤酒花。点击下面的“添加”按钮,按顺序添加,或者直接保存,不添加任何啤酒花。'; + + @override + String get pathEditor_addHops => '按照顺序添加啤酒花'; + + @override + String get pathEditor_searchRepeaters => '重复搜索'; + + @override + String get pathEditor_advancedHex => '高级:原始十六进制路径'; + + @override + String get pathEditor_hexLabel => '十六进制前缀'; + + @override + String get pathEditor_hexHelper => '每次跳跃,使用两个十六进制字符,用逗号分隔。'; + + @override + String pathEditor_invalidTokens(String tokens) { + return '无效:$tokens'; + } + + @override + String get pathEditor_tooManyHops => '最多 64 个跳跃'; + + @override + String get pathEditor_usePath => '请使用此路径'; + + @override + String get pathEditor_removeHop => '去除啤酒花'; + + @override + String get pathEditor_unknownHop => '未知的重复器'; + @override String get chat_pathSavedLocally => '已本地保存,连接设备后可同步。'; @@ -1542,6 +1638,39 @@ class AppLocalizationsZh extends AppLocalizations { @override String get map_title => '节点地图'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => '视线'; @@ -1922,54 +2051,12 @@ class AppLocalizationsZh extends AppLocalizations { @override String get common_clear => '清除'; - @override - String path_currentPath(String path) { - return '当前路径:$path'; - } - - @override - String path_usingHopsPath(int count) { - return '使用 $count 跳路径'; - } - - @override - String get path_enterCustomPath => '输入自定义路径'; - @override String get path_currentPathLabel => '当前路径'; - @override - String get path_hexPrefixInstructions => '请输入每个中继节点的2字符十六进制前缀,用逗号分隔。'; - - @override - String get path_hexPrefixExample => '例如:A1, F2, 3C(每个节点使用其公钥的第一字节)'; - - @override - String get path_labelHexPrefixes => '路径(十六进制前缀)'; - - @override - String get path_helperMaxHops => '最多 64 跳。每个前缀由 2 个十六进制字符(1 字节)组成。'; - - @override - String get path_selectFromContacts => '或从联系人列表中选择:'; - @override String get path_noRepeatersFound => '未找到任何转发节点或房间服务器。'; - @override - String get path_customPathsRequire => '自定义路径需要中间节点转发消息。'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return '无效的十六进制前缀:$prefixes'; - } - - @override - String get path_tooLong => '路径过长,最多允许 64 跳。'; - - @override - String get path_setPath => '设置路径'; - @override String get repeater_management => '转发节点管理'; @@ -2030,15 +2117,6 @@ class AppLocalizationsZh extends AppLocalizations { @override String get repeater_routingMode => '路由模式'; - @override - String get repeater_autoUseSavedPath => '自动(使用保存的路径)'; - - @override - String get repeater_forceFloodMode => '强制泛洪模式'; - - @override - String get repeater_pathManagement => '路径管理'; - @override String get repeater_refresh => '刷新'; @@ -2999,6 +3077,139 @@ class AppLocalizationsZh extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => '数字输入'; + + @override + String get telemetry_digitalOutputLabel => '数字输出'; + + @override + String get telemetry_analogInputLabel => '模拟输入'; + + @override + String get telemetry_analogOutputLabel => '模拟输出'; + + @override + String get telemetry_genericLabel => '通用传感器'; + + @override + String get telemetry_luminosityLabel => '照度'; + + @override + String get telemetry_presenceLabel => '存在检测'; + + @override + String get telemetry_humidityLabel => '湿度'; + + @override + String get telemetry_accelerometerLabel => '加速度计'; + + @override + String get telemetry_pressureLabel => '气压'; + + @override + String get telemetry_altitudeLabel => '高度'; + + @override + String get telemetry_frequencyLabel => '频率'; + + @override + String get telemetry_percentageLabel => '百分比'; + + @override + String get telemetry_concentrationLabel => '浓度'; + + @override + String get telemetry_powerLabel => '功率'; + + @override + String get telemetry_distanceLabel => '距离'; + + @override + String get telemetry_energyLabel => '能量'; + + @override + String get telemetry_directionLabel => '方向'; + + @override + String get telemetry_timeLabel => '时间'; + + @override + String get telemetry_gyrometerLabel => '陀螺仪'; + + @override + String get telemetry_colourLabel => '颜色'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => '开关'; + + @override + String get telemetry_polylineLabel => '折线'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + + @override + String get telemetry_autoFetchQuantity => '请求次数'; + + @override + String get telemetry_error => '无法获取数据'; + @override String get neighbors_receivedData => '已接收邻居信息'; @@ -3816,6 +4027,15 @@ class AppLocalizationsZh extends AppLocalizations { @override String get translation_composerSubtitle => '控制作曲家翻译图标的默认状态。'; + @override + String get translation_autoIncomingTitle => '自动翻译消息'; + + @override + String get translation_autoIncomingSubtitle => '自动为通知以及聊天或频道翻译消息。'; + + @override + String get translation_translateMessage => '翻译消息'; + @override String get translation_targetLanguage => '目标语言'; @@ -3938,4 +4158,135 @@ class AppLocalizationsZh extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => '放大'; + + @override + String get map_zoomOut => '放大'; + + @override + String get map_centerMap => '中心地图'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth 需要 Chromium 浏览器'; + + @override + String channels_communityShortId(String id) { + return 'ID:$id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => '通过GPS确认'; + + @override + String get pathTrace_legendInferred => '推测的位置'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_nl.arb b/lib/l10n/app_nl.arb index 7e83215b..7c72900b 100644 --- a/lib/l10n/app_nl.arb +++ b/lib/l10n/app_nl.arb @@ -33,6 +33,8 @@ "common_remove": "Verwijderen", "common_enable": "Activeren", "common_disable": "Uitschakelen", + "common_autoRefresh": "Automatisch vernieuwen", + "common_interval": "Tijdsinterval", "common_reboot": "Herstarten", "common_loading": "Laden...", "common_notAvailable": "—", @@ -1280,6 +1282,43 @@ } } }, + "telemetry_digitalInputLabel": "Digitale ingang", + "telemetry_digitalOutputLabel": "Digitale uitgang", + "telemetry_analogInputLabel": "Analoge ingang", + "telemetry_analogOutputLabel": "Analoge uitgang", + "telemetry_genericLabel": "Algemene sensor", + "telemetry_luminosityLabel": "Lichtsterkte", + "telemetry_presenceLabel": "Aanwezigheid", + "telemetry_humidityLabel": "Luchtvochtigheid", + "telemetry_accelerometerLabel": "Versnellingsmeter", + "telemetry_pressureLabel": "Druk", + "telemetry_altitudeLabel": "Hoogte", + "telemetry_frequencyLabel": "Frequentie", + "telemetry_percentageLabel": "Percentage", + "telemetry_concentrationLabel": "Concentratie", + "telemetry_powerLabel": "Vermogen", + "telemetry_distanceLabel": "Afstand", + "telemetry_energyLabel": "Energie", + "telemetry_directionLabel": "Richting", + "telemetry_timeLabel": "Tijd", + "telemetry_gyrometerLabel": "Gyrometer", + "telemetry_colourLabel": "Kleur", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Schakelaar", + "telemetry_polylineLabel": "Polylijn", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", + "telemetry_autoFetchQuantity": "Aantal aanvragen", + "telemetry_error": "Kan gegevens niet ophalen", "telemetry_noData": "Geen telemetriedata beschikbaar.", "telemetry_channelTitle": "Kanaal {channel}", "@telemetry_channelTitle": { @@ -2101,6 +2140,9 @@ "translation_composerTitle": "Vertaal voor verzending", "translation_composerSubtitle": "Stelt de standaardstatus van het pictogram voor de vertaling van de componist in.", "translation_useAppLanguage": "Gebruik de taal van de app", + "translation_autoIncomingTitle": "Berichten automatisch vertalen", + "translation_autoIncomingSubtitle": "Vertaalt berichten automatisch voor meldingen en voor chats of kanalen.", + "translation_translateMessage": "Bericht vertalen", "translation_targetLanguage": "Doeltaal", "translation_downloadedModelLabel": "Gedownloade model", "translation_presetModelLabel": "Voorgeprogrammeerd Hugging Face-model", @@ -2311,5 +2353,98 @@ "chat_newMessages": "Nieuwe berichten", "chat_markAsUnread": "Markeer als ongelezen", "settings_companionDebugLogSubtitle": "BLE/TCP/USB commando's, antwoorden en ruwe data", - "repeater_chanUtil": "Gebruik van het kanaal" + "repeater_chanUtil": "Gebruik van het kanaal", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_sent": "Verzonden", + "common_undo": "Achterhalen/Annuleren", + "messageStatus_delivered": "Leverd", + "messageStatus_pending": "Verzenden", + "messageStatus_failed": "Niet verzonden", + "messageStatus_repeated": "Hearsay, herhaald", + "contacts_moreOptions": "Meer opties", + "contacts_searchOpen": "Zoek contactpersonen", + "contacts_searchClose": "Zoeken", + "routing_title": "Routeplanning", + "routing_modeAuto": "Auto", + "routing_modeFlood": "Overstroming", + "routing_modeManual": "Handleiding", + "routing_modeAutoHint": "Selecteert automatisch het bekendste pad, en gebruikt een flood-algoritme als er geen bekend pad is.", + "routing_modeFloodHint": "Uitzendingen via elke zender. De meest betrouwbare methode, maar vereist meer uitzendtijd.", + "routing_modeManualHint": "Stuurt altijd de exacte route die u heeft aangegeven.", + "routing_currentRoute": "Huidige route", + "routing_directNoHops": "Direct – zonder tussenliggende schakels", + "routing_noPathYet": "Er is nog geen route gevonden. De berichten blijven binnenkomen totdat een route is ontdekt.", + "routing_floodBroadcast": "Uitgestoten via elke zender.", + "routing_editPath": "Pad bewerken", + "routing_forgetPath": "Vergeet het pad", + "routing_knownPaths": "Bekende routes", + "routing_knownPathsHint": "Maak een route om er naartoe te gaan.", + "routing_inUse": "In gebruik", + "routing_qualityStrong": "Sterke eerste sprong", + "routing_qualityGood": "Een goede eerste stap", + "routing_qualityFair": "Een goede eerste hop", + "routing_qualityWorked": "Is geleverd", + "routing_qualityFlood": "Hears via een overstroming", + "routing_qualityUntested": "Niet getest", + "routing_neverWorked": "nooit bevestigd", + "routing_deliveryCounts": "{successes} zijn behaald, {failures} zijn mislukt", + "routing_floodDelivery": "Levering bij overstroming", + "pathEditor_title": "Pad creëren", + "pathEditor_hopCounter": "{count} van 64 hopgranen", + "pathEditor_noHops": "Er zijn nog geen hop toegevoegd. Klik op de onderstaande knoppen om ze in de juiste volgorde toe te voegen, of sla de bestelling op zonder hop om deze direct te versturen.", + "pathEditor_addHops": "Voeg hop toe in de juiste volgorde.", + "pathEditor_searchRepeaters": "Zoek naar herhaaldelijke zenders", + "pathEditor_advancedHex": "Geavanceerd: ruwe hex-pad", + "pathEditor_hexLabel": "Hex-voorkanten", + "pathEditor_hexHelper": "Twee hex-tekens per stap, gescheiden door komma's", + "pathEditor_invalidTokens": "Ongeldig: {tokens}", + "pathEditor_tooManyHops": "Maximaal 64 hopken", + "pathEditor_usePath": "Gebruik deze route.", + "pathEditor_removeHop": "Verwijder de hop", + "pathEditor_unknownHop": "Onbekend type zender", + "map_zoomIn": "Inzoomen", + "routing_lastWorked": "worked {when}", + "map_zoomOut": "Inzoomen", + "map_centerMap": "Centraal overzicht", + "chrome_bluetoothRequiresChromium": "Web Bluetooth vereist een Chromium-browser.", + "channels_communityShortId": "ID: {id}...", + "pathTrace_legendGpsConfirmed": "GPS-locatie bevestigd", + "pathTrace_legendInferred": "Afgeleide positie" } diff --git a/lib/l10n/app_pl.arb b/lib/l10n/app_pl.arb index 4366e273..92fc6797 100644 --- a/lib/l10n/app_pl.arb +++ b/lib/l10n/app_pl.arb @@ -33,6 +33,8 @@ "common_remove": "Usuń", "common_enable": "Włącz", "common_disable": "Wyłącz", + "common_autoRefresh": "Automatyczne odświeżanie", + "common_interval": "Interwał", "common_reboot": "Uruchom ponownie", "common_loading": "Ładowanie...", "common_notAvailable": "—", @@ -1290,6 +1292,43 @@ } } }, + "telemetry_digitalInputLabel": "Wejście cyfrowe", + "telemetry_digitalOutputLabel": "Wyjście cyfrowe", + "telemetry_analogInputLabel": "Wejście analogowe", + "telemetry_analogOutputLabel": "Wyjście analogowe", + "telemetry_genericLabel": "Czujnik ogólny", + "telemetry_luminosityLabel": "Jasność", + "telemetry_presenceLabel": "Obecność", + "telemetry_humidityLabel": "Wilgotność", + "telemetry_accelerometerLabel": "Akcelerometr", + "telemetry_pressureLabel": "Ciśnienie", + "telemetry_altitudeLabel": "Wysokość", + "telemetry_frequencyLabel": "Częstotliwość", + "telemetry_percentageLabel": "Procent", + "telemetry_concentrationLabel": "Stężenie", + "telemetry_powerLabel": "Moc", + "telemetry_distanceLabel": "Odległość", + "telemetry_energyLabel": "Energia", + "telemetry_directionLabel": "Kierunek", + "telemetry_timeLabel": "Czas", + "telemetry_gyrometerLabel": "Żyrometr", + "telemetry_colourLabel": "Kolor", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Przełącznik", + "telemetry_polylineLabel": "Polilinia", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", + "telemetry_autoFetchQuantity": "Liczba żądań", + "telemetry_error": "Nie udało się pobrać danych", "telemetry_noData": "Brak dostępnych danych telemetrycznych.", "telemetry_channelTitle": "Kanał {channel}", "@telemetry_channelTitle": { @@ -2137,6 +2176,9 @@ "translation_enableTitle": "Włącz tłumaczenie", "translation_enableSubtitle": "Tłumaczenie otrzymywanych wiadomości oraz umożliwienie tłumaczenia przed wysłaniem.", "translation_composerSubtitle": "Kontroluje domyślny stan ikony tłumaczenia w edytorze.", + "translation_autoIncomingTitle": "Automatycznie tłumacz wiadomości", + "translation_autoIncomingSubtitle": "Automatycznie tłumaczy wiadomości do powiadomień oraz do czatów lub kanałów.", + "translation_translateMessage": "Przetłumacz wiadomość", "translation_targetLanguage": "Język docelowy", "translation_useAppLanguage": "Użyj języka aplikacji", "translation_downloadedModelLabel": "Pobudowany model", @@ -2349,5 +2391,98 @@ "settings_companionDebugLogSubtitle": "Polecenia, odpowiedzi i surowe dane związane z protokołami BLE/TCP/USB", "chat_markAsUnread": "Oznacz jako nieprzeczytane", "settings_companionDebugLog": "Log debugowania (dla pomocy w rozwiązywaniu problemów)", - "repeater_chanUtil": "Wykorzystanie kanału" + "repeater_chanUtil": "Wykorzystanie kanału", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_sent": "Wysłane", + "messageStatus_delivered": "Dostarczone", + "messageStatus_pending": "Wysyłanie", + "common_undo": "Wycofaj", + "messageStatus_failed": "Nie udało się wysłać", + "messageStatus_repeated": "Usłyszałem to wielokrotnie", + "contacts_moreOptions": "Więcej opcji", + "contacts_searchOpen": "Wyszukaj kontakty", + "contacts_searchClose": "Zaawansowane wyszukiwanie", + "routing_title": "Planowanie tras", + "routing_modeAuto": "Samochód", + "routing_modeFlood": "Powódź", + "routing_modeManual": "Instrukcja obsługi", + "routing_modeAutoHint": "Automatycznie wybiera najpopularniejszą ścieżkę, a w przypadku braku znanej, przechodzi do trybu \"przepływu\".", + "routing_modeFloodHint": "Transmisje za pośrednictwem każdego repeatera. Najbardziej niezawodna metoda, ale zużywa więcej czasu transmisji.", + "routing_modeManualHint": "Zawsze prowadzi dokładnie po trasie, którą określiłeś.", + "routing_currentRoute": "Obecna trasa", + "routing_directNoHops": "Bezpośrednio – bez pośrednictwa repeaterów", + "routing_noPathYet": "Na razie nie ma żadnej ścieżki. Komunikacja trwa do momentu, gdy zostanie odkryta trasa.", + "routing_floodBroadcast": "Transmisja za pośrednictwem każdego urządzenia powielającego", + "routing_editPath": "Edytuj ścieżkę", + "routing_forgetPath": "Zapomnij o ścieżce", + "routing_knownPaths": "Znane trasy", + "routing_knownPathsHint": "Wybierz ścieżkę, aby przełączyć się na nią.", + "routing_inUse": "W użyciu", + "routing_qualityStrong": "Silny pierwszy skok", + "routing_qualityGood": "Świetny początek", + "routing_qualityFair": "Świetny pierwszy krzak", + "routing_qualityWorked": "Zostało dostarczone", + "routing_qualityFlood": "Usłyszano dzięki doniesieniom", + "routing_qualityUntested": "Nieużywany", + "routing_lastWorked": "pracował {when}", + "routing_neverWorked": "nigdy nie zostało potwierdzone", + "routing_floodDelivery": "Dostawa w przypadku powodzi", + "pathEditor_title": "Stworzenie ścieżki", + "pathEditor_hopCounter": "{count} z 64 rodzajów chmielu", + "pathEditor_noHops": "Na razie nie dodano żadnych chmielu. Aby dodać je w odpowiedniej kolejności, kliknij w odpowiednie przyciski poniżej, lub zapisz przepis bez chmielu, aby wysłać go bezpośrednio.", + "pathEditor_addHops": "Dodawaj chmiel zgodnie z kolejnością.", + "pathEditor_searchRepeaters": "Funkcje powtarzania", + "pathEditor_advancedHex": "Zaawansowane: ścieżka w formacie szesnastkowym", + "pathEditor_hexLabel": "Prefiksy heksadecymalne", + "pathEditor_hexHelper": "Dwa znaki szesnastkowe na każdym kroku, oddzielone przecinkami", + "pathEditor_invalidTokens": "Nieprawidłowe: {tokens}", + "pathEditor_tooManyHops": "Maksymalnie 64 hopów", + "pathEditor_usePath": "Użyj tej ścieżki.", + "pathEditor_removeHop": "Usuń dziką psiankę", + "pathEditor_unknownHop": "Nieznany repeater", + "map_zoomIn": "Przybliż", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "map_zoomOut": "Przybliż z powrotem", + "map_centerMap": "Mapa centrum", + "chrome_bluetoothRequiresChromium": "Web Bluetooth wymaga przeglądarki Chromium.", + "channels_communityShortId": "ID: {id}...", + "pathTrace_legendGpsConfirmed": "GPS potwierdzone", + "pathTrace_legendInferred": "Wywnioskowana pozycja" } diff --git a/lib/l10n/app_pt.arb b/lib/l10n/app_pt.arb index 6b8abbbc..e9c72cf4 100644 --- a/lib/l10n/app_pt.arb +++ b/lib/l10n/app_pt.arb @@ -33,6 +33,8 @@ "common_remove": "Remover", "common_enable": "Ativar", "common_disable": "Desativar", + "common_autoRefresh": "Atualização automática", + "common_interval": "Intervalo", "common_reboot": "Reiniciar", "common_loading": "Carregando...", "common_notAvailable": "—", @@ -1280,6 +1282,43 @@ } } }, + "telemetry_digitalInputLabel": "Entrada digital", + "telemetry_digitalOutputLabel": "Saída digital", + "telemetry_analogInputLabel": "Entrada analógica", + "telemetry_analogOutputLabel": "Saída analógica", + "telemetry_genericLabel": "Sensor genérico", + "telemetry_luminosityLabel": "Luminosidade", + "telemetry_presenceLabel": "Presença", + "telemetry_humidityLabel": "Humidade", + "telemetry_accelerometerLabel": "Acelerómetro", + "telemetry_pressureLabel": "Pressão", + "telemetry_altitudeLabel": "Altitude", + "telemetry_frequencyLabel": "Frequência", + "telemetry_percentageLabel": "Percentagem", + "telemetry_concentrationLabel": "Concentração", + "telemetry_powerLabel": "Potência", + "telemetry_distanceLabel": "Distância", + "telemetry_energyLabel": "Energia", + "telemetry_directionLabel": "Direção", + "telemetry_timeLabel": "Hora", + "telemetry_gyrometerLabel": "Girómetro", + "telemetry_colourLabel": "Cor", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Interruptor", + "telemetry_polylineLabel": "Polilinha", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", + "telemetry_autoFetchQuantity": "Número de solicitações", + "telemetry_error": "Não foi possível obter os dados", "telemetry_noData": "Não estão disponíveis dados de telemetria.", "telemetry_channelTitle": "Canal {channel}", "@telemetry_channelTitle": { @@ -2100,6 +2139,9 @@ "translation_enableTitle": "Ativar a tradução", "translation_title": "Tradução", "translation_composerSubtitle": "Controla o estado padrão do ícone de tradução do compositor.", + "translation_autoIncomingTitle": "Traduzir mensagens automaticamente", + "translation_autoIncomingSubtitle": "Traduz automaticamente mensagens para notificações e para chats ou canais.", + "translation_translateMessage": "Traduzir mensagem", "translation_targetLanguage": "Língua-alvo", "translation_useAppLanguage": "Utilize o idioma da aplicação", "translation_downloadedModelLabel": "Modelo baixado", @@ -2311,5 +2353,98 @@ "settings_companionDebugLogSubtitle": "Comandos, respostas e dados brutos para protocolos BLE/TCP/USB", "chat_markAsUnread": "Marcar como não lido", "chat_newMessages": "Novas mensagens", - "repeater_chanUtil": "Utilização do canal" + "repeater_chanUtil": "Utilização do canal", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "common_undo": "Desfazer", + "messageStatus_sent": "Enviado", + "messageStatus_pending": "Enviar", + "messageStatus_delivered": "Entregue", + "messageStatus_failed": "Falhou ao enviar", + "messageStatus_repeated": "Ouvi repetidamente", + "contacts_moreOptions": "Mais opções", + "contacts_searchOpen": "Pesquisar contatos", + "contacts_searchClose": "Pesquisa avançada", + "routing_title": "Rotas", + "routing_modeAuto": "Carro", + "routing_modeFlood": "Inundação", + "routing_modeManual": "Manual", + "routing_modeAutoHint": "Seleciona automaticamente o caminho mais conhecido, e, se nenhum caminho conhecido for encontrado, utiliza a estratégia de \"inundação\".", + "routing_modeFloodHint": "Transmissão através de todos os repetidores. É a opção mais confiável, mas utiliza mais tempo de transmissão.", + "routing_modeManualHint": "Sempre segue exatamente o caminho que você define.", + "routing_currentRoute": "Rota atual", + "routing_directNoHops": "Direto – sem saltos de repetidor", + "routing_noPathYet": "Ainda não há um caminho definido. A mensagem continua a ser enviada até que uma rota seja encontrada.", + "routing_floodBroadcast": "Transmissão através de todos os repetidores", + "routing_editPath": "Editar caminho", + "routing_forgetPath": "Esqueça o caminho", + "routing_knownPaths": "Rotas conhecidas", + "routing_knownPathsHint": "Toque em um caminho para alternar para ele.", + "routing_inUse": "Em uso", + "routing_qualityStrong": "Primeiro salto notável", + "routing_qualityGood": "Primeiro salto bem-sucedido", + "routing_qualityFair": "Primeira etapa bem-sucedida", + "routing_qualityWorked": "Foi entregue", + "routing_qualityFlood": "Informação obtida através de relatos generalizados.", + "routing_qualityUntested": "Não testado", + "routing_neverWorked": "nunca confirmado", + "routing_floodDelivery": "Entrega em áreas afetadas por inundações", + "pathEditor_title": "Criar Caminho", + "pathEditor_hopCounter": "{count} de 64 gramas de lúpulo", + "pathEditor_noHops": "Ainda não há lúpulos adicionados. Clique nos repetidores abaixo para adicioná-los na ordem desejada, ou salve sem adicionar lúpulos para enviar diretamente.", + "pathEditor_addHops": "Adicione os lúpulos na seguinte ordem.", + "pathEditor_searchRepeaters": "Encontrar repetidores", + "pathEditor_advancedHex": "Avançado: caminho hexadecimal bruto", + "pathEditor_hexLabel": "Prefixos hexadecimais", + "pathEditor_hexHelper": "Dois caracteres hexadecimais por salto, separados por vírgulas.", + "pathEditor_invalidTokens": "Inválido: {tokens}", + "routing_lastWorked": "worked {when}", + "pathEditor_tooManyHops": "Máximo de 64 saltos", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "pathEditor_usePath": "Utilize este caminho.", + "pathEditor_removeHop": "Remova o lúpulo", + "pathEditor_unknownHop": "Repetidor desconhecido", + "map_zoomIn": "Ampliar", + "map_zoomOut": "Ampliar", + "map_centerMap": "Mapa do centro", + "chrome_bluetoothRequiresChromium": "O Web Bluetooth requer um navegador Chromium.", + "channels_communityShortId": "ID: {id}...", + "pathTrace_legendGpsConfirmed": "GPS confirmado", + "pathTrace_legendInferred": "Posição inferida" } diff --git a/lib/l10n/app_ru.arb b/lib/l10n/app_ru.arb index 5d5bcfc3..58ddacc8 100644 --- a/lib/l10n/app_ru.arb +++ b/lib/l10n/app_ru.arb @@ -39,6 +39,8 @@ "common_notAvailable": "—", "common_voltageValue": "{volts} В", "common_percentValue": "{percent}%", + "common_autoRefresh": "Автообновление", + "common_interval": "Интервал", "scanner_title": "MeshCore Open", "scanner_scanning": "Поиск устройств...", "scanner_connecting": "Подключение...", @@ -686,6 +688,43 @@ "telemetry_voltageValue": "{volts}В", "telemetry_currentValue": "{amps}А", "telemetry_temperatureValue": "{celsius}°C / {fahrenheit}°F", + "telemetry_digitalInputLabel": "Цифровой вход", + "telemetry_digitalOutputLabel": "Цифровой выход", + "telemetry_analogInputLabel": "Аналоговый вход", + "telemetry_analogOutputLabel": "Аналоговый выход", + "telemetry_genericLabel": "Общий датчик", + "telemetry_luminosityLabel": "Освещённость", + "telemetry_presenceLabel": "Присутствие", + "telemetry_humidityLabel": "Влажность", + "telemetry_accelerometerLabel": "Акселерометр", + "telemetry_pressureLabel": "Давление", + "telemetry_altitudeLabel": "Высота", + "telemetry_frequencyLabel": "Частота", + "telemetry_percentageLabel": "Процент", + "telemetry_concentrationLabel": "Концентрация", + "telemetry_powerLabel": "Мощность", + "telemetry_distanceLabel": "Расстояние", + "telemetry_energyLabel": "Энергия", + "telemetry_directionLabel": "Направление", + "telemetry_timeLabel": "Время", + "telemetry_gyrometerLabel": "Гирометр", + "telemetry_colourLabel": "Цвет", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Переключатель", + "telemetry_polylineLabel": "Полилиния", + "telemetry_altitudeValue": "{meters} м", + "telemetry_frequencyValue": "{hertz} Гц", + "telemetry_pressureValue": "{hpa} гПа", + "telemetry_luminosityValue": "{lux} лк", + "telemetry_powerValue": "{watts} Вт", + "telemetry_distanceValue": "{meters} м", + "telemetry_energyValue": "{kilowattHours} кВт⋅ч", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", + "telemetry_autoFetchQuantity": "Количество запросов", + "telemetry_error": "Не удалось получить данные", "neighbors_receivedData": "Полученные данные о соседях", "neighbors_requestTimedOut": "Время ожидания данных о соседях истекло.", "neighbors_errorLoading": "Ошибка загрузки соседей: {error}", @@ -1268,6 +1307,9 @@ "translation_title": "Перевод", "translation_enableTitle": "Включить перевод", "translation_composerSubtitle": "Управляет исходным состоянием значка перевода, предоставляемого редактором.", + "translation_autoIncomingTitle": "Автоматически переводить сообщения", + "translation_autoIncomingSubtitle": "Автоматически переводит сообщения для уведомлений, а также для чатов и каналов.", + "translation_translateMessage": "Перевести сообщение", "translation_targetLanguage": "Целевой язык", "translation_useAppLanguage": "Используйте язык приложения", "translation_downloadedModelLabel": "Загруженная модель", @@ -1614,5 +1656,98 @@ "repeater_cliHelpStatsCore": "(Только для серийного оборудования) Отображает основные статистические данные прошивки.", "settings_companionDebugLogSubtitle": "Команды, ответы и необработанные данные, используемые для протоколов BLE, TCP и USB.", "repeater_chanUtil": "Использование канала", - "settings_companionDebugLog": "Журнал отладки (для сопутствующего приложения)" + "settings_companionDebugLog": "Журнал отладки (для сопутствующего приложения)", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_pending": "Отправка", + "common_undo": "Отменить", + "messageStatus_delivered": "Доставлено", + "messageStatus_sent": "Отправлено", + "messageStatus_failed": "Не удалось отправить", + "messageStatus_repeated": "Услышал несколько раз", + "contacts_moreOptions": "Больше вариантов", + "contacts_searchOpen": "Найти контакты", + "contacts_searchClose": "Закрыть поиск", + "routing_title": "Маршрутизация", + "routing_modeAuto": "Авто", + "routing_modeFlood": "Наводнение", + "routing_modeManual": "Инструкция", + "routing_modeAutoHint": "Автоматически выбирает наиболее известный путь, и если такой путь неизвестен, использует алгоритм поиска пути.", + "routing_modeFloodHint": "Передача сигнала через все ретрансляторы. Самый надежный способ, но требует больше времени на передачу.", + "routing_modeManualHint": "Всегда следует точно по указанному вами маршруту.", + "routing_currentRoute": "Текущий маршрут", + "routing_directNoHops": "Прямое соединение – без использования ретрансляторов", + "routing_noPathYet": "Пока нет пути. Следующее сообщение будет отправлено до тех пор, пока не будет обнаружен маршрут.", + "routing_floodBroadcast": "Транслируется через все ретрансляторы", + "routing_editPath": "Изменить путь", + "routing_forgetPath": "Забудьте о маршруте", + "routing_knownPaths": "Известные маршруты", + "routing_knownPathsHint": "Создайте маршрут для переключения на этот пункт.", + "routing_inUse": "В эксплуатации", + "routing_qualityStrong": "Сильный первый скачок", + "routing_qualityGood": "Хорошее начало", + "routing_qualityFair": "Первый хороший урожай", + "routing_qualityWorked": "Осуществлено", + "routing_qualityFlood": "Узнал из новостей, распространяющихся в интернете.", + "routing_qualityUntested": "Непроверенный", + "routing_neverWorked": "никогда не было подтверждено", + "routing_floodDelivery": "Доставка при затоплении", + "pathEditor_title": "Создать маршрут", + "pathEditor_hopCounter": "{count} из 64 хмеля", + "pathEditor_noHops": "На данный момент хмель еще не добавлен. Чтобы добавить его, нажмите на соответствующие кнопки ниже в нужном порядке, или сохраните рецепт без хмеля, чтобы отправить его напрямую.", + "pathEditor_addHops": "Добавляйте хмель в соответствии с указанным порядком.", + "pathEditor_searchRepeaters": "Поиск повторителей", + "pathEditor_advancedHex": "Продвинутый уровень: прямой путь в шестнадцатеричном формате", + "pathEditor_hexLabel": "Префиксы шестнадцатеричной системы", + "pathEditor_hexHelper": "Два шестнадцатеричных символа на каждом шаге, разделенные запятыми.", + "pathEditor_invalidTokens": "Неверно: {tokens}", + "routing_lastWorked": "worked {when}", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "pathEditor_tooManyHops": "Максимальное количество ингредиентов – 64", + "pathEditor_usePath": "Используйте этот путь", + "pathEditor_removeHop": "Удалить хмель", + "pathEditor_unknownHop": "Неизвестный ретранслятор", + "map_zoomIn": "Увеличить масштаб", + "map_zoomOut": "Увеличить масштаб", + "map_centerMap": "Карта центра", + "chrome_bluetoothRequiresChromium": "Для работы Web Bluetooth требуется браузер на основе Chromium.", + "channels_communityShortId": "Идентификатор: {id}...", + "pathTrace_legendGpsConfirmed": "GPS подтверждено", + "pathTrace_legendInferred": "Выведенная позиция" } diff --git a/lib/l10n/app_sk.arb b/lib/l10n/app_sk.arb index 713c3976..2a8ac872 100644 --- a/lib/l10n/app_sk.arb +++ b/lib/l10n/app_sk.arb @@ -33,6 +33,8 @@ "common_remove": "Odstrániť", "common_enable": "Povolit", "common_disable": "Zakázať", + "common_autoRefresh": "Automatické obnovenie", + "common_interval": "Časový interval", "common_reboot": "Restartovať", "common_loading": "Načítavanie...", "common_notAvailable": "—", @@ -1280,6 +1282,43 @@ } } }, + "telemetry_digitalInputLabel": "Digitálny vstup", + "telemetry_digitalOutputLabel": "Digitálny výstup", + "telemetry_analogInputLabel": "Analógový vstup", + "telemetry_analogOutputLabel": "Analógový výstup", + "telemetry_genericLabel": "Všeobecný senzor", + "telemetry_luminosityLabel": "Osvetlenie", + "telemetry_presenceLabel": "Prítomnosť", + "telemetry_humidityLabel": "Vlhkosť", + "telemetry_accelerometerLabel": "Akcelerometer", + "telemetry_pressureLabel": "Tlak", + "telemetry_altitudeLabel": "Nadmorská výška", + "telemetry_frequencyLabel": "Frekvencia", + "telemetry_percentageLabel": "Percento", + "telemetry_concentrationLabel": "Koncentrácia", + "telemetry_powerLabel": "Výkon", + "telemetry_distanceLabel": "Vzdialenosť", + "telemetry_energyLabel": "Energia", + "telemetry_directionLabel": "Smer", + "telemetry_timeLabel": "Čas", + "telemetry_gyrometerLabel": "Gyrometer", + "telemetry_colourLabel": "Farba", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Prepínač", + "telemetry_polylineLabel": "Lomená čiara", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", + "telemetry_autoFetchQuantity": "Počet požiadaviek", + "telemetry_error": "Nepodarilo sa získať údaje", "telemetry_noData": "Nejsú dostupné žiadne údaje z telemetrie.", "telemetry_channelTitle": "Kanál {channel}", "@telemetry_channelTitle": { @@ -2100,6 +2139,9 @@ "translation_composerTitle": "Preložte pred odeslaním", "translation_title": "Preklad", "translation_composerSubtitle": "Riadi výchoce stav ikony pre preklad, ktorú používa program.", + "translation_autoIncomingTitle": "Automaticky prekladať správy", + "translation_autoIncomingSubtitle": "Automaticky prekladá správy pre upozornenia aj pre čet alebo kanál.", + "translation_translateMessage": "Preložiť správu", "translation_targetLanguage": "Cieľový jazyk", "translation_useAppLanguage": "Použite jazyk aplikácie", "translation_downloadedModelLabel": "Stiahnutý model", @@ -2311,5 +2353,98 @@ "settings_companionDebugLogSubtitle": "Príkazy, odpovede a surové dáta pre protokoly BLE/TCP/USB", "settings_companionDebugLog": "Logovanie pre ladenie (sprievodný log)", "chat_newMessages": "Nové správy", - "repeater_chanUtil": "Využitie kanálu" + "repeater_chanUtil": "Využitie kanálu", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_sent": "Odoslané", + "messageStatus_delivered": "Doručené", + "messageStatus_pending": "Odoslanie", + "common_undo": "Zrušiť", + "messageStatus_failed": "Neúspešné odeslanie", + "messageStatus_repeated": "Slyšal som to opakovane", + "contacts_moreOptions": "Ďalšie možnosti", + "contacts_searchOpen": "Vyhľadajte kontakty", + "contacts_searchClose": "Zavrieť vyhľadávanie", + "routing_title": "Navigácia", + "routing_modeAuto": "Auto", + "routing_modeFlood": "Povodňová vlna", + "routing_modeManual": "Ručná príručka", + "routing_modeAutoHint": "Automaticky vyberá najznámejší trasa, a ak žiadna nie je známa, použije náhodnú trasu.", + "routing_modeFloodHint": "Prenos prostredníctvom všetkých opakovačov. Najspoľahlivejší spôsob, ale vyžaduje viac času vysielania.", + "routing_modeManualHint": "Vždy dodáva presne podľa zadaného trasy.", + "routing_currentRoute": "Aktuálna trasa", + "routing_directNoHops": "Priamo – bez prechodných trás", + "routing_noPathYet": "Zatiaľ neexistuje žiadna cesta. Nasledujúce správy budú pokračovať, kým sa nenájde trasa.", + "routing_floodBroadcast": "Prenos prostredníctvom každého opakovača", + "routing_editPath": "Upraviť trasu", + "routing_forgetPath": "Zabudnite na trasu", + "routing_knownPaths": "Známe cesty", + "routing_knownPathsHint": "Kliknite na cestu, aby ste sa k nej presunuli.", + "routing_inUse": "V prevádzke", + "routing_qualityStrong": "Silný prvý krok", + "routing_qualityGood": "Úspešný prvý krok", + "routing_qualityFair": "Prvá, spravodlivá fáza", + "routing_qualityWorked": "Dosiahnutý úspech", + "routing_qualityFlood": "Zistil som to z informácií, ktoré som získal v dôsledku povodňovej situácie.", + "routing_qualityUntested": "Neotestované", + "routing_neverWorked": "nikedy nebolo potvrdené", + "routing_floodDelivery": "Doručenie v prípade povodní", + "pathEditor_title": "Vytvorenie cesty", + "pathEditor_hopCounter": "{count} z 64 chmelových zŕš", + "pathEditor_noHops": "Zatiaľ žiadne chmel. Kliknite na opakované, aby ste ich pridali postupne, alebo uložte bez chmelu, aby ste ho mohli poslať priamo.", + "pathEditor_addHops": "Pridávajte chmel podľa zadaného poriadku.", + "pathEditor_searchRepeaters": "Hľadať opakované", + "pathEditor_advancedHex": "Pokročilé: pôvodná hexová cesta", + "pathEditor_hexLabel": "Prefiksy pre hexadecimálne čísla", + "pathEditor_hexHelper": "Dve hexové čísla na každý krok, oddelené čiarkami", + "routing_lastWorked": "worked {when}", + "pathEditor_invalidTokens": "Neplatné: {tokens}", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "pathEditor_tooManyHops": "Maximálne 64 krokov", + "pathEditor_usePath": "Použite túto cestu", + "pathEditor_removeHop": "Odstráňte chmel", + "pathEditor_unknownHop": "Neznáme zariadenie na opakované vysielanie", + "map_zoomIn": "Zväčšiť", + "map_zoomOut": "Zmenť zamer zblízka", + "map_centerMap": "Mapa centra", + "chrome_bluetoothRequiresChromium": "Web Bluetooth vyžaduje prehliadač Chromium.", + "channels_communityShortId": "ID: {id}...", + "pathTrace_legendGpsConfirmed": "GPS potvrdilo", + "pathTrace_legendInferred": "Odvodená poloha" } diff --git a/lib/l10n/app_sl.arb b/lib/l10n/app_sl.arb index 00930c85..0c7ce198 100644 --- a/lib/l10n/app_sl.arb +++ b/lib/l10n/app_sl.arb @@ -33,6 +33,8 @@ "common_remove": "Izbrisati", "common_enable": "Omogoči", "common_disable": "Izklopiti", + "common_autoRefresh": "Samodejno osveževanje", + "common_interval": "Časovni interval", "common_reboot": "Ponoviti", "common_loading": "Naložanje...", "common_notAvailable": "—", @@ -1280,6 +1282,43 @@ } } }, + "telemetry_digitalInputLabel": "Digitalni vhod", + "telemetry_digitalOutputLabel": "Digitalni izhod", + "telemetry_analogInputLabel": "Analogni vhod", + "telemetry_analogOutputLabel": "Analogni izhod", + "telemetry_genericLabel": "Splošni senzor", + "telemetry_luminosityLabel": "Osvetljenost", + "telemetry_presenceLabel": "Prisotnost", + "telemetry_humidityLabel": "Vlažnost", + "telemetry_accelerometerLabel": "Merilnik pospeška", + "telemetry_pressureLabel": "Tlak", + "telemetry_altitudeLabel": "Nadmorska višina", + "telemetry_frequencyLabel": "Frekvenca", + "telemetry_percentageLabel": "Odstotek", + "telemetry_concentrationLabel": "Koncentracija", + "telemetry_powerLabel": "Moč", + "telemetry_distanceLabel": "Razdalja", + "telemetry_energyLabel": "Energija", + "telemetry_directionLabel": "Smer", + "telemetry_timeLabel": "Čas", + "telemetry_gyrometerLabel": "Žiroskop", + "telemetry_colourLabel": "Barva", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Stikalo", + "telemetry_polylineLabel": "Polilinija", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", + "telemetry_autoFetchQuantity": "Število zahtev", + "telemetry_error": "Podatkov ni bilo mogoče pridobiti", "telemetry_noData": "Niso na voljo podatki o telemetriji.", "telemetry_channelTitle": "Kanal {channel}", "@telemetry_channelTitle": { @@ -2099,6 +2138,9 @@ "translation_enableSubtitle": "Prevedite vstopne sporočila in omogočite predhodno prevajanje.", "translation_enableTitle": "Omogočite prevod", "translation_composerSubtitle": "Ureja privzeto stanje ikone za prevod, ki jo uporablja avtor.", + "translation_autoIncomingTitle": "Samodejno prevajaj sporočila", + "translation_autoIncomingSubtitle": "Samodejno prevaja sporočila za obvestila ter za klepete ali kanale.", + "translation_translateMessage": "Prevedi sporočilo", "translation_targetLanguage": "Ciljna jezika", "translation_useAppLanguage": "Uporabite jezik aplikacije", "translation_downloadedModelLabel": "Naložen model", @@ -2311,5 +2353,98 @@ "chat_markAsUnread": "Označiti kot neneobdelano", "chat_newMessages": "Nove novice", "settings_companionDebugLogSubtitle": "Navodila, odgovori in surova podatka za BLE/TCP/USB.", - "repeater_chanUtil": "Uporaba kanala" + "repeater_chanUtil": "Uporaba kanala", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "common_undo": "Preobrn", + "messageStatus_delivered": "Dostavljeno", + "messageStatus_sent": "Pošljeno", + "messageStatus_pending": "Pošiljanje", + "messageStatus_failed": "Uspešno ni bilo mogo, da se sporočilo pošlje", + "messageStatus_repeated": "Slišal sem večkrat", + "contacts_moreOptions": "Več možnosti", + "contacts_searchOpen": "Iskanje kontaktov", + "contacts_searchClose": "Izklopi iskanje", + "routing_title": "Navigacija", + "routing_modeAuto": "Avto", + "routing_modeFlood": "Poplavo", + "routing_modeManual": "Navodilo", + "routing_modeAutoHint": "Samodejno izbere najbolj poznano pot, in sicer, ko ni na voljo nobena.", + "routing_modeFloodHint": "Prenosi preko vseh repetitorjev. Najzanesljivejši način, vendar zahteva več časa.", + "routing_modeManualHint": "Vedno sledi natančni poti, ki jo ste določili.", + "routing_currentRoute": "Trenutna pot", + "routing_directNoHops": "Neposredno – brez prehodov", + "routing_noPathYet": "Žep trenutno ni mogoče najti. Naslednje sporočilo bo posredovano, dokler ne bo ugotovljeno, kje je pot.", + "routing_floodBroadcast": "Prenos preko vseh repetitiv", + "routing_editPath": "Uredi pot", + "routing_forgetPath": "Pozabi na pot", + "routing_knownPaths": "Poznati poti", + "routing_knownPathsHint": "Kliknite na pot, da jo izberete.", + "routing_inUse": "V uporabi", + "routing_qualityStrong": "Močan prvi korak", + "routing_qualityGood": "Prva uspešna faza", + "routing_qualityFair": "Prva, uspešna faza", + "routing_qualityWorked": "Izpolnil", + "routing_qualityFlood": "Slišano preko poplave", + "routing_qualityUntested": "Ne preizkušen", + "routing_lastWorked": "delal/a {when}", + "routing_neverWorked": "nikoli ni bilo potrjeno", + "routing_floodDelivery": "Dostava zaradi poplave", + "pathEditor_title": "Izgradnja poti", + "pathEditor_hopCounter": "{count} od 64 različnih sort hropa", + "pathEditor_noHops": "Še niso dodani hmelji. Za dodajanje hmelja v vrstnem redu kliknite na povezavo spodaj, ali pa shranite brez dodanega hmelja, da ga lahko posredujete neposredno.", + "pathEditor_addHops": "Dodajte suho travo v skladu s postopkom.", + "pathEditor_searchRepeaters": "Iskanje ponovitev", + "pathEditor_advancedHex": "Napredno: surovi šestnajstni pot", + "pathEditor_hexLabel": "Predfiks za heksadecimalno šifro", + "pathEditor_hexHelper": "Dva šestbitna znaka na vsak skok, ločena z vejico", + "pathEditor_invalidTokens": "Neveljaven: {tokens}", + "pathEditor_tooManyHops": "Največ 64 hopov", + "pathEditor_usePath": "Uporabite to poto", + "pathEditor_removeHop": "Odstranite hmelj", + "pathEditor_unknownHop": "Neznani ponovitelj", + "map_zoomIn": "Povečaj", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "map_zoomOut": "Povečajte pogled", + "map_centerMap": "Krajšarska karta", + "chrome_bluetoothRequiresChromium": "Web Bluetooth zahteva brskalnik Chromium.", + "channels_communityShortId": "ID: {id}...", + "pathTrace_legendGpsConfirmed": "GPS potrdilo", + "pathTrace_legendInferred": "Izpeljana lokacija" } diff --git a/lib/l10n/app_sv.arb b/lib/l10n/app_sv.arb index 00fd3b08..e5ae55d8 100644 --- a/lib/l10n/app_sv.arb +++ b/lib/l10n/app_sv.arb @@ -33,6 +33,8 @@ "common_remove": "Ta bort", "common_enable": "Aktivera", "common_disable": "Inaktivera", + "common_autoRefresh": "Automatisk uppdatering", + "common_interval": "Intervall", "common_reboot": "Start om", "common_loading": "Laddar...", "common_notAvailable": "—", @@ -1280,6 +1282,43 @@ } } }, + "telemetry_digitalInputLabel": "Digital ingång", + "telemetry_digitalOutputLabel": "Digital utgång", + "telemetry_analogInputLabel": "Analog ingång", + "telemetry_analogOutputLabel": "Analog utgång", + "telemetry_genericLabel": "Allmän sensor", + "telemetry_luminosityLabel": "Ljusstyrka", + "telemetry_presenceLabel": "Närvaro", + "telemetry_humidityLabel": "Luftfuktighet", + "telemetry_accelerometerLabel": "Accelerometer", + "telemetry_pressureLabel": "Tryck", + "telemetry_altitudeLabel": "Höjd", + "telemetry_frequencyLabel": "Frekvens", + "telemetry_percentageLabel": "Procent", + "telemetry_concentrationLabel": "Koncentration", + "telemetry_powerLabel": "Effekt", + "telemetry_distanceLabel": "Avstånd", + "telemetry_energyLabel": "Energi", + "telemetry_directionLabel": "Riktning", + "telemetry_timeLabel": "Tid", + "telemetry_gyrometerLabel": "Gyrometer", + "telemetry_colourLabel": "Färg", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Brytare", + "telemetry_polylineLabel": "Polylinje", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", + "telemetry_autoFetchQuantity": "Antal förfrågningar", + "telemetry_error": "Det gick inte att hämta data", "telemetry_noData": "Inga telemetridata tillgängliga.", "telemetry_channelTitle": "Kanal {channel}", "@telemetry_channelTitle": { @@ -2100,6 +2139,9 @@ "translation_title": "Översättning", "translation_composerTitle": "Översätt innan du skickar", "translation_composerSubtitle": "Styr standardtillståndet för kompositorns översättningsikon.", + "translation_autoIncomingTitle": "Översätt meddelanden automatiskt", + "translation_autoIncomingSubtitle": "Översätter meddelanden automatiskt för aviseringar och för chattar eller kanaler.", + "translation_translateMessage": "Översätt meddelande", "translation_targetLanguage": "Målmedvetet språk", "translation_useAppLanguage": "Använd appens språk", "translation_downloadedModelLabel": "Nedladdad modell", @@ -2311,5 +2353,98 @@ "settings_companionDebugLog": "Följande felsökningslogg", "chat_newMessages": "Nya meddelanden", "settings_companionDebugLogSubtitle": "BLE/TCP/USB-kommandon, svar och rådata", - "repeater_chanUtil": "Användning av kanal" + "repeater_chanUtil": "Användning av kanal", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_sent": "Sen", + "messageStatus_delivered": "Levererad", + "common_undo": "Ångra", + "messageStatus_pending": "Skicka", + "messageStatus_failed": "Misslyckades med att skicka", + "messageStatus_repeated": "Hördes upprepade gånger", + "contacts_moreOptions": "Fler alternativ", + "contacts_searchOpen": "Sök efter kontakter", + "contacts_searchClose": "Avancerad sökning", + "routing_title": "Ruttplanering", + "routing_modeAuto": "Bil", + "routing_modeFlood": "Översvämning", + "routing_modeManual": "Instruktioner", + "routing_modeAutoHint": "Väljer automatiskt den bästa kända vägen, och använder en \"flooding\"-strategi om ingen väg är känd.", + "routing_modeFloodHint": "Sändningar via alla repetrar. Det mest pålitliga alternativet, men kräver mer sändtid.", + "routing_modeManualHint": "Skickar alltid den exakta väg du har angivit.", + "routing_currentRoute": "Nuvarande rutt", + "routing_directNoHops": "Direkt – utan mellanliggande routrar", + "routing_noPathYet": "Ingen väg hittad ännu. Nästa meddelande skickas tills en rutt har upptäckts.", + "routing_floodBroadcast": "Sändas via alla repetrar", + "routing_editPath": "Redigera sökväg", + "routing_forgetPath": "Glöm vägen", + "routing_knownPaths": "Kända vägar", + "routing_knownPathsHint": "Välj en väg för att byta till den.", + "routing_inUse": "I användning", + "routing_qualityStrong": "En stark start", + "routing_qualityGood": "Bra första steg", + "routing_qualityFair": "Bra första hopp", + "routing_qualityWorked": "Har levererat", + "routing_qualityFlood": "Fått information via nyhetsflöde", + "routing_qualityUntested": "Ej testat", + "routing_lastWorked": "arbetade {when}", + "routing_neverWorked": "aldrig bekräftat", + "routing_floodDelivery": "Leverans vid översvämningsområde", + "pathEditor_title": "Skapa väg", + "pathEditor_hopCounter": "{count} av 64 humlor", + "pathEditor_noHops": "Inga humle än. Använd knapparna nedan för att lägga till dem i rätt ordning, eller spara utan humle för att skicka direkt.", + "pathEditor_addHops": "Tillsätt humlen i rätt ordning.", + "pathEditor_searchRepeaters": "Sök efter återupptagna samtal", + "pathEditor_advancedHex": "Avancerat: rå hex-sökväg", + "pathEditor_hexLabel": "Hex-prefikser", + "pathEditor_hexHelper": "Två hex-tecken per steg, separerade med kommatecken.", + "pathEditor_invalidTokens": "Ogiltigt: {tokens}", + "pathEditor_tooManyHops": "Maximalt 64 humlörter", + "pathEditor_usePath": "Använd denna väg", + "pathEditor_removeHop": "Ta bort humlen", + "pathEditor_unknownHop": "Okänd förstärkare", + "map_zoomIn": "Zooma in", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "map_zoomOut": "Zooma ut", + "map_centerMap": "Kartöversikt", + "chrome_bluetoothRequiresChromium": "Web Bluetooth kräver en Chromium-baserad webbläsare.", + "channels_communityShortId": "ID: {id}...", + "pathTrace_legendGpsConfirmed": "GPS-verifierat", + "pathTrace_legendInferred": "Antagen position" } diff --git a/lib/l10n/app_uk.arb b/lib/l10n/app_uk.arb index 8330d364..4ceecbb2 100644 --- a/lib/l10n/app_uk.arb +++ b/lib/l10n/app_uk.arb @@ -34,6 +34,8 @@ "common_remove": "Прибрати", "common_enable": "Увімкнути", "common_disable": "Вимкнути", + "common_autoRefresh": "Автооновлення", + "common_interval": "Інтервал", "common_reboot": "Перезавантажити", "common_loading": "Завантаження...", "common_notAvailable": "—", @@ -1291,6 +1293,43 @@ } } }, + "telemetry_digitalInputLabel": "Цифровий вхід", + "telemetry_digitalOutputLabel": "Цифровий вихід", + "telemetry_analogInputLabel": "Аналоговий вхід", + "telemetry_analogOutputLabel": "Аналоговий вихід", + "telemetry_genericLabel": "Загальний датчик", + "telemetry_luminosityLabel": "Освітленість", + "telemetry_presenceLabel": "Присутність", + "telemetry_humidityLabel": "Вологість", + "telemetry_accelerometerLabel": "Акселерометр", + "telemetry_pressureLabel": "Тиск", + "telemetry_altitudeLabel": "Висота", + "telemetry_frequencyLabel": "Частота", + "telemetry_percentageLabel": "Відсоток", + "telemetry_concentrationLabel": "Концентрація", + "telemetry_powerLabel": "Потужність", + "telemetry_distanceLabel": "Відстань", + "telemetry_energyLabel": "Енергія", + "telemetry_directionLabel": "Напрямок", + "telemetry_timeLabel": "Час", + "telemetry_gyrometerLabel": "Гірометр", + "telemetry_colourLabel": "Колір", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Перемикач", + "telemetry_polylineLabel": "Полілінія", + "telemetry_altitudeValue": "{meters} м", + "telemetry_frequencyValue": "{hertz} Гц", + "telemetry_pressureValue": "{hpa} гПа", + "telemetry_luminosityValue": "{lux} лк", + "telemetry_powerValue": "{watts} Вт", + "telemetry_distanceValue": "{meters} м", + "telemetry_energyValue": "{kilowattHours} кВт⋅год", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", + "telemetry_autoFetchQuantity": "Кількість запитів", + "telemetry_error": "Не вдалося отримати дані", "telemetry_noData": "Дані телеметрії недоступні.", "telemetry_channelTitle": "Канал {channel}", "@telemetry_channelTitle": { @@ -2109,6 +2148,9 @@ "translation_enableTitle": "Увімкнути переклад", "translation_enableSubtitle": "Перекладати отримані повідомлення та дозволяти попередній переклад перед відправкою.", "translation_composerSubtitle": "Контролює стан ікон перекладу, який використовується за замовчуванням.", + "translation_autoIncomingTitle": "Автоматично перекладати повідомлення", + "translation_autoIncomingSubtitle": "Автоматично перекладає повідомлення для сповіщень, а також для чатів і каналів.", + "translation_translateMessage": "Перекласти повідомлення", "translation_targetLanguage": "Цільова мова", "translation_useAppLanguage": "Використовувати мову застосунку", "translation_downloadedModelLabel": "Завантажений шаблон", @@ -2291,5 +2333,98 @@ "settings_companionDebugLogSubtitle": "Команди, відповіді та необроблена інформація для протоколів BLE/TCP/USB", "chat_newMessages": "Нові повідомлення", "chat_markAsUnread": "Позначити як непрочитане", - "repeater_chanUtil": "Використання каналу" + "repeater_chanUtil": "Використання каналу", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_delivered": "Доставлено", + "messageStatus_sent": "Надіслано", + "common_undo": "Скасувати", + "messageStatus_pending": "Надсилання", + "messageStatus_failed": "Не вдалося надіслати", + "messageStatus_repeated": "Почув неодноразово", + "contacts_moreOptions": "Більше можливостей", + "contacts_searchOpen": "Пошук контактів", + "contacts_searchClose": "Закрити пошук", + "routing_title": "Маршрутизація", + "routing_modeAuto": "Автомобіль", + "routing_modeFlood": "Повені", + "routing_modeManual": "Інструкція", + "routing_modeAutoHint": "Автоматично обирає найкращий відомий шлях, та у разі відсутності відомого шляху, використовує алгоритм \"занурення\".", + "routing_modeFloodHint": "Передавання через усі ретранслятори. Найбільш надійний спосіб, але потребує більше часу.", + "routing_modeManualHint": "Завжди доставляє точно за вказаним вами маршрутом.", + "routing_currentRoute": "Поточний маршрут", + "routing_directNoHops": "Пряме з'єднання – без проміжних ретрансляторів", + "routing_noPathYet": "Поки що немає жодного шляху. Повідомлення продовжуються надходити, поки не буде знайдено маршрут.", + "routing_floodBroadcast": "Поширення через усі ретранслятори", + "routing_editPath": "Редагувати шлях", + "routing_forgetPath": "Забудь про шлях", + "routing_knownPaths": "Відомі маршрути", + "routing_knownPathsHint": "Виберіть опцію, щоб переключитися на неї.", + "routing_inUse": "У робочому стані", + "routing_qualityStrong": "Сильний перший стрибок", + "routing_qualityGood": "Чудова перша спроба", + "routing_qualityFair": "Перший, але вдалий, крок", + "routing_qualityWorked": "Доставлено", + "routing_qualityFlood": "Дізнався через новини", + "routing_qualityUntested": "Не протестовано", + "routing_neverWorked": "ніколи не підтверджено", + "routing_floodDelivery": "Доставка під час повені", + "pathEditor_title": "Створити маршрут", + "pathEditor_hopCounter": "{count} з 64 штук хмелю", + "pathEditor_noHops": "Ще не додано хміль. Натисніть на відповідні кнопки, щоб додати його в потрібному порядку, або збережіть рецепт без хмілю, щоб відправити його безпосередньо.", + "pathEditor_addHops": "Додавайте хміль у наступній послідовності.", + "pathEditor_searchRepeaters": "Пошук повторювачів", + "pathEditor_advancedHex": "Просунутий рівень: пряма шлях у форматі шестнадцяткової системи.", + "pathEditor_hexLabel": "Префікси для шестнадцяткової системи числення", + "pathEditor_hexHelper": "Два шестизначні символи на кожний крок, розділені комами", + "pathEditor_invalidTokens": "Неправильно: {tokens}", + "routing_lastWorked": "worked {when}", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "pathEditor_tooManyHops": "Максимум 64 хмелеві колоди", + "pathEditor_usePath": "Використовуйте цей шлях", + "pathEditor_removeHop": "Видалити хміль", + "pathEditor_unknownHop": "Невідомий ретранслятор", + "map_zoomIn": "Увійти в режим збільшення", + "map_zoomOut": "Видалити зум", + "map_centerMap": "Карта центру", + "chrome_bluetoothRequiresChromium": "Web Bluetooth вимагає браузера на основі Chromium", + "channels_communityShortId": "ID: {id}...", + "pathTrace_legendGpsConfirmed": "GPS підтверджено", + "pathTrace_legendInferred": "Висновок щодо положення" } diff --git a/lib/l10n/app_zh.arb b/lib/l10n/app_zh.arb index 1e289315..d1ee964c 100644 --- a/lib/l10n/app_zh.arb +++ b/lib/l10n/app_zh.arb @@ -34,6 +34,8 @@ "common_remove": "移除", "common_enable": "启用", "common_disable": "禁用", + "common_autoRefresh": "自动刷新", + "common_interval": "间隔", "common_reboot": "重启", "common_loading": "正在加载...", "common_notAvailable": "—", @@ -1310,6 +1312,43 @@ } } }, + "telemetry_digitalInputLabel": "数字输入", + "telemetry_digitalOutputLabel": "数字输出", + "telemetry_analogInputLabel": "模拟输入", + "telemetry_analogOutputLabel": "模拟输出", + "telemetry_genericLabel": "通用传感器", + "telemetry_luminosityLabel": "照度", + "telemetry_presenceLabel": "存在检测", + "telemetry_humidityLabel": "湿度", + "telemetry_accelerometerLabel": "加速度计", + "telemetry_pressureLabel": "气压", + "telemetry_altitudeLabel": "高度", + "telemetry_frequencyLabel": "频率", + "telemetry_percentageLabel": "百分比", + "telemetry_concentrationLabel": "浓度", + "telemetry_powerLabel": "功率", + "telemetry_distanceLabel": "距离", + "telemetry_energyLabel": "能量", + "telemetry_directionLabel": "方向", + "telemetry_timeLabel": "时间", + "telemetry_gyrometerLabel": "陀螺仪", + "telemetry_colourLabel": "颜色", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "开关", + "telemetry_polylineLabel": "折线", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", + "telemetry_autoFetchQuantity": "请求次数", + "telemetry_error": "无法获取数据", "telemetry_noData": "暂无遥测数据", "telemetry_channelTitle": "频道 {channel}", "@telemetry_channelTitle": { @@ -2105,6 +2144,9 @@ "translation_composerTitle": "在发送之前进行翻译", "translation_enableTitle": "启用翻译功能", "translation_composerSubtitle": "控制作曲家翻译图标的默认状态。", + "translation_autoIncomingTitle": "自动翻译消息", + "translation_autoIncomingSubtitle": "自动为通知以及聊天或频道翻译消息。", + "translation_translateMessage": "翻译消息", "translation_targetLanguage": "目标语言", "translation_useAppLanguage": "使用应用程序语言", "translation_downloadedModelLabel": "下载的模型", @@ -2316,5 +2358,98 @@ "settings_companionDebugLog": "调试日志", "chat_newMessages": "新的消息", "settings_companionDebugLogSubtitle": "BLE/TCP/USB 协议、响应和原始数据", - "repeater_chanUtil": "频道利用率" + "repeater_chanUtil": "频道利用率", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_sent": "发送", + "common_undo": "撤销", + "messageStatus_delivered": "已送达", + "messageStatus_pending": "发送", + "messageStatus_failed": "发送失败", + "messageStatus_repeated": "多次听到", + "contacts_moreOptions": "更多选择", + "contacts_searchOpen": "搜索联系人", + "contacts_searchClose": "高级搜索", + "routing_title": "路由", + "routing_modeAuto": "汽车", + "routing_modeFlood": "洪水", + "routing_modeManual": "手册", + "routing_modeAutoHint": "自动选择已知最佳路径,当没有已知路径时,则进行“洪水”搜索。", + "routing_modeFloodHint": "通过所有中继站进行广播。 这种方式最可靠,但占用更多的时间。", + "routing_modeManualHint": "总是按照您设置的路径进行导航。", + "routing_currentRoute": "当前路线", + "routing_directNoHops": "直接连接— 无中继跳", + "routing_noPathYet": "目前还没有找到路径。直到找到路径,才会收到后续消息。", + "routing_floodBroadcast": "通过所有中继器进行广播", + "routing_editPath": "编辑路径", + "routing_forgetPath": "忘记原路", + "routing_knownPaths": "已知的路径", + "routing_knownPathsHint": "点击该路径以切换到它。", + "routing_inUse": "使用中", + "routing_qualityStrong": "强劲的初始阶段", + "routing_qualityGood": "不错的开端", + "routing_qualityFair": "第一次尝试,结果良好", + "routing_qualityWorked": "已完成", + "routing_qualityFlood": "通过新闻报道", + "routing_qualityUntested": "未经测试", + "routing_lastWorked": "工作于 {when}", + "routing_neverWorked": "从未得到证实", + "routing_floodDelivery": "洪水配送", + "pathEditor_title": "构建路径", + "pathEditor_noHops": "目前还没有添加任何啤酒花。点击下面的“添加”按钮,按顺序添加,或者直接保存,不添加任何啤酒花。", + "pathEditor_addHops": "按照顺序添加啤酒花", + "pathEditor_searchRepeaters": "重复搜索", + "pathEditor_advancedHex": "高级:原始十六进制路径", + "pathEditor_hexLabel": "十六进制前缀", + "pathEditor_hexHelper": "每次跳跃,使用两个十六进制字符,用逗号分隔。", + "pathEditor_invalidTokens": "无效:{tokens}", + "pathEditor_tooManyHops": "最多 64 个跳跃", + "pathEditor_usePath": "请使用此路径", + "pathEditor_removeHop": "去除啤酒花", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "pathEditor_hopCounter": "{count} of 64 hops", + "pathEditor_unknownHop": "未知的重复器", + "map_zoomIn": "放大", + "map_zoomOut": "放大", + "map_centerMap": "中心地图", + "chrome_bluetoothRequiresChromium": "Web Bluetooth 需要 Chromium 浏览器", + "channels_communityShortId": "ID:{id}...", + "pathTrace_legendGpsConfirmed": "通过GPS确认", + "pathTrace_legendInferred": "推测的位置" } diff --git a/lib/main.dart b/lib/main.dart index cd622811..1445bdde 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter/foundation.dart'; +import 'package:flutter/services.dart'; import 'l10n/app_localizations.dart'; import 'package:provider/provider.dart'; @@ -23,11 +24,21 @@ import 'services/translation_service.dart'; import 'services/ui_view_state_service.dart'; import 'services/timeout_prediction_service.dart'; import 'storage/prefs_manager.dart'; +import 'theme/mesh_theme.dart'; import 'utils/app_logger.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); + // On desktop, debugPrint is not suppressed in release builds and every + // call is a synchronous stdout write. The connector logs heavily on hot + // paths (frame handling, queue/channel sync), which shows up as syscall + // overhead on low-end Linux machines (issue #202). The in-app debug log + // screens are unaffected — they store entries themselves. + if (kReleaseMode) { + debugPrint = (String? message, {int? wrapWidth}) {}; + } + // Initialize SharedPreferences cache await PrefsManager.initialize(); @@ -190,23 +201,8 @@ class MeshCoreApp extends StatelessWidget { locale: _localeFromSetting( settingsService.settings.languageOverride, ), - theme: ThemeData( - colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue), - useMaterial3: true, - snackBarTheme: const SnackBarThemeData( - behavior: SnackBarBehavior.floating, - ), - ), - darkTheme: ThemeData( - colorScheme: ColorScheme.fromSeed( - seedColor: Colors.blue, - brightness: Brightness.dark, - ), - useMaterial3: true, - snackBarTheme: const SnackBarThemeData( - behavior: SnackBarBehavior.floating, - ), - ), + theme: MeshTheme.light(), + darkTheme: MeshTheme.dark(), themeMode: _themeModeFromSetting( settingsService.settings.themeMode, ), @@ -214,7 +210,10 @@ class MeshCoreApp extends StatelessWidget { // Update notification service with resolved locale final locale = Localizations.localeOf(context); NotificationService().setLocale(locale); - return child ?? const SizedBox.shrink(); + return AnnotatedRegion( + value: _systemUiOverlayStyle(context), + child: child ?? const SizedBox.shrink(), + ); }, home: (PlatformInfo.isWeb && !PlatformInfo.isChrome) ? const ChromeRequiredScreen() @@ -236,6 +235,24 @@ class MeshCoreApp extends StatelessWidget { } } + SystemUiOverlayStyle _systemUiOverlayStyle(BuildContext context) { + final theme = Theme.of(context); + final colorScheme = theme.colorScheme; + final isDark = theme.brightness == Brightness.dark; + final iconBrightness = isDark ? Brightness.light : Brightness.dark; + + // Keep Android system bars aligned with the resolved Flutter theme. + return SystemUiOverlayStyle( + statusBarColor: Colors.transparent, + statusBarIconBrightness: iconBrightness, + statusBarBrightness: isDark ? Brightness.dark : Brightness.light, + systemNavigationBarColor: colorScheme.surface, + systemNavigationBarIconBrightness: iconBrightness, + systemNavigationBarDividerColor: colorScheme.surface, + systemNavigationBarContrastEnforced: false, + ); + } + Locale? _localeFromSetting(String? languageCode) { if (languageCode == null) return null; return Locale(languageCode); diff --git a/lib/models/app_settings.dart b/lib/models/app_settings.dart index 4e95311f..3fd0d05f 100644 --- a/lib/models/app_settings.dart +++ b/lib/models/app_settings.dart @@ -113,6 +113,7 @@ class AppSettings { final int tcpServerPort; final bool jumpToOldestUnread; final bool translationEnabled; + final bool autoTranslateIncomingMessages; final String? translationTargetLanguageCode; final bool composerTranslationEnabled; final String? translationModelSourceUrl; @@ -140,7 +141,7 @@ class AppSettings { this.mapKeyPrefix = '', this.mapShowMarkers = true, this.mapShowGuessedLocations = true, - this.enableMessageTracing = false, + this.enableMessageTracing = true, this.mapCacheBounds, this.mapCacheMinZoom = 10, this.mapCacheMaxZoom = 15, @@ -148,7 +149,7 @@ class AppSettings { this.notifyOnNewMessage = true, this.notifyOnNewChannelMessage = true, this.notifyOnNewAdvert = true, - this.autoRouteRotationEnabled = false, + this.autoRouteRotationEnabled = true, this.maxRouteWeight = 5.0, this.initialRouteWeight = 3.0, this.routeWeightSuccessIncrement = 0.5, @@ -166,6 +167,7 @@ class AppSettings { this.tcpServerPort = 0, this.jumpToOldestUnread = false, this.translationEnabled = false, + this.autoTranslateIncomingMessages = true, this.translationTargetLanguageCode, this.composerTranslationEnabled = false, this.translationModelSourceUrl, @@ -226,6 +228,7 @@ class AppSettings { 'tcp_server_port': tcpServerPort, 'jump_to_oldest_unread': jumpToOldestUnread, 'translation_enabled': translationEnabled, + 'auto_translate_incoming_messages': autoTranslateIncomingMessages, 'translation_target_language_code': translationTargetLanguageCode, 'composer_translation_enabled': composerTranslationEnabled, 'translation_model_source_url': translationModelSourceUrl, @@ -261,7 +264,7 @@ class AppSettings { mapShowMarkers: json['map_show_markers'] as bool? ?? true, mapShowGuessedLocations: json['map_show_guessed_locations'] as bool? ?? true, - enableMessageTracing: json['enable_message_tracing'] as bool? ?? false, + enableMessageTracing: json['enable_message_tracing'] as bool? ?? true, mapCacheBounds: (json['map_cache_bounds'] as Map?)?.map( (key, value) => MapEntry(key.toString(), (value as num).toDouble()), ), @@ -273,7 +276,7 @@ class AppSettings { json['notify_on_new_channel_message'] as bool? ?? true, notifyOnNewAdvert: json['notify_on_new_advert'] as bool? ?? true, autoRouteRotationEnabled: - json['auto_route_rotation_enabled'] as bool? ?? false, + json['auto_route_rotation_enabled'] as bool? ?? true, maxRouteWeight: (json['max_route_weight'] as num?)?.toDouble() ?? 5.0, initialRouteWeight: (json['initial_route_weight'] as num?)?.toDouble() ?? 3.0, @@ -307,6 +310,8 @@ class AppSettings { tcpServerPort: json['tcp_server_port'] as int? ?? 0, jumpToOldestUnread: json['jump_to_oldest_unread'] as bool? ?? false, translationEnabled: json['translation_enabled'] as bool? ?? false, + autoTranslateIncomingMessages: + json['auto_translate_incoming_messages'] as bool? ?? true, translationTargetLanguageCode: json['translation_target_language_code'] as String?, composerTranslationEnabled: @@ -396,6 +401,7 @@ class AppSettings { int? tcpServerPort, bool? jumpToOldestUnread, bool? translationEnabled, + bool? autoTranslateIncomingMessages, Object? translationTargetLanguageCode = _unset, bool? composerTranslationEnabled, Object? translationModelSourceUrl = _unset, @@ -453,6 +459,8 @@ class AppSettings { tcpServerPort: tcpServerPort ?? this.tcpServerPort, jumpToOldestUnread: jumpToOldestUnread ?? this.jumpToOldestUnread, translationEnabled: translationEnabled ?? this.translationEnabled, + autoTranslateIncomingMessages: + autoTranslateIncomingMessages ?? this.autoTranslateIncomingMessages, translationTargetLanguageCode: translationTargetLanguageCode == _unset ? this.translationTargetLanguageCode : translationTargetLanguageCode as String?, diff --git a/lib/models/channel.dart b/lib/models/channel.dart index 4fdd6270..9baf6302 100644 --- a/lib/models/channel.dart +++ b/lib/models/channel.dart @@ -4,6 +4,9 @@ import 'dart:typed_data'; import 'package:crypto/crypto.dart' as crypto; import '../connector/meshcore_protocol.dart'; +import 'community.dart'; + +enum ChannelType { public, private, hashtag, communityPublic, communityHashtag } class Channel { final int index; @@ -111,5 +114,36 @@ class Channel { return bytes.map((b) => b.toRadixString(16).padLeft(2, '0')).join(); } + static bool isCommunityChannel(ChannelType channelType) { + switch (channelType) { + case ChannelType.communityPublic: + case ChannelType.communityHashtag: + return true; + case ChannelType.public: + case ChannelType.private: + case ChannelType.hashtag: + return false; + } + } + + static ChannelType getChannelType( + Channel channel, + CommunityPskIndex communityIndex, + ) { + Community? community = communityIndex.getCommunityForChannel(channel); + if (community != null) { + if (Community.isCommunityPublicChannel(channel, community)) { + return ChannelType.communityPublic; + } + return ChannelType.communityHashtag; + } + if (channel.isPublicChannel) { + return ChannelType.public; + } else if (channel.name.startsWith('#')) { + return ChannelType.hashtag; + } + return ChannelType.private; + } + static const String publicChannelPsk = '8b3387e9c5cdea6ac9e5edbaa115cd72'; } diff --git a/lib/models/community.dart b/lib/models/community.dart index c829f3d1..7261ddf9 100644 --- a/lib/models/community.dart +++ b/lib/models/community.dart @@ -4,6 +4,8 @@ import 'dart:typed_data'; import 'package:crypto/crypto.dart' as crypto; +import 'channel.dart'; + /// Represents a community with a shared secret for deriving channel PSKs. /// /// A Community is a namespace with a shared secret K (32 random bytes), @@ -162,6 +164,12 @@ class Community { return hashtag.replaceFirst(RegExp(r'^#'), '').toLowerCase().trim(); } + /// Returns true if this is the community's public channel + static bool isCommunityPublicChannel(Channel channel, Community community) { + final publicPsk = community.deriveCommunityPublicPsk(); + return channel.pskHex == Channel.formatPskHex(publicPsk); + } + /// Add a hashtag channel to this community's list Community addHashtagChannel(String hashtag) { final normalized = _normalizeCommunityHashtag(hashtag); @@ -237,3 +245,28 @@ class Community { @override int get hashCode => id.hashCode; } + +class CommunityPskIndex { + // Cache of PSK hex -> Community for quick lookup + final Map _pskToCommunity = {}; + + void initialize(List communities) { + _pskToCommunity.clear(); + for (final community in communities) { + // Map the community public channel PSK + final publicPsk = community.deriveCommunityPublicPsk(); + _pskToCommunity[Channel.formatPskHex(publicPsk)] = community; + + // Map all known hashtag channel PSKs + for (final hashtag in community.hashtagChannels) { + final hashtagPsk = community.deriveCommunityHashtagPsk(hashtag); + _pskToCommunity[Channel.formatPskHex(hashtagPsk)] = community; + } + } + } + + /// Returns the community this channel belongs to, or null if not a community channel + Community? getCommunityForChannel(Channel channel) { + return _pskToCommunity[channel.pskHex]; + } +} diff --git a/lib/models/display_path.dart b/lib/models/display_path.dart new file mode 100644 index 00000000..71f8ed53 --- /dev/null +++ b/lib/models/display_path.dart @@ -0,0 +1,69 @@ +import 'dart:ui'; + +import 'package:latlong2/latlong.dart'; + +import 'path_history.dart'; + +/// One observed route rendered on the path map — the live traced path +/// (primary) or an alternate from the contact's path history — resolved to +/// map coordinates with per-hop confidence flags. +class DisplayPath { + final String id; + final String label; + final Color color; + final bool isPrimary; + + /// Outbound hop bytes, including hops that could not be placed on the map. + final List hopBytes; + + /// Resolved map points: self, each locatable hop, then the target when its + /// position is known. Hops with no position are skipped here but still + /// counted in [unresolvedHops]. + final List points; + + /// Display name for each entry of [points]. + final List pointLabels; + + /// Whether each entry of [points] is a GPS-grade position (vs inferred). + final List pointConfirmed; + + /// Per segment (length points-1): true when either endpoint is inferred or + /// unlocatable hops were skipped in between — rendered dashed. + final List segmentEstimated; + + /// Per segment: the transmission ordinal of the segment's destination, + /// used to highlight the matching hop-list row during animation. + final List rowForSegment; + + /// Total transmissions on the full route (including unlocatable hops). + final int totalTransmissions; + + /// True when the route ends with a chat-target endpoint row. + final bool hasTargetEndpoint; + + final int gpsConfirmedHops; + final int unresolvedHops; + final double distanceMeters; + + /// History metadata; null for the live traced (primary) path. + final PathRecord? record; + + const DisplayPath({ + required this.id, + required this.label, + required this.color, + required this.isPrimary, + required this.hopBytes, + required this.points, + required this.pointLabels, + required this.pointConfirmed, + required this.segmentEstimated, + required this.rowForSegment, + required this.totalTransmissions, + required this.hasTargetEndpoint, + required this.gpsConfirmedHops, + required this.unresolvedHops, + required this.distanceMeters, + this.record, + }); +} diff --git a/lib/models/path_playback.dart b/lib/models/path_playback.dart new file mode 100644 index 00000000..89fdff0b --- /dev/null +++ b/lib/models/path_playback.dart @@ -0,0 +1,177 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/scheduler.dart'; +import 'package:latlong2/latlong.dart'; + +/// Timeline state for the packet-flow animation on the path map. +/// +/// The packet travels each segment over [segmentMs] (scaled by [speed]), +/// then dwells at the reached hop for [dwellMs] so the hop visibly lights up. +/// Overlay layers listen to this controller directly; [activeSegment] only +/// fires when the segment index changes so list highlights rebuild cheaply. +class PathPlaybackController extends ChangeNotifier { + static const double segmentMs = 1100; + static const double dwellMs = 380; + static const List speedSteps = [0.5, 1.0, 2.0]; + + late final Ticker _ticker; + List _points = const []; + double _timelineMs = 0; + Duration _lastTick = Duration.zero; + bool _playing = false; + bool _started = false; + double _speed = 1.0; + + /// Segment currently being traveled (clamped to the last segment), or -1 + /// while the animation has not been started — listeners use this for + /// hop-list highlighting without rebuilding every tick. + final ValueNotifier activeSegment = ValueNotifier(-1); + + PathPlaybackController(TickerProvider vsync) { + _ticker = vsync.createTicker(_onTick); + } + + List get points => _points; + bool get hasPath => _points.length >= 2; + int get segmentCount => hasPath ? _points.length - 1 : 0; + bool get playing => _playing; + double get speed => _speed; + + /// True once the user has started or stepped the animation; the packet + /// overlay renders only in this state. + bool get started => _started; + + double get _slotMs => segmentMs + dwellMs; + double get _totalMs => segmentCount * _slotMs; + bool get isComplete => hasPath && _timelineMs >= _totalMs; + + int get currentSegment { + if (!hasPath) return 0; + return (_timelineMs / _slotMs).floor().clamp(0, segmentCount - 1); + } + + /// Travel progress through [currentSegment]; 1.0 while dwelling at its end. + double get segmentProgress { + if (!hasPath) return 0; + final within = _timelineMs - currentSegment * _slotMs; + return (within / segmentMs).clamp(0.0, 1.0); + } + + /// Dwell progress (0..1) at the reached hop, or null while traveling. + double? get dwellProgress { + if (!hasPath || isComplete) return null; + final within = _timelineMs - currentSegment * _slotMs; + if (within < segmentMs) return null; + return ((within - segmentMs) / dwellMs).clamp(0.0, 1.0); + } + + /// Index of the point the packet has most recently reached. + int get reachedPointIndex { + if (!hasPath) return 0; + if (isComplete) return _points.length - 1; + return segmentProgress >= 1.0 ? currentSegment + 1 : currentSegment; + } + + LatLng get position { + if (!hasPath) return const LatLng(0, 0); + final seg = currentSegment; + final a = _points[seg]; + final b = _points[seg + 1]; + final t = segmentProgress; + return LatLng( + a.latitude + (b.latitude - a.latitude) * t, + a.longitude + (b.longitude - a.longitude) * t, + ); + } + + /// Replaces the path and resets the animation to the start. + void setPath(List points) { + _ticker.stop(); + _points = List.unmodifiable(points); + _timelineMs = 0; + _playing = false; + _started = false; + activeSegment.value = -1; + notifyListeners(); + } + + void play() { + if (!hasPath) return; + if (isComplete) _timelineMs = 0; + _started = true; + _playing = true; + activeSegment.value = currentSegment; + if (!_ticker.isActive) { + _lastTick = Duration.zero; + _ticker.start(); + } + notifyListeners(); + } + + void pause() { + _ticker.stop(); + _playing = false; + notifyListeners(); + } + + void togglePlay() => _playing ? pause() : play(); + + void replay() { + if (!hasPath) return; + _timelineMs = 0; + activeSegment.value = 0; + play(); + } + + /// Stops playback and hides the packet overlay. + void stop() { + _ticker.stop(); + _playing = false; + _started = false; + _timelineMs = 0; + activeSegment.value = -1; + notifyListeners(); + } + + void stepForward() => _jumpToPoint(reachedPointIndex + 1); + + void stepBack() => _jumpToPoint(reachedPointIndex - 1); + + void cycleSpeed() { + final index = speedSteps.indexOf(_speed); + _speed = speedSteps[(index + 1) % speedSteps.length]; + notifyListeners(); + } + + void _jumpToPoint(int index) { + if (!hasPath) return; + _ticker.stop(); + _playing = false; + _started = true; + final clamped = index.clamp(0, _points.length - 1); + // Land at the start of the dwell window so the hop pulse plays. + _timelineMs = clamped == 0 ? 0 : (clamped - 1) * _slotMs + segmentMs; + activeSegment.value = currentSegment; + notifyListeners(); + } + + void _onTick(Duration elapsed) { + final dtMs = (elapsed - _lastTick).inMicroseconds / 1000.0; + _lastTick = elapsed; + _timelineMs = (_timelineMs + dtMs * _speed).clamp(0.0, _totalMs); + if (_timelineMs >= _totalMs) { + _ticker.stop(); + _playing = false; + } + if (activeSegment.value != currentSegment) { + activeSegment.value = currentSegment; + } + notifyListeners(); + } + + @override + void dispose() { + _ticker.dispose(); + activeSegment.dispose(); + super.dispose(); + } +} diff --git a/lib/models/radio_settings.dart b/lib/models/radio_settings.dart index 099d9201..e74cf209 100644 --- a/lib/models/radio_settings.dart +++ b/lib/models/radio_settings.dart @@ -181,6 +181,276 @@ class RadioSettings { txPowerDbm: 14, ), ), + ( + 'Russia Artyom (VVO)', + RadioSettings( + frequencyMHz: 864.281, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_6, + txPowerDbm: 20, + ), + ), + ( + 'Russia Biysk (BSK)', + RadioSettings( + frequencyMHz: 869.000, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_5, + txPowerDbm: 20, + ), + ), + ( + 'Russia Chelyabinsk (CEK)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_6, + txPowerDbm: 20, + ), + ), + ( + 'Russia Cherepovets (CEE)', + RadioSettings( + frequencyMHz: 868.570, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf7, + codingRate: LoRaCodingRate.cr4_8, + txPowerDbm: 20, + ), + ), + ( + 'Russia Irkutsk (IKT)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf7, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Ivanovo (IWA)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_8, + txPowerDbm: 20, + ), + ), + ( + 'Russia Izhevsk (IJK)', + RadioSettings( + frequencyMHz: 868.732, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_8, + txPowerDbm: 20, + ), + ), + ( + 'Russia Kaluga (KLF)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf7, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Kazan (KZN)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_6, + txPowerDbm: 20, + ), + ), + ( + 'Russia Khabarovsk (KHV)', + RadioSettings( + frequencyMHz: 864.281, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_6, + txPowerDbm: 20, + ), + ), + ( + 'Russia Kirov (KVX)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_8, + txPowerDbm: 20, + ), + ), + ( + 'Russia Lipetsk (LPK)', + RadioSettings( + frequencyMHz: 868.950, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf9, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Moscow (MOW)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf7, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Nizhny Novgorod (GOJ)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_6, + txPowerDbm: 20, + ), + ), + ( + 'Russia Novosibirsk (OVB)', + RadioSettings( + frequencyMHz: 869.000, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf9, + codingRate: LoRaCodingRate.cr4_8, + txPowerDbm: 20, + ), + ), + ( + 'Russia Rostov-on-Don (ROV)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf9, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Ryazan (RZN)', + RadioSettings( + frequencyMHz: 868.880, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf9, + codingRate: LoRaCodingRate.cr4_5, + txPowerDbm: 20, + ), + ), + ( + 'Russia Samara (KUF)', + RadioSettings( + frequencyMHz: 864.281, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Saratov (GSV)', + RadioSettings( + frequencyMHz: 864.281, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia St. Petersburg (LED)', + RadioSettings( + frequencyMHz: 868.856, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf7, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Tambov (TBW)', + RadioSettings( + frequencyMHz: 868.950, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf10, + codingRate: LoRaCodingRate.cr4_5, + txPowerDbm: 20, + ), + ), + ( + 'Russia Tula (TYA)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Tver (KLD)', + RadioSettings( + frequencyMHz: 869.169, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_8, + txPowerDbm: 20, + ), + ), + ( + 'Russia Ufa (UFA)', + RadioSettings( + frequencyMHz: 868.732, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_8, + txPowerDbm: 20, + ), + ), + ( + 'Russia Volgograd (VOG)', + RadioSettings( + frequencyMHz: 869.525, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf7, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Voronezh (VOZ)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_6, + txPowerDbm: 20, + ), + ), + ( + 'Russia Yekaterinburg (SVX)', + RadioSettings( + frequencyMHz: 869.046, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf7, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), ( 'Switzerland', RadioSettings( diff --git a/lib/screens/app_debug_log_screen.dart b/lib/screens/app_debug_log_screen.dart index ca6a6bf1..4b00c70c 100644 --- a/lib/screens/app_debug_log_screen.dart +++ b/lib/screens/app_debug_log_screen.dart @@ -4,6 +4,7 @@ import 'package:provider/provider.dart'; import '../l10n/l10n.dart'; import '../services/app_debug_log_service.dart'; +import '../theme/mesh_theme.dart'; import '../widgets/adaptive_app_bar_title.dart'; import '../helpers/snack_bar_builder.dart'; @@ -58,25 +59,57 @@ class AppDebugLogScreen extends StatelessWidget { child: hasEntries ? ListView.separated( itemCount: entries.length, - separatorBuilder: (_, _) => const Divider(height: 1), + separatorBuilder: (_, _) => + const Divider(height: 1, color: MeshPalette.line), itemBuilder: (context, index) { final entry = entries[index]; - return ListTile( - dense: true, - leading: _buildLevelIcon(entry.level), - title: Text( - '[${entry.tag}] ${entry.message}', - style: const TextStyle( - fontSize: 12, - fontFamily: 'monospace', - ), + return Container( + color: MeshPalette.bg, + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, ), - subtitle: Text( - entry.formattedTime, - style: TextStyle( - fontSize: 10, - color: Colors.grey[600], - ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildLevelIcon(context, entry.level), + const SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: '[${entry.tag}] ', + style: MeshTheme.mono( + fontSize: 11.5, + color: _levelColor(entry.level), + ), + ), + TextSpan( + text: entry.message, + style: MeshTheme.mono( + fontSize: 11.5, + color: MeshPalette.ink2, + ), + ), + ], + ), + ), + const SizedBox(height: 2), + Text( + entry.formattedTime, + style: MeshTheme.mono( + fontSize: 9.5, + color: MeshPalette.ink4, + ), + ), + ], + ), + ), + ], ), ); }, @@ -85,25 +118,25 @@ class AppDebugLogScreen extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon( + const Icon( Icons.bug_report_outlined, size: 64, - color: Colors.grey[400], + color: MeshPalette.ink3, ), const SizedBox(height: 16), Text( context.l10n.debugLog_noEntries, - style: TextStyle( + style: const TextStyle( fontSize: 16, - color: Colors.grey[600], + color: MeshPalette.ink3, ), ), const SizedBox(height: 8), Text( context.l10n.debugLog_enableInSettings, - style: TextStyle( + style: const TextStyle( fontSize: 12, - color: Colors.grey[500], + color: MeshPalette.ink3, ), ), ], @@ -115,18 +148,37 @@ class AppDebugLogScreen extends StatelessWidget { ); } - Widget _buildLevelIcon(AppDebugLogLevel level) { + Color _levelColor(AppDebugLogLevel level) { switch (level) { case AppDebugLogLevel.info: - return const Icon(Icons.info_outline, size: 18, color: Colors.blue); + return MeshPalette.blue; + case AppDebugLogLevel.warning: + return MeshPalette.warn; + case AppDebugLogLevel.error: + return MeshPalette.alert; + } + } + + Widget _buildLevelIcon(BuildContext context, AppDebugLogLevel level) { + switch (level) { + case AppDebugLogLevel.info: + return const Icon( + Icons.info_outline, + size: 18, + color: MeshPalette.blue, + ); case AppDebugLogLevel.warning: return const Icon( Icons.warning_amber_outlined, size: 18, - color: Colors.orange, + color: MeshPalette.warn, ); case AppDebugLogLevel.error: - return const Icon(Icons.error_outline, size: 18, color: Colors.red); + return const Icon( + Icons.error_outline, + size: 18, + color: MeshPalette.alert, + ); } } } diff --git a/lib/screens/app_settings_screen.dart b/lib/screens/app_settings_screen.dart index 94b3efe8..e54687c9 100644 --- a/lib/screens/app_settings_screen.dart +++ b/lib/screens/app_settings_screen.dart @@ -10,7 +10,10 @@ import '../models/translation_support.dart'; import '../services/app_settings_service.dart'; import '../services/notification_service.dart'; import '../services/translation_service.dart'; +import '../theme/mesh_theme.dart'; import '../widgets/adaptive_app_bar_title.dart'; +import '../widgets/mesh_ui.dart'; +import '../widgets/sync_progress_overlay.dart'; import '../helpers/snack_bar_builder.dart'; import 'map_cache_screen.dart'; @@ -23,6 +26,7 @@ class AppSettingsScreen extends StatelessWidget { appBar: AppBar( title: AdaptiveAppBarTitle(context.l10n.appSettings_title), centerTitle: true, + bottom: const SyncProgressAppBarBottom(), ), body: SafeArea( top: false, @@ -41,29 +45,84 @@ class AppSettingsScreen extends StatelessWidget { child, ) { return ListView( - padding: const EdgeInsets.all(16), + padding: const EdgeInsets.fromLTRB(0, 8, 0, 24), children: [ - _buildAppearanceCard(context, settingsService), - const SizedBox(height: 16), - _buildNotificationsCard(context, settingsService), - const SizedBox(height: 16), - _buildMessagingCard(context, settingsService), - const SizedBox(height: 16), - if (!kIsWeb) ...[ - _buildTranslationCard( + // APPEARANCE + SectionHeader(context.l10n.appSettings_appearance), + MeshCard( + padding: EdgeInsets.zero, + child: _buildAppearanceContent( context, settingsService, - translationService, ), - const SizedBox(height: 16), + ), + + // NOTIFICATIONS + SectionHeader(context.l10n.appSettings_notifications), + MeshCard( + padding: EdgeInsets.zero, + child: _buildNotificationsContent( + context, + settingsService, + ), + ), + + // MESSAGING + SectionHeader(context.l10n.appSettings_messaging), + MeshCard( + padding: EdgeInsets.zero, + child: _buildMessagingContent( + context, + settingsService, + ), + ), + + // BATTERY + SectionHeader(context.l10n.appSettings_battery), + MeshCard( + padding: const EdgeInsets.fromLTRB(16, 4, 16, 16), + child: _buildBatteryContent( + context, + settingsService, + connector, + ), + ), + + // MAP + SectionHeader(context.l10n.appSettings_mapDisplay), + MeshCard( + padding: EdgeInsets.zero, + child: _buildMapContent(context, settingsService), + ), + + // TRANSLATION (non-web only) + if (!kIsWeb) ...[ + SectionHeader(context.l10n.translation_title), + MeshCard( + padding: EdgeInsets.zero, + child: _buildTranslationContent( + context, + settingsService, + translationService, + ), + ), ], - _buildBatteryCard(context, settingsService, connector), - const SizedBox(height: 16), - _buildMapSettingsCard(context, settingsService), - const SizedBox(height: 16), - _buildCyr2LatCard(context, settingsService), - const SizedBox(height: 16), - _buildDebugCard(context, settingsService), + + // CYR2LAT + SectionHeader( + context.l10n.channels_cyr2latSettingsHeading, + ), + MeshCard( + padding: const EdgeInsets.fromLTRB(16, 4, 16, 16), + child: _buildCyr2LatContent(context, settingsService), + ), + + // DEBUG + SectionHeader(context.l10n.appSettings_debugCard), + MeshCard( + padding: EdgeInsets.zero, + child: _buildDebugContent(context, settingsService), + ), ], ); }, @@ -72,660 +131,1047 @@ class AppSettingsScreen extends StatelessWidget { ); } - Widget _buildAppearanceCard( + Widget _buildAppearanceContent( BuildContext context, AppSettingsService settingsService, ) { - return Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - child: Text( - context.l10n.appSettings_appearance, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), - ), - ListTile( - leading: const Icon(Icons.brightness_6_outlined), - title: Text(context.l10n.appSettings_theme), - subtitle: Text( - _themeModeLabel(context, settingsService.settings.themeMode), - ), - trailing: const Icon(Icons.chevron_right), - onTap: () => _showThemeModeDialog(context, settingsService), - ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.language_outlined), - title: Text(context.l10n.appSettings_language), - subtitle: Text( - _languageLabel( - context, - settingsService.settings.languageOverride, + final scheme = Theme.of(context).colorScheme; + final textTheme = Theme.of(context).textTheme; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(16, 14, 16, 10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Icon( + Icons.brightness_6_outlined, + size: 20, + color: scheme.onSurfaceVariant, + ), + const SizedBox(width: 12), + Text( + context.l10n.appSettings_theme, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + ], ), - ), - trailing: const Icon(Icons.chevron_right), - onTap: () => _showLanguageDialog(context, settingsService), + const SizedBox(height: 10), + SegmentedButton( + segments: [ + ButtonSegment( + value: 'system', + label: Text(context.l10n.appSettings_themeSystem), + ), + ButtonSegment( + value: 'light', + label: Text(context.l10n.appSettings_themeLight), + ), + ButtonSegment( + value: 'dark', + label: Text(context.l10n.appSettings_themeDark), + ), + ], + selected: {settingsService.settings.themeMode}, + onSelectionChanged: (selection) { + settingsService.setThemeMode(selection.first); + }, + ), + ], ), - const Divider(height: 1), - SwitchListTile( - secondary: const Icon(Icons.location_searching), - title: Text(context.l10n.appSettings_enableMessageTracing), - subtitle: Text( - context.l10n.appSettings_enableMessageTracingSubtitle, + ), + const Divider(height: 1, indent: 16), + InkWell( + onTap: () => _showLanguageSheet(context, settingsService), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + child: Row( + children: [ + Icon( + Icons.language_outlined, + size: 20, + color: scheme.onSurfaceVariant, + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context.l10n.appSettings_language, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 2), + Text( + _languageLabel( + context, + settingsService.settings.languageOverride, + ), + style: textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + Icon( + Icons.chevron_right, + color: scheme.onSurfaceVariant, + size: 16, + ), + ], ), - value: settingsService.settings.enableMessageTracing, - onChanged: (value) { - settingsService.setEnableMessageTracing(value); - }, ), - ], - ), + ), + ], ); } - Widget _buildNotificationsCard( + Widget _buildNotificationsContent( BuildContext context, AppSettingsService settingsService, ) { - return Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - child: Text( - context.l10n.appSettings_notifications, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + final notifEnabled = settingsService.settings.notificationsEnabled; + return Column( + children: [ + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: const Icon(Icons.notifications_outlined, size: 20), + title: Text(context.l10n.appSettings_enableNotifications), + subtitle: Text(context.l10n.appSettings_enableNotificationsSubtitle), + value: settingsService.settings.notificationsEnabled, + onChanged: (value) async { + if (value) { + final granted = await NotificationService().requestPermissions(); + if (!granted) { + if (context.mounted) { + showDismissibleSnackBar( + context, + content: Text( + context.l10n.appSettings_notificationPermissionDenied, + ), + duration: const Duration(seconds: 2), + ); + } + return; + } + } + await settingsService.setNotificationsEnabled(value); + if (context.mounted) { + showDismissibleSnackBar( + context, + content: Text( + value + ? context.l10n.appSettings_notificationsEnabled + : context.l10n.appSettings_notificationsDisabled, + ), + duration: const Duration(seconds: 2), + ); + } + }, + ), + const Divider(height: 1, indent: 16), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: Icon( + Icons.message_outlined, + size: 20, + color: notifEnabled ? null : Theme.of(context).disabledColor, + ), + title: Text( + context.l10n.appSettings_messageNotifications, + style: TextStyle( + color: notifEnabled ? null : Theme.of(context).disabledColor, ), ), - SwitchListTile( - secondary: const Icon(Icons.notifications_outlined), - title: Text(context.l10n.appSettings_enableNotifications), - subtitle: Text( - context.l10n.appSettings_enableNotificationsSubtitle, + subtitle: Text( + context.l10n.appSettings_messageNotificationsSubtitle, + style: TextStyle( + color: notifEnabled ? null : Theme.of(context).disabledColor, ), - value: settingsService.settings.notificationsEnabled, - onChanged: (value) async { - if (value) { - // Request permission when enabling - final granted = await NotificationService() - .requestPermissions(); - if (!granted) { - if (context.mounted) { - showDismissibleSnackBar( - context, - content: Text( - context.l10n.appSettings_notificationPermissionDenied, + ), + value: settingsService.settings.notifyOnNewMessage, + onChanged: notifEnabled + ? (value) => settingsService.setNotifyOnNewMessage(value) + : null, + ), + const Divider(height: 1, indent: 16), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: Icon( + Icons.forum_outlined, + size: 20, + color: notifEnabled ? null : Theme.of(context).disabledColor, + ), + title: Text( + context.l10n.appSettings_channelMessageNotifications, + style: TextStyle( + color: notifEnabled ? null : Theme.of(context).disabledColor, + ), + ), + subtitle: Text( + context.l10n.appSettings_channelMessageNotificationsSubtitle, + style: TextStyle( + color: notifEnabled ? null : Theme.of(context).disabledColor, + ), + ), + value: settingsService.settings.notifyOnNewChannelMessage, + onChanged: notifEnabled + ? (value) => settingsService.setNotifyOnNewChannelMessage(value) + : null, + ), + const Divider(height: 1, indent: 16), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: Icon( + Icons.cell_tower, + size: 20, + color: notifEnabled ? null : Theme.of(context).disabledColor, + ), + title: Text( + context.l10n.appSettings_advertisementNotifications, + style: TextStyle( + color: notifEnabled ? null : Theme.of(context).disabledColor, + ), + ), + subtitle: Text( + context.l10n.appSettings_advertisementNotificationsSubtitle, + style: TextStyle( + color: notifEnabled ? null : Theme.of(context).disabledColor, + ), + ), + value: settingsService.settings.notifyOnNewAdvert, + onChanged: notifEnabled + ? (value) => settingsService.setNotifyOnNewAdvert(value) + : null, + ), + ], + ); + } + + Widget _buildMessagingContent( + BuildContext context, + AppSettingsService settingsService, + ) { + final autoRouteEnabled = settingsService.settings.autoRouteRotationEnabled; + return Column( + children: [ + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: const Icon(Icons.refresh_outlined, size: 20), + title: Text(context.l10n.appSettings_clearPathOnMaxRetry), + subtitle: Text(context.l10n.appSettings_clearPathOnMaxRetrySubtitle), + value: settingsService.settings.clearPathOnMaxRetry, + onChanged: (value) { + settingsService.setClearPathOnMaxRetry(value); + showDismissibleSnackBar( + context, + content: Text( + value + ? context.l10n.appSettings_pathsWillBeCleared + : context.l10n.appSettings_pathsWillNotBeCleared, + ), + duration: const Duration(seconds: 2), + ); + }, + ), + const Divider(height: 1, indent: 16), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: const Icon(Icons.vertical_align_top, size: 20), + title: Text(context.l10n.appSettings_jumpToOldestUnread), + subtitle: Text(context.l10n.appSettings_jumpToOldestUnreadSubtitle), + value: settingsService.settings.jumpToOldestUnread, + onChanged: settingsService.setJumpToOldestUnread, + ), + const Divider(height: 1, indent: 16), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: const Icon(Icons.alt_route, size: 20), + title: Text(context.l10n.appSettings_autoRouteRotation), + subtitle: Text(context.l10n.appSettings_autoRouteRotationSubtitle), + value: autoRouteEnabled, + onChanged: (value) { + settingsService.setAutoRouteRotationEnabled(value); + showDismissibleSnackBar( + context, + content: Text( + value + ? context.l10n.appSettings_autoRouteRotationEnabled + : context.l10n.appSettings_autoRouteRotationDisabled, + ), + duration: const Duration(seconds: 2), + ); + }, + ), + // AnimatedSize sub-options for auto-route rotation + AnimatedSize( + duration: const Duration(milliseconds: 200), + alignment: Alignment.topCenter, + child: autoRouteEnabled + ? Container( + color: Theme.of(context).colorScheme.surfaceContainerHighest, + padding: const EdgeInsets.only(left: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Divider(height: 1), + ListTile( + title: Text(context.l10n.appSettings_maxRouteWeight), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context.l10n.appSettings_maxRouteWeightSubtitle, + ), + Slider( + value: settingsService.settings.maxRouteWeight, + min: 1, + max: 10, + divisions: 9, + label: settingsService.settings.maxRouteWeight + .round() + .toString(), + onChanged: (value) => + settingsService.setMaxRouteWeight(value), + ), + ], + ), ), - duration: const Duration(seconds: 2), + const Divider(height: 1), + ListTile( + title: Text( + context.l10n.appSettings_initialRouteWeight, + ), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context + .l10n + .appSettings_initialRouteWeightSubtitle, + ), + Slider( + value: + settingsService.settings.initialRouteWeight, + min: 0.5, + max: 5.0, + divisions: 9, + label: settingsService.settings.initialRouteWeight + .toStringAsFixed(1), + onChanged: (value) => + settingsService.setInitialRouteWeight(value), + ), + ], + ), + ), + const Divider(height: 1), + ListTile( + title: Text( + context.l10n.appSettings_routeWeightSuccessIncrement, + ), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context + .l10n + .appSettings_routeWeightSuccessIncrementSubtitle, + ), + Slider( + value: settingsService + .settings + .routeWeightSuccessIncrement, + min: 0.1, + max: 2.0, + divisions: 19, + label: settingsService + .settings + .routeWeightSuccessIncrement + .toStringAsFixed(1), + onChanged: (value) => settingsService + .setRouteWeightSuccessIncrement(value), + ), + ], + ), + ), + const Divider(height: 1), + ListTile( + title: Text( + context.l10n.appSettings_routeWeightFailureDecrement, + ), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context + .l10n + .appSettings_routeWeightFailureDecrementSubtitle, + ), + Slider( + value: settingsService + .settings + .routeWeightFailureDecrement, + min: 0.1, + max: 2.0, + divisions: 19, + label: settingsService + .settings + .routeWeightFailureDecrement + .toStringAsFixed(1), + onChanged: (value) => settingsService + .setRouteWeightFailureDecrement(value), + ), + ], + ), + ), + const Divider(height: 1), + ListTile( + title: Text(context.l10n.appSettings_maxMessageRetries), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context + .l10n + .appSettings_maxMessageRetriesSubtitle, + ), + Slider( + value: settingsService.settings.maxMessageRetries + .toDouble(), + min: 2, + max: 10, + divisions: 8, + label: settingsService.settings.maxMessageRetries + .toString(), + onChanged: (value) => settingsService + .setMaxMessageRetries(value.toInt()), + ), + ], + ), + ), + ], + ), + ) + : const SizedBox.shrink(), + ), + const Divider(height: 1, indent: 16), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: const Icon(Icons.location_searching, size: 20), + title: Text(context.l10n.appSettings_enableMessageTracing), + subtitle: Text(context.l10n.appSettings_enableMessageTracingSubtitle), + value: settingsService.settings.enableMessageTracing, + onChanged: (value) { + settingsService.setEnableMessageTracing(value); + }, + ), + ], + ); + } + + Widget _buildBatteryContent( + BuildContext context, + AppSettingsService settingsService, + MeshCoreConnector connector, + ) { + final deviceId = connector.batteryDeviceKey; + final isConnected = connector.isConnected && deviceId != null; + final selection = isConnected + ? settingsService.batteryChemistryForDevice(deviceId) + : 'nmc'; + final scheme = Theme.of(context).colorScheme; + final textTheme = Theme.of(context).textTheme; + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 12, bottom: 4), + child: Row( + children: [ + Icon( + Icons.battery_full, + size: 20, + color: scheme.onSurfaceVariant, + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context.l10n.appSettings_batteryChemistry, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 2), + Text( + isConnected + ? context.l10n.appSettings_batteryChemistryPerDevice( + connector.deviceDisplayName, + ) + : context + .l10n + .appSettings_batteryChemistryConnectFirst, + style: textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + ], + ), + ), + const SizedBox(height: 8), + DropdownButtonFormField( + initialValue: selection, + isExpanded: true, + decoration: const InputDecoration( + border: UnderlineInputBorder(), + isDense: true, + ), + onChanged: isConnected + ? (value) { + if (value != null) { + settingsService.setBatteryChemistryForDevice( + deviceId, + value, ); } - return; } - } - - await settingsService.setNotificationsEnabled(value); - if (context.mounted) { - showDismissibleSnackBar( - context, - content: Text( - value - ? context.l10n.appSettings_notificationsEnabled - : context.l10n.appSettings_notificationsDisabled, - ), - duration: const Duration(seconds: 2), - ); - } - }, - ), - const Divider(height: 1), - SwitchListTile( - secondary: Icon( - Icons.message_outlined, - color: settingsService.settings.notificationsEnabled - ? null - : Colors.grey, + : null, + items: [ + DropdownMenuItem( + value: 'nmc', + child: Text(context.l10n.appSettings_batteryNmc), ), - title: Text( - context.l10n.appSettings_messageNotifications, - style: TextStyle( - color: settingsService.settings.notificationsEnabled - ? null - : Colors.grey, - ), + DropdownMenuItem( + value: 'lifepo4', + child: Text(context.l10n.appSettings_batteryLifepo4), ), - subtitle: Text( - context.l10n.appSettings_messageNotificationsSubtitle, - style: TextStyle( - color: settingsService.settings.notificationsEnabled - ? null - : Colors.grey, - ), - ), - value: settingsService.settings.notifyOnNewMessage, - onChanged: settingsService.settings.notificationsEnabled - ? (value) { - settingsService.setNotifyOnNewMessage(value); - } - : null, - ), - const Divider(height: 1), - SwitchListTile( - secondary: Icon( - Icons.forum_outlined, - color: settingsService.settings.notificationsEnabled - ? null - : Colors.grey, - ), - title: Text( - context.l10n.appSettings_channelMessageNotifications, - style: TextStyle( - color: settingsService.settings.notificationsEnabled - ? null - : Colors.grey, - ), - ), - subtitle: Text( - context.l10n.appSettings_channelMessageNotificationsSubtitle, - style: TextStyle( - color: settingsService.settings.notificationsEnabled - ? null - : Colors.grey, - ), - ), - value: settingsService.settings.notifyOnNewChannelMessage, - onChanged: settingsService.settings.notificationsEnabled - ? (value) { - settingsService.setNotifyOnNewChannelMessage(value); - } - : null, - ), - const Divider(height: 1), - SwitchListTile( - secondary: Icon( - Icons.cell_tower, - color: settingsService.settings.notificationsEnabled - ? null - : Colors.grey, - ), - title: Text( - context.l10n.appSettings_advertisementNotifications, - style: TextStyle( - color: settingsService.settings.notificationsEnabled - ? null - : Colors.grey, - ), - ), - subtitle: Text( - context.l10n.appSettings_advertisementNotificationsSubtitle, - style: TextStyle( - color: settingsService.settings.notificationsEnabled - ? null - : Colors.grey, - ), - ), - value: settingsService.settings.notifyOnNewAdvert, - onChanged: settingsService.settings.notificationsEnabled - ? (value) { - settingsService.setNotifyOnNewAdvert(value); - } - : null, - ), - ], - ), - ); - } - - Widget _buildMessagingCard( - BuildContext context, - AppSettingsService settingsService, - ) { - return Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - child: Text( - context.l10n.appSettings_messaging, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), - ), - SwitchListTile( - secondary: const Icon(Icons.refresh_outlined), - title: Text(context.l10n.appSettings_clearPathOnMaxRetry), - subtitle: Text( - context.l10n.appSettings_clearPathOnMaxRetrySubtitle, - ), - value: settingsService.settings.clearPathOnMaxRetry, - onChanged: (value) { - settingsService.setClearPathOnMaxRetry(value); - showDismissibleSnackBar( - context, - content: Text( - value - ? context.l10n.appSettings_pathsWillBeCleared - : context.l10n.appSettings_pathsWillNotBeCleared, - ), - duration: const Duration(seconds: 2), - ); - }, - ), - const Divider(height: 1), - SwitchListTile( - secondary: const Icon(Icons.vertical_align_top), - title: Text(context.l10n.appSettings_jumpToOldestUnread), - subtitle: Text(context.l10n.appSettings_jumpToOldestUnreadSubtitle), - value: settingsService.settings.jumpToOldestUnread, - onChanged: settingsService.setJumpToOldestUnread, - ), - const Divider(height: 1), - SwitchListTile( - secondary: const Icon(Icons.alt_route), - title: Text(context.l10n.appSettings_autoRouteRotation), - subtitle: Text(context.l10n.appSettings_autoRouteRotationSubtitle), - value: settingsService.settings.autoRouteRotationEnabled, - onChanged: (value) { - settingsService.setAutoRouteRotationEnabled(value); - showDismissibleSnackBar( - context, - content: Text( - value - ? context.l10n.appSettings_autoRouteRotationEnabled - : context.l10n.appSettings_autoRouteRotationDisabled, - ), - duration: const Duration(seconds: 2), - ); - }, - ), - if (settingsService.settings.autoRouteRotationEnabled) ...[ - const Divider(height: 1), - ListTile( - title: Text(context.l10n.appSettings_maxRouteWeight), - subtitle: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(context.l10n.appSettings_maxRouteWeightSubtitle), - Slider( - value: settingsService.settings.maxRouteWeight, - min: 1, - max: 10, - divisions: 9, - label: settingsService.settings.maxRouteWeight - .round() - .toString(), - onChanged: (value) => - settingsService.setMaxRouteWeight(value), - ), - ], - ), - ), - const Divider(height: 1), - ListTile( - title: Text(context.l10n.appSettings_initialRouteWeight), - subtitle: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(context.l10n.appSettings_initialRouteWeightSubtitle), - Slider( - value: settingsService.settings.initialRouteWeight, - min: 0.5, - max: 5.0, - divisions: 9, - label: settingsService.settings.initialRouteWeight - .toStringAsFixed(1), - onChanged: (value) => - settingsService.setInitialRouteWeight(value), - ), - ], - ), - ), - const Divider(height: 1), - ListTile( - title: Text(context.l10n.appSettings_routeWeightSuccessIncrement), - subtitle: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - context - .l10n - .appSettings_routeWeightSuccessIncrementSubtitle, - ), - Slider( - value: settingsService.settings.routeWeightSuccessIncrement, - min: 0.1, - max: 2.0, - divisions: 19, - label: settingsService.settings.routeWeightSuccessIncrement - .toStringAsFixed(1), - onChanged: (value) => - settingsService.setRouteWeightSuccessIncrement(value), - ), - ], - ), - ), - const Divider(height: 1), - ListTile( - title: Text(context.l10n.appSettings_routeWeightFailureDecrement), - subtitle: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - context - .l10n - .appSettings_routeWeightFailureDecrementSubtitle, - ), - Slider( - value: settingsService.settings.routeWeightFailureDecrement, - min: 0.1, - max: 2.0, - divisions: 19, - label: settingsService.settings.routeWeightFailureDecrement - .toStringAsFixed(1), - onChanged: (value) => - settingsService.setRouteWeightFailureDecrement(value), - ), - ], - ), - ), - const Divider(height: 1), - ListTile( - title: Text(context.l10n.appSettings_maxMessageRetries), - subtitle: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(context.l10n.appSettings_maxMessageRetriesSubtitle), - Slider( - value: settingsService.settings.maxMessageRetries - .toDouble(), - min: 2, - max: 10, - divisions: 8, - label: settingsService.settings.maxMessageRetries - .toString(), - onChanged: (value) => - settingsService.setMaxMessageRetries(value.toInt()), - ), - ], - ), + DropdownMenuItem( + value: 'lipo', + child: Text(context.l10n.appSettings_batteryLipo), ), ], - ], - ), + ), + ], ); } - Widget _buildMapSettingsCard( + Widget _buildMapContent( BuildContext context, AppSettingsService settingsService, ) { - return Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - child: Text( - context.l10n.appSettings_mapDisplay, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + final scheme = Theme.of(context).colorScheme; + final textTheme = Theme.of(context).textTheme; + return Column( + children: [ + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: const Icon(Icons.router_outlined, size: 20), + title: Text(context.l10n.appSettings_showRepeaters), + subtitle: Text(context.l10n.appSettings_showRepeatersSubtitle), + value: settingsService.settings.mapShowRepeaters, + onChanged: (value) => settingsService.setMapShowRepeaters(value), + ), + const Divider(height: 1, indent: 16), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: const Icon(Icons.chat_outlined, size: 20), + title: Text(context.l10n.appSettings_showChatNodes), + subtitle: Text(context.l10n.appSettings_showChatNodesSubtitle), + value: settingsService.settings.mapShowChatNodes, + onChanged: (value) => settingsService.setMapShowChatNodes(value), + ), + const Divider(height: 1, indent: 16), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: const Icon(Icons.people_outline, size: 20), + title: Text(context.l10n.appSettings_showOtherNodes), + subtitle: Text(context.l10n.appSettings_showOtherNodesSubtitle), + value: settingsService.settings.mapShowOtherNodes, + onChanged: (value) => settingsService.setMapShowOtherNodes(value), + ), + const Divider(height: 1, indent: 16), + InkWell( + onTap: () => _showTimeFilterSheet(context, settingsService), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + child: Row( + children: [ + Icon( + Icons.timer_outlined, + size: 20, + color: scheme.onSurfaceVariant, + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context.l10n.appSettings_timeFilter, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 2), + Text( + settingsService.settings.mapTimeFilterHours == 0 + ? context.l10n.appSettings_timeFilterShowAll + : context.l10n.appSettings_timeFilterShowLast( + settingsService.settings.mapTimeFilterHours + .toInt(), + ), + style: textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + Icon( + Icons.chevron_right, + color: scheme.onSurfaceVariant, + size: 16, + ), + ], ), ), - SwitchListTile( - secondary: const Icon(Icons.router_outlined), - title: Text(context.l10n.appSettings_showRepeaters), - subtitle: Text(context.l10n.appSettings_showRepeatersSubtitle), - value: settingsService.settings.mapShowRepeaters, - onChanged: (value) { - settingsService.setMapShowRepeaters(value); - }, - ), - const Divider(height: 1), - SwitchListTile( - secondary: const Icon(Icons.chat_outlined), - title: Text(context.l10n.appSettings_showChatNodes), - subtitle: Text(context.l10n.appSettings_showChatNodesSubtitle), - value: settingsService.settings.mapShowChatNodes, - onChanged: (value) { - settingsService.setMapShowChatNodes(value); - }, - ), - const Divider(height: 1), - SwitchListTile( - secondary: const Icon(Icons.people_outline), - title: Text(context.l10n.appSettings_showOtherNodes), - subtitle: Text(context.l10n.appSettings_showOtherNodesSubtitle), - value: settingsService.settings.mapShowOtherNodes, - onChanged: (value) { - settingsService.setMapShowOtherNodes(value); - }, - ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.timer_outlined), - title: Text(context.l10n.appSettings_timeFilter), - subtitle: Text( - settingsService.settings.mapTimeFilterHours == 0 - ? context.l10n.appSettings_timeFilterShowAll - : context.l10n.appSettings_timeFilterShowLast( - settingsService.settings.mapTimeFilterHours.toInt(), - ), + ), + const Divider(height: 1, indent: 16), + InkWell( + onTap: () => _showUnitsSheet(context, settingsService), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + child: Row( + children: [ + Icon( + Icons.straighten, + size: 20, + color: scheme.onSurfaceVariant, + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context.l10n.appSettings_unitsTitle, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 2), + Text( + settingsService.settings.unitSystem == + UnitSystem.imperial + ? context.l10n.appSettings_unitsImperial + : context.l10n.appSettings_unitsMetric, + style: textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + Icon( + Icons.chevron_right, + color: scheme.onSurfaceVariant, + size: 16, + ), + ], ), - trailing: const Icon(Icons.chevron_right), - onTap: () => _showTimeFilterDialog(context, settingsService), ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.straighten), - title: Text(context.l10n.appSettings_unitsTitle), - subtitle: Text( - settingsService.settings.unitSystem == UnitSystem.imperial - ? context.l10n.appSettings_unitsImperial - : context.l10n.appSettings_unitsMetric, + ), + const Divider(height: 1, indent: 16), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => const MapCacheScreen()), + ); + }, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + child: Row( + children: [ + Icon( + Icons.download_outlined, + size: 20, + color: scheme.onSurfaceVariant, + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context.l10n.appSettings_offlineMapCache, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 2), + Text( + settingsService.settings.mapCacheBounds == null + ? context.l10n.appSettings_noAreaSelected + : context.l10n.appSettings_areaSelectedZoom( + settingsService.settings.mapCacheMinZoom, + settingsService.settings.mapCacheMaxZoom, + ), + style: textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + Icon( + Icons.chevron_right, + color: scheme.onSurfaceVariant, + size: 16, + ), + ], ), - trailing: const Icon(Icons.chevron_right), - onTap: () => _showUnitsDialog(context, settingsService), ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.download_outlined), - title: Text(context.l10n.appSettings_offlineMapCache), - subtitle: Text( - settingsService.settings.mapCacheBounds == null - ? context.l10n.appSettings_noAreaSelected - : context.l10n.appSettings_areaSelectedZoom( - settingsService.settings.mapCacheMinZoom, - settingsService.settings.mapCacheMaxZoom, - ), - ), - trailing: const Icon(Icons.chevron_right), - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => const MapCacheScreen()), - ); - }, - ), - ], - ), + ), + ], ); } - Widget _buildTranslationCard( + Widget _buildTranslationContent( BuildContext context, AppSettingsService settingsService, TranslationService translationService, ) { final settings = settingsService.settings; - return Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - child: Text( - context.l10n.translation_title, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), + final translationEnabled = settings.translationEnabled; + final scheme = Theme.of(context).colorScheme; + final textTheme = Theme.of(context).textTheme; + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, ), - SwitchListTile( - secondary: const Icon(Icons.translate), - title: Text(context.l10n.translation_enableTitle), - subtitle: Text(context.l10n.translation_enableSubtitle), - value: settings.translationEnabled, - onChanged: settingsService.setTranslationEnabled, + secondary: const Icon(Icons.translate, size: 20), + title: Text(context.l10n.translation_enableTitle), + subtitle: Text(context.l10n.translation_enableSubtitle), + value: settings.translationEnabled, + onChanged: settingsService.setTranslationEnabled, + ), + const Divider(height: 1, indent: 16), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, ), - const Divider(height: 1), - SwitchListTile( - secondary: const Icon(Icons.outgoing_mail), - title: Text(context.l10n.translation_composerTitle), - subtitle: Text(context.l10n.translation_composerSubtitle), - value: settings.composerTranslationEnabled, - onChanged: settingsService.setComposerTranslationEnabled, + secondary: Icon( + Icons.auto_awesome_outlined, + size: 20, + color: translationEnabled ? null : Theme.of(context).disabledColor, ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.language), - title: Text(context.l10n.translation_targetLanguage), - subtitle: Text( - _translationLanguageLabel( - context, - settings.translationTargetLanguageCode, - ), - ), - trailing: const Icon(Icons.chevron_right), - onTap: () => - _showTranslationLanguageDialog(context, settingsService), - ), - const Divider(height: 1), - Padding( - padding: const EdgeInsets.fromLTRB(16, 12, 16, 4), - child: DropdownButtonFormField( - initialValue: settings.translationSelectedModelId, - isExpanded: true, - decoration: InputDecoration( - labelText: context.l10n.translation_downloadedModelLabel, - border: const OutlineInputBorder(), - ), - items: [ - for (final model in settings.translationDownloadedModels) - DropdownMenuItem( - value: model.id, - child: Text(translationModelFriendlyName(model)), - ), - ], - onChanged: settings.translationDownloadedModels.isEmpty + title: Text( + context.l10n.translation_autoIncomingTitle, + style: TextStyle( + color: translationEnabled ? null - : (value) { - settingsService.setTranslationSelectedModelId(value); - }, + : Theme.of(context).disabledColor, ), ), - Padding( - padding: const EdgeInsets.fromLTRB(16, 12, 16, 4), - child: DropdownButtonFormField( - initialValue: null, - isExpanded: true, - decoration: InputDecoration( - labelText: context.l10n.translation_presetModelLabel, - border: const OutlineInputBorder(), - ), - items: [ - for (final preset in translationPresetModels) - DropdownMenuItem( - value: preset.sourceUrl, - child: Text(translationModelFriendlyName(preset)), - ), - ], - onChanged: translationService.isBusy + subtitle: Text( + context.l10n.translation_autoIncomingSubtitle, + style: TextStyle( + color: translationEnabled ? null - : (value) async { - if (value == null) return; - final preset = translationPresetModels.firstWhere( - (entry) => entry.sourceUrl == value, - ); - await _downloadTranslationModel( + : Theme.of(context).disabledColor, + ), + ), + value: settings.autoTranslateIncomingMessages, + onChanged: translationEnabled + ? settingsService.setAutoTranslateIncomingMessages + : null, + ), + const Divider(height: 1, indent: 16), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: Icon( + Icons.outgoing_mail, + size: 20, + color: translationEnabled ? null : Theme.of(context).disabledColor, + ), + title: Text( + context.l10n.translation_composerTitle, + style: TextStyle( + color: translationEnabled + ? null + : Theme.of(context).disabledColor, + ), + ), + subtitle: Text( + context.l10n.translation_composerSubtitle, + style: TextStyle( + color: translationEnabled + ? null + : Theme.of(context).disabledColor, + ), + ), + value: settings.composerTranslationEnabled, + onChanged: translationEnabled + ? settingsService.setComposerTranslationEnabled + : null, + ), + const Divider(height: 1, indent: 16), + InkWell( + onTap: () => _showTranslationLanguageDialog(context, settingsService), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + child: Row( + children: [ + Icon(Icons.language, size: 20, color: scheme.onSurfaceVariant), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context.l10n.translation_targetLanguage, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 2), + Text( + _translationLanguageLabel( + context, + settings.translationTargetLanguageCode, + ), + style: textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + Icon( + Icons.chevron_right, + color: scheme.onSurfaceVariant, + size: 16, + ), + ], + ), + ), + ), + const Divider(height: 1, indent: 16), + Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 4), + child: DropdownButtonFormField( + initialValue: settings.translationSelectedModelId, + isExpanded: true, + decoration: InputDecoration( + labelText: context.l10n.translation_downloadedModelLabel, + border: const OutlineInputBorder(), + ), + items: [ + for (final model in settings.translationDownloadedModels) + DropdownMenuItem( + value: model.id, + child: Text(translationModelFriendlyName(model)), + ), + ], + onChanged: settings.translationDownloadedModels.isEmpty + ? null + : (value) { + settingsService.setTranslationSelectedModelId(value); + }, + ), + ), + Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 4), + child: DropdownButtonFormField( + initialValue: null, + isExpanded: true, + decoration: InputDecoration( + labelText: context.l10n.translation_presetModelLabel, + border: const OutlineInputBorder(), + ), + items: [ + for (final preset in translationPresetModels) + DropdownMenuItem( + value: preset.sourceUrl, + child: Text(translationModelFriendlyName(preset)), + ), + ], + onChanged: translationService.isBusy + ? null + : (value) async { + if (value == null) return; + final preset = translationPresetModels.firstWhere( + (entry) => entry.sourceUrl == value, + ); + await _downloadTranslationModel( + context, + translationService, + settingsService, + sourceUrl: preset.sourceUrl, + fileName: preset.name, + id: preset.id, + ); + }, + ), + ), + Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _TranslationUrlField( + initialValue: settings.translationModelSourceUrl ?? '', + onChanged: settingsService.setTranslationModelSourceUrl, + onDownload: translationService.isBusy + ? null + : (url) => _downloadTranslationModel( context, translationService, settingsService, - sourceUrl: preset.sourceUrl, - fileName: preset.name, - id: preset.id, - ); - }, - ), - ), - Padding( - padding: const EdgeInsets.fromLTRB(16, 12, 16, 16), - child: Column( - children: [ - _TranslationUrlField( - initialValue: settings.translationModelSourceUrl ?? '', - onChanged: settingsService.setTranslationModelSourceUrl, - onDownload: translationService.isBusy - ? null - : (url) => _downloadTranslationModel( - context, - translationService, - settingsService, - sourceUrl: url, - ), - downloadLabel: translationService.isDownloading - ? context.l10n.translation_downloading - : translationService.isBusy - ? context.l10n.translation_working - : context.l10n.translation_downloadModel, - isDownloading: translationService.isDownloading, - onCancel: translationService.cancelDownload, - labelText: context.l10n.translation_manualUrlLabel, - stopLabel: context.l10n.translation_stop, - ), - if (translationService.isDownloading) ...[ - const SizedBox(height: 12), - LinearProgressIndicator( + sourceUrl: url, + ), + downloadLabel: translationService.isDownloading + ? context.l10n.translation_downloading + : translationService.isBusy + ? context.l10n.translation_working + : context.l10n.translation_downloadModel, + isDownloading: translationService.isDownloading, + onCancel: translationService.cancelDownload, + labelText: context.l10n.translation_manualUrlLabel, + stopLabel: context.l10n.translation_stop, + ), + if (translationService.isDownloading) ...[ + const SizedBox(height: 12), + ClipRRect( + borderRadius: BorderRadius.circular(2), + child: LinearProgressIndicator( value: translationService.downloadFileName == 'Merging chunks...' ? null : translationService.downloadProgress, ), - const SizedBox(height: 8), - Align( - alignment: Alignment.centerLeft, - child: Text( - _downloadProgressLabel(context, translationService), - style: Theme.of(context).textTheme.bodySmall, + ), + const SizedBox(height: 8), + Align( + alignment: Alignment.centerLeft, + child: Text( + _downloadProgressLabel(context, translationService), + style: MeshTheme.mono( + fontSize: 12, + color: scheme.onSurfaceVariant, ), ), - ], - if (settings.translationDownloadedModels.isNotEmpty) ...[ - const SizedBox(height: 16), - Align( - alignment: Alignment.centerLeft, - child: Text( - context.l10n.translation_downloadedModels, - style: Theme.of(context).textTheme.titleSmall, - ), + ), + ], + if (settings.translationDownloadedModels.isNotEmpty) ...[ + const SizedBox(height: 16), + Align( + alignment: Alignment.centerLeft, + child: Text( + context.l10n.translation_downloadedModels, + style: Theme.of(context).textTheme.titleSmall, ), - const SizedBox(height: 8), - for (final model in settings.translationDownloadedModels) - Card.outlined( - margin: const EdgeInsets.only(bottom: 8), - child: ListTile( - contentPadding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 4, - ), - leading: Icon( + ), + const SizedBox(height: 8), + for (final model in settings.translationDownloadedModels) + Padding( + padding: const EdgeInsets.only(bottom: 8), + child: Row( + children: [ + Icon( model.id == settings.translationSelectedModelId ? Icons.check_circle : Icons.memory_outlined, + size: 20, + color: model.id == settings.translationSelectedModelId + ? scheme.primary + : scheme.onSurfaceVariant, ), - title: Text(translationModelFriendlyName(model)), - subtitle: Text(_downloadedModelLabel(model)), - trailing: IconButton( + const SizedBox(width: 12), + Expanded( + child: InkWell( + borderRadius: BorderRadius.circular(MeshRadii.xs), + onTap: () => settingsService + .setTranslationSelectedModelId(model.id), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + translationModelFriendlyName(model), + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + Text( + _downloadedModelLabel(model), + style: MeshTheme.mono( + fontSize: 11, + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + ), + IconButton( tooltip: context.l10n.translation_deleteModel, onPressed: translationService.isBusy ? null @@ -736,161 +1182,118 @@ class AppSettingsScreen extends StatelessWidget { ), icon: const Icon(Icons.delete_outline), ), - onTap: () => settingsService - .setTranslationSelectedModelId(model.id), - ), - ), - ], - if (translationService.lastError != null) ...[ - const SizedBox(height: 8), - Text( - translationService.lastError!, - style: TextStyle( - color: Theme.of(context).colorScheme.error, + ], ), ), - ], ], - ), - ), - ], - ), - ); - } - - // Fixed rendering issues - Widget _buildBatteryCard( - BuildContext context, - AppSettingsService settingsService, - MeshCoreConnector connector, - ) { - final deviceId = connector.deviceId; - final isConnected = connector.isConnected && deviceId != null; - final selection = isConnected - ? settingsService.batteryChemistryForDevice(deviceId) - : 'nmc'; - - return Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const SizedBox(height: 4), - Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - child: Text( - context.l10n.appSettings_battery, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), - ), - - // Main tile (icon + text only) - ListTile( - leading: const Icon(Icons.battery_full), - title: Text(context.l10n.appSettings_batteryChemistry), - subtitle: Text( - isConnected - ? context.l10n.appSettings_batteryChemistryPerDevice( - connector.deviceDisplayName, - ) - : context.l10n.appSettings_batteryChemistryConnectFirst, - ), - contentPadding: const EdgeInsets.symmetric(horizontal: 16), - ), - - // Dropdown (separate full-width row) - Padding( - padding: const EdgeInsets.fromLTRB(16, 0, 16, 16), - child: DropdownButtonFormField( - initialValue: selection, - isExpanded: true, - decoration: const InputDecoration( - border: UnderlineInputBorder(), - isDense: true, - ), - onChanged: isConnected - ? (value) { - if (value != null) { - settingsService.setBatteryChemistryForDevice( - deviceId, - value, - ); - } - } - : null, - items: [ - DropdownMenuItem( - value: 'nmc', - child: Text(context.l10n.appSettings_batteryNmc), - ), - DropdownMenuItem( - value: 'lifepo4', - child: Text(context.l10n.appSettings_batteryLifepo4), - ), - DropdownMenuItem( - value: 'lipo', - child: Text(context.l10n.appSettings_batteryLipo), + if (translationService.lastError != null) ...[ + const SizedBox(height: 8), + Text( + translationService.lastError!, + style: TextStyle(color: Theme.of(context).colorScheme.error), ), ], - ), - ), - ], - ), - ); - } - - void _showThemeModeDialog( - BuildContext context, - AppSettingsService settingsService, - ) { - showDialog( - context: context, - builder: (context) => AlertDialog( - title: Text(context.l10n.appSettings_theme), - content: RadioGroup( - groupValue: settingsService.settings.themeMode, - onChanged: (value) { - if (value != null) { - settingsService.setThemeMode(value); - Navigator.pop(context); - } - }, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - RadioListTile( - title: Text(context.l10n.appSettings_themeSystem), - value: 'system', - ), - RadioListTile( - title: Text(context.l10n.appSettings_themeLight), - value: 'light', - ), - RadioListTile( - title: Text(context.l10n.appSettings_themeDark), - value: 'dark', - ), ], ), ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(context), - child: Text(context.l10n.common_close), - ), - ], - ), + ], ); } - String _themeModeLabel(BuildContext context, String value) { - switch (value) { - case 'light': - return context.l10n.appSettings_themeLight; - case 'dark': - return context.l10n.appSettings_themeDark; - default: - return context.l10n.appSettings_themeSystem; - } + Widget _buildCyr2LatContent( + BuildContext context, + AppSettingsService settingsService, + ) { + final selectedProfile = settingsService.getSelectedCyr2LatProfile(); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const SizedBox(height: 8), + DropdownButtonFormField( + initialValue: settingsService.settings.selectedCyr2latProfileId, + decoration: InputDecoration( + labelText: context.l10n.channels_cyr2latSettingsSubheading, + border: const OutlineInputBorder(), + ), + items: settingsService.settings.cyr2latProfiles.map((profile) { + return DropdownMenuItem( + value: profile.id, + child: Text(profile.name), + ); + }).toList(), + onChanged: (value) { + if (value != null) { + settingsService.setSelectedCyr2LatProfile(value); + } + }, + ), + const SizedBox(height: 12), + Row( + children: [ + Expanded( + child: OutlinedButton.icon( + onPressed: () => + _showAddCyr2LatProfileDialog(context, settingsService), + icon: const Icon(Icons.add), + label: Text(context.l10n.common_add), + ), + ), + const SizedBox(width: 8), + Expanded( + child: OutlinedButton.icon( + onPressed: () => _showEditCyr2LatProfileDialog( + context, + settingsService, + selectedProfile, + ), + icon: const Icon(Icons.edit), + label: Text(context.l10n.common_edit), + ), + ), + const SizedBox(width: 8), + Expanded( + child: OutlinedButton.icon( + onPressed: settingsService.settings.cyr2latProfiles.length > 1 + ? () => _showDeleteCyr2LatProfileDialog( + context, + settingsService, + selectedProfile, + ) + : null, + icon: const Icon(Icons.delete), + label: Text(context.l10n.common_delete), + ), + ), + ], + ), + ], + ); + } + + Widget _buildDebugContent( + BuildContext context, + AppSettingsService settingsService, + ) { + return SwitchListTile( + contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + secondary: const Icon(Icons.bug_report_outlined, size: 20), + title: Text(context.l10n.appSettings_appDebugLogging), + subtitle: Text(context.l10n.appSettings_appDebugLoggingSubtitle), + value: settingsService.settings.appDebugLogEnabled, + onChanged: (value) async { + await settingsService.setAppDebugLogEnabled(value); + if (!context.mounted) return; + showDismissibleSnackBar( + context, + content: Text( + value + ? context.l10n.appSettings_appDebugLoggingEnabled + : context.l10n.appSettings_appDebugLoggingDisabled, + ), + duration: const Duration(seconds: 2), + ); + }, + ); } String _languageLabel(BuildContext context, String? languageCode) { @@ -936,208 +1339,344 @@ class AppSettingsScreen extends StatelessWidget { } } - void _showLanguageDialog( + void _showLanguageSheet( BuildContext context, AppSettingsService settingsService, ) { - showDialog( - context: context, - builder: (context) => AlertDialog( - title: Text(context.l10n.appSettings_language), - content: SingleChildScrollView( - child: RadioGroup( - groupValue: settingsService.settings.languageOverride, - onChanged: (value) { - settingsService.setLanguageOverride(value); - Navigator.pop(context); - }, - child: Column( - mainAxisSize: MainAxisSize.min, + showMeshSheet( + context, + builder: (ctx) => Column( + mainAxisSize: MainAxisSize.min, + children: [ + BottomSheetHeader(title: context.l10n.appSettings_language), + SizedBox( + height: 400, + child: ListView( children: [ - RadioListTile( - title: Text(context.l10n.appSettings_languageSystem), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageSystem, value: null, + selected: settingsService.settings.languageOverride == null, + onTap: () { + settingsService.setLanguageOverride(null); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageEn), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageEn, value: 'en', + selected: settingsService.settings.languageOverride == 'en', + onTap: () { + settingsService.setLanguageOverride('en'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageFr), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageFr, value: 'fr', + selected: settingsService.settings.languageOverride == 'fr', + onTap: () { + settingsService.setLanguageOverride('fr'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageEs), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageEs, value: 'es', + selected: settingsService.settings.languageOverride == 'es', + onTap: () { + settingsService.setLanguageOverride('es'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageDe), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageDe, value: 'de', + selected: settingsService.settings.languageOverride == 'de', + onTap: () { + settingsService.setLanguageOverride('de'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languagePl), + _sheetOption( + ctx, + label: context.l10n.appSettings_languagePl, value: 'pl', + selected: settingsService.settings.languageOverride == 'pl', + onTap: () { + settingsService.setLanguageOverride('pl'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageSl), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageSl, value: 'sl', + selected: settingsService.settings.languageOverride == 'sl', + onTap: () { + settingsService.setLanguageOverride('sl'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languagePt), + _sheetOption( + ctx, + label: context.l10n.appSettings_languagePt, value: 'pt', + selected: settingsService.settings.languageOverride == 'pt', + onTap: () { + settingsService.setLanguageOverride('pt'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageIt), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageIt, value: 'it', + selected: settingsService.settings.languageOverride == 'it', + onTap: () { + settingsService.setLanguageOverride('it'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageZh), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageZh, value: 'zh', + selected: settingsService.settings.languageOverride == 'zh', + onTap: () { + settingsService.setLanguageOverride('zh'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageSv), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageSv, value: 'sv', + selected: settingsService.settings.languageOverride == 'sv', + onTap: () { + settingsService.setLanguageOverride('sv'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageNl), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageNl, value: 'nl', + selected: settingsService.settings.languageOverride == 'nl', + onTap: () { + settingsService.setLanguageOverride('nl'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageSk), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageSk, value: 'sk', + selected: settingsService.settings.languageOverride == 'sk', + onTap: () { + settingsService.setLanguageOverride('sk'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageBg), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageBg, value: 'bg', + selected: settingsService.settings.languageOverride == 'bg', + onTap: () { + settingsService.setLanguageOverride('bg'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageRu), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageRu, value: 'ru', + selected: settingsService.settings.languageOverride == 'ru', + onTap: () { + settingsService.setLanguageOverride('ru'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageUk), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageUk, value: 'uk', + selected: settingsService.settings.languageOverride == 'uk', + onTap: () { + settingsService.setLanguageOverride('uk'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageHu), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageHu, value: 'hu', + selected: settingsService.settings.languageOverride == 'hu', + onTap: () { + settingsService.setLanguageOverride('hu'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageJa), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageJa, value: 'ja', + selected: settingsService.settings.languageOverride == 'ja', + onTap: () { + settingsService.setLanguageOverride('ja'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageKo), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageKo, value: 'ko', + selected: settingsService.settings.languageOverride == 'ko', + onTap: () { + settingsService.setLanguageOverride('ko'); + Navigator.pop(ctx); + }, ), + SizedBox(height: MediaQuery.paddingOf(ctx).bottom + 8), ], ), ), - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(context), - child: Text(context.l10n.common_close), - ), ], ), ); } - void _showTimeFilterDialog( + void _showTimeFilterSheet( BuildContext context, AppSettingsService settingsService, ) { - showDialog( - context: context, - builder: (context) => AlertDialog( - title: Text(context.l10n.appSettings_mapTimeFilter), - content: RadioGroup( - groupValue: settingsService.settings.mapTimeFilterHours, - onChanged: (value) { - if (value != null) { - settingsService.setMapTimeFilterHours(value); - Navigator.pop(context); - } - }, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Text(context.l10n.appSettings_showNodesDiscoveredWithin), - const SizedBox(height: 16), - RadioListTile( - title: Text(context.l10n.appSettings_allTime), - value: 0, - ), - RadioListTile( - title: Text(context.l10n.appSettings_lastHour), - value: 1, - ), - RadioListTile( - title: Text(context.l10n.appSettings_last6Hours), - value: 6, - ), - RadioListTile( - title: Text(context.l10n.appSettings_last24Hours), - value: 24, - ), - RadioListTile( - title: Text(context.l10n.appSettings_lastWeek), - value: 168, - ), - ], + showMeshSheet( + context, + builder: (ctx) => Column( + mainAxisSize: MainAxisSize.min, + children: [ + BottomSheetHeader(title: context.l10n.appSettings_mapTimeFilter), + Padding( + padding: const EdgeInsets.fromLTRB(16, 4, 16, 8), + child: Text(context.l10n.appSettings_showNodesDiscoveredWithin), ), - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(context), - child: Text(context.l10n.common_close), + _sheetOption( + ctx, + label: context.l10n.appSettings_allTime, + value: 0, + selected: settingsService.settings.mapTimeFilterHours == 0, + onTap: () { + settingsService.setMapTimeFilterHours(0); + Navigator.pop(ctx); + }, ), + _sheetOption( + ctx, + label: context.l10n.appSettings_lastHour, + value: 1, + selected: settingsService.settings.mapTimeFilterHours == 1, + onTap: () { + settingsService.setMapTimeFilterHours(1); + Navigator.pop(ctx); + }, + ), + _sheetOption( + ctx, + label: context.l10n.appSettings_last6Hours, + value: 6, + selected: settingsService.settings.mapTimeFilterHours == 6, + onTap: () { + settingsService.setMapTimeFilterHours(6); + Navigator.pop(ctx); + }, + ), + _sheetOption( + ctx, + label: context.l10n.appSettings_last24Hours, + value: 24, + selected: settingsService.settings.mapTimeFilterHours == 24, + onTap: () { + settingsService.setMapTimeFilterHours(24); + Navigator.pop(ctx); + }, + ), + _sheetOption( + ctx, + label: context.l10n.appSettings_lastWeek, + value: 168, + selected: settingsService.settings.mapTimeFilterHours == 168, + onTap: () { + settingsService.setMapTimeFilterHours(168); + Navigator.pop(ctx); + }, + ), + SizedBox(height: MediaQuery.paddingOf(ctx).bottom + 8), ], ), ); } - void _showUnitsDialog( + void _showUnitsSheet( BuildContext context, AppSettingsService settingsService, ) { - showDialog( - context: context, - builder: (context) => AlertDialog( - title: Text(context.l10n.appSettings_unitsTitle), - content: RadioGroup( - groupValue: settingsService.settings.unitSystem, - onChanged: (value) { - if (value != null) { - settingsService.setUnitSystem(value); - Navigator.pop(context); - } - }, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - RadioListTile( - title: Text(context.l10n.appSettings_unitsMetric), - value: UnitSystem.metric, - ), - RadioListTile( - title: Text(context.l10n.appSettings_unitsImperial), - value: UnitSystem.imperial, - ), - ], + showMeshSheet( + context, + builder: (ctx) => Column( + mainAxisSize: MainAxisSize.min, + children: [ + BottomSheetHeader(title: context.l10n.appSettings_unitsTitle), + _sheetOption( + ctx, + label: context.l10n.appSettings_unitsMetric, + value: UnitSystem.metric, + selected: settingsService.settings.unitSystem == UnitSystem.metric, + onTap: () { + settingsService.setUnitSystem(UnitSystem.metric); + Navigator.pop(ctx); + }, ), - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(context), - child: Text(context.l10n.common_close), + _sheetOption( + ctx, + label: context.l10n.appSettings_unitsImperial, + value: UnitSystem.imperial, + selected: + settingsService.settings.unitSystem == UnitSystem.imperial, + onTap: () { + settingsService.setUnitSystem(UnitSystem.imperial); + Navigator.pop(ctx); + }, ), + SizedBox(height: MediaQuery.paddingOf(ctx).bottom + 8), ], ), ); } + Widget _sheetOption( + BuildContext context, { + required String label, + required T value, + required bool selected, + required VoidCallback onTap, + }) { + final scheme = Theme.of(context).colorScheme; + return ListTile( + leading: Icon( + selected ? Icons.radio_button_checked : Icons.radio_button_unchecked, + color: selected ? scheme.primary : scheme.onSurfaceVariant, + ), + title: Text(label), + onTap: onTap, + ); + } + void _showTranslationLanguageDialog( BuildContext context, AppSettingsService settingsService, @@ -1263,90 +1802,6 @@ class AppSettingsScreen extends StatelessWidget { return '${sizeMb.toStringAsFixed(1)} MB • $source'; } - Widget _buildCyr2LatCard( - BuildContext context, - AppSettingsService settingsService, - ) { - final selectedProfile = settingsService.getSelectedCyr2LatProfile(); - return Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - child: Text( - context.l10n.channels_cyr2latSettingsHeading, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), - ), - Padding( - padding: const EdgeInsets.fromLTRB(16, 0, 16, 8), - child: DropdownButtonFormField( - initialValue: settingsService.settings.selectedCyr2latProfileId, - decoration: InputDecoration( - labelText: context.l10n.channels_cyr2latSettingsSubheading, - border: const OutlineInputBorder(), - ), - items: settingsService.settings.cyr2latProfiles.map((profile) { - return DropdownMenuItem( - value: profile.id, - child: Text(profile.name), - ); - }).toList(), - onChanged: (value) { - if (value != null) { - settingsService.setSelectedCyr2LatProfile(value); - } - }, - ), - ), - Padding( - padding: const EdgeInsets.fromLTRB(16, 0, 16, 16), - child: Row( - children: [ - Expanded( - child: OutlinedButton.icon( - onPressed: () => - _showAddCyr2LatProfileDialog(context, settingsService), - icon: const Icon(Icons.add), - label: Text(context.l10n.common_add), - ), - ), - const SizedBox(width: 8), - Expanded( - child: OutlinedButton.icon( - onPressed: () => _showEditCyr2LatProfileDialog( - context, - settingsService, - selectedProfile, - ), - icon: const Icon(Icons.edit), - label: Text(context.l10n.common_edit), - ), - ), - const SizedBox(width: 8), - Expanded( - child: OutlinedButton.icon( - onPressed: - settingsService.settings.cyr2latProfiles.length > 1 - ? () => _showDeleteCyr2LatProfileDialog( - context, - settingsService, - selectedProfile, - ) - : null, - icon: const Icon(Icons.delete), - label: Text(context.l10n.common_delete), - ), - ), - ], - ), - ), - ], - ), - ); - } - void _showAddCyr2LatProfileDialog( BuildContext context, AppSettingsService settingsService, @@ -1554,45 +2009,6 @@ class AppSettingsScreen extends StatelessWidget { ), ); } - - Widget _buildDebugCard( - BuildContext context, - AppSettingsService settingsService, - ) { - return Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - child: Text( - context.l10n.appSettings_debugCard, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), - ), - SwitchListTile( - secondary: const Icon(Icons.bug_report_outlined), - title: Text(context.l10n.appSettings_appDebugLogging), - subtitle: Text(context.l10n.appSettings_appDebugLoggingSubtitle), - value: settingsService.settings.appDebugLogEnabled, - onChanged: (value) async { - await settingsService.setAppDebugLogEnabled(value); - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text( - value - ? context.l10n.appSettings_appDebugLoggingEnabled - : context.l10n.appSettings_appDebugLoggingDisabled, - ), - duration: const Duration(seconds: 2), - ); - }, - ), - ], - ), - ); - } } /// Owns the [TextEditingController] for the manual model URL field so it diff --git a/lib/screens/ble_debug_log_screen.dart b/lib/screens/ble_debug_log_screen.dart index 6d186970..c229c2e5 100644 --- a/lib/screens/ble_debug_log_screen.dart +++ b/lib/screens/ble_debug_log_screen.dart @@ -4,6 +4,7 @@ import 'package:flutter/services.dart'; import '../l10n/l10n.dart'; import '../services/ble_debug_log_service.dart'; import '../connector/meshcore_protocol.dart'; +import '../theme/mesh_theme.dart'; import '../widgets/adaptive_app_bar_title.dart'; import '../helpers/snack_bar_builder.dart'; @@ -32,6 +33,7 @@ class _BleDebugLogScreenState extends State { return Scaffold( appBar: AppBar( title: AdaptiveAppBarTitle(context.l10n.debugLog_bleTitle), + centerTitle: true, actions: [ IconButton( tooltip: context.l10n.debugLog_copyLog, @@ -101,23 +103,14 @@ class _BleDebugLogScreenState extends State { itemCount: showingFrames ? entries.length : rawEntries.length, - separatorBuilder: (_, _) => const Divider(height: 1), + separatorBuilder: (_, _) => + const Divider(height: 1, color: MeshPalette.line), itemBuilder: (context, index) { if (showingFrames) { final entry = entries[index]; final time = '${entry.timestamp.hour.toString().padLeft(2, '0')}:${entry.timestamp.minute.toString().padLeft(2, '0')}:${entry.timestamp.second.toString().padLeft(2, '0')}'; - return ListTile( - dense: true, - title: Text(entry.description), - subtitle: Text('${entry.hexPreview}\n$time'), - isThreeLine: true, - leading: Icon( - entry.outgoing - ? Icons.upload - : Icons.download, - size: 18, - ), + return GestureDetector( onLongPress: () async { await Clipboard.setData( ClipboardData( @@ -131,6 +124,60 @@ class _BleDebugLogScreenState extends State { ), ); }, + child: Container( + color: MeshPalette.bg, + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, + ), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Icon( + entry.outgoing + ? Icons.upload + : Icons.download, + size: 18, + color: entry.outgoing + ? MeshPalette.blue + : MeshPalette.signal, + ), + const SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + entry.description, + style: MeshTheme.mono( + fontSize: 11.5, + color: MeshPalette.ink, + ), + ), + const SizedBox(height: 2), + Text( + entry.hexPreview, + style: MeshTheme.mono( + fontSize: 10, + color: MeshPalette.ink3, + ), + ), + const SizedBox(height: 2), + Text( + time, + style: MeshTheme.mono( + fontSize: 9.5, + color: MeshPalette.ink4, + ), + ), + ], + ), + ), + ], + ), + ), ); } @@ -138,18 +185,65 @@ class _BleDebugLogScreenState extends State { final info = _decodeRawPacket(entry.payload); final time = '${entry.timestamp.hour.toString().padLeft(2, '0')}:${entry.timestamp.minute.toString().padLeft(2, '0')}:${entry.timestamp.second.toString().padLeft(2, '0')}'; - return ListTile( - dense: true, - title: Text(info.title), - subtitle: Text('${info.summary}\n$time'), - isThreeLine: true, - leading: const Icon(Icons.download, size: 18), + return GestureDetector( onTap: () => _showRawDialog(context, info), + child: Container( + color: MeshPalette.bg, + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Icon( + Icons.download, + size: 18, + color: MeshPalette.signal, + ), + const SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + info.title, + style: MeshTheme.mono( + fontSize: 11.5, + color: MeshPalette.ink, + ), + ), + const SizedBox(height: 2), + Text( + info.summary, + style: MeshTheme.mono( + fontSize: 10, + color: MeshPalette.ink3, + ), + ), + const SizedBox(height: 2), + Text( + time, + style: MeshTheme.mono( + fontSize: 9.5, + color: MeshPalette.ink4, + ), + ), + ], + ), + ), + ], + ), + ), ); }, ) : Center( - child: Text(context.l10n.debugLog_noBleActivity), + child: Text( + context.l10n.debugLog_noBleActivity, + style: const TextStyle(color: MeshPalette.ink3), + ), ), ), ], diff --git a/lib/screens/channel_chat_screen.dart b/lib/screens/channel_chat_screen.dart index fcd50861..94101ef3 100644 --- a/lib/screens/channel_chat_screen.dart +++ b/lib/screens/channel_chat_screen.dart @@ -1,13 +1,16 @@ +import 'dart:async'; import 'dart:convert'; import 'dart:math' as math; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter/services.dart'; -import 'package:intl/intl.dart'; +import 'package:intl/intl.dart' hide TextDirection; import 'package:provider/provider.dart'; import '../connector/meshcore_connector.dart'; +import '../models/community.dart'; +import '../storage/community_store.dart'; import '../utils/platform_info.dart'; import '../helpers/chat_scroll_controller.dart'; import '../connector/meshcore_protocol.dart'; @@ -22,8 +25,8 @@ import '../models/translation_support.dart'; import '../services/app_settings_service.dart'; import '../services/chat_text_scale_service.dart'; import '../services/translation_service.dart'; -import '../utils/emoji_utils.dart'; import '../widgets/byte_count_input.dart'; +import '../widgets/empty_state.dart'; import '../widgets/chat_zoom_wrapper.dart'; import '../widgets/emoji_picker.dart'; import '../widgets/gif_message.dart'; @@ -32,8 +35,11 @@ import '../widgets/gif_picker.dart'; import '../widgets/message_translation_button.dart'; import '../widgets/message_status_icon.dart'; import '../widgets/radio_stats_entry.dart'; +import '../widgets/sync_progress_overlay.dart'; import '../widgets/translated_message_content.dart'; import '../widgets/unread_divider.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/mesh_ui.dart'; import 'channel_message_path_screen.dart'; import 'map_screen.dart'; @@ -56,8 +62,11 @@ class _ChannelChatScreenState extends State { final ChatScrollController _scrollController = ChatScrollController(); final FocusNode _textFieldFocusNode = FocusNode(); ChannelMessage? _replyingToMessage; + final CommunityStore _communityStore = CommunityStore(); + final CommunityPskIndex _communityIndex = CommunityPskIndex(); final Map _messageKeys = {}; bool _isLoadingOlder = false; + bool _communitiesLoaded = false; MeshCoreConnector? _connector; DateTime? _lastChannelSendAt; @@ -81,6 +90,7 @@ class _ChannelChatScreenState extends State { final idx = widget.channel.index; final unread = widget.initialUnreadCount; final messages = connector.getChannelMessages(widget.channel); + _loadCommunities(); ChannelMessage? anchor; if (unread > 0) { anchor = _findOldestUnreadChannelAnchor(messages, unread); @@ -99,7 +109,7 @@ class _ChannelChatScreenState extends State { totalMessages: messages.length, onJumped: () { if (!mounted) return; - _scrollToMessage(anchor!.messageId); + _scrollToMessage(anchor!.messageId, quiet: true); }, ); }); @@ -107,6 +117,19 @@ class _ChannelChatScreenState extends State { }); } + // TODO: Reload communities when returning from another screen + Future _loadCommunities() async { + final connector = context.read(); + _communityStore.setPublicKeyHex = connector.selfPublicKeyHex; + final communities = await _communityStore.loadCommunities(); + if (mounted) { + setState(() { + _communityIndex.initialize(communities); + _communitiesLoaded = true; + }); + } + } + ChannelMessage? _findOldestUnreadChannelAnchor( List messages, int unreadCount, @@ -171,9 +194,12 @@ class _ChannelChatScreenState extends State { }); } - Future _scrollToMessage(String messageId) async { + Future _scrollToMessage(String messageId, {bool quiet = false}) async { final key = _messageKeys[messageId]; if (key == null) { + // The auto unread-jump can resolve a frame after navigating away; + // a deactivated context can't host a snackbar. + if (quiet || !mounted || !context.mounted) return; showDismissibleSnackBar( context, content: Text(context.l10n.chat_originalMessageNotFound), @@ -193,16 +219,63 @@ class _ChannelChatScreenState extends State { ); } + Widget _channelIcon(Channel channel) { + // Determine icon based on channel type + final ChannelType channelType = Channel.getChannelType( + channel, + _communityIndex, + ); + final bool isCommunityChannel = Channel.isCommunityChannel(channelType); + IconData icon; + switch (channelType) { + case ChannelType.communityPublic: + icon = Icons.groups; + case ChannelType.communityHashtag: + icon = Icons.tag; + case ChannelType.public: + icon = Icons.public; + case ChannelType.hashtag: + icon = Icons.tag; + case ChannelType.private: + icon = Icons.lock; + } + return Stack( + children: [ + Padding( + padding: const EdgeInsets.symmetric(vertical: 3), + child: _communitiesLoaded + ? Icon(icon, size: 20) + : SizedBox.square(dimension: 20), + ), + if (isCommunityChannel) + Positioned( + right: 0, + bottom: 0, + child: Container( + width: 12, + height: 12, + decoration: BoxDecoration( + color: Colors.purple, + shape: BoxShape.circle, + border: Border.all( + color: Theme.of(context).cardColor, + width: 2, + ), + ), + child: const Icon(Icons.people, size: 8, color: Colors.white), + ), + ), + ], + ); + } + @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Row( children: [ - Icon( - widget.channel.isPublicChannel ? Icons.public : Icons.tag, - size: 20, - ), + _channelIcon(widget.channel), const SizedBox(width: 8), Expanded( child: Column( @@ -215,6 +288,8 @@ class _ChannelChatScreenState extends State { ) : widget.channel.name, style: const TextStyle(fontSize: 16), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), Consumer( builder: (context, connector, _) { @@ -236,15 +311,14 @@ class _ChannelChatScreenState extends State { ], ), centerTitle: false, + bottom: const SyncProgressAppBarBottom(), actions: [ const RadioStatsIconButton(), PopupMenuButton( icon: const Icon(Icons.more_vert), onSelected: (value) { if (value == 'clearChat') { - context.read().clearMessagesForChannel( - widget.channel.index, - ); + _confirmClearChat(); } }, itemBuilder: (context) => [ @@ -252,11 +326,17 @@ class _ChannelChatScreenState extends State { value: 'clearChat', child: Row( children: [ - const Icon(Icons.delete, size: 20, color: Colors.red), + Icon( + Icons.delete, + size: 20, + color: Theme.of(context).colorScheme.error, + ), const SizedBox(width: 12), Text( context.l10n.contact_clearChat, - style: const TextStyle(color: Colors.red), + style: TextStyle( + color: Theme.of(context).colorScheme.error, + ), ), ], ), @@ -275,34 +355,17 @@ class _ChannelChatScreenState extends State { final messages = connector.getChannelMessages(widget.channel); if (messages.isEmpty) { - return Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - widget.channel.isPublicChannel - ? Icons.public - : Icons.tag, - size: 64, - color: Colors.grey[400], - ), - const SizedBox(height: 16), - Text( - context.l10n.chat_noMessages, - style: TextStyle( - fontSize: 16, - color: Colors.grey[600], - ), - ), - const SizedBox(height: 8), - Text( - context.l10n.chat_sendMessageToStart, - style: TextStyle( - fontSize: 14, - color: Colors.grey[500], - ), - ), - ], + return EmptyState( + icon: widget.channel.isPublicChannel + ? Icons.public + : Icons.tag, + title: context.l10n.chat_noMessages, + subtitle: context.l10n.chat_sendMessageTo( + widget.channel.name.isEmpty + ? context.l10n.channels_channelIndex( + widget.channel.index, + ) + : widget.channel.name, ), ); } @@ -312,6 +375,25 @@ class _ChannelChatScreenState extends State { final itemCount = reversedMessages.length + (_isLoadingOlder ? 1 : 0); + // Prune stale keys (deleted/cleared messages) to avoid + // unbounded growth. + final liveIds = reversedMessages + .map((m) => m.messageId) + .toSet(); + _messageKeys.removeWhere((id, _) => !liveIds.contains(id)); + + // Two messages can collide on messageId (same ms + name/text + // hash). Only the first occurrence owns the shared GlobalKey + // used for scroll-to-message; duplicates get a local key so + // no two widgets share one GlobalKey. + final seenIds = {}; + final keyedIndices = {}; + for (var i = 0; i < reversedMessages.length; i++) { + if (seenIds.add(reversedMessages[i].messageId)) { + keyedIndices.add(i); + } + } + // Auto-scroll to bottom if user is already at bottom WidgetsBinding.instance.addPostFrameCallback((_) { if (_channelSkipNextBottomSnap) { @@ -347,14 +429,20 @@ class _ChannelChatScreenState extends State { } final messageIndex = index; final message = reversedMessages[messageIndex]; - if (!_messageKeys.containsKey(message.messageId)) { - _messageKeys[message.messageId] = GlobalKey(); + final GlobalKey messageKey; + if (keyedIndices.contains(messageIndex)) { + messageKey = _messageKeys.putIfAbsent( + message.messageId, + GlobalKey.new, + ); + } else { + messageKey = GlobalKey(); } final isUnreadAnchor = _unreadDividerMessageId != null && message.messageId == _unreadDividerMessageId; return Container( - key: _messageKeys[message.messageId]!, + key: messageKey, child: Builder( builder: (context) { final textScale = context @@ -407,6 +495,7 @@ class _ChannelChatScreenState extends State { final settingsService = context.watch(); final enableTracing = settingsService.settings.enableMessageTracing; final isOutgoing = message.isOutgoing; + final scheme = Theme.of(context).colorScheme; final gifId = GifHelper.parseGif(message.text); final poi = parseMarkerText(message.text); final translatedDisplayText = @@ -423,201 +512,174 @@ class _ChannelChatScreenState extends State { ? message.pathVariants.first : Uint8List(0)); + // Bubble colors — outgoing uses MeshPalette.me / meBorder / meInk. + final bubbleColor = isOutgoing + ? MeshPalette.me + : scheme.surfaceContainerLow; + final bubbleBorder = isOutgoing + ? MeshPalette.meBorder + : scheme.outlineVariant; + final textColor = isOutgoing ? MeshPalette.meInk : scheme.onSurface; + final metaColor = textColor.withValues(alpha: 0.65); + const bodyFontSize = 14.0; + + // Asymmetric radius matching chat_screen bubbles. + final borderRadius = isOutgoing + ? const BorderRadius.only( + topLeft: Radius.circular(MeshRadii.lg), + topRight: Radius.circular(MeshRadii.lg), + bottomLeft: Radius.circular(MeshRadii.lg), + bottomRight: Radius.circular(MeshRadii.xs), + ) + : const BorderRadius.only( + topLeft: Radius.circular(MeshRadii.xs), + topRight: Radius.circular(MeshRadii.lg), + bottomLeft: Radius.circular(MeshRadii.lg), + bottomRight: Radius.circular(MeshRadii.lg), + ); + const maxSwipeOffset = 64.0; const replySwipeThreshold = 64.0; - const bodyFontSize = 14.0; - final messageBody = Column( - crossAxisAlignment: isOutgoing - ? CrossAxisAlignment.end - : CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: isOutgoing - ? MainAxisAlignment.end - : MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (!isOutgoing) ...[ - _buildAvatar(message.senderName), - const SizedBox(width: 8), - ], - Flexible( - child: GestureDetector( - onTap: PlatformInfo.isDesktop - ? null - : () => _showMessagePathInfo(message), - onLongPress: () => _showMessageActions(message), - onSecondaryTapUp: PlatformInfo.isDesktop - ? (_) => _showMessageActions(message) - : null, - child: Container( - padding: gifId != null - ? const EdgeInsets.all(4) - : const EdgeInsets.symmetric(horizontal: 12, vertical: 8), - constraints: BoxConstraints( - maxWidth: MediaQuery.of(context).size.width * 0.65, - ), - decoration: BoxDecoration( - color: isOutgoing - ? Theme.of(context).colorScheme.primaryContainer - : Theme.of(context).colorScheme.surfaceContainerHighest, - borderRadius: BorderRadius.circular(12), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (!isOutgoing) ...[ - Padding( - padding: gifId != null - ? const EdgeInsets.only( - left: 8, - top: 4, - bottom: 4, - ) - : EdgeInsets.zero, - child: Text( - message.senderName, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - color: Theme.of(context).colorScheme.primary, + final messageBody = LayoutBuilder( + builder: (context, constraints) => Column( + crossAxisAlignment: isOutgoing + ? CrossAxisAlignment.end + : CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: isOutgoing + ? MainAxisAlignment.end + : MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + if (!isOutgoing) ...[ + _buildAvatar(message.senderName), + const SizedBox(width: 6), + ], + Flexible( + child: GestureDetector( + onLongPress: () => _showMessageActions(message), + onSecondaryTapUp: PlatformInfo.isDesktop + ? (_) => _showMessageActions(message) + : null, + child: Container( + padding: gifId != null + ? const EdgeInsets.all(4) + : const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + constraints: BoxConstraints( + maxWidth: constraints.maxWidth * 0.72, + ), + decoration: BoxDecoration( + color: bubbleColor, + borderRadius: borderRadius, + border: Border.all(color: bubbleBorder, width: 1), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (!isOutgoing) ...[ + Padding( + padding: gifId != null + ? const EdgeInsets.only( + left: 8, + top: 4, + bottom: 4, + ) + : EdgeInsets.zero, + child: Text( + message.senderName, + style: MeshTheme.mono( + fontSize: 11, + fontWeight: FontWeight.w700, + color: _colorForName(message.senderName), + ), ), ), - ), - if (gifId == null) const SizedBox(height: 4), - ], - if (message.replyToMessageId != null) ...[ - _buildReplyPreview(message, textScale), - const SizedBox(height: 8), - ], - if (poi != null) - _buildPoiMessage( - context, - poi, - isOutgoing, - textScale, - message.senderName, - trailing: (!enableTracing && isOutgoing) - ? Padding( - padding: const EdgeInsets.only(bottom: 2), - child: MessageStatusIcon( - isAcked: - message.status == - ChannelMessageStatus.sent && - displayPath.isNotEmpty, - isFailed: - message.status == - ChannelMessageStatus.failed, + if (gifId == null) const SizedBox(height: 2), + ], + if (message.replyToMessageId != null) ...[ + _buildReplyPreview(message, textScale), + const SizedBox(height: 8), + ], + if (poi != null) + _buildPoiMessage( + context, + poi, + isOutgoing, + textScale, + message.senderName, + ) + else if (gifId != null) + Stack( + children: [ + ClipRRect( + borderRadius: BorderRadius.circular(8), + child: GifMessage( + url: + 'https://media.giphy.com/media/$gifId/giphy.gif', + backgroundColor: Colors.transparent, + fallbackTextColor: textColor.withValues( + alpha: 0.7, ), - ) - : null, - ) - else if (gifId != null) - Stack( - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(8), - child: GifMessage( - url: - 'https://media.giphy.com/media/$gifId/giphy.gif', - backgroundColor: Colors.transparent, - fallbackTextColor: isOutgoing - ? Theme.of(context) - .colorScheme - .onPrimaryContainer - .withValues(alpha: 0.7) - : Theme.of(context).colorScheme.onSurface - .withValues(alpha: 0.6), - ), - ), - if (!enableTracing && isOutgoing) - Positioned( - top: 0, - right: 0, - child: Container( - padding: const EdgeInsets.all(3), - decoration: BoxDecoration( - color: isOutgoing - ? Theme.of( - context, - ).colorScheme.primaryContainer - : Theme.of( - context, - ).colorScheme.surfaceContainerHighest, - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(10), - topRight: Radius.circular(8), - ), - ), - child: MessageStatusIcon( - isAcked: - message.status == - ChannelMessageStatus.sent && - displayPath.isNotEmpty, - isFailed: - message.status == - ChannelMessageStatus.failed, - ), - ), - ), - ], - ) - else - Row( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Flexible( - child: TranslatedMessageContent( - displayText: translatedDisplayText, - originalText: originalDisplayText, - style: TextStyle( - fontSize: bodyFontSize * textScale, - ), - originalStyle: TextStyle( - fontSize: bodyFontSize * textScale, - fontStyle: FontStyle.italic, - color: Theme.of(context).colorScheme.onSurface - .withValues(alpha: 0.72), - ), - ), - ), - if (!enableTracing && isOutgoing) ...[ - const SizedBox(width: 4), - Padding( - padding: const EdgeInsets.only(bottom: 2), - child: MessageStatusIcon( - isAcked: - message.status == - ChannelMessageStatus.sent && - displayPath.isNotEmpty, - isFailed: - message.status == - ChannelMessageStatus.failed, ), ), ], - ], - ), - if (enableTracing) ...[ - if (displayPath.isNotEmpty) ...[ - const SizedBox(height: 4), + ) + else + Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Flexible( + child: TranslatedMessageContent( + displayText: translatedDisplayText, + originalText: originalDisplayText, + style: TextStyle( + color: textColor, + fontSize: bodyFontSize * textScale, + ), + originalStyle: TextStyle( + fontSize: bodyFontSize * textScale, + fontStyle: FontStyle.italic, + color: textColor.withValues(alpha: 0.72), + ), + ), + ), + ], + ), + if (enableTracing && displayPath.isNotEmpty) ...[ + const SizedBox(height: 3), Padding( padding: gifId != null ? const EdgeInsets.symmetric(horizontal: 8) : EdgeInsets.zero, - child: Text( - context.l10n.channels_via( - _formatPathPrefixes(displayPath), - ), - style: TextStyle( - fontSize: 11, - color: Colors.grey[600], - ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + RouteChip( + isDirect: (message.pathLength ?? -1) >= 0, + hops: (message.pathLength ?? -1) >= 0 + ? message.pathLength + : null, + ), + const SizedBox(width: 4), + Text( + context.l10n.channels_via( + _formatPathPrefixes(displayPath), + ), + style: MeshTheme.mono( + fontSize: 9.5 * textScale, + color: metaColor, + ), + ), + ], ), ), ], - const SizedBox(height: 4), + const SizedBox(height: 3), Padding( padding: gifId != null ? const EdgeInsets.only( @@ -631,63 +693,65 @@ class _ChannelChatScreenState extends State { children: [ Text( _formatTime(context, message.timestamp), - style: TextStyle( - fontSize: 11, - color: Colors.grey[600], + style: MeshTheme.mono( + fontSize: 10 * textScale, + color: metaColor, ), ), - if (message.repeatCount > 0) ...[ + if (enableTracing && message.repeatCount > 0) ...[ const SizedBox(width: 6), Icon( Icons.repeat, - size: 12, - color: Colors.grey[600], + size: 11 * textScale, + color: metaColor, ), const SizedBox(width: 2), Text( '${message.repeatCount}', - style: TextStyle( - fontSize: 11, - color: Colors.grey[600], + style: MeshTheme.mono( + fontSize: 10 * textScale, + color: metaColor, ), ), ], if (isOutgoing) ...[ const SizedBox(width: 4), - Icon( - message.status == ChannelMessageStatus.sent - ? Icons.check - : message.status == - ChannelMessageStatus.pending - ? Icons.schedule - : Icons.error_outline, - size: 14, - color: + MessageStatusIcon( + isAcked: message.status == - ChannelMessageStatus.failed - ? Colors.red - : Colors.grey[600], + ChannelMessageStatus.sent, + isRepeated: + message.status == + ChannelMessageStatus.sent && + displayPath.isNotEmpty, + isPending: + message.status == + ChannelMessageStatus.pending, + isFailed: + message.status == + ChannelMessageStatus.failed, + onColor: metaColor, ), ], ], ), ), ], - ], + ), ), ), ), + ], + ), + if (message.reactions.isNotEmpty) ...[ + const SizedBox(height: 4), + Padding( + padding: EdgeInsets.only(left: isOutgoing ? 0 : 42), + child: _buildReactionsDisplay(message), ), ], - ), - if (message.reactions.isNotEmpty) ...[ - const SizedBox(height: 4), - Padding( - padding: EdgeInsets.only(left: isOutgoing ? 0 : 48), - child: _buildReactionsDisplay(message), - ), ], - ], + ), ); if (!isOutgoing && !PlatformInfo.isDesktop) { @@ -701,7 +765,7 @@ class _ChannelChatScreenState extends State { ); } else { return Padding( - padding: const EdgeInsets.symmetric(vertical: 4), + padding: const EdgeInsets.symmetric(vertical: 3), child: messageBody, ); } @@ -798,7 +862,7 @@ class _ChannelChatScreenState extends State { padding: const EdgeInsets.all(8), decoration: BoxDecoration( color: colorScheme.surfaceContainerHighest.withValues(alpha: 0.5), - borderRadius: BorderRadius.circular(8), + borderRadius: BorderRadius.circular(MeshRadii.sm), border: Border( left: BorderSide(color: colorScheme.primary, width: 3), ), @@ -811,9 +875,7 @@ class _ChannelChatScreenState extends State { style: TextStyle( fontSize: 11 * textScale, fontWeight: FontWeight.bold, - color: isOwnNode - ? Theme.of(context).colorScheme.primary - : Theme.of(context).colorScheme.onSurface, + color: isOwnNode ? colorScheme.primary : colorScheme.onSurface, ), ), const SizedBox(height: 2), @@ -825,6 +887,7 @@ class _ChannelChatScreenState extends State { } Widget _buildReactionsDisplay(ChannelMessage message) { + final scheme = Theme.of(context).colorScheme; return Wrap( spacing: 6, runSpacing: 6, @@ -835,27 +898,29 @@ class _ChannelChatScreenState extends State { return Container( padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), decoration: BoxDecoration( - color: Theme.of(context).colorScheme.secondaryContainer, - borderRadius: BorderRadius.circular(12), - border: Border.all( - color: Theme.of( - context, - ).colorScheme.outline.withValues(alpha: 0.3), - width: 1, - ), + color: scheme.surfaceContainerHigh, + borderRadius: BorderRadius.circular(MeshRadii.pill), + border: Border.all(color: scheme.outlineVariant, width: 1), ), child: Row( mainAxisSize: MainAxisSize.min, children: [ - Text(emoji, style: const TextStyle(fontSize: 16)), + Text( + emoji, + style: MeshTheme.emoji(fontSize: 16), + textHeightBehavior: const TextHeightBehavior( + applyHeightToFirstAscent: false, + applyHeightToLastDescent: false, + ), + ), if (count > 1) ...[ const SizedBox(width: 4), Text( '$count', - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - color: Theme.of(context).colorScheme.onSecondaryContainer, + style: MeshTheme.mono( + fontSize: 11, + fontWeight: FontWeight.w700, + color: scheme.onSurface, ), ), ], @@ -874,24 +939,21 @@ class _ChannelChatScreenState extends State { String senderName, { Widget? trailing, }) { - final colorScheme = Theme.of(context).colorScheme; - final textColor = isOutgoing - ? colorScheme.onPrimaryContainer - : colorScheme.onSurface; + final scheme = Theme.of(context).colorScheme; + final textColor = isOutgoing ? MeshPalette.meInk : scheme.onSurface; final metaColor = textColor.withValues(alpha: 0.7); - final channelColor = widget.channel.isPublicChannel - ? Colors.orange - : Colors.blue; return Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ IconButton( - icon: Icon(Icons.location_on_outlined, color: channelColor), + icon: Icon(Icons.location_on_outlined, color: scheme.primary), padding: EdgeInsets.zero, - constraints: const BoxConstraints(minWidth: 32, minHeight: 32), + constraints: const BoxConstraints(minWidth: 40, minHeight: 40), onPressed: () { - final selfName = context.read().selfName ?? 'Me'; + final selfName = + context.read().selfName ?? + context.l10n.chat_me; final fromName = isOutgoing ? selfName : senderName; final key = buildSharedMarkerKey( sourceId: 'channel:${widget.channel.index}', @@ -951,71 +1013,24 @@ class _ChannelChatScreenState extends State { } Widget _buildAvatar(String senderName) { - final initial = _getFirstCharacterOrEmoji(senderName); - final color = _getColorForName(senderName); - - return CircleAvatar( - radius: 18, - backgroundColor: color.withValues(alpha: 0.2), - child: Text( - initial, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.bold, - color: color, - ), - ), - ); - } - - String _getFirstCharacterOrEmoji(String name) { - if (name.isEmpty) return '?'; - - final emoji = firstEmoji(name); - if (emoji != null) return emoji; - - final runes = name.runes.toList(); - if (runes.isEmpty) return '?'; - return String.fromCharCode(runes[0]).toUpperCase(); - } - - Color _getColorForName(String name) { - // Generate a consistent color based on the name hash - final hash = name.hashCode; - final colors = [ - Colors.blue, - Colors.green, - Colors.orange, - Colors.purple, - Colors.pink, - Colors.teal, - Colors.indigo, - Colors.cyan, - Colors.amber, - Colors.deepOrange, - ]; - - return colors[hash.abs() % colors.length]; + return AvatarCircle(name: senderName, size: 32); } Widget _buildReplyBanner(double textScale) { final message = _replyingToMessage!; + final scheme = Theme.of(context).colorScheme; return Container( width: double.infinity, padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), decoration: BoxDecoration( - color: Theme.of(context).colorScheme.secondaryContainer, + color: scheme.surfaceContainerHigh, border: Border( - bottom: BorderSide(color: Theme.of(context).dividerColor, width: 1), + bottom: BorderSide(color: scheme.outlineVariant, width: 1), ), ), child: Row( children: [ - Icon( - Icons.reply, - size: 18, - color: Theme.of(context).colorScheme.onSecondaryContainer, - ), + Icon(Icons.reply, size: 18, color: scheme.primary), const SizedBox(width: 8), Expanded( child: Column( @@ -1023,10 +1038,10 @@ class _ChannelChatScreenState extends State { children: [ Text( context.l10n.chat_replyingTo(message.senderName), - style: TextStyle( - fontSize: 12 * textScale, - fontWeight: FontWeight.bold, - color: Theme.of(context).colorScheme.onSecondaryContainer, + style: MeshTheme.mono( + fontSize: 11 * textScale, + fontWeight: FontWeight.w700, + color: scheme.primary, ), ), Text( @@ -1035,9 +1050,7 @@ class _ChannelChatScreenState extends State { overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 11 * textScale, - color: Theme.of( - context, - ).colorScheme.onSecondaryContainer.withValues(alpha: 0.7), + color: scheme.onSurfaceVariant, ), ), ], @@ -1046,9 +1059,8 @@ class _ChannelChatScreenState extends State { IconButton( icon: const Icon(Icons.close, size: 18), onPressed: _cancelReply, - color: Theme.of(context).colorScheme.onSecondaryContainer, - padding: EdgeInsets.zero, - constraints: const BoxConstraints(), + color: scheme.onSurfaceVariant, + constraints: const BoxConstraints(minWidth: 44, minHeight: 44), ), ], ), @@ -1059,6 +1071,7 @@ class _ChannelChatScreenState extends State { final connector = context.watch(); final maxBytes = maxChannelMessageBytes(connector.selfName); final settings = context.watch().settings; + final scheme = Theme.of(context).colorScheme; return Column( mainAxisSize: MainAxisSize.min, children: [ @@ -1072,123 +1085,166 @@ class _ChannelChatScreenState extends State { }, ), Container( - padding: const EdgeInsets.all(8), decoration: BoxDecoration( - color: Theme.of(context).colorScheme.surface, - boxShadow: [ - BoxShadow( - color: Colors.black.withValues(alpha: 0.1), - blurRadius: 4, - offset: const Offset(0, -2), - ), - ], + color: scheme.surface, + border: Border( + top: BorderSide(color: scheme.outlineVariant, width: 1), + ), ), - child: Row( - children: [ - IconButton( - icon: const Icon(Icons.gif_box), - onPressed: () => _showGifPicker(context), - tooltip: context.l10n.chat_sendGif, - ), - if (settings.translationEnabled) - MessageTranslationButton( - enabled: settings.composerTranslationEnabled, - languageCode: settings.translationTargetLanguageCode, - onPressed: _showTranslationOptions, - ), - Expanded( - child: ValueListenableBuilder( - valueListenable: _textController, - builder: (context, value, child) { - final gifId = GifHelper.parseGif(value.text); - if (gifId != null) { - return Focus( - autofocus: true, - onKeyEvent: (node, event) { - if (event is KeyDownEvent && - (event.logicalKey == LogicalKeyboardKey.enter || - event.logicalKey == - LogicalKeyboardKey.numpadEnter)) { - _sendMessage(); - return KeyEventResult.handled; - } - return KeyEventResult.ignored; - }, - child: Row( - children: [ - Expanded( - child: ClipRRect( - borderRadius: BorderRadius.circular(12), - child: GifMessage( - url: - 'https://media.giphy.com/media/$gifId/giphy.gif', - backgroundColor: Theme.of( - context, - ).colorScheme.surfaceContainerHighest, - fallbackTextColor: Theme.of(context) - .colorScheme - .onSurface - .withValues(alpha: 0.6), - maxSize: 160, + child: SafeArea( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + IconButton( + icon: const Icon(Icons.gif_box), + onPressed: () => _showGifPicker(context), + tooltip: context.l10n.chat_sendGif, + ), + if (settings.translationEnabled) + MessageTranslationButton( + enabled: settings.composerTranslationEnabled, + languageCode: settings.translationTargetLanguageCode, + onPressed: _showTranslationOptions, + ), + Expanded( + child: ValueListenableBuilder( + valueListenable: _textController, + builder: (context, value, child) { + final gifId = GifHelper.parseGif(value.text); + if (gifId != null) { + return Focus( + autofocus: true, + onKeyEvent: (node, event) { + if (event is KeyDownEvent && + (event.logicalKey == + LogicalKeyboardKey.enter || + event.logicalKey == + LogicalKeyboardKey.numpadEnter)) { + _sendMessage(); + return KeyEventResult.handled; + } + return KeyEventResult.ignored; + }, + child: Row( + children: [ + Expanded( + child: ClipRRect( + borderRadius: BorderRadius.circular(12), + child: GifMessage( + url: + 'https://media.giphy.com/media/$gifId/giphy.gif', + backgroundColor: + scheme.surfaceContainerHighest, + fallbackTextColor: scheme.onSurface + .withValues(alpha: 0.6), + maxSize: 160, + ), + ), ), + const SizedBox(width: 8), + IconButton( + icon: const Icon(Icons.close), + onPressed: () { + _textController.clear(); + _textFieldFocusNode.requestFocus(); + }, + ), + ], + ), + ); + } + return ByteCountedTextField( + maxBytes: maxBytes, + controller: _textController, + focusNode: _textFieldFocusNode, + hintText: context.l10n.chat_typeMessage, + onSubmitted: (_) => _sendMessage(), + encoder: + (connector.isChannelSmazEnabled( + widget.channel.index, + ) || + connector.isChannelCyr2LatEnabled( + widget.channel.index, + )) + ? (text) => connector.prepareChannelOutboundText( + widget.channel.index, + text, + ) + : null, + decoration: InputDecoration( + hintText: context.l10n.chat_typeMessage, + border: OutlineInputBorder( + borderRadius: BorderRadius.circular( + MeshRadii.pill, + ), + borderSide: BorderSide( + color: scheme.outlineVariant, ), ), - const SizedBox(width: 8), - IconButton( - icon: const Icon(Icons.close), - onPressed: () { - _textController.clear(); - _textFieldFocusNode.requestFocus(); - }, + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular( + MeshRadii.pill, + ), + borderSide: BorderSide( + color: scheme.outlineVariant, + ), ), - ], + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular( + MeshRadii.pill, + ), + borderSide: BorderSide( + color: scheme.primary, + width: 1.5, + ), + ), + filled: true, + fillColor: scheme.surfaceContainerLow, + contentPadding: const EdgeInsets.symmetric( + horizontal: 18, + vertical: 12, + ), + ), + ); + }, + ), + ), + const SizedBox(width: 6), + ValueListenableBuilder( + valueListenable: _textController, + builder: (context, value, _) { + final hasText = value.text.trim().isNotEmpty; + return AnimatedContainer( + duration: const Duration(milliseconds: 180), + curve: Curves.easeInOut, + child: IconButton.filled( + icon: const Icon(Icons.send, size: 20), + tooltip: context.l10n.chat_sendMessage, + style: IconButton.styleFrom( + backgroundColor: hasText + ? scheme.primary + : scheme.surfaceContainerHighest, + foregroundColor: hasText + ? scheme.onPrimary + : scheme.onSurfaceVariant, + minimumSize: const Size(40, 40), + shape: const CircleBorder(), + ), + onPressed: hasText + ? () { + HapticFeedback.lightImpact(); + _sendMessage(); + } + : null, ), ); - } - return ByteCountedTextField( - maxBytes: maxBytes, - controller: _textController, - focusNode: _textFieldFocusNode, - hintText: context.l10n.chat_typeMessage, - onSubmitted: (_) => _sendMessage(), - encoder: - (connector.isChannelSmazEnabled( - widget.channel.index, - ) || - connector.isChannelCyr2LatEnabled( - widget.channel.index, - )) - ? (text) => connector.prepareChannelOutboundText( - widget.channel.index, - text, - ) - : null, - decoration: InputDecoration( - hintText: context.l10n.chat_typeMessage, - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(24), - ), - filled: true, - fillColor: Theme.of( - context, - ).colorScheme.surfaceContainerLow, - contentPadding: const EdgeInsets.symmetric( - horizontal: 20, - vertical: 14, - ), - ), - ); - }, - ), + }, + ), + ], ), - const SizedBox(width: 8), - IconButton( - icon: const Icon(Icons.send), - tooltip: context.l10n.chat_sendMessage, - onPressed: _sendMessage, - color: Theme.of(context).colorScheme.primary, - ), - ], + ), ), ), ], @@ -1320,12 +1376,29 @@ class _ChannelChatScreenState extends State { } void _showMessageActions(ChannelMessage message) { - showModalBottomSheet( - context: context, + final translationService = context.read(); + final canTranslateMessage = + translationService.canTranslateIncoming( + text: message.text, + isCli: false, + isOutgoing: message.isOutgoing, + ) && + (message.translatedText?.trim().isEmpty ?? true); + + showMeshSheet( + context, builder: (sheetContext) => SafeArea( child: Column( mainAxisSize: MainAxisSize.min, children: [ + BottomSheetHeader( + title: message.text.length > 40 + ? '${message.text.substring(0, 40)}…' + : message.text, + subtitle: message.senderName.isNotEmpty + ? message.senderName + : null, + ), ListTile( leading: const Icon(Icons.reply), title: Text(context.l10n.chat_reply), @@ -1334,15 +1407,14 @@ class _ChannelChatScreenState extends State { _setReplyingTo(message); }, ), - if (PlatformInfo.isDesktop) - ListTile( - leading: const Icon(Icons.route), - title: Text(context.l10n.chat_path), - onTap: () { - Navigator.pop(sheetContext); - _showMessagePathInfo(message); - }, - ), + ListTile( + leading: const Icon(Icons.route), + title: Text(context.l10n.chat_path), + onTap: () { + Navigator.pop(sheetContext); + _showMessagePathInfo(message); + }, + ), // Can't react to your own messages if (!message.isOutgoing) ListTile( @@ -1361,6 +1433,21 @@ class _ChannelChatScreenState extends State { _copyMessageText(message.text); }, ), + if (canTranslateMessage) + ListTile( + leading: const Icon(Icons.translate), + title: Text(context.l10n.translation_translateMessage), + onTap: () { + Navigator.pop(sheetContext); + unawaited( + context.read().translateChannelMessage( + widget.channel.index, + message, + manualTranslation: true, + ), + ); + }, + ), if (!message.isOutgoing) ListTile( leading: const Icon(Icons.mark_chat_unread_outlined), @@ -1370,19 +1457,22 @@ class _ChannelChatScreenState extends State { _markAsUnread(message); }, ), + const Divider(height: 1), ListTile( - leading: const Icon(Icons.delete_outline), - title: Text(context.l10n.common_delete), + leading: Icon( + Icons.delete_outline, + color: Theme.of(context).colorScheme.error, + ), + title: Text( + context.l10n.common_delete, + style: TextStyle(color: Theme.of(context).colorScheme.error), + ), onTap: () async { Navigator.pop(sheetContext); await _deleteMessage(message); }, ), - ListTile( - leading: const Icon(Icons.close), - title: Text(context.l10n.common_cancel), - onTap: () => Navigator.pop(sheetContext), - ), + const SizedBox(height: 8), ], ), ), @@ -1423,6 +1513,34 @@ class _ChannelChatScreenState extends State { ); } + Future _confirmClearChat() async { + final confirmed = await showDialog( + context: context, + builder: (dialogContext) => AlertDialog( + title: Text(context.l10n.contact_clearChat), + actions: [ + TextButton( + onPressed: () => Navigator.pop(dialogContext, false), + child: Text(context.l10n.common_cancel), + ), + TextButton( + onPressed: () => Navigator.pop(dialogContext, true), + style: TextButton.styleFrom( + foregroundColor: Theme.of(context).colorScheme.error, + ), + child: Text(context.l10n.common_delete), + ), + ], + ), + ); + if (confirmed == true) { + if (!mounted) return; + context.read().clearMessagesForChannel( + widget.channel.index, + ); + } + } + Future _deleteMessage(ChannelMessage message) async { await context.read().deleteChannelMessage(message); if (!mounted) return; @@ -1437,6 +1555,23 @@ class _ChannelChatScreenState extends State { .map((b) => b.toRadixString(16).padLeft(2, '0').toUpperCase()) .join(','); } + + /// Deterministic name-to-hue mapping consistent with [AvatarCircle]. + Color _colorForName(String name) { + const hues = [ + MeshPalette.blue, + MeshPalette.magenta, + MeshPalette.signal, + MeshPalette.warn, + Color(0xFF8FA8F0), + Color(0xFF6FD9CE), + ]; + var h = 0; + for (final c in name.codeUnits) { + h = (h * 31 + c) & 0x7fffffff; + } + return hues[h % hues.length]; + } } class _SwipeReplyBubble extends StatefulWidget { @@ -1464,6 +1599,7 @@ class _SwipeReplyBubbleState extends State<_SwipeReplyBubble> { double _maxSwipeDistance = 0; int? _swipePointerId; bool _swipeLockedToHorizontal = false; + bool _isRtl = false; void _handleSwipeStart(Offset position) { _swipeStartPosition = position; @@ -1484,11 +1620,13 @@ class _SwipeReplyBubbleState extends State<_SwipeReplyBubble> { return; } - final dx = event.position.dx - _swipeStartPosition!.dx; + final rawDx = event.position.dx - _swipeStartPosition!.dx; + // In LTR swipe left (rawDx < 0) triggers reply; in RTL swipe right (rawDx > 0). + final signedDx = _isRtl ? rawDx : -rawDx; const axisLockThreshold = 12.0; if (!_swipeLockedToHorizontal) { - if (-dx < axisLockThreshold) { + if (signedDx < axisLockThreshold) { return; } _swipeLockedToHorizontal = true; @@ -1500,28 +1638,32 @@ class _SwipeReplyBubbleState extends State<_SwipeReplyBubble> { void _handleSwipeUpdate(Offset position) { if (_swipeStartPosition == null) return; - final dx = position.dx - _swipeStartPosition!.dx; - if (dx >= 0) return; + final rawDx = position.dx - _swipeStartPosition!.dx; + final signedDx = _isRtl ? rawDx : -rawDx; + if (signedDx <= 0) return; - if (-dx < 6) return; + if (signedDx < 6) return; - if (-dx > _maxSwipeDistance) { - _maxSwipeDistance = -dx; + if (signedDx > _maxSwipeDistance) { + _maxSwipeDistance = signedDx; } - final double clamped = dx.clamp(-widget.maxSwipeOffset, 0.0).toDouble(); + final double clamped = signedDx.clamp(0.0, widget.maxSwipeOffset); final adjusted = _applySwipeResistance(clamped, widget.maxSwipeOffset); - if (adjusted != _swipeOffset) { - setState(() => _swipeOffset = adjusted); + // Translate in the gesture direction: negative for LTR (left), positive for RTL (right). + final translationOffset = _isRtl ? adjusted : -adjusted; + if (translationOffset != _swipeOffset) { + setState(() => _swipeOffset = translationOffset); } } void _handleSwipePointerUp(Offset position) { if (_swipeLockedToHorizontal && _swipeStartPosition != null) { - final dx = position.dx - _swipeStartPosition!.dx; + final rawDx = position.dx - _swipeStartPosition!.dx; + final signedDx = _isRtl ? rawDx : -rawDx; final peak = math.max( _maxSwipeDistance, - (-dx).clamp(0.0, double.infinity), + signedDx.clamp(0.0, double.infinity), ); if (peak >= widget.replySwipeThreshold) { widget.onReplyTriggered(); @@ -1561,20 +1703,24 @@ class _SwipeReplyBubbleState extends State<_SwipeReplyBubble> { @override Widget build(BuildContext context) { + _isRtl = Directionality.of(context) == TextDirection.rtl; + // In LTR, the bubble slides left and the hint appears on the right (isStart: false). + // In RTL, the bubble slides right and the hint appears on the left (isStart: true). + final hintIsStart = _isRtl; return Listener( onPointerDown: _handleSwipePointerDown, onPointerMove: _handleSwipePointerMove, onPointerUp: (event) => _handleSwipePointerUp(event.position), onPointerCancel: (_) => _resetSwipe(), child: Padding( - padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 8), + padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 8), child: Stack( alignment: Alignment.center, children: [ Positioned.fill( child: Opacity( opacity: _swipeOffset.abs() / widget.maxSwipeOffset, - child: widget.hintBuilder(isStart: false), + child: widget.hintBuilder(isStart: hintIsStart), ), ), AnimatedContainer( diff --git a/lib/screens/channel_message_path_screen.dart b/lib/screens/channel_message_path_screen.dart index afb2b906..c46c413a 100644 --- a/lib/screens/channel_message_path_screen.dart +++ b/lib/screens/channel_message_path_screen.dart @@ -8,15 +8,21 @@ import 'package:meshcore_open/screens/path_trace_map.dart'; import 'package:provider/provider.dart'; import '../connector/meshcore_connector.dart'; +import '../helpers/path_hop_resolver.dart'; import '../services/map_tile_cache_service.dart'; import '../services/app_settings_service.dart'; -import '../connector/meshcore_protocol.dart'; import '../l10n/app_localizations.dart'; import '../l10n/l10n.dart'; import '../models/channel_message.dart'; import '../models/app_settings.dart'; import '../models/contact.dart'; +import '../models/display_path.dart'; +import '../models/path_playback.dart'; +import '../theme/mesh_theme.dart'; import '../widgets/adaptive_app_bar_title.dart'; +import '../widgets/mesh_ui.dart'; +import '../widgets/path_map_ui.dart'; +import '../widgets/themed_map_tile_layer.dart'; class ChannelMessagePathScreen extends StatelessWidget { final ChannelMessage message; @@ -40,7 +46,12 @@ class ChannelMessagePathScreen extends StatelessWidget { final primaryPath = !channelMessage && !message.isOutgoing ? Uint8List.fromList(primaryPathTmp.reversed.toList()) : primaryPathTmp; - final hops = _buildPathHops(primaryPath, connector, l10n); + final hops = _buildPathHops( + primaryPath, + connector, + l10n, + resolveFromEnd: !message.isOutgoing, + ); final hasHopDetails = primaryPath.isNotEmpty; final observedLabel = _formatObservedHops( primaryPath.length, @@ -85,31 +96,25 @@ class ChannelMessagePathScreen extends StatelessWidget { body: SafeArea( top: false, child: ListView( - padding: const EdgeInsets.all(16), + padding: const EdgeInsets.symmetric(vertical: 8), children: [ _buildSummaryCard(context, observedLabel: observedLabel), - const SizedBox(height: 16), if (extraPaths.isNotEmpty) ...[ - Text( + SectionHeader( l10n.channelPath_otherObservedPaths, - style: Theme.of(context).textTheme.titleSmall, + padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), ), - const SizedBox(height: 8), _buildPathVariants(context, extraPaths), - const SizedBox(height: 16), ], - Text( + SectionHeader( l10n.channelPath_repeaterHops, - style: Theme.of(context).textTheme.titleSmall, + padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), ), - const SizedBox(height: 8), if (!hasHopDetails) - Text( - l10n.channelPath_noHopDetails, - style: const TextStyle(color: Colors.grey), - ) + _buildNoHopCard(context, l10n) else - ..._buildHopTiles(context, hops), + _buildHopTimeline(context, hops, l10n), + const SizedBox(height: 16), ], ), ), @@ -120,35 +125,64 @@ class ChannelMessagePathScreen extends StatelessWidget { Widget _buildSummaryCard(BuildContext context, {String? observedLabel}) { final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - l10n.channelPath_messageDetails, - style: Theme.of(context).textTheme.titleSmall, - ), - const SizedBox(height: 8), - _buildDetailRow(l10n.channelPath_senderLabel, message.senderName), - _buildDetailRow( - l10n.channelPath_timeLabel, - _formatTime(message.timestamp, l10n), - ), - if (message.repeatCount > 0) - _buildDetailRow( - l10n.channelPath_repeatsLabel, - message.repeatCount.toString(), + final scheme = Theme.of(context).colorScheme; + final routeChip = message.pathLength == null + ? null + : message.pathLength! < 0 + ? const RouteChip(isDirect: false) + : RouteChip(isDirect: true, hops: message.pathLength); + + return MeshCard( + margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + padding: const EdgeInsets.all(14), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: SectionHeader( + l10n.channelPath_messageDetails, + padding: EdgeInsets.zero, + ), ), + ?routeChip, + ], + ), + const SizedBox(height: 10), + _buildDetailRow( + context, + l10n.channelPath_senderLabel, + message.senderName, + scheme: scheme, + ), + _buildDetailRow( + context, + l10n.channelPath_timeLabel, + _formatTime(message.timestamp, l10n), + scheme: scheme, + ), + if (message.repeatCount > 0) _buildDetailRow( - l10n.channelPath_pathLabelTitle, - _formatPathLabel(message.pathLength, l10n), + context, + l10n.channelPath_repeatsLabel, + message.repeatCount.toString(), + scheme: scheme, ), - if (observedLabel != null) - _buildDetailRow(l10n.channelPath_observedLabel, observedLabel), - ], - ), + _buildDetailRow( + context, + l10n.channelPath_pathLabelTitle, + _formatPathLabel(message.pathLength, l10n), + scheme: scheme, + ), + if (observedLabel != null) + _buildDetailRow( + context, + l10n.channelPath_observedLabel, + observedLabel, + scheme: scheme, + ), + ], ), ); } @@ -159,54 +193,199 @@ class ChannelMessagePathScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ for (int i = 0; i < variants.length; i++) - Card( - margin: const EdgeInsets.symmetric(vertical: 4), - child: ListTile( - dense: true, - title: Text( - l10n.channelPath_observedPathTitle( - i + 1, - _formatHopCount(variants[i].length, l10n), + MeshCard( + margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10), + onTap: () => _openPathMap( + context, + initialPath: variants[i], + channelMessage: channelMessage, + ), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + l10n.channelPath_observedPathTitle( + i + 1, + _formatHopCount(variants[i].length, l10n), + ), + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 2), + Text( + _formatPathPrefixes(variants[i]), + style: MeshTheme.mono( + fontSize: 11, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + ), + ], + ), ), - ), - subtitle: Text(_formatPathPrefixes(variants[i])), - trailing: const Icon(Icons.map_outlined, size: 20), - onTap: () => _openPathMap( - context, - initialPath: variants[i], - channelMessage: channelMessage, - ), + const SizedBox(width: 8), + Icon( + Icons.map_outlined, + size: 20, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + ], ), ), ], ); } - List _buildHopTiles(BuildContext context, List<_PathHop> hops) { - final l10n = context.l10n; - return [ - for (final hop in hops) - Card( - margin: const EdgeInsets.symmetric(vertical: 4), - child: ListTile( - dense: true, - leading: CircleAvatar( - radius: 14, - child: Text( - hop.index.toString(), - style: const TextStyle(fontSize: 12), - ), - ), - title: Text(hop.displayLabel), - subtitle: Text( - hop.hasLocation - ? '${hop.position!.latitude.toStringAsFixed(5)}, ' - '${hop.position!.longitude.toStringAsFixed(5)}' - : l10n.channelPath_noLocationData, + Widget _buildNoHopCard(BuildContext context, AppLocalizations l10n) { + final scheme = Theme.of(context).colorScheme; + return MeshCard( + margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + padding: const EdgeInsets.all(14), + child: Row( + children: [ + Icon(Icons.route_outlined, size: 20, color: scheme.onSurfaceVariant), + const SizedBox(width: 10), + Expanded( + child: Text( + l10n.channelPath_noHopDetails, + style: TextStyle(color: scheme.onSurfaceVariant), ), ), - ), - ]; + ], + ), + ); + } + + Widget _buildHopTimeline( + BuildContext context, + List<_PathHop> hops, + AppLocalizations l10n, + ) { + if (hops.isEmpty) return const SizedBox.shrink(); + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Column( + children: [ + for (int i = 0; i < hops.length; i++) + ListEntrance( + index: i, + child: _buildTimelineNode( + context, + hops[i], + l10n, + isLast: i == hops.length - 1, + ), + ), + ], + ), + ); + } + + Widget _buildTimelineNode( + BuildContext context, + _PathHop hop, + AppLocalizations l10n, { + required bool isLast, + }) { + final scheme = Theme.of(context).colorScheme; + final hexPrefix = _formatPrefix(hop.prefix); + final locationText = hop.hasLocation + ? '${hop.position!.latitude.toStringAsFixed(5)}, ' + '${hop.position!.longitude.toStringAsFixed(5)}' + : l10n.channelPath_noLocationData; + + return IntrinsicHeight( + child: Row( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + SizedBox( + width: 48, + child: Column( + children: [ + Stack( + clipBehavior: Clip.none, + children: [ + AvatarCircle(name: hop.displayLabel, size: 36), + Positioned( + right: -4, + top: -4, + child: Container( + width: 18, + height: 18, + decoration: BoxDecoration( + color: MeshPalette.blueDim, + shape: BoxShape.circle, + border: Border.all( + color: scheme.surfaceContainerLow, + width: 1.5, + ), + ), + alignment: Alignment.center, + child: Text( + hop.index.toString(), + style: const TextStyle( + color: Colors.white, + fontSize: 9, + fontWeight: FontWeight.w700, + ), + ), + ), + ), + ], + ), + if (!isLast) + Expanded( + child: Container( + width: 2, + margin: const EdgeInsets.symmetric(vertical: 4), + color: MeshPalette.blueLine, + ), + ) + else + const SizedBox(height: 12), + ], + ), + ), + const SizedBox(width: 12), + Expanded( + child: Padding( + padding: const EdgeInsets.only(bottom: 16, top: 4), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + hop.displayLabel, + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 2), + Text( + hexPrefix, + style: MeshTheme.mono( + fontSize: 11, + color: scheme.onSurfaceVariant, + ), + ), + const SizedBox(height: 2), + Text( + locationText, + style: MeshTheme.mono( + fontSize: 11, + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + ), + ], + ), + ); } String _formatTime(DateTime time, AppLocalizations l10n) { @@ -250,16 +429,25 @@ class ChannelMessagePathScreen extends StatelessWidget { return l10n.channelPath_observedSomeOf(observedCount, pathLength); } - Widget _buildDetailRow(String label, String value) { + Widget _buildDetailRow( + BuildContext context, + String label, + String value, { + required ColorScheme scheme, + }) { return Padding( - padding: const EdgeInsets.symmetric(vertical: 2), + padding: const EdgeInsets.symmetric(vertical: 3), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - width: 70, - child: Text(label, style: TextStyle(color: Colors.grey[600])), + width: 72, + child: Text( + label.toUpperCase(), + style: MeshTheme.accentLabel(color: scheme.onSurfaceVariant), + ), ), + const SizedBox(width: 8), Expanded(child: Text(value)), ], ), @@ -302,7 +490,8 @@ class ChannelMessagePathMapScreen extends StatefulWidget { } class _ChannelMessagePathMapScreenState - extends State { + extends State + with SingleTickerProviderStateMixin { static const double _labelZoomThreshold = 8.5; static const double _mapMinZoom = 2.0; static const double _mapMaxZoom = 18.0; @@ -314,10 +503,39 @@ class _ChannelMessagePathMapScreenState bool _didReceivePositionUpdate = false; int? _focusedHopIndex; + // Packet-flow animation + multi-path view state. + late final PathPlaybackController _playback; + PathViewMode _viewMode = PathViewMode.single; + final Set _hiddenPathIds = {}; + bool _panelCollapsed = false; + bool _animationEnabled = true; + bool _followPacket = false; + @override void initState() { super.initState(); _selectedPath = widget.initialPath; + _playback = PathPlaybackController(this); + _playback.addListener(_followPacketCamera); + } + + /// Keeps the camera centered on the packet while the follow lock is on. + void _followPacketCamera() { + if (!_followPacket || + !_animationEnabled || + !_playback.started || + !_playback.hasPath || + !mounted) { + return; + } + _mapController.move(_playback.position, _mapController.camera.zoom); + } + + void _toggleFollowPacket() { + setState(() { + _followPacket = !_followPacket; + }); + _followPacketCamera(); } @override @@ -334,10 +552,142 @@ class _ChannelMessagePathMapScreenState @override void dispose() { + _playback.dispose(); _mapController.dispose(); super.dispose(); } + /// Builds a renderable [DisplayPath] for one observed route, oriented in + /// the direction the packet traveled (sender first, receiver last). + DisplayPath? _buildDisplayPath({ + required int index, + required bool isPrimary, + required Uint8List orientedBytes, + required List<_PathHop> hops, + required MeshCoreConnector connector, + }) { + final l10n = context.l10n; + final selfLat = connector.selfLatitude; + final selfLon = connector.selfLongitude; + + final points = []; + final labels = []; + final confirmed = []; + final rowIdx = []; + final gapBefore = []; + var pendingGap = false; + var locatedHops = 0; + + void addSelf() { + if (selfLat == null || selfLon == null) return; + points.add(LatLng(selfLat, selfLon)); + labels.add(l10n.pathTrace_you); + confirmed.add(true); + rowIdx.add(-1); + gapBefore.add(pendingGap); + pendingGap = false; + } + + final selfFirst = widget.message.isOutgoing; + if (selfFirst) addSelf(); + for (var i = 0; i < hops.length; i++) { + final hop = hops[i]; + if (!hop.hasLocation) { + pendingGap = true; + continue; + } + locatedHops++; + points.add(hop.position!); + labels.add(hop.contact?.name ?? _formatPrefix(hop.prefix)); + confirmed.add(true); + rowIdx.add(i); + gapBefore.add(pendingGap); + pendingGap = false; + } + if (!selfFirst) addSelf(); + + if (points.length < 2) return null; + + final segmentEstimated = []; + final rowForSegment = []; + for (var i = 0; i < points.length - 1; i++) { + segmentEstimated.add(gapBefore[i + 1]); + final dest = rowIdx[i + 1]; + rowForSegment.add(dest >= 0 ? dest : (rowIdx[i] >= 0 ? rowIdx[i] : 0)); + } + + return DisplayPath( + id: 'op-$index', + label: isPrimary ? l10n.pathMap_primary : l10n.pathMap_alternate(index), + color: isPrimary + ? kPrimaryPathColor + : kAlternatePathColors[(index - 1) % kAlternatePathColors.length], + isPrimary: isPrimary, + hopBytes: List.from(orientedBytes), + points: points, + pointLabels: labels, + pointConfirmed: confirmed, + segmentEstimated: segmentEstimated, + rowForSegment: rowForSegment, + totalTransmissions: hops.length, + hasTargetEndpoint: false, + gpsConfirmedHops: locatedHops, + unresolvedHops: hops.length - locatedHops, + distanceMeters: getPathDistanceMeters(points), + record: null, + ); + } + + /// Updates the playback path after this frame, but only when the selected + /// path's geometry actually changed, so rebuilds don't reset a running + /// animation. + void _schedulePlaybackSync(DisplayPath? selected) { + final points = selected?.points ?? const []; + WidgetsBinding.instance.addPostFrameCallback((_) { + if (!mounted) return; + if (points.length == _playback.points.length) { + var same = true; + for (var i = 0; i < points.length; i++) { + if (points[i] != _playback.points[i]) { + same = false; + break; + } + } + if (same) return; + } + _playback.setPath(points); + }); + } + + void _selectEntry(_ObservedPathEntry entry) { + setState(() { + _selectedPath = entry.observedBytes; + _hiddenPathIds.remove(entry.display.id); + _focusedHopIndex = null; + }); + } + + void _togglePathVisibility( + DisplayPath path, + List<_ObservedPathEntry> entries, + DisplayPath? selected, + ) { + setState(() { + if (!_hiddenPathIds.remove(path.id)) { + _hiddenPathIds.add(path.id); + if (path.id == selected?.id) { + final visible = entries.where( + (e) => !_hiddenPathIds.contains(e.display.id), + ); + if (visible.isNotEmpty) { + _selectedPath = visible.first.observedBytes; + _focusedHopIndex = null; + } + } + } + }); + } + bool _isDesktopPlatform(TargetPlatform platform) { return platform == TargetPlatform.linux || platform == TargetPlatform.windows || @@ -412,17 +762,17 @@ class _ChannelMessagePathMapScreenState children: [ IconButton( icon: const Icon(Icons.add), - tooltip: 'Zoom in', + tooltip: context.l10n.map_zoomIn, onPressed: () => _zoomMapBy(1), ), IconButton( icon: const Icon(Icons.remove), - tooltip: 'Zoom out', + tooltip: context.l10n.map_zoomOut, onPressed: () => _zoomMapBy(-1), ), IconButton( icon: const Icon(Icons.my_location), - tooltip: 'Center map', + tooltip: context.l10n.map_centerMap, onPressed: () => _resetMapView( initialCenter: initialCenter, initialZoom: initialZoom, @@ -442,6 +792,7 @@ class _ChannelMessagePathMapScreenState final settings = context.watch().settings; final isImperial = settings.unitSystem == UnitSystem.imperial; final tileCache = context.read(); + final mapScheme = Theme.of(context).colorScheme; final primaryPath = _selectPrimaryPath( widget.message.pathBytes, widget.message.pathVariants, @@ -457,14 +808,66 @@ class _ChannelMessagePathMapScreenState primaryPath, ); - final selectedPath = - ((!widget.message.isOutgoing && !widget.channelMessage) || - (widget.message.isOutgoing && widget.channelMessage)) - ? Uint8List.fromList(selectedPathTmp.reversed.toList()) - : selectedPathTmp; + final selectedPath = _orientPath(selectedPathTmp); - final selectedIndex = _indexForPath(selectedPath, observedPaths); - final hops = _buildPathHops(selectedPath, connector, context.l10n); + // Match on the unoriented bytes — observedPaths stores them as + // recorded, while selectedPath may be reversed for display. + final selectedIndex = _indexForPath(selectedPathTmp, observedPaths); + final hops = _buildPathHops( + selectedPath, + connector, + context.l10n, + resolveFromEnd: !widget.message.isOutgoing, + ); + + // Renderable paths for the animation and combined view. + final entries = <_ObservedPathEntry>[]; + for (var i = 0; i < observedPaths.length; i++) { + final oriented = _orientPath(observedPaths[i].pathBytes); + final pathHops = i == selectedIndex + ? hops + : _buildPathHops( + oriented, + connector, + context.l10n, + resolveFromEnd: !widget.message.isOutgoing, + ); + final display = _buildDisplayPath( + index: i, + isPrimary: observedPaths[i].isPrimary, + orientedBytes: oriented, + hops: pathHops, + connector: connector, + ); + if (display != null) { + entries.add( + _ObservedPathEntry( + index: i, + observedBytes: observedPaths[i].pathBytes, + display: display, + hops: pathHops, + ), + ); + } + } + final effectiveMode = entries.length > 1 + ? _viewMode + : PathViewMode.single; + _ObservedPathEntry? selectedEntry; + for (final entry in entries) { + if (entry.index == selectedIndex) { + selectedEntry = entry; + break; + } + } + final selectedDisplay = selectedEntry?.display; + final visibleEntries = effectiveMode == PathViewMode.single + ? [?selectedEntry] + : entries + .where((e) => !_hiddenPathIds.contains(e.display.id)) + .toList(); + final visibleDisplays = visibleEntries.map((e) => e.display).toList(); + _schedulePlaybackSync(selectedDisplay); final points = []; @@ -489,7 +892,7 @@ class _ChannelMessagePathMapScreenState Polyline( points: points, strokeWidth: 4, - color: Colors.blueAccent, + color: MeshPalette.blue, ), ] : []; @@ -546,10 +949,16 @@ class _ChannelMessagePathMapScreenState : const KeyboardOptions.disabled(), ), onPositionChanged: (camera, hasGesture) { + if (!mounted) return; + // A manual pan/zoom releases the follow lock. + if (hasGesture && _followPacket) { + setState(() { + _followPacket = false; + }); + } final shouldShow = camera.zoom >= _labelZoomThreshold; if (!_didReceivePositionUpdate || shouldShow != _showNodeLabels) { - if (!mounted) return; setState(() { _didReceivePositionUpdate = true; _showNodeLabels = shouldShow; @@ -558,20 +967,64 @@ class _ChannelMessagePathMapScreenState }, ), children: [ - TileLayer( - urlTemplate: kMapTileUrlTemplate, - tileProvider: tileCache.tileProvider, - userAgentPackageName: - MapTileCacheService.userAgentPackageName, - maxZoom: 19, + ThemedMapTileLayer(tileCache: tileCache), + AnimatedBuilder( + animation: _playback, + builder: (context, _) { + List lines; + if (visibleDisplays.isEmpty) { + lines = polylines; + } else { + final animating = + _animationEnabled && + _playback.started && + _playback.hasPath; + lines = buildMultiPathPolylines( + visible: visibleDisplays, + selected: selectedDisplay, + combined: effectiveMode == PathViewMode.combined, + animating: animating, + ); + if (animating && selectedDisplay != null) { + lines.addAll( + buildPacketTrailPolylines( + _playback, + selectedDisplay.color, + ), + ); + } + } + if (lines.isEmpty) return const SizedBox.shrink(); + return PolylineLayer(polylines: lines); + }, ), - if (polylines.isNotEmpty) - PolylineLayer(polylines: polylines), - MarkerLayer( - markers: _buildHopMarkers( - hops, - showLabels: _showNodeLabels, + if (effectiveMode == PathViewMode.combined) + MarkerLayer( + markers: _buildCombinedHopMarkers( + visibleEntries, + showLabels: _showNodeLabels, + ), + ) + else + MarkerLayer( + markers: _buildHopMarkers( + hops, + showLabels: _showNodeLabels, + ), ), + AnimatedBuilder( + animation: _playback, + builder: (context, _) { + if (!_animationEnabled || selectedDisplay == null) { + return const SizedBox.shrink(); + } + final markers = buildPacketMarkers( + _playback, + selectedDisplay.color, + ); + if (markers.isEmpty) return const SizedBox.shrink(); + return MarkerLayer(markers: markers); + }, ), ], ), @@ -581,28 +1034,46 @@ class _ChannelMessagePathMapScreenState initialZoom: initialZoom, bounds: bounds, ), - if (observedPaths.length > 1) - _buildPathSelector(context, observedPaths, selectedIndex, ( - index, - ) { - setState(() { - _selectedPath = observedPaths[index].pathBytes; - _focusedHopIndex = null; - }); - }), + if (entries.length > 1) + PathViewModeToggle( + mode: effectiveMode, + onChanged: (mode) => setState(() => _viewMode = mode), + ), + if (observedPaths.length > 1 && + effectiveMode == PathViewMode.single) + _buildPathSelector( + context, + observedPaths, + selectedIndex, + (index) { + setState(() { + _selectedPath = observedPaths[index].pathBytes; + _focusedHopIndex = null; + }); + }, + topOffset: entries.length > 1 ? 60.0 : 16.0, + ), if (points.isEmpty) Center( - child: Card( - color: Colors.white.withValues(alpha: 0.9), - child: Padding( - padding: EdgeInsets.all(12), - child: Text( - context.l10n.channelPath_noRepeaterLocations, - ), + child: Container( + margin: const EdgeInsets.all(24), + padding: const EdgeInsets.all(14), + decoration: BoxDecoration( + color: mapScheme.surfaceContainerLow, + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: mapScheme.outlineVariant), ), + child: Text(context.l10n.channelPath_noRepeaterLocations), ), ), - _buildLegendCard(context, hops, isImperial), + _buildLegendCard( + context, + hops, + isImperial, + entries: entries, + selectedEntry: selectedEntry, + effectiveMode: effectiveMode, + ), ], ), ), @@ -615,8 +1086,9 @@ class _ChannelMessagePathMapScreenState BuildContext context, List<_ObservedPath> paths, int selectedIndex, - ValueChanged onSelected, - ) { + ValueChanged onSelected, { + double topOffset = 16, + }) { final l10n = context.l10n; final selectedPath = paths[selectedIndex]; final label = selectedPath.isPrimary @@ -625,7 +1097,7 @@ class _ChannelMessagePathMapScreenState return Positioned( left: 16, right: 16, - top: 16, + top: topOffset, child: SafeArea( child: Card( child: Padding( @@ -664,7 +1136,10 @@ class _ChannelMessagePathMapScreenState label, _formatPathPrefixes(selectedPath.pathBytes), ), - style: TextStyle(color: Colors.grey[700], fontSize: 12), + style: TextStyle( + color: Theme.of(context).colorScheme.onSurfaceVariant, + fontSize: 12, + ), ), ], ), @@ -685,28 +1160,32 @@ class _ChannelMessagePathMapScreenState markers.add( Marker( point: point, - width: 35, - height: 35, - child: Container( - decoration: BoxDecoration( - color: Colors.green, - shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), - boxShadow: [ - BoxShadow( - color: Colors.black.withValues(alpha: 0.3), - blurRadius: 4, - offset: const Offset(0, 2), + width: 48, + height: 48, + child: Center( + child: Container( + width: 35, + height: 35, + decoration: BoxDecoration( + color: MeshPalette.blue, + shape: BoxShape.circle, + border: Border.all(color: Colors.white, width: 2), + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.3), + blurRadius: 4, + offset: const Offset(0, 2), + ), + ], + ), + alignment: Alignment.center, + child: Text( + hop.index.toString(), + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 12, ), - ], - ), - alignment: Alignment.center, - child: Text( - hop.index.toString(), - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 12, ), ), ), @@ -722,18 +1201,28 @@ class _ChannelMessagePathMapScreenState } } + markers.addAll(_buildSelfMarkers(showLabels: showLabels)); + + return markers; + } + + List _buildSelfMarkers({required bool showLabels}) { final selfLat = context.read().selfLatitude; final selfLon = context.read().selfLongitude; - if (selfLat != null && selfLon != null) { - final selfPoint = LatLng(selfLat, selfLon); - markers.add( - Marker( - point: selfPoint, - width: 35, - height: 35, + if (selfLat == null || selfLon == null) return const []; + final markers = []; + final selfPoint = LatLng(selfLat, selfLon); + markers.add( + Marker( + point: selfPoint, + width: 48, + height: 48, + child: Center( child: Container( + width: 35, + height: 35, decoration: BoxDecoration( - color: Colors.teal, + color: MeshPalette.signal, shape: BoxShape.circle, border: Border.all(color: Colors.white, width: 2), boxShadow: [ @@ -755,20 +1244,147 @@ class _ChannelMessagePathMapScreenState ), ), ), + ), + ); + if (showLabels) { + markers.add( + _buildNodeLabelMarker( + point: selfPoint, + label: context.l10n.pathTrace_you, + ), + ); + } + return markers; + } + + /// Markers for the union of located hops across all visible paths, with a + /// badge on repeaters used by more than one path. + List _buildCombinedHopMarkers( + List<_ObservedPathEntry> visibleEntries, { + required bool showLabels, + }) { + final markers = []; + + final nodes = {}; + for (final entry in visibleEntries) { + final seenInPath = {}; + for (final hop in entry.hops) { + if (!hop.hasLocation) continue; + final key = + '${hop.prefix}|${hop.position!.latitude.toStringAsFixed(5)},' + '${hop.position!.longitude.toStringAsFixed(5)}'; + if (!seenInPath.add(key)) continue; + nodes.putIfAbsent(key, () => _SharedNode(hop)).paths.add(entry.display); + } + } + + for (final node in nodes.values) { + final hop = node.hop; + final point = hop.position!; + final label = _formatPrefix(hop.prefix); + final shared = node.paths.length > 1; + + markers.add( + Marker( + point: point, + width: 48, + height: 48, + child: GestureDetector( + onTap: () => showSharedNodeSheet( + context, + title: '$label: ${_resolveName(hop.contact, context.l10n)}', + paths: node.paths, + onSelect: (display) { + for (final entry in visibleEntries) { + if (entry.display.id == display.id) { + _selectEntry(entry); + break; + } + } + }, + ), + child: Stack( + alignment: Alignment.center, + children: [ + Container( + width: 35, + height: 35, + decoration: BoxDecoration( + color: MeshPalette.blue, + shape: BoxShape.circle, + border: Border.all( + color: Colors.white, + width: shared ? 2.5 : 2, + ), + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.3), + blurRadius: 4, + offset: const Offset(0, 2), + ), + ], + ), + alignment: Alignment.center, + child: Text( + label, + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 11, + ), + ), + ), + if (shared) + Positioned( + top: 0, + right: 0, + child: Container( + width: 17, + height: 17, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: MeshPalette.bg1, + border: Border.all(color: MeshPalette.line3), + ), + alignment: Alignment.center, + child: Text( + '${node.paths.length}', + style: MeshTheme.mono( + fontSize: 9, + fontWeight: FontWeight.w700, + color: MeshPalette.ink, + ), + ), + ), + ), + ], + ), + ), + ), ); if (showLabels) { markers.add( _buildNodeLabelMarker( - point: selfPoint, - label: context.l10n.pathTrace_you, + point: point, + label: hop.contact?.name ?? label, ), ); } } + markers.addAll(_buildSelfMarkers(showLabels: showLabels)); + return markers; } + /// Orients recorded path bytes in the direction the packet traveled. + Uint8List _orientPath(Uint8List bytes) { + final reverse = + (!widget.message.isOutgoing && !widget.channelMessage) || + (widget.message.isOutgoing && widget.channelMessage); + return reverse ? Uint8List.fromList(bytes.reversed.toList()) : bytes; + } + Marker _buildNodeLabelMarker({required LatLng point, required String label}) { return Marker( point: point, @@ -807,12 +1423,35 @@ class _ChannelMessagePathMapScreenState Widget _buildLegendCard( BuildContext context, List<_PathHop> hops, - bool isImperial, - ) { + bool isImperial, { + required List<_ObservedPathEntry> entries, + required _ObservedPathEntry? selectedEntry, + required PathViewMode effectiveMode, + }) { final l10n = context.l10n; - final maxHeight = MediaQuery.of(context).size.height * 0.35; - final estimatedHeight = 72.0 + (hops.length * 56.0); - final cardHeight = max(96.0, min(maxHeight, estimatedHeight)); + final combined = effectiveMode == PathViewMode.combined; + final selectedDisplay = selectedEntry?.display; + final maxHeight = + MediaQuery.of(context).size.height * (combined ? 0.45 : 0.35); + + double cardHeight; + if (_panelCollapsed) { + cardHeight = 128; + } else { + final summaryHeight = combined ? 34.0 + entries.length * 36.0 : 0; + final estimatedHeight = 132.0 + summaryHeight + hops.length * 56.0; + cardHeight = max(176.0, min(maxHeight, estimatedHeight)); + } + + final hopUseCount = {}; + if (combined) { + for (final entry in entries) { + if (_hiddenPathIds.contains(entry.display.id)) continue; + for (final prefix in entry.hops.map((h) => h.prefix).toSet()) { + hopUseCount.update(prefix, (v) => v + 1, ifAbsent: () => 1); + } + } + } return Positioned( left: 16, @@ -820,64 +1459,255 @@ class _ChannelMessagePathMapScreenState bottom: 16, child: SizedBox( height: cardHeight, - child: Card( + child: Container( + decoration: BoxDecoration( + color: MeshPalette.bg1, + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: MeshPalette.line2), + ), + clipBehavior: Clip.antiAlias, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: const EdgeInsets.all(12), - child: Text( - '${l10n.channelPath_repeaterHops} ${formatDistance(_pathDistance, isImperial: isImperial)}', - style: const TextStyle(fontWeight: FontWeight.w600), + padding: const EdgeInsets.fromLTRB(12, 8, 4, 0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Text( + l10n.channelPath_repeaterHops, + style: const TextStyle( + fontWeight: FontWeight.w600, + ), + ), + ), + Text( + formatDistance( + selectedDisplay?.distanceMeters ?? + _pathDistance, + isImperial: isImperial, + ), + style: MeshTheme.mono( + fontSize: 12, + color: MeshPalette.ink2, + ), + ), + ], + ), + const SizedBox(height: 4), + PathMiniLegend( + combined: combined, + showInferred: false, + ), + ], + ), + ), + IconButton( + visualDensity: VisualDensity.compact, + icon: Icon( + _panelCollapsed ? Icons.expand_less : Icons.expand_more, + size: 20, + ), + tooltip: _panelCollapsed + ? l10n.pathMap_expandPanel + : l10n.pathMap_collapsePanel, + onPressed: () => + setState(() => _panelCollapsed = !_panelCollapsed), + ), + ], ), ), - const Divider(height: 1), - Expanded( - child: hops.isEmpty - ? Center( - child: Text(l10n.channelPath_noHopDetailsAvailable), - ) - : ListView.separated( - padding: const EdgeInsets.symmetric(vertical: 4), - itemCount: hops.length, - separatorBuilder: (_, _) => const Divider(height: 1), - itemBuilder: (context, index) { - final hop = hops[index]; - final isFocused = _focusedHopIndex == hop.index; - return ListTile( - dense: true, - enabled: hop.hasLocation, - selected: isFocused, - selectedTileColor: Theme.of( - context, - ).colorScheme.primary.withValues(alpha: 0.12), - onTap: hop.hasLocation - ? () => _onHopTapped(hop) - : null, - leading: CircleAvatar( - radius: 14, - child: Text( - hop.index.toString(), - style: const TextStyle(fontSize: 12), - ), - ), - title: Text(hop.displayLabel), - subtitle: Text( - hop.hasLocation - ? '${hop.position!.latitude.toStringAsFixed(5)}, ' - '${hop.position!.longitude.toStringAsFixed(5)}' - : l10n.channelPath_noLocationData, - ), - ); - }, - ), + PathAnimationControls( + playback: _playback, + selected: selectedDisplay, + animationEnabled: _animationEnabled, + onToggleAnimation: () => setState(() { + _animationEnabled = !_animationEnabled; + if (!_animationEnabled) _playback.stop(); + }), + followEnabled: _followPacket, + onToggleFollow: _toggleFollowPacket, ), + if (!_panelCollapsed) ...[ + if (selectedDisplay != null && + selectedDisplay.unresolvedHops > 0) + Padding( + padding: const EdgeInsets.fromLTRB(12, 0, 12, 4), + child: Text( + l10n.pathMap_partialAnimation( + selectedDisplay.unresolvedHops, + ), + style: TextStyle(fontSize: 10.5, color: MeshPalette.warn), + ), + ), + if (combined) + PathSummaryList( + paths: entries.map((e) => e.display).toList(), + selectedId: selectedDisplay?.id ?? '', + hiddenIds: _hiddenPathIds, + isImperial: isImperial, + onSelect: (display) { + for (final entry in entries) { + if (entry.display.id == display.id) { + _selectEntry(entry); + break; + } + } + }, + onToggleVisibility: (display) => _togglePathVisibility( + display, + entries, + selectedDisplay, + ), + onShowAll: () => setState(_hiddenPathIds.clear), + ), + const Divider(height: 1), + Expanded( + child: _buildHopListView(hops, selectedDisplay, hopUseCount), + ), + ], ], ), ), ), ); } + + Widget _buildHopListView( + List<_PathHop> hops, + DisplayPath? selectedDisplay, + Map hopUseCount, + ) { + final l10n = context.l10n; + if (hops.isEmpty) { + return Center(child: Text(l10n.channelPath_noHopDetailsAvailable)); + } + return ValueListenableBuilder( + valueListenable: _playback.activeSegment, + builder: (context, activeSegment, _) { + int highlightRow = -1; + if (_animationEnabled && + selectedDisplay != null && + activeSegment >= 0 && + activeSegment < selectedDisplay.rowForSegment.length) { + highlightRow = selectedDisplay.rowForSegment[activeSegment]; + } + final highlightColor = (selectedDisplay?.color ?? MeshPalette.blue) + .withValues(alpha: 0.14); + return ListView.separated( + padding: const EdgeInsets.symmetric(vertical: 4), + itemCount: hops.length, + separatorBuilder: (_, _) => const Divider(height: 1), + itemBuilder: (context, index) { + final hop = hops[index]; + final isFocused = _focusedHopIndex == hop.index; + final sharedCount = hopUseCount[hop.prefix] ?? 0; + return InkWell( + onTap: hop.hasLocation ? () => _onHopTapped(hop) : null, + child: Container( + color: index == highlightRow + ? highlightColor + : isFocused + ? MeshPalette.blueBg + : Colors.transparent, + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + child: Row( + children: [ + Container( + width: 28, + height: 28, + decoration: BoxDecoration( + color: MeshPalette.blueDim.withValues(alpha: 0.3), + shape: BoxShape.circle, + border: Border.all( + color: MeshPalette.blueDim.withValues(alpha: 0.5), + ), + ), + alignment: Alignment.center, + child: Text( + hop.index.toString(), + style: const TextStyle( + color: Colors.white, + fontSize: 11, + fontWeight: FontWeight.w700, + ), + ), + ), + const SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + hop.displayLabel, + style: const TextStyle( + fontWeight: FontWeight.w600, + fontSize: 13, + ), + overflow: TextOverflow.ellipsis, + ), + Text( + [ + hop.hasLocation + ? '${hop.position!.latitude.toStringAsFixed(5)}, ' + '${hop.position!.longitude.toStringAsFixed(5)}' + : context.l10n.channelPath_noLocationData, + if (sharedCount > 1) + context.l10n.pathMap_sharedNodeCount( + sharedCount, + ), + ].join(' · '), + style: MeshTheme.mono( + fontSize: 10, + color: MeshPalette.ink3, + ), + overflow: TextOverflow.ellipsis, + ), + ], + ), + ), + ], + ), + ), + ); + }, + ); + }, + ); + } +} + +/// One observed route paired with its renderable form and resolved hops. +class _ObservedPathEntry { + final int index; + final Uint8List observedBytes; + final DisplayPath display; + final List<_PathHop> hops; + + const _ObservedPathEntry({ + required this.index, + required this.observedBytes, + required this.display, + required this.hops, + }); +} + +/// A located hop shared across one or more visible paths. +class _SharedNode { + final _PathHop hop; + final List paths = []; + + _SharedNode(this.hop); } class _PathHop { @@ -913,76 +1743,25 @@ class _ObservedPath { List<_PathHop> _buildPathHops( Uint8List pathBytes, MeshCoreConnector connector, - AppLocalizations l10n, -) { + AppLocalizations l10n, { + bool resolveFromEnd = false, +}) { if (pathBytes.isEmpty) return const []; - final candidatesByPrefix = >{}; - final allContacts = connector.allContacts; - for (final contact in allContacts) { - if (contact.publicKey.isEmpty) continue; - if (contact.type != advTypeRepeater && contact.type != advTypeRoom) { - continue; - } - final prefix = contact.publicKey.first; - candidatesByPrefix.putIfAbsent(prefix, () => []).add(contact); - } - for (final candidates in candidatesByPrefix.values) { - candidates.sort((a, b) => b.lastSeen.compareTo(a.lastSeen)); - } - final startPoint = + final endpoint = (connector.selfLatitude != null && connector.selfLongitude != null) ? LatLng(connector.selfLatitude!, connector.selfLongitude!) : null; - var previousPosition = startPoint; - final distance = Distance(); - var lastDistance = 0.0; - var bestDistance = 0.0; + final resolvedContacts = PathHopResolver.resolve( + pathBytes: pathBytes, + contacts: connector.allContacts, + endpoint: endpoint, + resolveFromEnd: resolveFromEnd, + ); + final hops = <_PathHop>[]; for (var i = 0; i < pathBytes.length; i++) { - final searchPoint = i == 0 ? startPoint : previousPosition; - final candidates = candidatesByPrefix[pathBytes[i]]; - Contact? contact; - if (candidates != null && candidates.isNotEmpty) { - var bestIndex = 0; - if (searchPoint != null) { - bestDistance = double.infinity; - for (var j = 0; j < candidates.length; j++) { - final candidate = candidates[j]; - if (!candidate.hasLocation || - candidate.latitude == null || - candidate.longitude == null) { - continue; - } - final currentDistance = distance( - searchPoint, - LatLng(candidate.latitude!, candidate.longitude!), - ); - if (currentDistance < bestDistance) { - bestDistance = currentDistance; - bestIndex = j; - } - } - } - contact = candidates.removeAt(bestIndex); - if (candidates.isEmpty) { - candidatesByPrefix.remove(pathBytes[i]); - } - } - + final contact = resolvedContacts[i]; final resolvedPosition = _resolvePosition(contact); - if (resolvedPosition != null) { - previousPosition = resolvedPosition; - } - // If the best candidate is much farther than the previous hop, it's likely not the correct match. - if (lastDistance + bestDistance > 50000 && - candidates != null && - candidates.isNotEmpty) { - i--; - lastDistance = bestDistance; - continue; - } - lastDistance = bestDistance; - hops.add( _PathHop( index: i + 1, diff --git a/lib/screens/channels_screen.dart b/lib/screens/channels_screen.dart index 7447f1e1..94bbd65e 100644 --- a/lib/screens/channels_screen.dart +++ b/lib/screens/channels_screen.dart @@ -1,8 +1,8 @@ import 'dart:async'; import 'dart:math'; -import 'dart:typed_data'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:meshcore_open/storage/channel_message_store.dart'; import 'package:meshcore_open/utils/platform_info.dart'; import 'package:meshcore_open/widgets/app_bar.dart'; @@ -16,13 +16,16 @@ import '../services/ui_view_state_service.dart'; import '../models/channel.dart'; import '../models/community.dart'; import '../storage/community_store.dart'; +import '../theme/mesh_theme.dart'; import '../utils/dialog_utils.dart'; import '../utils/disconnect_navigation_mixin.dart'; import '../utils/route_transitions.dart'; import '../widgets/list_filter_widget.dart'; import '../widgets/empty_state.dart'; +import '../widgets/mesh_ui.dart'; import '../widgets/qr_code_display.dart'; import '../widgets/quick_switch_bar.dart'; +import '../widgets/sync_progress_overlay.dart'; import '../widgets/unread_badge.dart'; import '../helpers/snack_bar_builder.dart'; import 'channel_chat_screen.dart'; @@ -44,11 +47,9 @@ class _ChannelsScreenState extends State with DisconnectNavigationMixin { final TextEditingController _searchController = TextEditingController(); final CommunityStore _communityStore = CommunityStore(); - Timer? _searchDebounce; + final CommunityPskIndex _communityIndex = CommunityPskIndex(); List _communities = []; - - // Cache of PSK hex -> Community for quick lookup - final Map _pskToCommunity = {}; + Timer? _searchDebounce; ChannelMessageStore get _channelMessageStore => ChannelMessageStore(); @@ -71,37 +72,11 @@ class _ChannelsScreenState extends State if (mounted) { setState(() { _communities = communities; - _buildPskCommunityMap(); + _communityIndex.initialize(communities); }); } } - void _buildPskCommunityMap() { - _pskToCommunity.clear(); - for (final community in _communities) { - // Map the community public channel PSK - final publicPsk = community.deriveCommunityPublicPsk(); - _pskToCommunity[Channel.formatPskHex(publicPsk)] = community; - - // Map all known hashtag channel PSKs - for (final hashtag in community.hashtagChannels) { - final hashtagPsk = community.deriveCommunityHashtagPsk(hashtag); - _pskToCommunity[Channel.formatPskHex(hashtagPsk)] = community; - } - } - } - - /// Returns the community this channel belongs to, or null if not a community channel - Community? _getCommunityForChannel(Channel channel) { - return _pskToCommunity[channel.pskHex]; - } - - /// Returns true if this is the community's public channel - bool _isCommunityPublicChannel(Channel channel, Community community) { - final publicPsk = community.deriveCommunityPublicPsk(); - return channel.pskHex == Channel.formatPskHex(publicPsk); - } - @override void dispose() { _searchDebounce?.cancel(); @@ -109,6 +84,14 @@ class _ChannelsScreenState extends State super.dispose(); } + String _relativeTime(DateTime t) { + final diff = DateTime.now().difference(t); + if (diff.inMinutes < 1) return 'now'; + if (diff.inMinutes < 60) return '${diff.inMinutes}m'; + if (diff.inHours < 24) return '${diff.inHours}h'; + return '${diff.inDays}d'; + } + @override Widget build(BuildContext context) { final connector = context.watch(); @@ -131,36 +114,42 @@ class _ChannelsScreenState extends State title: AppBarTitle(context.l10n.channels_title), centerTitle: true, automaticallyImplyLeading: false, + bottom: const SyncProgressAppBarBottom(), actions: [ PopupMenuButton( - itemBuilder: (context) => [ + // onTap handlers run after the menu route pops, so they must + // capture the screen's context — not the itemBuilder's menu + // context, which is deactivated by then. + itemBuilder: (menuContext) => [ PopupMenuItem( child: Row( children: [ - const Icon(Icons.logout, color: Colors.red), + Icon( + Icons.logout, + color: Theme.of(menuContext).colorScheme.error, + ), const SizedBox(width: 8), - Text(context.l10n.common_disconnect), + Text(menuContext.l10n.common_disconnect), ], ), onTap: () => _disconnect(context), ), - if (_communities.isNotEmpty) - PopupMenuItem( - child: Row( - children: [ - const Icon(Icons.groups), - const SizedBox(width: 8), - Text(context.l10n.community_manageCommunities), - ], - ), - onTap: () => _showManageCommunitiesDialog(context), + PopupMenuItem( + child: Row( + children: [ + const Icon(Icons.groups), + const SizedBox(width: 8), + Text(menuContext.l10n.community_manageCommunities), + ], ), + onTap: () => _showManageCommunitiesDialog(context), + ), PopupMenuItem( child: Row( children: [ const Icon(Icons.settings), const SizedBox(width: 8), - Text(context.l10n.settings_title), + Text(menuContext.l10n.settings_title), ], ), onTap: () => Navigator.push( @@ -180,12 +169,17 @@ class _ChannelsScreenState extends State await context.read().getChannels(force: true); }, child: () { - if (connector.isLoadingChannels) { + final channels = connector.channels; + final waitingForFirstChannel = + connector.isLoadingChannels && channels.isEmpty; + + // Only block the list while the first channel is actively loading. + // If the initial sync aborts, show cached/partial channels instead + // of trapping the user behind an idle spinner. + if (waitingForFirstChannel) { return const Center(child: CircularProgressIndicator()); } - final channels = connector.channels; - if (channels.isEmpty) { return ListView( children: [ @@ -238,9 +232,6 @@ class _ChannelsScreenState extends State _buildFilterButton(viewState), ], ), - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(12), - ), contentPadding: const EdgeInsets.symmetric( horizontal: 16, vertical: 12, @@ -262,47 +253,37 @@ class _ChannelsScreenState extends State ), Expanded( child: filteredChannels.isEmpty - ? ListView( - children: [ - SizedBox( - height: MediaQuery.of(context).size.height - 300, - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - Icons.search_off, - size: 64, - color: Colors.grey[400], - ), - const SizedBox(height: 16), - Text( - context.l10n.channels_noChannelsFound, - style: TextStyle( - fontSize: 16, - color: Colors.grey[600], - ), - ), - ], + ? LayoutBuilder( + builder: (context, constraints) => ListView( + physics: const AlwaysScrollableScrollPhysics(), + children: [ + ConstrainedBox( + constraints: BoxConstraints( + minHeight: constraints.maxHeight, + ), + child: EmptyState( + icon: Icons.search_off, + title: context.l10n.channels_noChannelsFound, ), ), - ), - ], + ], + ), ) : (viewState.channelsSortOption == ChannelSortOption.manual && viewState.channelsSearchText.isEmpty) ? ReorderableListView.builder( padding: const EdgeInsets.only( - left: 16, - right: 16, + left: 0, + right: 0, top: 8, bottom: 88, ), buildDefaultDragHandles: false, itemCount: filteredChannels.length, - onReorder: (oldIndex, newIndex) { - if (newIndex > oldIndex) newIndex -= 1; + onReorderItem: (oldIndex, newIndex) { + // onReorderItem already adjusts newIndex after the + // removed item, unlike the deprecated onReorder. final reordered = List.from( filteredChannels, ); @@ -323,13 +304,14 @@ class _ChannelsScreenState extends State channel, showDragHandle: true, dragIndex: index, + listIndex: index, ); }, ) : ListView.builder( padding: const EdgeInsets.only( - left: 16, - right: 16, + left: 0, + right: 0, top: 8, bottom: 88, ), @@ -341,6 +323,7 @@ class _ChannelsScreenState extends State connector, channelMessageStore, channel, + listIndex: index, ); }, ), @@ -375,138 +358,213 @@ class _ChannelsScreenState extends State Channel channel, { bool showDragHandle = false, int? dragIndex, + int listIndex = 0, }) { final unreadCount = connector.getUnreadCountForChannel(channel); - final community = _getCommunityForChannel(channel); - final isCommunityChannel = community != null; - final isCommunityPublic = - isCommunityChannel && _isCommunityPublicChannel(channel, community); + final isMuted = context.watch().isChannelMuted( + channel.name, + ); + final scheme = Theme.of(context).colorScheme; // Determine icon and colors based on channel type IconData icon; Color iconColor; - Color bgColor; - - if (isCommunityChannel) { - // Community channel styling - iconColor = Colors.purple; - bgColor = Colors.purple.withValues(alpha: 0.2); - if (isCommunityPublic) { + final ChannelType channelType = Channel.getChannelType( + channel, + _communityIndex, + ); + final bool isCommunityChannel = Channel.isCommunityChannel(channelType); + switch (channelType) { + case ChannelType.communityPublic: icon = Icons.groups; - } else { + iconColor = MeshPalette.magenta; + case ChannelType.communityHashtag: + icon = Icons.groups; + iconColor = MeshPalette.magenta; + case ChannelType.public: + icon = Icons.public; + iconColor = MeshPalette.signal; + case ChannelType.hashtag: icon = Icons.tag; - } - } else if (channel.isPublicChannel) { - icon = Icons.public; - iconColor = Colors.green; - bgColor = Colors.green.withValues(alpha: 0.2); - } else if (channel.name.startsWith('#')) { - icon = Icons.tag; - iconColor = Colors.blue; - bgColor = Colors.blue.withValues(alpha: 0.2); - } else { - icon = Icons.lock; - iconColor = Colors.blue; - bgColor = Colors.blue.withValues(alpha: 0.2); + iconColor = MeshPalette.blue; + case ChannelType.private: + icon = Icons.lock; + iconColor = MeshPalette.blue; } - return Card( - key: ValueKey('channel_${channel.index}'), - margin: const EdgeInsets.only(bottom: 12), - child: GestureDetector( - onSecondaryTapUp: PlatformInfo.isDesktop - ? (_) => _showChannelActions( - context, - connector, - channelMessageStore, - channel, - ) - : null, - child: ListTile( - dense: true, - minVerticalPadding: 14, - contentPadding: const EdgeInsets.symmetric(horizontal: 12), - visualDensity: const VisualDensity(vertical: -2), - leading: Stack( - children: [ - Padding( - padding: const EdgeInsets.symmetric(vertical: 3), - child: CircleAvatar( - backgroundColor: bgColor, - child: Icon(icon, color: iconColor), - ), + // Last message preview + final messages = connector.getChannelMessages(channel); + final lastMessage = messages.isNotEmpty ? messages.last : null; + final lastPreview = lastMessage?.text ?? ''; + final lastTime = lastMessage?.timestamp; + + final channelLabel = channel.name.isEmpty + ? context.l10n.channels_channelIndex(channel.index) + : channel.name; + + return ListEntrance( + key: ValueKey('channel_entrance_${channel.index}'), + index: dragIndex ?? listIndex, + child: MeshCard( + key: ValueKey('channel_${channel.index}'), + margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10), + onTap: () { + HapticFeedback.selectionClick(); + final unread = connector.getUnreadCountForChannelIndex(channel.index); + connector.markChannelRead(channel.index); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ChannelChatScreen( + channel: channel, + initialUnreadCount: unread, ), - if (isCommunityChannel) - Positioned( - right: 0, - bottom: 0, - child: Container( - width: 14, - height: 14, - decoration: BoxDecoration( - color: Colors.purple, - shape: BoxShape.circle, - border: Border.all( - color: Theme.of(context).cardColor, - width: 2, + ), + ); + }, + onLongPress: () => _showChannelActions( + this.context, + connector, + channelMessageStore, + channel, + ), + child: GestureDetector( + onSecondaryTapUp: PlatformInfo.isDesktop + ? (_) => _showChannelActions( + this.context, + connector, + channelMessageStore, + channel, + ) + : null, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + // Leading avatar with optional community badge + Stack( + clipBehavior: Clip.none, + children: [ + AvatarCircle( + name: channelLabel, + size: 42, + color: iconColor, + icon: icon, + ), + if (isCommunityChannel) + Positioned( + right: -2, + bottom: -2, + child: Container( + width: 16, + height: 16, + decoration: BoxDecoration( + color: MeshPalette.magenta, + shape: BoxShape.circle, + border: Border.all( + color: Theme.of( + context, + ).colorScheme.surfaceContainerLow, + width: 2, + ), + ), + child: const Icon( + Icons.people, + size: 8, + color: Colors.white, + ), ), ), - child: const Icon( - Icons.people, - size: 8, - color: Colors.white, + ], + ), + const SizedBox(width: 12), + // Title + subtitle + ch chip + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Text( + channelLabel, + style: Theme.of(context).textTheme.bodyMedium + ?.copyWith(fontWeight: FontWeight.w500), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ), + const SizedBox(width: 6), + StatusChip( + label: 'CH ${channel.index}', + color: MeshPalette.blue, + fontSize: 10, + ), + ], + ), + if (lastPreview.isNotEmpty) ...[ + const SizedBox(height: 2), + Text( + lastPreview, + style: MeshTheme.mono( + fontSize: 11.5, + color: scheme.onSurfaceVariant, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ], + ], + ), + ), + const SizedBox(width: 8), + // Right side: time + unread badge + muted + drag handle + Column( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.min, + children: [ + if (lastTime != null) + Text( + _relativeTime(lastTime), + style: MeshTheme.mono( + fontSize: 11, + color: scheme.onSurfaceVariant, + ), + ), + const SizedBox(height: 4), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + if (isMuted) ...[ + Icon( + Icons.notifications_off, + size: 14, + color: scheme.onSurfaceVariant, + ), + const SizedBox(width: 4), + ], + if (unreadCount > 0) UnreadBadge(count: unreadCount), + ], + ), + ], + ), + if (showDragHandle && dragIndex != null) ...[ + const SizedBox(width: 4), + ReorderableDragStartListener( + index: dragIndex, + child: Padding( + padding: const EdgeInsets.all(8), + child: Icon( + Icons.drag_handle, + color: scheme.onSurfaceVariant, ), ), ), - ], - ), - title: Text( - channel.name.isEmpty - ? context.l10n.channels_channelIndex(channel.index) - : channel.name, - style: const TextStyle(fontWeight: FontWeight.w500), - ), - trailing: Row( - mainAxisSize: MainAxisSize.min, - children: [ - if (unreadCount > 0) ...[ - UnreadBadge(count: unreadCount), - const SizedBox(width: 4), ], - if (showDragHandle && dragIndex != null) - ReorderableDelayedDragStartListener( - index: dragIndex, - child: Icon( - Icons.drag_handle, - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - ), ], ), - onTap: () async { - final unread = connector.getUnreadCountForChannelIndex( - channel.index, - ); - connector.markChannelRead(channel.index); - await Future.delayed(const Duration(milliseconds: 50)); - if (context.mounted) { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => ChannelChatScreen( - channel: channel, - initialUnreadCount: unread, - ), - ), - ); - } - }, - onLongPress: () => _showChannelActions( - context, - connector, - channelMessageStore, - channel, - ), ), ), ); @@ -530,7 +588,7 @@ class _ChannelsScreenState extends State children: [ ListTile( leading: const Icon(Icons.edit_outlined), - title: Text(context.l10n.channels_editChannel), + title: Text(sheetContext.l10n.channels_editChannel), onTap: () async { Navigator.pop(sheetContext); await Future.delayed(const Duration(milliseconds: 100)); @@ -547,8 +605,8 @@ class _ChannelsScreenState extends State ), title: Text( isMuted - ? context.l10n.channels_unmuteChannel - : context.l10n.channels_muteChannel, + ? sheetContext.l10n.channels_unmuteChannel + : sheetContext.l10n.channels_muteChannel, ), onTap: () async { Navigator.pop(sheetContext); @@ -560,17 +618,22 @@ class _ChannelsScreenState extends State }, ), ListTile( - leading: const Icon(Icons.delete_outline, color: Colors.red), + leading: Icon( + Icons.delete_outline, + color: Theme.of(sheetContext).colorScheme.error, + ), title: Text( - context.l10n.channels_deleteChannel, - style: const TextStyle(color: Colors.red), + sheetContext.l10n.channels_deleteChannel, + style: TextStyle( + color: Theme.of(sheetContext).colorScheme.error, + ), ), onTap: () async { Navigator.pop(sheetContext); await Future.delayed(const Duration(milliseconds: 100)); if (parentContext.mounted) { _confirmDeleteChannel( - context, + parentContext, connector, channelMessageStore, channel, @@ -727,11 +790,11 @@ class _ChannelsScreenState extends State _communityStore.setPublicKeyHex = connector.selfPublicKeyHex; - showDialog( - context: context, - builder: (dialogContext) => StatefulBuilder( - builder: (dialogContext, setDialogState) { - Widget buildOptionTile({ + showMeshSheet( + context, + builder: (sheetContext) => StatefulBuilder( + builder: (sheetContext, setSheetState) { + Widget buildOptionCard({ required int optionIndex, required IconData icon, required String title, @@ -739,35 +802,15 @@ class _ChannelsScreenState extends State bool enabled = true, }) { final isSelected = selectedOption == optionIndex; - return ListTile( - leading: CircleAvatar( - backgroundColor: enabled - ? (isSelected - ? Theme.of(dialogContext).colorScheme.primaryContainer - : null) - : Colors.grey.withValues(alpha: 0.2), - child: Icon( - icon, - color: enabled - ? (isSelected - ? Theme.of(dialogContext).colorScheme.primary - : null) - : Colors.grey, - ), - ), - title: Text( - title, - style: TextStyle(color: enabled ? null : Colors.grey), - ), - subtitle: Text( - subtitle, - style: TextStyle(color: enabled ? null : Colors.grey), - ), - trailing: enabled ? const Icon(Icons.chevron_right) : null, - selected: isSelected, + final cardScheme = Theme.of(sheetContext).colorScheme; + return MeshCard( + margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10), + borderColor: isSelected && enabled ? MeshPalette.blueLine : null, + color: isSelected && enabled ? MeshPalette.blueBg : null, onTap: enabled ? () { - setDialogState(() { + setSheetState(() { selectedOption = optionIndex; nameController.clear(); pskController.clear(); @@ -775,6 +818,57 @@ class _ChannelsScreenState extends State }); } : null, + child: Row( + children: [ + AvatarCircle( + name: title, + size: 38, + color: enabled + ? (isSelected + ? MeshPalette.blue + : cardScheme.onSurfaceVariant) + : cardScheme.outline, + icon: icon, + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + title, + style: Theme.of(sheetContext).textTheme.bodyMedium + ?.copyWith( + fontWeight: FontWeight.w500, + color: enabled ? null : cardScheme.outline, + ), + ), + const SizedBox(height: 2), + Text( + subtitle, + style: Theme.of(sheetContext).textTheme.bodySmall + ?.copyWith( + color: enabled + ? cardScheme.onSurfaceVariant + : cardScheme.outline, + ), + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), + ], + ), + ), + if (enabled) + Icon( + Icons.chevron_right, + color: isSelected + ? MeshPalette.blue + : cardScheme.onSurfaceVariant, + size: 20, + ), + ], + ), ); } @@ -793,7 +887,7 @@ class _ChannelsScreenState extends State child: TextField( controller: nameController, decoration: InputDecoration( - labelText: dialogContext.l10n.channels_channelName, + labelText: sheetContext.l10n.channels_channelName, border: const OutlineInputBorder(), ), maxLength: 31, @@ -811,7 +905,7 @@ class _ChannelsScreenState extends State showDismissibleSnackBar( context, content: Text( - dialogContext + sheetContext .l10n .channels_enterChannelName, ), @@ -823,7 +917,7 @@ class _ChannelsScreenState extends State for (int i = 0; i < 16; i++) { psk[i] = random.nextInt(256); } - Navigator.pop(dialogContext); + Navigator.pop(sheetContext); await connector.setChannel( nextIndex, name, @@ -841,12 +935,13 @@ class _ChannelsScreenState extends State ); } }, - child: Text(dialogContext.l10n.common_create), + child: Text(sheetContext.l10n.common_create), ), ), ], ), ), + const SizedBox(height: 8), ], ); @@ -861,7 +956,7 @@ class _ChannelsScreenState extends State child: TextField( controller: nameController, decoration: InputDecoration( - labelText: dialogContext.l10n.channels_channelName, + labelText: sheetContext.l10n.channels_channelName, border: const OutlineInputBorder(), ), maxLength: 31, @@ -875,7 +970,7 @@ class _ChannelsScreenState extends State child: TextField( controller: pskController, decoration: InputDecoration( - labelText: dialogContext.l10n.channels_pskHex, + labelText: sheetContext.l10n.channels_pskHex, border: const OutlineInputBorder(), ), ), @@ -893,7 +988,7 @@ class _ChannelsScreenState extends State showDismissibleSnackBar( context, content: Text( - dialogContext + sheetContext .l10n .channels_enterChannelName, ), @@ -907,14 +1002,12 @@ class _ChannelsScreenState extends State showDismissibleSnackBar( context, content: Text( - dialogContext - .l10n - .channels_pskMustBe32Hex, + sheetContext.l10n.channels_pskMustBe32Hex, ), ); return; } - Navigator.pop(dialogContext); + Navigator.pop(sheetContext); connector.setChannel(nextIndex, name, psk); if (context.mounted) { showDismissibleSnackBar( @@ -925,12 +1018,13 @@ class _ChannelsScreenState extends State ); } }, - child: Text(dialogContext.l10n.common_add), + child: Text(sheetContext.l10n.common_add), ), ), ], ), ), + const SizedBox(height: 8), ], ); @@ -948,8 +1042,12 @@ class _ChannelsScreenState extends State final psk = Channel.parsePskHex( Channel.publicChannelPsk, ); - Navigator.pop(dialogContext); - connector.setChannel(nextIndex, 'Public', psk); + Navigator.pop(sheetContext); + connector.setChannel( + nextIndex, + context.l10n.channels_public, + psk, + ); if (context.mounted) { showDismissibleSnackBar( context, @@ -959,7 +1057,7 @@ class _ChannelsScreenState extends State ); } }, - child: Text(dialogContext.l10n.common_add), + child: Text(sheetContext.l10n.common_add), ), ), ], @@ -973,7 +1071,7 @@ class _ChannelsScreenState extends State if (_communities.isNotEmpty) ...[ RadioGroup( groupValue: isRegularHashtag, - onChanged: (v) => setDialogState(() { + onChanged: (v) => setSheetState(() { if (v == null) return; isRegularHashtag = v; if (isRegularHashtag) { @@ -988,20 +1086,20 @@ class _ChannelsScreenState extends State RadioListTile( value: true, title: Text( - dialogContext.l10n.community_regularHashtag, + sheetContext.l10n.community_regularHashtag, ), subtitle: Text( - dialogContext.l10n.community_regularHashtagDesc, + sheetContext.l10n.community_regularHashtagDesc, ), dense: true, ), RadioListTile( value: false, title: Text( - dialogContext.l10n.community_communityHashtag, + sheetContext.l10n.community_communityHashtag, ), subtitle: Text( - dialogContext + sheetContext .l10n .community_communityHashtagDesc, ), @@ -1029,10 +1127,10 @@ class _ChannelsScreenState extends State ) .toList(), onChanged: (c) => - setDialogState(() => selectedCommunity = c), + setSheetState(() => selectedCommunity = c), decoration: InputDecoration( labelText: - dialogContext.l10n.community_selectCommunity, + sheetContext.l10n.community_selectCommunity, border: const OutlineInputBorder(), prefixIcon: const Icon(Icons.groups), ), @@ -1047,8 +1145,8 @@ class _ChannelsScreenState extends State child: TextField( controller: hashtagController, decoration: InputDecoration( - labelText: dialogContext.l10n.channels_enterHashtag, - hintText: dialogContext.l10n.channels_hashtagHint, + labelText: sheetContext.l10n.channels_enterHashtag, + hintText: sheetContext.l10n.channels_hashtagHint, border: const OutlineInputBorder(), prefixIcon: const Icon(Icons.tag), ), @@ -1060,10 +1158,12 @@ class _ChannelsScreenState extends State Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: Text( - dialogContext.l10n.community_hashtagPrivacyHint, + sheetContext.l10n.community_hashtagPrivacyHint, style: TextStyle( fontSize: 12, - color: Colors.grey[600], + color: Theme.of( + sheetContext, + ).colorScheme.onSurfaceVariant, fontStyle: FontStyle.italic, ), ), @@ -1083,7 +1183,7 @@ class _ChannelsScreenState extends State showDismissibleSnackBar( context, content: Text( - dialogContext + sheetContext .l10n .channels_enterChannelName, ), @@ -1106,9 +1206,9 @@ class _ChannelsScreenState extends State // Community hashtag - HMAC derivation from community secret if (selectedCommunity == null) { showDismissibleSnackBar( - dialogContext, + sheetContext, content: Text( - dialogContext + sheetContext .l10n .community_selectCommunity, ), @@ -1127,8 +1227,8 @@ class _ChannelsScreenState extends State _loadCommunities(); } - if (dialogContext.mounted) { - Navigator.pop(dialogContext); + if (sheetContext.mounted) { + Navigator.pop(sheetContext); } connector.setChannel( nextIndex, @@ -1146,7 +1246,7 @@ class _ChannelsScreenState extends State ); } }, - child: Text(dialogContext.l10n.common_add), + child: Text(sheetContext.l10n.common_add), ), ), ], @@ -1166,7 +1266,7 @@ class _ChannelsScreenState extends State Expanded( child: FilledButton.icon( onPressed: () async { - Navigator.pop(dialogContext); + Navigator.pop(sheetContext); if (context.mounted) { final result = await Navigator.push( context, @@ -1182,7 +1282,7 @@ class _ChannelsScreenState extends State } }, icon: const Icon(Icons.qr_code_scanner), - label: Text(dialogContext.l10n.community_scanQr), + label: Text(sheetContext.l10n.community_scanQr), ), ), ], @@ -1200,8 +1300,8 @@ class _ChannelsScreenState extends State child: TextField( controller: nameController, decoration: InputDecoration( - labelText: dialogContext.l10n.community_name, - hintText: dialogContext.l10n.community_enterName, + labelText: sheetContext.l10n.community_name, + hintText: sheetContext.l10n.community_enterName, border: const OutlineInputBorder(), prefixIcon: const Icon(Icons.groups), ), @@ -1211,15 +1311,13 @@ class _ChannelsScreenState extends State CheckboxListTile( value: addPublicChannel, onChanged: (value) { - setDialogState(() { + setSheetState(() { addPublicChannel = value ?? true; }); }, - title: Text( - dialogContext.l10n.community_addPublicChannel, - ), + title: Text(sheetContext.l10n.community_addPublicChannel), subtitle: Text( - dialogContext.l10n.community_addPublicChannelHint, + sheetContext.l10n.community_addPublicChannelHint, ), controlAffinity: ListTileControlAffinity.leading, contentPadding: const EdgeInsets.symmetric( @@ -1234,11 +1332,13 @@ class _ChannelsScreenState extends State child: FilledButton( onPressed: () async { final name = nameController.text.trim(); + final publicLabel = + context.l10n.channels_public; if (name.isEmpty) { showDismissibleSnackBar( context, content: Text( - dialogContext.l10n.community_enterName, + sheetContext.l10n.community_enterName, ), ); return; @@ -1258,7 +1358,7 @@ class _ChannelsScreenState extends State final psk = community .deriveCommunityPublicPsk(); final channelName = - '${community.name} Public'; + '${community.name} $publicLabel'; connector.setChannel( nextIndex, channelName, @@ -1266,8 +1366,8 @@ class _ChannelsScreenState extends State ); } - if (dialogContext.mounted) { - Navigator.pop(dialogContext); + if (sheetContext.mounted) { + Navigator.pop(sheetContext); } // Refresh communities list @@ -1296,12 +1396,13 @@ class _ChannelsScreenState extends State ); } }, - child: Text(dialogContext.l10n.common_create), + child: Text(sheetContext.l10n.common_create), ), ), ], ), ), + const SizedBox(height: 8), ], ); @@ -1310,84 +1411,78 @@ class _ChannelsScreenState extends State } } - return AlertDialog( - title: Text(dialogContext.l10n.channels_addChannel), - contentPadding: const EdgeInsets.symmetric(vertical: 16), - content: SizedBox( - width: double.maxFinite, - child: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - buildOptionTile( - optionIndex: 0, - icon: Icons.add, - title: dialogContext.l10n.channels_createPrivateChannel, - subtitle: - dialogContext.l10n.channels_createPrivateChannelDesc, - ), - if (selectedOption == 0) - buildExpandedContent(_channelMessageStore)!, - const Divider(height: 1), - buildOptionTile( - optionIndex: 1, - icon: Icons.lock, - title: dialogContext.l10n.channels_joinPrivateChannel, - subtitle: - dialogContext.l10n.channels_joinPrivateChannelDesc, - ), - if (selectedOption == 1) - buildExpandedContent(_channelMessageStore)!, - if (!hasPublicChannel) ...[ - const Divider(height: 1), - buildOptionTile( - optionIndex: 2, - icon: Icons.public, - title: dialogContext.l10n.channels_joinPublicChannel, + return DraggableScrollableSheet( + expand: false, + initialChildSize: 0.7, + minChildSize: 0.4, + maxChildSize: 0.95, + builder: (_, scrollController) => Column( + children: [ + BottomSheetHeader(title: sheetContext.l10n.channels_addChannel), + Expanded( + child: ListView( + controller: scrollController, + padding: const EdgeInsets.only(bottom: 24), + children: [ + buildOptionCard( + optionIndex: 0, + icon: Icons.add, + title: sheetContext.l10n.channels_createPrivateChannel, subtitle: - dialogContext.l10n.channels_joinPublicChannelDesc, + sheetContext.l10n.channels_createPrivateChannelDesc, ), - if (selectedOption == 2) + if (selectedOption == 0) + buildExpandedContent(_channelMessageStore)!, + buildOptionCard( + optionIndex: 1, + icon: Icons.lock, + title: sheetContext.l10n.channels_joinPrivateChannel, + subtitle: + sheetContext.l10n.channels_joinPrivateChannelDesc, + ), + if (selectedOption == 1) + buildExpandedContent(_channelMessageStore)!, + if (!hasPublicChannel) ...[ + buildOptionCard( + optionIndex: 2, + icon: Icons.public, + title: sheetContext.l10n.channels_joinPublicChannel, + subtitle: + sheetContext.l10n.channels_joinPublicChannelDesc, + ), + if (selectedOption == 2) + buildExpandedContent(_channelMessageStore)!, + ], + buildOptionCard( + optionIndex: 3, + icon: Icons.tag, + title: sheetContext.l10n.channels_joinHashtagChannel, + subtitle: + sheetContext.l10n.channels_joinHashtagChannelDesc, + ), + if (selectedOption == 3) + buildExpandedContent(_channelMessageStore)!, + buildOptionCard( + optionIndex: 4, + icon: Icons.qr_code_scanner, + title: sheetContext.l10n.community_scanQr, + subtitle: sheetContext.l10n.community_join, + ), + if (selectedOption == 4) + buildExpandedContent(_channelMessageStore)!, + buildOptionCard( + optionIndex: 5, + icon: Icons.groups, + title: sheetContext.l10n.community_create, + subtitle: sheetContext.l10n.community_createDesc, + ), + if (selectedOption == 5) buildExpandedContent(_channelMessageStore)!, ], - const Divider(height: 1), - buildOptionTile( - optionIndex: 3, - icon: Icons.tag, - title: dialogContext.l10n.channels_joinHashtagChannel, - subtitle: - dialogContext.l10n.channels_joinHashtagChannelDesc, - ), - if (selectedOption == 3) - buildExpandedContent(_channelMessageStore)!, - const Divider(height: 1), - buildOptionTile( - optionIndex: 4, - icon: Icons.qr_code_scanner, - title: dialogContext.l10n.community_scanQr, - subtitle: dialogContext.l10n.community_join, - ), - if (selectedOption == 4) - buildExpandedContent(_channelMessageStore)!, - const Divider(height: 1), - buildOptionTile( - optionIndex: 5, - icon: Icons.groups, - title: dialogContext.l10n.community_create, - subtitle: dialogContext.l10n.community_createDesc, - ), - if (selectedOption == 5) - buildExpandedContent(_channelMessageStore)!, - ], + ), ), - ), + ], ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(dialogContext), - child: Text(dialogContext.l10n.common_close), - ), - ], ); }, ), @@ -1411,154 +1506,187 @@ class _ChannelsScreenState extends State channel.index, ); - showDialog( - context: context, - builder: (dialogContext) => StatefulBuilder( - builder: (dialogContext, setState) => AlertDialog( - title: Text( - dialogContext.l10n.channels_editChannelTitle(channel.index), - ), - content: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - TextField( - controller: nameController, - decoration: InputDecoration( - labelText: dialogContext.l10n.channels_channelName, - border: const OutlineInputBorder(), - ), - maxLength: 31, + showMeshSheet( + context, + builder: (sheetContext) => StatefulBuilder( + builder: (sheetContext, setSheetState) => DraggableScrollableSheet( + expand: false, + initialChildSize: 0.65, + minChildSize: 0.4, + maxChildSize: 0.95, + builder: (_, scrollController) => Column( + children: [ + BottomSheetHeader( + title: sheetContext.l10n.channels_editChannelTitle( + channel.index, ), - const SizedBox(height: 16), - TextField( - controller: pskController, - decoration: InputDecoration( - labelText: dialogContext.l10n.channels_pskHex, - border: const OutlineInputBorder(), - suffixIcon: IconButton( - icon: const Icon(Icons.casino), - tooltip: dialogContext.l10n.channels_generateRandomPsk, - onPressed: () { - final random = Random.secure(); - final bytes = Uint8List(16); - for (int i = 0; i < 16; i++) { - bytes[i] = random.nextInt(256); - } - pskController.text = Channel.formatPskHex(bytes); - }, - ), - ), - ), - const SizedBox(height: 16), - SwitchListTile( - contentPadding: EdgeInsets.zero, - title: Text(dialogContext.l10n.channels_smazCompression), - value: smazEnabled, - onChanged: (value) => setState(() { - smazEnabled = value; - if (smazEnabled) { - cyr2latEnabled = false; - } - }), - ), - SwitchListTile( - contentPadding: EdgeInsets.zero, - title: Text(dialogContext.l10n.channels_cyr2latCompression), - subtitle: Text( - dialogContext.l10n.channels_cyr2latCompressionDscr, - ), - value: cyr2latEnabled, - onChanged: (value) => setState(() { - cyr2latEnabled = value; - if (cyr2latEnabled) { - smazEnabled = false; - } - }), - ), - if (cyr2latEnabled) ...[ - Padding( - padding: const EdgeInsets.fromLTRB(0, 8, 0, 8), - child: DropdownButtonFormField( - initialValue: selectedCyr2LatProfileId, + ), + Expanded( + child: ListView( + controller: scrollController, + padding: const EdgeInsets.symmetric(horizontal: 16), + children: [ + const SizedBox(height: 8), + TextField( + controller: nameController, decoration: InputDecoration( - labelText: dialogContext - .l10n - .channels_cyr2latSettingsSubheading, + labelText: sheetContext.l10n.channels_channelName, border: const OutlineInputBorder(), ), - items: appSettingsService.settings.cyr2latProfiles.map(( - profile, - ) { - return DropdownMenuItem( - value: profile.id, - child: Text(profile.name), - ); - }).toList(), - onChanged: (value) => setState(() { - selectedCyr2LatProfileId = value; + maxLength: 31, + ), + const SizedBox(height: 16), + TextField( + controller: pskController, + decoration: InputDecoration( + labelText: sheetContext.l10n.channels_pskHex, + border: const OutlineInputBorder(), + suffixIcon: IconButton( + icon: const Icon(Icons.casino), + tooltip: sheetContext.l10n.channels_generateRandomPsk, + onPressed: () { + final random = Random.secure(); + final bytes = Uint8List(16); + for (int i = 0; i < 16; i++) { + bytes[i] = random.nextInt(256); + } + pskController.text = Channel.formatPskHex(bytes); + }, + ), + ), + ), + const SizedBox(height: 16), + SwitchListTile( + contentPadding: EdgeInsets.zero, + title: Text(sheetContext.l10n.channels_smazCompression), + value: smazEnabled, + onChanged: (value) => setSheetState(() { + smazEnabled = value; + if (smazEnabled) { + cyr2latEnabled = false; + } }), ), - ), - ], - ], - ), - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(dialogContext), - child: Text(dialogContext.l10n.common_cancel), - ), - FilledButton( - onPressed: () async { - final name = nameController.text.trim(); - final pskHex = pskController.text.trim(); - - Uint8List psk; - try { - psk = Channel.parsePskHex(pskHex); - } on FormatException { - showDismissibleSnackBar( - dialogContext, - content: Text(dialogContext.l10n.channels_pskMustBe32Hex), - ); - return; - } - - Navigator.pop(dialogContext); - try { - await connector.setChannel(channel.index, name, psk); - await connector.setChannelSmazEnabled( - channel.index, - smazEnabled, - ); - await connector.setChannelCyr2LatEnabled( - channel.index, - cyr2latEnabled, - ); - await connector.setChannelCyr2LatProfileId( - channel.index, - selectedCyr2LatProfileId, - ); - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text(context.l10n.channels_channelUpdated(name)), - ); - } catch (e, st) { - debugPrint(st.toString()); - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text( - context.l10n.channels_channelUpdateFailed('$e'), + SwitchListTile( + contentPadding: EdgeInsets.zero, + title: Text( + sheetContext.l10n.channels_cyr2latCompression, + ), + subtitle: Text( + sheetContext.l10n.channels_cyr2latCompressionDscr, + ), + value: cyr2latEnabled, + onChanged: (value) => setSheetState(() { + cyr2latEnabled = value; + if (cyr2latEnabled) { + smazEnabled = false; + } + }), ), - ); - } - }, - child: Text(dialogContext.l10n.common_save), - ), - ], + if (cyr2latEnabled) ...[ + Padding( + padding: const EdgeInsets.fromLTRB(0, 8, 0, 8), + child: DropdownButtonFormField( + initialValue: selectedCyr2LatProfileId, + decoration: InputDecoration( + labelText: sheetContext + .l10n + .channels_cyr2latSettingsSubheading, + border: const OutlineInputBorder(), + ), + items: appSettingsService.settings.cyr2latProfiles + .map((profile) { + return DropdownMenuItem( + value: profile.id, + child: Text(profile.name), + ); + }) + .toList(), + onChanged: (value) => setSheetState(() { + selectedCyr2LatProfileId = value; + }), + ), + ), + ], + const SizedBox(height: 24), + ], + ), + ), + Padding( + padding: const EdgeInsets.fromLTRB(16, 8, 16, 16), + child: Row( + children: [ + Expanded( + child: OutlinedButton( + onPressed: () => Navigator.pop(sheetContext), + child: Text(sheetContext.l10n.common_cancel), + ), + ), + const SizedBox(width: 12), + Expanded( + child: FilledButton( + onPressed: () async { + final name = nameController.text.trim(); + final pskHex = pskController.text.trim(); + + Uint8List psk; + try { + psk = Channel.parsePskHex(pskHex); + } on FormatException { + showDismissibleSnackBar( + sheetContext, + content: Text( + sheetContext.l10n.channels_pskMustBe32Hex, + ), + ); + return; + } + + Navigator.pop(sheetContext); + try { + await connector.setChannel( + channel.index, + name, + psk, + ); + await connector.setChannelSmazEnabled( + channel.index, + smazEnabled, + ); + await connector.setChannelCyr2LatEnabled( + channel.index, + cyr2latEnabled, + ); + await connector.setChannelCyr2LatProfileId( + channel.index, + selectedCyr2LatProfileId, + ); + if (!context.mounted) return; + showDismissibleSnackBar( + context, + content: Text( + context.l10n.channels_channelUpdated(name), + ), + ); + } catch (e, st) { + debugPrint(st.toString()); + if (!context.mounted) return; + showDismissibleSnackBar( + context, + content: Text( + context.l10n.channels_channelUpdateFailed('$e'), + ), + ); + } + }, + child: Text(sheetContext.l10n.common_save), + ), + ), + ], + ), + ), + ], + ), ), ), ); @@ -1614,7 +1742,9 @@ class _ChannelsScreenState extends State }, child: Text( dialogContext.l10n.common_delete, - style: const TextStyle(color: Colors.red), + style: TextStyle( + color: Theme.of(dialogContext).colorScheme.error, + ), ), ), ], @@ -1624,7 +1754,7 @@ class _ChannelsScreenState extends State void _addPublicChannel(BuildContext context, MeshCoreConnector connector) { final psk = Channel.parsePskHex(Channel.publicChannelPsk); - connector.setChannel(0, 'Public', psk); + connector.setChannel(0, context.l10n.channels_public, psk); showDismissibleSnackBar( context, content: Text(context.l10n.channels_publicChannelAdded), @@ -1640,9 +1770,8 @@ class _ChannelsScreenState extends State } void _showManageCommunitiesDialog(BuildContext context) { - showModalBottomSheet( - context: context, - isScrollControlled: true, + showMeshSheet( + context, builder: (sheetContext) => DraggableScrollableSheet( initialChildSize: 0.5, minChildSize: 0.3, @@ -1650,18 +1779,8 @@ class _ChannelsScreenState extends State expand: false, builder: (_, scrollController) => Column( children: [ - Padding( - padding: const EdgeInsets.all(16), - child: Row( - children: [ - const Icon(Icons.groups, size: 28), - const SizedBox(width: 12), - Text( - context.l10n.community_manageCommunities, - style: Theme.of(context).textTheme.titleLarge, - ), - ], - ), + BottomSheetHeader( + title: sheetContext.l10n.community_manageCommunities, ), const Divider(height: 1), Expanded( @@ -1673,22 +1792,30 @@ class _ChannelsScreenState extends State Icon( Icons.groups_outlined, size: 64, - color: Colors.grey[400], + color: Theme.of(sheetContext) + .colorScheme + .onSurfaceVariant + .withValues(alpha: 0.6), ), const SizedBox(height: 16), Text( - context.l10n.community_noCommunities, + sheetContext.l10n.community_noCommunities, style: TextStyle( fontSize: 16, - color: Colors.grey[600], + color: Theme.of( + sheetContext, + ).colorScheme.onSurfaceVariant, ), ), const SizedBox(height: 8), Text( - context.l10n.community_scanOrCreate, + sheetContext.l10n.community_scanOrCreate, style: TextStyle( fontSize: 14, - color: Colors.grey[500], + color: Theme.of(sheetContext) + .colorScheme + .onSurfaceVariant + .withValues(alpha: 0.8), ), textAlign: TextAlign.center, ), @@ -1702,29 +1829,33 @@ class _ChannelsScreenState extends State final community = _communities[index]; return ListTile( leading: CircleAvatar( - backgroundColor: Colors.purple.withValues( - alpha: 0.2, - ), + backgroundColor: MeshPalette.magentaBg, child: const Icon( Icons.groups, - color: Colors.purple, + color: MeshPalette.magenta, ), ), title: Text(community.name), subtitle: Text( - 'ID: ${community.shortCommunityId}...', + context.l10n.channels_communityShortId( + community.shortCommunityId, + ), style: TextStyle( fontSize: 12, - color: Colors.grey[600], + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant, ), ), trailing: PopupMenuButton( onSelected: (value) { Navigator.pop(sheetContext); + // Use the screen's context: the sheet item's + // context is deactivated once the sheet pops. if (value == 'share') { - _showCommunityQrDialog(context, community); + _showCommunityQrDialog(this.context, community); } else if (value == 'leave') { - _confirmLeaveCommunity(context, community); + _confirmLeaveCommunity(this.context, community); } }, itemBuilder: (context) => [ @@ -1742,14 +1873,20 @@ class _ChannelsScreenState extends State value: 'leave', child: Row( children: [ - const Icon( + Icon( Icons.exit_to_app, - color: Colors.red, + color: Theme.of( + context, + ).colorScheme.error, ), const SizedBox(width: 12), Text( context.l10n.community_delete, - style: const TextStyle(color: Colors.red), + style: TextStyle( + color: Theme.of( + context, + ).colorScheme.error, + ), ), ], ), @@ -1850,7 +1987,9 @@ class _ChannelsScreenState extends State }, child: Text( dialogContext.l10n.community_delete, - style: const TextStyle(color: Colors.red), + style: TextStyle( + color: Theme.of(dialogContext).colorScheme.error, + ), ), ), ], diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart index 8d3bc66c..5bdd0fdc 100644 --- a/lib/screens/chat_screen.dart +++ b/lib/screens/chat_screen.dart @@ -5,7 +5,6 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter/services.dart'; -import 'package:meshcore_open/screens/path_trace_map.dart'; import 'package:provider/provider.dart'; import '../utils/platform_info.dart'; @@ -15,37 +14,36 @@ import '../connector/meshcore_protocol.dart'; import '../helpers/cyr2lat.dart'; import '../helpers/reaction_helper.dart'; import '../widgets/message_status_icon.dart'; +import '../widgets/empty_state.dart'; import '../helpers/chat_scroll_controller.dart'; import '../helpers/gif_helper.dart'; -import '../helpers/path_helper.dart'; import '../models/channel_message.dart'; import '../models/contact.dart'; import '../l10n/contact_localization.dart'; import '../models/message.dart'; -import '../models/path_history.dart'; import '../models/translation_support.dart'; import '../services/app_settings_service.dart'; import '../services/chat_text_scale_service.dart'; import '../services/path_history_service.dart'; import '../services/translation_service.dart'; import '../widgets/chat_zoom_wrapper.dart'; -import '../widgets/elements_ui.dart'; import '../widgets/byte_count_input.dart'; import 'channel_message_path_screen.dart'; import 'map_screen.dart'; -import '../utils/emoji_utils.dart'; import '../widgets/emoji_picker.dart'; import '../widgets/gif_message.dart'; import '../widgets/jump_to_bottom_button.dart'; import '../widgets/gif_picker.dart'; import '../widgets/message_translation_button.dart'; -import '../widgets/path_selection_dialog.dart'; +import '../widgets/routing_sheet.dart'; import '../widgets/radio_stats_entry.dart'; +import '../widgets/sync_progress_overlay.dart'; import '../widgets/translated_message_content.dart'; -import '../utils/app_logger.dart'; import '../l10n/l10n.dart'; import '../helpers/snack_bar_builder.dart'; import '../widgets/unread_divider.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/mesh_ui.dart'; import 'telemetry_screen.dart'; class ChatScreen extends StatefulWidget { @@ -186,28 +184,30 @@ class _ChatScreenState extends State { final unreadLabel = context.l10n.chat_unread(unreadCount); final pathLabel = _currentPathLabel(contact); - // Show path details if we have non-empty path data (from device or override) - final effectivePath = contact.pathOverrideBytes ?? contact.path; - final hasPathData = effectivePath.isNotEmpty; - return Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - Text(contact.name), + Text( + contact.name, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), GestureDetector( behavior: HitTestBehavior.opaque, - onTap: hasPathData - ? () => _showFullPathDialog(context, effectivePath) - : null, - child: Text( - '$pathLabel • $unreadLabel', - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 11, - fontWeight: FontWeight.normal, - decoration: hasPathData ? TextDecoration.underline : null, - decorationStyle: TextDecorationStyle.dotted, + onTap: () => + ContactRoutingSheet.show(context, contact: contact), + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 6), + child: Text( + '$pathLabel • $unreadLabel', + overflow: TextOverflow.ellipsis, + style: const TextStyle( + fontSize: 11, + fontWeight: FontWeight.normal, + decoration: TextDecoration.underline, + decorationStyle: TextDecorationStyle.dotted, + ), ), ), ), @@ -216,140 +216,46 @@ class _ChatScreenState extends State { }, ), centerTitle: false, + bottom: const SyncProgressAppBarBottom(), actions: [ - Consumer( - builder: (context, connector, _) { - final contact = _resolveContact(connector); - final isFloodMode = contact.pathOverride == -1; - - final isDirectMode = contact.pathOverride == 0; - final activeMode = isFloodMode - ? 'flood' - : isDirectMode - ? 'direct' - : 'auto'; - - return PopupMenuButton( - icon: Icon(isFloodMode ? Icons.waves : Icons.route), - tooltip: context.l10n.chat_routingMode, - onSelected: (mode) async { - if (mode == 'flood') { - await connector.setPathOverride(contact, pathLen: -1); - } else if (mode == 'direct') { - await connector.setPathOverride( - contact, - pathLen: 0, - pathBytes: Uint8List(0), - ); - } else { - await connector.setPathOverride(contact, pathLen: null); - } - }, - itemBuilder: (context) => [ - PopupMenuItem( - value: 'auto', - child: Row( - children: [ - Icon( - Icons.auto_mode, - size: 20, - color: activeMode == 'auto' - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - context.l10n.chat_autoUseSavedPath, - style: TextStyle( - fontWeight: activeMode == 'auto' - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - PopupMenuItem( - value: 'direct', - child: Row( - children: [ - Icon( - Icons.near_me, - size: 20, - color: activeMode == 'direct' - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - context.l10n.chat_direct, - style: TextStyle( - fontWeight: activeMode == 'direct' - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - PopupMenuItem( - value: 'flood', - child: Row( - children: [ - Icon( - Icons.waves, - size: 20, - color: activeMode == 'flood' - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - context.l10n.chat_forceFloodMode, - style: TextStyle( - fontWeight: activeMode == 'flood' - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - ], - ); - }, - ), - IconButton( - icon: const Icon(Icons.timeline), - tooltip: context.l10n.chat_pathManagement, - onPressed: () => _showPathHistory(context), - ), const RadioStatsIconButton(), Consumer( builder: (context, connector, _) { + final contact = _resolveContact(connector); + return PopupMenuButton( icon: const Icon(Icons.more_vert), onSelected: (value) { - if (value == 'info') { - _showContactInfo(context); - } - if (value == 'settings') { - _showContactSettings(context); - } - if (value == 'telemetry') { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - TelemetryScreen(contact: widget.contact), - ), - ); - } - if (value == 'clearChat') { - connector.clearMessagesForContact(widget.contact); + switch (value) { + case 'routing': + ContactRoutingSheet.show(context, contact: contact); + case 'info': + _showContactInfo(context); + case 'settings': + _showContactSettings(context); + case 'telemetry': + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + TelemetryScreen(contact: widget.contact), + ), + ); + case 'clearChat': + _confirmClearChat(context, connector); } }, itemBuilder: (context) => [ + PopupMenuItem( + value: 'routing', + child: Row( + children: [ + const Icon(Icons.route, size: 20), + const SizedBox(width: 12), + Text(context.l10n.routing_title), + ], + ), + ), PopupMenuItem( value: 'info', child: Row( @@ -384,11 +290,17 @@ class _ChatScreenState extends State { value: 'clearChat', child: Row( children: [ - const Icon(Icons.delete, size: 20, color: Colors.red), + Icon( + Icons.delete, + size: 20, + color: Theme.of(context).colorScheme.error, + ), const SizedBox(width: 12), Text( context.l10n.contact_clearChat, - style: const TextStyle(color: Colors.red), + style: TextStyle( + color: Theme.of(context).colorScheme.error, + ), ), ], ), @@ -423,24 +335,11 @@ class _ChatScreenState extends State { } Widget _buildEmptyState() { - return Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon(Icons.chat_bubble_outline, size: 64, color: Colors.grey[400]), - const SizedBox(height: 16), - Text( - context.l10n.chat_noMessages, - style: TextStyle(fontSize: 16, color: Colors.grey[600]), - ), - const SizedBox(height: 8), - Text( - context.l10n.chat_sendMessageTo( - _resolveContact(context.read()).name, - ), - style: TextStyle(fontSize: 14, color: Colors.grey[500]), - ), - ], + return EmptyState( + icon: Icons.chat_bubble_outline, + title: context.l10n.chat_noMessages, + subtitle: context.l10n.chat_sendMessageTo( + _resolveContact(context.read()).name, ), ); } @@ -482,10 +381,14 @@ class _ChatScreenState extends State { } final messageIndex = index; Contact contact = _resolveContact(connector); + final bool isRoom = contact.type == advTypeRoom; final message = reversedMessages[messageIndex]; String fourByteHex = ''; - if (contact.type == advTypeRoom) { - contact = _resolveContactFrom4Bytes( + Contact? roomAuthor; + if (isRoom) { + // Room-server messages carry the original author's 4-byte prefix + // separately from message.text; use it only for resolving the name. + roomAuthor = _resolveContactFrom4Bytes( connector, message.fourByteRoomContactKey.isEmpty ? Uint8List.fromList([0, 0, 0, 0]) @@ -495,6 +398,9 @@ class _ChatScreenState extends State { .map((b) => b.toRadixString(16).padLeft(2, '0')) .join() .toUpperCase(); + // Only adopt the author identity when we actually know them; never + // fall back to the room server's own name as the sender. + if (roomAuthor != null) contact = roomAuthor; } return Builder( @@ -502,16 +408,15 @@ class _ChatScreenState extends State { final textScale = context.select( (service) => service.scale, ); - final resolvedContact = _resolveContact(connector); final bubble = _MessageBubble( message: message, - senderName: resolvedContact.type == advTypeRoom - ? "${contact.name} [$fourByteHex]" + senderName: isRoom + ? (roomAuthor != null + ? "${roomAuthor.name} [$fourByteHex]" + : "[$fourByteHex]") : contact.name, sourceId: widget.contact.publicKeyHex, - isRoomServer: resolvedContact.type == advTypeRoom, textScale: textScale, - onTap: () => _openMessagePath(message, contact), onLongPress: () => _showMessageActions(message, contact), onRetryReaction: (msg, emoji) => _sendReaction(msg, contact, emoji), @@ -550,119 +455,157 @@ class _ChatScreenState extends State { Widget _buildInputBar(MeshCoreConnector connector) { final maxBytes = maxContactMessageBytes(); - final colorScheme = Theme.of(context).colorScheme; + final scheme = Theme.of(context).colorScheme; final settings = context.watch().settings; return Container( - padding: const EdgeInsets.all(8), decoration: BoxDecoration( - color: colorScheme.surface, - border: Border(top: BorderSide(color: Theme.of(context).dividerColor)), + color: scheme.surface, + border: Border(top: BorderSide(color: scheme.outlineVariant, width: 1)), ), child: SafeArea( - child: Row( - children: [ - IconButton( - icon: const Icon(Icons.gif_box), - onPressed: () => _showGifPicker(context), - tooltip: context.l10n.chat_sendGif, - ), - if (settings.translationEnabled) - MessageTranslationButton( - enabled: settings.composerTranslationEnabled, - languageCode: settings.translationTargetLanguageCode, - onPressed: _showTranslationOptions, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + IconButton( + icon: const Icon(Icons.gif_box), + onPressed: () => _showGifPicker(context), + tooltip: context.l10n.chat_sendGif, ), - Expanded( - child: ValueListenableBuilder( - valueListenable: _textController, - builder: (context, value, child) { - final gifId = GifHelper.parseGif(value.text); - if (gifId != null) { - return Focus( - autofocus: true, - onKeyEvent: (node, event) { - if (event is KeyDownEvent && - (event.logicalKey == LogicalKeyboardKey.enter || - event.logicalKey == - LogicalKeyboardKey.numpadEnter)) { - _sendMessage(connector); - return KeyEventResult.handled; - } - return KeyEventResult.ignored; - }, - child: Row( - children: [ - Expanded( - child: ClipRRect( - borderRadius: BorderRadius.circular(12), - child: GifMessage( - url: - 'https://media.giphy.com/media/$gifId/giphy.gif', - backgroundColor: - colorScheme.surfaceContainerHighest, - fallbackTextColor: colorScheme.onSurface - .withValues(alpha: 0.6), - maxSize: 160, + if (settings.translationEnabled) + MessageTranslationButton( + enabled: settings.composerTranslationEnabled, + languageCode: settings.translationTargetLanguageCode, + onPressed: _showTranslationOptions, + ), + Expanded( + child: ValueListenableBuilder( + valueListenable: _textController, + builder: (context, value, child) { + final gifId = GifHelper.parseGif(value.text); + if (gifId != null) { + return Focus( + autofocus: true, + onKeyEvent: (node, event) { + if (event is KeyDownEvent && + (event.logicalKey == LogicalKeyboardKey.enter || + event.logicalKey == + LogicalKeyboardKey.numpadEnter)) { + _sendMessage(connector); + return KeyEventResult.handled; + } + return KeyEventResult.ignored; + }, + child: Row( + children: [ + Expanded( + child: ClipRRect( + borderRadius: BorderRadius.circular(12), + child: GifMessage( + url: + 'https://media.giphy.com/media/$gifId/giphy.gif', + backgroundColor: + scheme.surfaceContainerHighest, + fallbackTextColor: scheme.onSurface + .withValues(alpha: 0.6), + maxSize: 160, + ), ), ), + const SizedBox(width: 8), + IconButton( + icon: const Icon(Icons.close), + onPressed: () { + _textController.clear(); + _textFieldFocusNode.requestFocus(); + }, + ), + ], + ), + ); + } + return ByteCountedTextField( + maxBytes: maxBytes, + controller: _textController, + focusNode: _textFieldFocusNode, + hintText: context.l10n.chat_typeMessage, + onSubmitted: (_) => _sendMessage(connector), + encoder: + (connector.isContactSmazEnabled( + widget.contact.publicKeyHex, + ) || + connector.isContactCyr2LatEnabled( + widget.contact.publicKeyHex, + )) + ? (text) => connector.prepareContactOutboundText( + widget.contact, + text, + ) + : null, + decoration: InputDecoration( + hintText: context.l10n.chat_typeMessage, + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(MeshRadii.pill), + borderSide: BorderSide(color: scheme.outlineVariant), + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(MeshRadii.pill), + borderSide: BorderSide(color: scheme.outlineVariant), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(MeshRadii.pill), + borderSide: BorderSide( + color: scheme.primary, + width: 1.5, ), - const SizedBox(width: 8), - IconButton( - icon: const Icon(Icons.close), - onPressed: () { - _textController.clear(); - _textFieldFocusNode.requestFocus(); - }, - ), - ], + ), + filled: true, + fillColor: scheme.surfaceContainerLow, + contentPadding: const EdgeInsets.symmetric( + horizontal: 18, + vertical: 12, + ), ), ); - } - return ByteCountedTextField( - maxBytes: maxBytes, - controller: _textController, - focusNode: _textFieldFocusNode, - hintText: context.l10n.chat_typeMessage, - onSubmitted: (_) => _sendMessage(connector), - encoder: - (connector.isContactSmazEnabled( - widget.contact.publicKeyHex, - ) || - connector.isContactCyr2LatEnabled( - widget.contact.publicKeyHex, - )) - ? (text) => connector.prepareContactOutboundText( - widget.contact, - text, - ) - : null, - decoration: InputDecoration( - hintText: context.l10n.chat_typeMessage, - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(24), + }, + ), + ), + const SizedBox(width: 6), + ValueListenableBuilder( + valueListenable: _textController, + builder: (context, value, _) { + final hasText = value.text.trim().isNotEmpty; + return AnimatedContainer( + duration: const Duration(milliseconds: 180), + curve: Curves.easeInOut, + child: IconButton.filled( + icon: const Icon(Icons.send, size: 20), + tooltip: context.l10n.chat_sendMessageTo( + _resolveContact(connector).name, ), - filled: true, - fillColor: Theme.of( - context, - ).colorScheme.surfaceContainerLow, - contentPadding: const EdgeInsets.symmetric( - horizontal: 20, - vertical: 14, + style: IconButton.styleFrom( + backgroundColor: hasText + ? scheme.primary + : scheme.surfaceContainerHighest, + foregroundColor: hasText + ? scheme.onPrimary + : scheme.onSurfaceVariant, + minimumSize: const Size(40, 40), + shape: const CircleBorder(), ), + onPressed: hasText + ? () { + HapticFeedback.lightImpact(); + _sendMessage(connector); + } + : null, ), ); }, ), - ), - const SizedBox(width: 8), - IconButton.filled( - icon: const Icon(Icons.send), - tooltip: context.l10n.chat_sendMessageTo( - _resolveContact(connector).name, - ), - onPressed: () => _sendMessage(connector), - ), - ], + ], + ), ), ), ); @@ -772,389 +715,32 @@ class _ChatScreenState extends State { ); } - void _showPathHistory(BuildContext context) { - final connector = Provider.of(context, listen: false); - bool showAllPaths = false; - showDialog( + Future _confirmClearChat( + BuildContext context, + MeshCoreConnector connector, + ) async { + final confirmed = await showDialog( context: context, - builder: (context) => StatefulBuilder( - builder: (context, setDialogState) => Consumer( - builder: (context, pathService, _) { - final paths = pathService.getRecentPaths( - widget.contact.publicKeyHex, - ); - - final repeatersList = List.of(connector.directRepeaters) - ..sort((a, b) => b.ranking.compareTo(a.ranking)); - - if (repeatersList.isEmpty) { - showAllPaths = true; - } - - final directRepeater = repeatersList.isEmpty - ? null - : repeatersList.first; - final secondDirectRepeater = repeatersList.length < 2 - ? null - : repeatersList.elementAt(1); - final thirdDirectRepeater = repeatersList.length < 3 - ? null - : repeatersList.elementAt(2); - - List>> - pathsWithRepeaters = paths.map((path) { - final isDirectRepeater = - directRepeater != null && - path.pathBytes.isNotEmpty && - directRepeater.pubkeyFirstByte == path.pathBytes.first; - final isSecondDirectRepeater = - secondDirectRepeater != null && - path.pathBytes.isNotEmpty && - secondDirectRepeater.pubkeyFirstByte == path.pathBytes.first; - final isThirdDirectRepeater = - thirdDirectRepeater != null && - path.pathBytes.isNotEmpty && - thirdDirectRepeater.pubkeyFirstByte == path.pathBytes.first; - - int ranking = -1; - Color color = Colors.grey; - if (isDirectRepeater) { - color = Colors.green; - ranking = 3; - } else if (isSecondDirectRepeater) { - color = Colors.yellow; - ranking = 2; - } else if (isThirdDirectRepeater) { - color = Colors.red; - ranking = 1; - } else if (path.wasFloodDiscovery) { - color = Colors.blue; - ranking = 0; - } - - return MapEntry(ranking, MapEntry(color, path)); - }).toList(); - - pathsWithRepeaters.sort((a, b) => b.key.compareTo(a.key)); - - return AlertDialog( - title: Row( - children: [ - const Icon(Icons.timeline), - const SizedBox(width: 8), - Text(context.l10n.chat_pathManagement), - ], - ), - content: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (pathsWithRepeaters.isNotEmpty) ...[ - if (repeatersList.isNotEmpty) - FeatureToggleRow( - title: context.l10n.chat_ShowAllPaths, - subtitle: "", - value: showAllPaths, - onChanged: (val) { - setDialogState(() { - showAllPaths = val; - }); - }, - ), - Text( - context.l10n.chat_recentAckPaths, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 12, - ), - ), - if (pathsWithRepeaters.length >= 100) ...[ - const SizedBox(height: 8), - Container( - width: double.infinity, - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - decoration: BoxDecoration( - color: Colors.amber[100], - borderRadius: BorderRadius.circular(8), - ), - child: Text( - context.l10n.chat_pathHistoryFull, - style: const TextStyle(fontSize: 12), - ), - ), - ], - const SizedBox(height: 8), - ...pathsWithRepeaters.map((entry) { - final path = entry.value.value; - final color = entry.value.key; - if (!showAllPaths && entry.key < 1) { - return const SizedBox.shrink(); - } else { - return Card( - margin: const EdgeInsets.symmetric(vertical: 4), - child: ListTile( - dense: true, - leading: CircleAvatar( - radius: 16, - backgroundColor: color, - child: Text( - '${path.hopCount}', - style: const TextStyle(fontSize: 12), - ), - ), - title: Text( - '${path.hopCount} ${path.hopCount == 1 ? context.l10n.chat_hopSingular : context.l10n.chat_hopPlural}', - style: const TextStyle(fontSize: 14), - ), - subtitle: Text( - '${(path.tripTimeMs / 1000).toStringAsFixed(2)}s • ${_formatRelativeTime(path.timestamp)} • ${path.successCount} ${context.l10n.chat_successes}', - style: const TextStyle(fontSize: 11), - ), - trailing: Row( - mainAxisSize: MainAxisSize.min, - children: [ - IconButton( - icon: const Icon(Icons.close, size: 16), - tooltip: context.l10n.chat_removePath, - onPressed: () async { - await pathService.removePathRecord( - widget.contact.publicKeyHex, - path.pathBytes, - ); - }, - ), - path.wasFloodDiscovery - ? const Icon( - Icons.waves, - size: 16, - color: Colors.grey, - ) - : const Icon( - Icons.route, - size: 16, - color: Colors.grey, - ), - ], - ), - onLongPress: () => - _showFullPathDialog(context, path.pathBytes), - onTap: () async { - if (path.pathBytes.isEmpty) { - showDismissibleSnackBar( - context, - content: Text( - context.l10n.chat_pathDetailsNotAvailable, - ), - duration: const Duration(seconds: 2), - ); - return; - } - - final pathBytes = Uint8List.fromList( - path.pathBytes, - ); - final pathLength = path.pathBytes.length; - - // Set the path override to persist user's choice - await connector.setPathOverride( - _resolveContact(connector), - pathLen: pathLength, - pathBytes: pathBytes, - ); - - if (!context.mounted) return; - Navigator.pop(context); - await _notifyPathSet( - connector, - _resolveContact(connector), - pathBytes, - path.hopCount, - ); - }, - ), - ); - } - }), - const Divider(), - ] else ...[ - Text(context.l10n.chat_noPathHistoryYet), - const Divider(), - ], - const SizedBox(height: 8), - Text( - context.l10n.chat_pathActions, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 12, - ), - ), - const SizedBox(height: 8), - ListTile( - dense: true, - leading: const CircleAvatar( - radius: 16, - backgroundColor: Colors.purple, - child: Icon(Icons.edit_road, size: 16), - ), - title: Text( - context.l10n.chat_setCustomPath, - style: const TextStyle(fontSize: 14), - ), - subtitle: Text( - context.l10n.chat_setCustomPathSubtitle, - style: const TextStyle(fontSize: 11), - ), - onTap: () { - Navigator.pop(context); - _showCustomPathDialog(context); - }, - ), - ListTile( - dense: true, - leading: const CircleAvatar( - radius: 16, - backgroundColor: Colors.orange, - child: Icon(Icons.clear_all, size: 16), - ), - title: Text( - context.l10n.chat_clearPath, - style: const TextStyle(fontSize: 14), - ), - subtitle: Text( - context.l10n.chat_clearPathSubtitle, - style: const TextStyle(fontSize: 11), - ), - onTap: () async { - await connector.clearContactPath( - _resolveContact(connector), - ); - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text(context.l10n.chat_pathCleared), - duration: const Duration(seconds: 2), - ); - Navigator.pop(context); - }, - ), - ListTile( - dense: true, - leading: const CircleAvatar( - radius: 16, - backgroundColor: Colors.blue, - child: Icon(Icons.waves, size: 16), - ), - title: Text( - context.l10n.chat_forceFloodMode, - style: const TextStyle(fontSize: 14), - ), - subtitle: Text( - context.l10n.chat_floodModeSubtitle, - style: const TextStyle(fontSize: 11), - ), - onTap: () async { - await connector.setPathOverride( - _resolveContact(connector), - pathLen: -1, - ); - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text(context.l10n.chat_floodModeEnabled), - duration: const Duration(seconds: 2), - ); - Navigator.pop(context); - }, - ), - ], - ), - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(context), - child: Text(context.l10n.common_close), - ), - ], - ); - }, - ), - ), - ); - } - - String _formatRelativeTime(DateTime? time) { - if (time == null) return '—'; - final diff = DateTime.now().difference(time); - if (diff.inSeconds < 60) return context.l10n.time_justNow; - if (diff.inMinutes < 60) { - return context.l10n.time_minutesAgo(diff.inMinutes); - } - if (diff.inHours < 24) return context.l10n.time_hoursAgo(diff.inHours); - return context.l10n.time_daysAgo(diff.inDays); - } - - void _showFullPathDialog(BuildContext context, List pathBytes) { - if (pathBytes.isEmpty) { - showDismissibleSnackBar( - context, - content: Text(context.l10n.chat_pathDetailsNotAvailable), - duration: const Duration(seconds: 2), - ); - return; - } - - final connector = context.read(); - final allContacts = connector.allContacts; - - final formattedPath = PathHelper.formatPathHex(pathBytes); - final resolvedNames = PathHelper.resolvePathNames(pathBytes, allContacts); - - showDialog( - context: context, - builder: (context) => AlertDialog( - title: Text(context.l10n.chat_fullPath), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SelectableText(formattedPath), - const SizedBox(height: 8), - SelectableText( - resolvedNames, - style: TextStyle( - fontSize: 13, - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - ), - ], - ), + builder: (dialogContext) => AlertDialog( + title: Text(context.l10n.contact_clearChat), actions: [ TextButton( - onPressed: () => Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PathTraceMapScreen( - title: context.l10n.contacts_repeaterPathTrace, - path: Uint8List.fromList(pathBytes), - flipPathAround: true, - targetContact: widget.contact, - pathHashByteWidth: connector.pathHashByteWidth, - ), - ), - ), - child: Text(context.l10n.contacts_pathTrace), + onPressed: () => Navigator.pop(dialogContext, false), + child: Text(context.l10n.common_cancel), ), TextButton( - onPressed: () => Navigator.pop(context), - child: Text(context.l10n.common_close), + onPressed: () => Navigator.pop(dialogContext, true), + style: TextButton.styleFrom( + foregroundColor: Theme.of(context).colorScheme.error, + ), + child: Text(context.l10n.common_delete), ), ], ), ); + if (confirmed == true) { + connector.clearMessagesForContact(widget.contact); + } } int _resolveContactIndex = -1; @@ -1175,13 +761,17 @@ class _ChatScreenState extends State { return connector.contacts[_resolveContactIndex]; } - Contact _resolveContactFrom4Bytes( + Contact? _resolveContactFrom4Bytes( MeshCoreConnector connector, Uint8List key4Bytes, ) { - return connector.contacts.firstWhere( - (c) => listEquals(c.publicKey.sublist(0, 4), key4Bytes.sublist(0, 4)), - orElse: () => widget.contact, + // Match against saved contacts first, then nodes only seen via discovery — + // a room poster you haven't saved may still be in the discovered list. + return connector.allContactsUnfiltered.cast().firstWhere( + (c) => + c != null && + listEquals(c.publicKey.sublist(0, 4), key4Bytes.sublist(0, 4)), + orElse: () => null, ); } @@ -1199,29 +789,6 @@ class _ChatScreenState extends State { return context.l10n.chat_hopsCount(contact.pathLength); } - Future _notifyPathSet( - MeshCoreConnector connector, - Contact contact, - Uint8List pathBytes, - int hopCount, - ) async { - final verified = connector.isConnected - ? await connector.verifyContactPathOnDevice(contact, pathBytes) - : false; - if (!mounted) return; - - final status = !connector.isConnected - ? context.l10n.chat_pathSavedLocally - : (verified - ? context.l10n.chat_pathDeviceConfirmed - : context.l10n.chat_pathDeviceNotConfirmed); - showDismissibleSnackBar( - context, - content: Text(context.l10n.chat_pathSetHops(hopCount, status)), - duration: const Duration(seconds: 3), - ); - } - void _showContactInfo(BuildContext context) { final connector = Provider.of(context, listen: false); final contact = _resolveContact(connector); @@ -1436,7 +1003,12 @@ class _ChatScreenState extends State { children: [ SizedBox( width: 80, - child: Text(label, style: TextStyle(color: Colors.grey[600])), + child: Text( + label, + style: TextStyle( + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + ), ), Expanded(child: SelectableText(value)), ], @@ -1477,72 +1049,6 @@ class _ChatScreenState extends State { ); } - Future _showCustomPathDialog(BuildContext context) async { - final connector = Provider.of(context, listen: false); - - final currentContact = _resolveContact(connector); - if (currentContact.pathLength > 0 && - currentContact.path.isEmpty && - connector.isConnected) { - connector.getContacts(); - } - - final pathForInput = currentContact.pathFormattedIdList( - connector.pathHashByteWidth, - ); - final currentPathLabel = _currentPathLabel(currentContact); - - // Filter out the current contact from available contacts - final availableContacts = connector.allContacts - .where((c) => c != widget.contact) - .toList(); - - final result = await PathSelectionDialog.show( - context, - availableContacts: availableContacts, - initialPath: pathForInput.isEmpty ? null : pathForInput, - title: context.l10n.chat_setCustomPath, - currentPathLabel: currentPathLabel, - onRefresh: connector.isConnected ? connector.getContacts : null, - ); - - appLogger.info( - 'PathSelectionDialog returned: ${result?.length ?? 0} bytes, mounted: $mounted', - tag: 'ChatScreen', - ); - - if (result == null) { - return; // Cancelled — keep existing path - } - - if (!mounted) { - appLogger.warn( - 'Widget not mounted after dialog, cannot set path', - tag: 'ChatScreen', - ); - return; - } - - appLogger.info( - 'Calling setPathOverride for ${widget.contact.name}', - tag: 'ChatScreen', - ); - await connector.setPathOverride( - _resolveContact(connector), - pathLen: result.length, - pathBytes: result, - ); - appLogger.info('setPathOverride completed', tag: 'ChatScreen'); - - if (!mounted) return; - await _notifyPathSet( - connector, - _resolveContact(connector), - result, - result.length, - ); - } - void _openMessagePath(Message message, Contact contact) { final connector = context.read(); final fourByteHex = message.fourByteRoomContactKey @@ -1553,7 +1059,11 @@ class _ChatScreenState extends State { if (message.isOutgoing) { senderName = connector.selfName ?? context.l10n.chat_me; } else if (_resolveContact(connector).type == advTypeRoom) { - senderName = "${contact.name} [$fourByteHex]"; + // An unresolved author leaves `contact` as the room server itself; show + // only the prefix rather than mislabeling the post with the room's name. + senderName = contact.type == advTypeRoom + ? "[$fourByteHex]" + : "${contact.name} [$fourByteHex]"; } else { senderName = _resolveContact(connector).name; } @@ -1577,12 +1087,26 @@ class _ChatScreenState extends State { } void _showMessageActions(Message message, Contact contact) { - showModalBottomSheet( - context: context, + final translationService = context.read(); + final canTranslateMessage = + translationService.canTranslateIncoming( + text: message.text, + isCli: message.isCli, + isOutgoing: message.isOutgoing, + ) && + (message.translatedText?.trim().isEmpty ?? true); + + showMeshSheet( + context, builder: (sheetContext) => SafeArea( child: Column( mainAxisSize: MainAxisSize.min, children: [ + BottomSheetHeader( + title: message.text.length > 40 + ? '${message.text.substring(0, 40)}…' + : message.text, + ), // Can't react to your own messages if (!message.isOutgoing) ListTile( @@ -1593,15 +1117,14 @@ class _ChatScreenState extends State { _showEmojiPicker(message, contact); }, ), - if (PlatformInfo.isDesktop) - ListTile( - leading: const Icon(Icons.route), - title: Text(context.l10n.chat_path), - onTap: () { - Navigator.pop(sheetContext); - _openMessagePath(message, contact); - }, - ), + ListTile( + leading: const Icon(Icons.route), + title: Text(context.l10n.chat_path), + onTap: () { + Navigator.pop(sheetContext); + _openMessagePath(message, contact); + }, + ), ListTile( leading: const Icon(Icons.copy), title: Text(context.l10n.common_copy), @@ -1610,6 +1133,21 @@ class _ChatScreenState extends State { _copyMessageText(message.text); }, ), + if (canTranslateMessage) + ListTile( + leading: const Icon(Icons.translate), + title: Text(context.l10n.translation_translateMessage), + onTap: () { + Navigator.pop(sheetContext); + unawaited( + context.read().translateContactMessage( + widget.contact.publicKeyHex, + message, + manualTranslation: true, + ), + ); + }, + ), if (!message.isOutgoing) ListTile( leading: const Icon(Icons.mark_chat_unread_outlined), @@ -1619,14 +1157,6 @@ class _ChatScreenState extends State { _markAsUnread(message); }, ), - ListTile( - leading: const Icon(Icons.delete_outline), - title: Text(context.l10n.common_delete), - onTap: () async { - Navigator.pop(sheetContext); - await _deleteMessage(message); - }, - ), if (message.isOutgoing && message.status == MessageStatus.failed) ListTile( leading: const Icon(Icons.refresh), @@ -1646,11 +1176,22 @@ class _ChatScreenState extends State { _openChat(context, contact); }, ), + const Divider(height: 1), ListTile( - leading: const Icon(Icons.close), - title: Text(context.l10n.common_cancel), - onTap: () => Navigator.pop(sheetContext), + leading: Icon( + Icons.delete_outline, + color: Theme.of(context).colorScheme.error, + ), + title: Text( + context.l10n.common_delete, + style: TextStyle(color: Theme.of(context).colorScheme.error), + ), + onTap: () async { + Navigator.pop(sheetContext); + await _deleteMessage(message); + }, ), + const SizedBox(height: 8), ], ), ), @@ -1676,8 +1217,7 @@ class _ChatScreenState extends State { void _retryMessage(Message message) { final connector = Provider.of(context, listen: false); - // Retry using the contact's current path override setting - connector.sendMessage(_resolveContact(connector), message.text); + connector.resendMessage(_resolveContact(connector), message); showDismissibleSnackBar( context, content: Text(context.l10n.chat_retryingMessage), @@ -1721,8 +1261,6 @@ class _ChatScreenState extends State { class _MessageBubble extends StatelessWidget { final Message message; final String senderName; - final bool isRoomServer; - final VoidCallback? onTap; final VoidCallback? onLongPress; final void Function(Message message, String emoji)? onRetryReaction; final double textScale; @@ -1732,9 +1270,7 @@ class _MessageBubble extends StatelessWidget { required this.message, required this.senderName, required this.sourceId, - required this.isRoomServer, required this.textScale, - this.onTap, this.onLongPress, this.onRetryReaction, }); @@ -1744,24 +1280,48 @@ class _MessageBubble extends StatelessWidget { final settingsService = context.watch(); final enableTracing = settingsService.settings.enableMessageTracing; final isOutgoing = message.isOutgoing; - final colorScheme = Theme.of(context).colorScheme; + final scheme = Theme.of(context).colorScheme; final gifId = GifHelper.parseGif(message.text); final poi = parseMarkerText(message.text); final isFailed = message.status == MessageStatus.failed; + + // Bubble colors — outgoing uses MeshPalette.me / meBorder / meInk. final bubbleColor = isFailed - ? colorScheme.errorContainer - : (isOutgoing - ? colorScheme.primary - : colorScheme.surfaceContainerHighest); + ? scheme.errorContainer + : isOutgoing + ? MeshPalette.me + : scheme.surfaceContainerLow; + final bubbleBorder = isFailed + ? scheme.error + : isOutgoing + ? MeshPalette.meBorder + : scheme.outlineVariant; final textColor = isFailed - ? colorScheme.onErrorContainer - : (isOutgoing ? colorScheme.onPrimary : colorScheme.onSurface); - final metaColor = textColor.withValues(alpha: 0.7); + ? scheme.onErrorContainer + : isOutgoing + ? MeshPalette.meInk + : scheme.onSurface; + final metaColor = textColor.withValues(alpha: 0.65); const bodyFontSize = 14.0; - String messageText = message.text; - if (isRoomServer && !isOutgoing) { - messageText = message.text.substring(4.clamp(0, message.text.length)); - } + + // Asymmetric radius: outgoing — top-left large, others also large; outgoing bottom-right tight. + final borderRadius = isOutgoing + ? const BorderRadius.only( + topLeft: Radius.circular(MeshRadii.lg), + topRight: Radius.circular(MeshRadii.lg), + bottomLeft: Radius.circular(MeshRadii.lg), + bottomRight: Radius.circular(MeshRadii.xs), + ) + : const BorderRadius.only( + topLeft: Radius.circular(MeshRadii.xs), + topRight: Radius.circular(MeshRadii.lg), + bottomLeft: Radius.circular(MeshRadii.lg), + bottomRight: Radius.circular(MeshRadii.lg), + ); + + // Do not strip room-server author bytes here: the parser stores them in + // fourByteRoomContactKey, so message.text is safe to render as-is. + final messageText = message.text; final translatedDisplayText = message.translatedText != null && message.translatedText!.trim().isNotEmpty @@ -1770,168 +1330,119 @@ class _MessageBubble extends StatelessWidget { final originalDisplayText = isOutgoing ? message.originalText : (translatedDisplayText != messageText ? messageText : null); + return Padding( - padding: const EdgeInsets.symmetric(vertical: 4), + padding: const EdgeInsets.symmetric(vertical: 3), child: Column( crossAxisAlignment: isOutgoing ? CrossAxisAlignment.end : CrossAxisAlignment.start, children: [ - GestureDetector( - onTap: PlatformInfo.isDesktop ? null : onTap, - onLongPress: onLongPress, - onSecondaryTapUp: PlatformInfo.isDesktop - ? (_) => onLongPress?.call() - : null, - child: Row( - mainAxisAlignment: isOutgoing - ? MainAxisAlignment.end - : MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (!isOutgoing) ...[ - _buildAvatar(senderName, colorScheme), - const SizedBox(width: 8), - ], - Flexible( - child: Container( - padding: gifId != null - ? const EdgeInsets.all(4) - : const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - constraints: BoxConstraints( - maxWidth: MediaQuery.of(context).size.width * 0.65, - ), - decoration: BoxDecoration( - color: bubbleColor, - borderRadius: BorderRadius.circular(16), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (!isOutgoing) ...[ - Padding( - padding: gifId != null - ? const EdgeInsets.only( - left: 8, - top: 4, - bottom: 4, - ) - : EdgeInsets.zero, - child: Text( - senderName, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - color: colorScheme.primary, + LayoutBuilder( + builder: (context, constraints) => GestureDetector( + onLongPress: onLongPress, + onSecondaryTapUp: PlatformInfo.isDesktop + ? (_) => onLongPress?.call() + : null, + child: Row( + mainAxisAlignment: isOutgoing + ? MainAxisAlignment.end + : MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + if (!isOutgoing) ...[ + _buildAvatar(senderName), + const SizedBox(width: 6), + ], + Flexible( + child: Container( + padding: gifId != null + ? const EdgeInsets.all(4) + : const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + constraints: BoxConstraints( + maxWidth: constraints.maxWidth * 0.72, + ), + decoration: BoxDecoration( + color: bubbleColor, + borderRadius: borderRadius, + border: Border.all(color: bubbleBorder, width: 1), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (!isOutgoing) ...[ + Padding( + padding: gifId != null + ? const EdgeInsets.only( + left: 8, + top: 4, + bottom: 4, + ) + : EdgeInsets.zero, + child: Text( + senderName, + style: MeshTheme.mono( + fontSize: 11, + fontWeight: FontWeight.w700, + color: _colorForName(senderName), + ), ), ), - ), - if (gifId == null) const SizedBox(height: 4), - ], - if (poi != null) - _buildPoiMessage( - context, - poi, - textColor, - metaColor, - textScale, - senderName, - trailing: (!enableTracing && isOutgoing) - ? Padding( - padding: const EdgeInsets.only(bottom: 2), - child: MessageStatusIcon( - isAcked: - message.status == - MessageStatus.delivered && - message.pathBytes.isNotEmpty, - isFailed: - message.status == - MessageStatus.failed, + if (gifId == null) const SizedBox(height: 2), + ], + if (poi != null) + _buildPoiMessage( + context, + poi, + textColor, + metaColor, + textScale, + senderName, + ) + else if (gifId != null) + Stack( + children: [ + ClipRRect( + borderRadius: BorderRadius.circular(12), + child: GifMessage( + url: + 'https://media.giphy.com/media/$gifId/giphy.gif', + backgroundColor: Colors.transparent, + fallbackTextColor: textColor.withValues( + alpha: 0.7, ), - ) - : null, - ) - else if (gifId != null) - Stack( - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(12), - child: GifMessage( - url: - 'https://media.giphy.com/media/$gifId/giphy.gif', - backgroundColor: Colors.transparent, - fallbackTextColor: textColor.withValues( - alpha: 0.7, - ), - ), - ), - if (!enableTracing && isOutgoing) - Positioned( - top: 0, - right: 0, - child: Container( - padding: const EdgeInsets.all(3), - decoration: BoxDecoration( - color: bubbleColor, - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(10), - topRight: Radius.circular(12), - ), - ), - child: MessageStatusIcon( - isAcked: - message.status == - MessageStatus.delivered && - message.pathBytes.isNotEmpty, - isFailed: - message.status == - MessageStatus.failed, - ), - ), - ), - ], - ) - else - Row( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Flexible( - child: TranslatedMessageContent( - displayText: translatedDisplayText, - originalText: originalDisplayText, - style: TextStyle( - color: textColor, - fontSize: bodyFontSize * textScale, - ), - originalStyle: TextStyle( - color: textColor.withValues(alpha: 0.78), - fontSize: bodyFontSize * textScale, - ), - ), - ), - if (!enableTracing && isOutgoing) ...[ - const SizedBox(width: 4), - Padding( - padding: const EdgeInsets.only(bottom: 2), - child: MessageStatusIcon( - isAcked: - message.status == - MessageStatus.delivered && - message.pathBytes.isNotEmpty, - isFailed: - message.status == MessageStatus.failed, ), ), ], - ], - ), - if (enableTracing) ...[ - if (isOutgoing && message.retryCount > 0) ...[ - const SizedBox(height: 4), + ) + else + Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Flexible( + child: TranslatedMessageContent( + displayText: translatedDisplayText, + originalText: originalDisplayText, + style: TextStyle( + color: textColor, + fontSize: bodyFontSize * textScale, + ), + originalStyle: TextStyle( + color: textColor.withValues(alpha: 0.72), + fontSize: bodyFontSize * textScale, + ), + ), + ), + ], + ), + if (enableTracing && + isOutgoing && + message.retryCount > 0) ...[ + const SizedBox(height: 3), Padding( padding: gifId != null ? const EdgeInsets.symmetric(horizontal: 8) @@ -1944,15 +1455,15 @@ class _MessageBubble extends StatelessWidget { .settings .maxMessageRetries, ), - style: TextStyle( - fontSize: 10, + style: MeshTheme.mono( + fontSize: 9.5 * textScale, color: metaColor, - fontWeight: FontWeight.w500, ), ), ), ], - const SizedBox(height: 4), + const SizedBox(height: 3), + // Meta row: timestamp + status icon + optional tracing Padding( padding: gifId != null ? const EdgeInsets.only( @@ -1967,33 +1478,44 @@ class _MessageBubble extends StatelessWidget { children: [ Text( _formatTime(message.timestamp), - style: TextStyle( - fontSize: 10, + style: MeshTheme.mono( + fontSize: 10 * textScale, color: metaColor, ), ), if (isOutgoing) ...[ - const SizedBox(width: 4), - _buildStatusIcon(metaColor), + const SizedBox(width: 2), + MessageStatusIcon( + size: 12 * textScale, + onColor: metaColor, + isAcked: + message.status == + MessageStatus.delivered, + isPending: + message.status == MessageStatus.pending, + isFailed: + message.status == MessageStatus.failed, + ), ], - if (message.tripTimeMs != null && + if (enableTracing && + message.tripTimeMs != null && message.status == MessageStatus.delivered) ...[ - const SizedBox(width: 4), + const SizedBox(width: 2), Icon( Icons.speed, - size: 10, + size: 10 * textScale, color: isOutgoing ? metaColor - : Colors.green[700], + : scheme.tertiary, ), Text( '${(message.tripTimeMs! / 1000).toStringAsFixed(1)}s', - style: TextStyle( - fontSize: 9, + style: MeshTheme.mono( + fontSize: 9 * textScale, color: isOutgoing ? metaColor - : Colors.green[700], + : scheme.tertiary, ), ), ], @@ -2001,18 +1523,18 @@ class _MessageBubble extends StatelessWidget { ), ), ], - ], + ), ), ), - ), - ], + ], + ), ), ), if (message.reactions.isNotEmpty) ...[ const SizedBox(height: 4), Padding( - padding: EdgeInsets.only(left: isOutgoing ? 0 : 48), - child: _buildReactionsDisplay(context, message, colorScheme), + padding: EdgeInsets.only(left: isOutgoing ? 0 : 42), + child: _buildReactionsDisplay(context, message, scheme), ), ], ], @@ -2035,9 +1557,11 @@ class _MessageBubble extends StatelessWidget { IconButton( icon: Icon(Icons.location_on_outlined, color: textColor), padding: EdgeInsets.zero, - constraints: const BoxConstraints(minWidth: 32, minHeight: 32), + constraints: const BoxConstraints(minWidth: 40, minHeight: 40), onPressed: () async { - final selfName = context.read().selfName ?? 'Me'; + final selfName = + context.read().selfName ?? + context.l10n.chat_me; final fromName = message.isOutgoing ? selfName : senderName; final key = buildSharedMarkerKey( sourceId: sourceId, @@ -2087,7 +1611,7 @@ class _MessageBubble extends StatelessWidget { Widget _buildReactionsDisplay( BuildContext context, Message message, - ColorScheme colorScheme, + ColorScheme scheme, ) { return Wrap( spacing: 6, @@ -2110,28 +1634,33 @@ class _MessageBubble extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), decoration: BoxDecoration( color: isFailed - ? colorScheme.errorContainer - : colorScheme.secondaryContainer, - borderRadius: BorderRadius.circular(12), + ? scheme.errorContainer + : scheme.surfaceContainerHigh, + borderRadius: BorderRadius.circular(MeshRadii.pill), border: Border.all( - color: isFailed - ? colorScheme.error - : colorScheme.outline.withValues(alpha: 0.3), + color: isFailed ? scheme.error : scheme.outlineVariant, width: 1, ), ), child: Row( mainAxisSize: MainAxisSize.min, children: [ - Text(emoji, style: const TextStyle(fontSize: 16)), + Text( + emoji, + style: MeshTheme.emoji(fontSize: 16), + textHeightBehavior: const TextHeightBehavior( + applyHeightToFirstAscent: false, + applyHeightToLastDescent: false, + ), + ), if (count > 1) ...[ const SizedBox(width: 4), Text( '$count', - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - color: colorScheme.onSecondaryContainer, + style: MeshTheme.mono( + fontSize: 11, + fontWeight: FontWeight.w700, + color: scheme.onSurface, ), ), ], @@ -2142,13 +1671,13 @@ class _MessageBubble extends StatelessWidget { height: 8, child: CircularProgressIndicator( strokeWidth: 1.5, - color: colorScheme.onSecondaryContainer, + color: scheme.primary, ), ), ], if (isFailed) ...[ const SizedBox(width: 2), - Icon(Icons.replay, size: 10, color: colorScheme.error), + Icon(Icons.replay, size: 10, color: scheme.error), ], ], ), @@ -2159,72 +1688,8 @@ class _MessageBubble extends StatelessWidget { ); } - Widget _buildAvatar(String senderName, ColorScheme colorScheme) { - final initial = _getFirstCharacterOrEmoji(senderName); - final color = _getColorForName(senderName); - - return CircleAvatar( - radius: 18, - backgroundColor: color.withValues(alpha: 0.2), - child: Text( - initial, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.bold, - color: color, - ), - ), - ); - } - - String _getFirstCharacterOrEmoji(String name) { - if (name.isEmpty) return '?'; - - final emoji = firstEmoji(name); - if (emoji != null) return emoji; - - final runes = name.runes.toList(); - if (runes.isEmpty) return '?'; - return String.fromCharCode(runes[0]).toUpperCase(); - } - - Color _getColorForName(String name) { - // Generate a consistent color based on the name hash - final hash = name.hashCode; - final colors = [ - Colors.blue, - Colors.green, - Colors.orange, - Colors.purple, - Colors.pink, - Colors.teal, - Colors.indigo, - Colors.cyan, - Colors.amber, - Colors.deepOrange, - ]; - - return colors[hash.abs() % colors.length]; - } - - Widget _buildStatusIcon(Color color) { - IconData icon; - switch (message.status) { - case MessageStatus.pending: - icon = Icons.access_time; - break; - case MessageStatus.sent: - icon = Icons.schedule; - break; - case MessageStatus.delivered: - icon = Icons.check; - break; - case MessageStatus.failed: - icon = Icons.error_outline; - break; - } - - return Icon(icon, size: 12, color: color); + Widget _buildAvatar(String senderName) { + return AvatarCircle(name: senderName, size: 32); } String _formatTime(DateTime time) { @@ -2233,3 +1698,20 @@ class _MessageBubble extends StatelessWidget { return '$hour:$minute'; } } + +/// Deterministic name-to-hue mapping consistent with [AvatarCircle]. +Color _colorForName(String name) { + const hues = [ + MeshPalette.blue, + MeshPalette.magenta, + MeshPalette.signal, + MeshPalette.warn, + Color(0xFF8FA8F0), + Color(0xFF6FD9CE), + ]; + var h = 0; + for (final c in name.codeUnits) { + h = (h * 31 + c) & 0x7fffffff; + } + return hues[h % hues.length]; +} diff --git a/lib/screens/chrome_required_screen.dart b/lib/screens/chrome_required_screen.dart index 1827aeb9..4507b10f 100644 --- a/lib/screens/chrome_required_screen.dart +++ b/lib/screens/chrome_required_screen.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; import '../l10n/l10n.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/mesh_ui.dart'; class ChromeRequiredScreen extends StatelessWidget { const ChromeRequiredScreen({super.key}); @@ -7,81 +9,95 @@ class ChromeRequiredScreen extends StatelessWidget { @override Widget build(BuildContext context) { final l10n = context.l10n; - final theme = Theme.of(context); - final isDark = theme.brightness == Brightness.dark; + final scheme = Theme.of(context).colorScheme; return Scaffold( - body: Container( - width: double.infinity, - padding: const EdgeInsets.symmetric(horizontal: 32), - decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: isDark - ? [const Color(0xFF1A1A1A), const Color(0xFF0D0D0D)] - : [const Color(0xFFF5F7FA), const Color(0xFFE4E7EB)], - ), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - padding: const EdgeInsets.all(24), - decoration: BoxDecoration( - color: Colors.orange.withValues(alpha: 0.1), - shape: BoxShape.circle, - ), - child: const Icon( - Icons.browser_not_supported_rounded, - size: 80, - color: Colors.orange, - ), - ), - const SizedBox(height: 32), - Text( - l10n.scanner_chromeRequired, - textAlign: TextAlign.center, - style: theme.textTheme.headlineMedium?.copyWith( - fontWeight: FontWeight.bold, - color: isDark ? Colors.white : Colors.black87, - ), - ), - const SizedBox(height: 16), - Text( - l10n.scanner_chromeRequiredMessage, - textAlign: TextAlign.center, - style: theme.textTheme.bodyLarge?.copyWith( - color: isDark ? Colors.white70 : Colors.black54, - height: 1.5, - ), - ), - const SizedBox(height: 48), - // We can't really "fix" it for them other than telling them to use Chrome - // but we can provide a nice visual. - Container( - padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12), - decoration: BoxDecoration( - color: Colors.blue.withValues(alpha: 0.1), - borderRadius: BorderRadius.circular(30), - border: Border.all(color: Colors.blue.withValues(alpha: 0.3)), - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - const Icon(Icons.info_outline, size: 20, color: Colors.blue), - const SizedBox(width: 12), - Text( - "Web Bluetooth requires a Chromium browser", - style: theme.textTheme.bodyMedium?.copyWith( - color: Colors.blue, - fontWeight: FontWeight.w500, + body: SafeArea( + child: Center( + child: SingleChildScrollView( + padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 40), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // Icon in tinted circle + Container( + width: 88, + height: 88, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: scheme.tertiary.withValues(alpha: 0.10), + border: Border.all( + color: scheme.tertiary.withValues(alpha: 0.25), + width: 1.5, ), ), - ], - ), + child: Icon( + Icons.browser_not_supported_rounded, + size: 42, + color: scheme.tertiary, + ), + ), + const SizedBox(height: 28), + + // Title + Text( + l10n.scanner_chromeRequired, + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.titleLarge?.copyWith( + fontWeight: FontWeight.w700, + color: scheme.onSurface, + letterSpacing: -0.3, + ), + ), + const SizedBox(height: 12), + + // Body text + Text( + l10n.scanner_chromeRequiredMessage, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 14, + color: scheme.onSurfaceVariant, + height: 1.55, + ), + ), + const SizedBox(height: 32), + + // Info chip + MeshCard( + margin: EdgeInsets.zero, + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 12, + ), + color: scheme.secondaryContainer.withValues(alpha: 0.35), + borderColor: scheme.outline.withValues(alpha: 0.3), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + Icons.info_outline, + size: 18, + color: scheme.secondary, + ), + const SizedBox(width: 10), + Flexible( + child: Text( + l10n.chrome_bluetoothRequiresChromium, + style: MeshTheme.mono( + fontSize: 12, + color: scheme.onSecondaryContainer, + fontWeight: FontWeight.w500, + ), + textAlign: TextAlign.center, + ), + ), + ], + ), + ), + ], ), - ], + ), ), ), ); diff --git a/lib/screens/community_qr_scanner_screen.dart b/lib/screens/community_qr_scanner_screen.dart index 6b71715f..77321573 100644 --- a/lib/screens/community_qr_scanner_screen.dart +++ b/lib/screens/community_qr_scanner_screen.dart @@ -1,14 +1,18 @@ +import 'dart:async'; + import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:uuid/uuid.dart'; import '../connector/meshcore_connector.dart'; +import '../helpers/snack_bar_builder.dart'; import '../l10n/l10n.dart'; import '../models/community.dart'; import '../storage/community_store.dart'; +import '../theme/mesh_theme.dart'; import '../widgets/adaptive_app_bar_title.dart'; +import '../widgets/mesh_ui.dart'; import '../widgets/qr_scanner_widget.dart'; -import '../helpers/snack_bar_builder.dart'; /// Screen for scanning community QR codes to join communities. /// @@ -35,16 +39,87 @@ class _CommunityQrScannerScreenState extends State { centerTitle: true, ), body: _isProcessing - ? const Center(child: CircularProgressIndicator()) + ? Container( + color: Theme.of(context).colorScheme.surface, + child: const Center(child: CircularProgressIndicator()), + ) : QrScannerWidget( onScanned: (data) => _handleScannedData(context, data), validator: Community.isValidQrData, onValidationFailed: (_) => _showInvalidQrError(context), instructions: context.l10n.community_scanInstructions, + overlay: _buildThemedOverlay(context), ), ); } + Widget _buildThemedOverlay(BuildContext context) { + return Stack( + fit: StackFit.expand, + children: [ + // Dark semi-transparent background with cutout + ColorFiltered( + colorFilter: ColorFilter.mode( + Colors.black.withValues(alpha: 0.5), + BlendMode.srcOut, + ), + child: Stack( + fit: StackFit.expand, + children: [ + Container( + decoration: const BoxDecoration( + color: Colors.black, + backgroundBlendMode: BlendMode.dstOut, + ), + ), + Center( + child: Container( + height: 250, + width: 250, + decoration: BoxDecoration( + color: Colors.red, + borderRadius: BorderRadius.circular(16), + ), + ), + ), + ], + ), + ), + // Corner brackets on top + const ScannerCornerOverlay( + scanWindowSize: 250, + borderColor: MeshPalette.blue, + borderWidth: 2, + cornerLength: 24, + ), + // Instructions pill below the scan window + Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + const SizedBox(height: 250 + 24), + Container( + padding: const EdgeInsets.symmetric( + horizontal: 20, + vertical: 10, + ), + decoration: BoxDecoration( + color: Colors.black.withValues(alpha: 0.72), + borderRadius: BorderRadius.circular(MeshRadii.pill), + ), + child: Text( + context.l10n.community_scanInstructions, + style: const TextStyle(color: MeshPalette.ink2, fontSize: 13), + textAlign: TextAlign.center, + ), + ), + ], + ), + ), + ], + ); + } + Future _handleScannedData(BuildContext context, String data) async { if (_isProcessing) return; @@ -80,7 +155,7 @@ class _CommunityQrScannerScreenState extends State { showDismissibleSnackBar( context, content: Text(context.l10n.community_invalidQrCode), - backgroundColor: Colors.red, + backgroundColor: MeshPalette.alert, ); } } finally { @@ -96,29 +171,74 @@ class _CommunityQrScannerScreenState extends State { showDismissibleSnackBar( context, content: Text(context.l10n.community_invalidQrCode), - backgroundColor: Colors.orange, + backgroundColor: MeshPalette.warn, duration: const Duration(seconds: 2), ); } void _showAlreadyMemberDialog(BuildContext context, Community community) { - showDialog( - context: context, - builder: (dialogContext) => AlertDialog( - title: Text(context.l10n.community_alreadyMember), - content: Text( - context.l10n.community_alreadyMemberMessage(community.name), - ), - actions: [ - TextButton( - onPressed: () { - Navigator.pop(dialogContext); - Navigator.pop(context); - }, - child: Text(context.l10n.common_ok), - ), - ], - ), + showMeshSheet( + context, + builder: (sheetContext) { + final sheetScheme = Theme.of(sheetContext).colorScheme; + return Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + BottomSheetHeader(title: context.l10n.community_alreadyMember), + Padding( + padding: const EdgeInsets.fromLTRB(20, 0, 20, 4), + child: Text( + context.l10n.community_alreadyMemberMessage(community.name), + style: TextStyle(color: sheetScheme.onSurfaceVariant), + ), + ), + MeshCard( + child: Row( + children: [ + const Icon( + Icons.groups, + color: MeshPalette.magenta, + size: 32, + ), + const SizedBox(width: 14), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + community.name, + style: const TextStyle( + fontWeight: FontWeight.w600, + fontSize: 15, + ), + ), + Text( + 'ID: ${community.shortCommunityId}...', + style: MeshTheme.mono( + fontSize: 11.5, + color: sheetScheme.onSurfaceVariant, + ), + ), + ], + ), + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.fromLTRB(16, 8, 16, 16), + child: FilledButton( + onPressed: () { + Navigator.pop(sheetContext); + Navigator.pop(context); + }, + child: Text(context.l10n.common_ok), + ), + ), + ], + ); + }, ); } @@ -127,77 +247,111 @@ class _CommunityQrScannerScreenState extends State { Community community, ) async { bool addPublicChannel = true; + final completer = Completer(); - final result = await showDialog( - context: context, - builder: (dialogContext) => StatefulBuilder( - builder: (dialogContext, setDialogState) => AlertDialog( - title: Text(context.l10n.community_joinTitle), - content: Column( + await showMeshSheet( + context, + builder: (sheetContext) => StatefulBuilder( + builder: (sheetContext, setSheetState) { + final joinScheme = Theme.of(sheetContext).colorScheme; + return Column( mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Text(context.l10n.community_joinConfirmation(community.name)), - const SizedBox(height: 16), - Row( - children: [ - Icon( - Icons.groups, - color: Theme.of(dialogContext).colorScheme.primary, - ), - const SizedBox(width: 12), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - community.name, - style: const TextStyle(fontWeight: FontWeight.bold), - ), - Text( - 'ID: ${community.shortCommunityId}...', - style: TextStyle( - fontSize: 12, - color: Colors.grey[600], - ), - ), - ], - ), - ), - ], + BottomSheetHeader(title: context.l10n.community_joinTitle), + Padding( + padding: const EdgeInsets.fromLTRB(20, 0, 20, 4), + child: Text( + context.l10n.community_joinConfirmation(community.name), + style: TextStyle(color: joinScheme.onSurfaceVariant), + ), + ), + MeshCard( + child: Row( + children: [ + AvatarCircle( + name: community.name, + icon: Icons.groups, + color: MeshPalette.magenta, + size: 44, + ), + const SizedBox(width: 14), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + community.name, + style: const TextStyle( + fontWeight: FontWeight.w600, + fontSize: 15, + ), + ), + Text( + 'ID: ${community.shortCommunityId}...', + style: MeshTheme.mono( + fontSize: 11.5, + color: joinScheme.onSurfaceVariant, + ), + ), + ], + ), + ), + ], + ), ), - const SizedBox(height: 16), - const Divider(), - const SizedBox(height: 8), CheckboxListTile( value: addPublicChannel, onChanged: (value) { - setDialogState(() { + setSheetState(() { addPublicChannel = value ?? true; }); }, title: Text(context.l10n.community_addPublicChannel), subtitle: Text(context.l10n.community_addPublicChannelHint), controlAffinity: ListTileControlAffinity.leading, - contentPadding: EdgeInsets.zero, + contentPadding: const EdgeInsets.symmetric(horizontal: 16), + ), + Padding( + padding: const EdgeInsets.fromLTRB(16, 8, 16, 16), + child: Row( + children: [ + Expanded( + child: OutlinedButton( + onPressed: () { + completer.complete(false); + Navigator.pop(sheetContext); + }, + child: Text(context.l10n.common_cancel), + ), + ), + const SizedBox(width: 12), + Expanded( + child: FilledButton( + onPressed: () { + completer.complete(true); + Navigator.pop(sheetContext); + }, + child: Text(context.l10n.community_join), + ), + ), + ], + ), ), ], - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(dialogContext, false), - child: Text(context.l10n.common_cancel), - ), - FilledButton( - onPressed: () => Navigator.pop(dialogContext, true), - child: Text(context.l10n.community_join), - ), - ], - ), + ); + }, ), ); - if (result == true && context.mounted) { + // If sheet was dismissed without a button press, treat as cancel + if (!completer.isCompleted) { + completer.complete(false); + } + + final result = await completer.future; + + if (result && context.mounted) { await _joinCommunity(context, community, addPublicChannel); } else if (context.mounted) { // User cancelled - go back @@ -231,7 +385,7 @@ class _CommunityQrScannerScreenState extends State { showDismissibleSnackBar( context, content: Text(context.l10n.community_joined(community.name)), - backgroundColor: Colors.green, + backgroundColor: MeshPalette.signal, ); // Return to previous screen diff --git a/lib/screens/companion_radio_stats_screen.dart b/lib/screens/companion_radio_stats_screen.dart index 9c376769..f7d8f46e 100644 --- a/lib/screens/companion_radio_stats_screen.dart +++ b/lib/screens/companion_radio_stats_screen.dart @@ -2,6 +2,8 @@ import 'package:flutter/material.dart'; import 'package:meshcore_open/connector/meshcore_connector.dart'; import 'package:meshcore_open/models/companion_radio_stats.dart'; import 'package:meshcore_open/l10n/l10n.dart'; +import 'package:meshcore_open/theme/mesh_theme.dart'; +import 'package:meshcore_open/widgets/mesh_ui.dart'; import 'package:provider/provider.dart'; class CompanionRadioStatsScreen extends StatefulWidget { @@ -49,6 +51,25 @@ class _CompanionRadioStatsScreenState extends State { super.dispose(); } + Widget _tile(String text, IconData icon, Color color) { + final scheme = Theme.of(context).colorScheme; + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10), + child: Row( + children: [ + Icon(icon, size: 16, color: color), + const SizedBox(width: 10), + Expanded( + child: Text( + text, + style: MeshTheme.mono(fontSize: 13, color: scheme.onSurface), + ), + ), + ], + ), + ); + } + @override Widget build(BuildContext context) { final l10n = context.l10n; @@ -85,44 +106,105 @@ class _CompanionRadioStatsScreenState extends State { valueListenable: connector.radioStatsNotifier, builder: (context, stats, _) { return ListView( - padding: const EdgeInsets.all(16), + padding: const EdgeInsets.symmetric(vertical: 8), children: [ if (stats != null) ...[ - Text( - l10n.radioStats_noiseFloor(stats.noiseFloorDbm), - style: tt.titleMedium, + const SectionHeader( + 'Signal', + padding: EdgeInsets.fromLTRB(16, 16, 16, 8), ), - const SizedBox(height: 4), - Text(l10n.radioStats_lastRssi(stats.lastRssiDbm)), - Text( - l10n.radioStats_lastSnr( - stats.lastSnrDb.toStringAsFixed(1), + MeshCard( + margin: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + padding: const EdgeInsets.all(4), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _tile( + l10n.radioStats_noiseFloor(stats.noiseFloorDbm), + Icons.noise_aware, + scheme.onSurfaceVariant, + ), + const Divider(height: 1), + _tile( + l10n.radioStats_lastRssi(stats.lastRssiDbm), + Icons.wifi_tethering, + scheme.onSurfaceVariant, + ), + const Divider(height: 1), + _tile( + l10n.radioStats_lastSnr( + stats.lastSnrDb.toStringAsFixed(1), + ), + Icons.signal_cellular_alt, + MeshTheme.snrColor(stats.lastSnrDb, blocked: false), + ), + ], ), ), - Text(l10n.radioStats_txAir(stats.txAirSecs)), - Text(l10n.radioStats_rxAir(stats.rxAirSecs)), - const SizedBox(height: 16), - ] else - Text(l10n.radioStats_waiting), - const SizedBox(height: 16), - SizedBox( - height: 200, - child: CustomPaint( - painter: _NoiseChartPainter( - samples: List.from(_noiseHistory), - colorScheme: scheme, - textTheme: tt, + const SectionHeader( + 'Airtime', + padding: EdgeInsets.fromLTRB(16, 16, 16, 8), + ), + MeshCard( + margin: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + padding: const EdgeInsets.all(4), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _tile( + l10n.radioStats_txAir(stats.txAirSecs), + Icons.upload, + MeshPalette.blue, + ), + const Divider(height: 1), + _tile( + l10n.radioStats_rxAir(stats.rxAirSecs), + Icons.download, + MeshPalette.blue, + ), + ], + ), + ), + ] else ...[ + const SizedBox(height: 80), + Center( + child: CircularProgressIndicator( + color: Theme.of(context).colorScheme.primary, + ), + ), + const SizedBox(height: 8), + Center( + child: Text( + l10n.radioStats_waiting, + style: TextStyle(color: scheme.onSurfaceVariant), + ), + ), + ], + SectionHeader( + l10n.radioStats_chartCaption, + padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: SizedBox( + height: 200, + child: CustomPaint( + painter: _NoiseChartPainter( + samples: List.from(_noiseHistory), + colorScheme: scheme, + textTheme: tt, + ), + child: const SizedBox.expand(), ), - child: const SizedBox.expand(), ), ), const SizedBox(height: 8), - Text( - l10n.radioStats_chartCaption, - style: tt.bodySmall?.copyWith( - color: scheme.onSurfaceVariant, - ), - ), ], ); }, @@ -210,10 +292,10 @@ class _NoiseChartPainter extends CustomPainter { } final span = maxV - minV; - for (var i = 0; i <= 2; i++) { - final v = maxV - span * i / 2; + for (var i = 0; i <= 4; i++) { + final v = maxV - span * i / 4; final tp = _yAxisLabel(v); - final y = chart.top + (chart.height * i / 2) - tp.height / 2; + final y = chart.top + (chart.height * i / 4) - tp.height / 2; tp.paint(canvas, Offset(4, y)); } diff --git a/lib/screens/contacts_screen.dart b/lib/screens/contacts_screen.dart index d5e1b79a..44ec78d2 100644 --- a/lib/screens/contacts_screen.dart +++ b/lib/screens/contacts_screen.dart @@ -16,6 +16,7 @@ import '../models/contact.dart'; import '../l10n/contact_localization.dart'; import '../models/contact_group.dart'; import '../services/ui_view_state_service.dart'; +import '../theme/mesh_theme.dart'; import '../utils/contact_search.dart'; import '../storage/contact_group_store.dart'; import '../utils/dialog_utils.dart'; @@ -24,9 +25,11 @@ import '../utils/emoji_utils.dart'; import '../utils/route_transitions.dart'; import '../widgets/list_filter_widget.dart'; import '../widgets/empty_state.dart'; +import '../widgets/mesh_ui.dart'; import '../widgets/quick_switch_bar.dart'; import '../widgets/repeater_login_dialog.dart'; import '../widgets/room_login_dialog.dart'; +import '../widgets/sync_progress_overlay.dart'; import '../widgets/unread_badge.dart'; import '../helpers/snack_bar_builder.dart'; import 'channels_screen.dart'; @@ -58,7 +61,7 @@ class _ContactsScreenState extends State String _loadedGroupScopeKeyHex = ''; Timer? _searchDebounce; - final Set _pendingOperations = {}; + final List _pendingOperations = []; StreamSubscription? _frameSubscription; @@ -184,59 +187,52 @@ class _ContactsScreenState extends State Clipboard.setData(ClipboardData(text: "meshcore://$hexString")); } + // Generic OK/ERR acks carry no command correlation, so consume only + // the oldest pending operation per ack instead of clearing all. if (code == respCodeOk) { - // Show a snackbar indicating success if (!mounted) return; - - if (_pendingOperations.contains(ContactOperationType.import)) { - showDismissibleSnackBar( - context, - content: Text(context.l10n.contacts_contactImported), - ); + if (_pendingOperations.isEmpty) return; + final op = _pendingOperations.removeAt(0); + switch (op) { + case ContactOperationType.import: + showDismissibleSnackBar( + context, + content: Text(context.l10n.contacts_contactImported), + ); + case ContactOperationType.zeroHopShare: + showDismissibleSnackBar( + context, + content: Text(context.l10n.contacts_zeroHopContactAdvertSent), + ); + case ContactOperationType.export: + showDismissibleSnackBar( + context, + content: Text(context.l10n.contacts_contactAdvertCopied), + ); } - - if (_pendingOperations.contains(ContactOperationType.zeroHopShare)) { - showDismissibleSnackBar( - context, - content: Text(context.l10n.contacts_zeroHopContactAdvertSent), - ); - } - - if (_pendingOperations.contains(ContactOperationType.export)) { - showDismissibleSnackBar( - context, - content: Text(context.l10n.contacts_contactAdvertCopied), - ); - } - - _pendingOperations.clear(); } if (code == respCodeErr) { - // Show a snackbar indicating failure if (!mounted) return; - - if (_pendingOperations.contains(ContactOperationType.import)) { - showDismissibleSnackBar( - context, - content: Text(context.l10n.contacts_contactImportFailed), - ); + if (_pendingOperations.isEmpty) return; + final op = _pendingOperations.removeAt(0); + switch (op) { + case ContactOperationType.import: + showDismissibleSnackBar( + context, + content: Text(context.l10n.contacts_contactImportFailed), + ); + case ContactOperationType.zeroHopShare: + showDismissibleSnackBar( + context, + content: Text(context.l10n.contacts_zeroHopContactAdvertFailed), + ); + case ContactOperationType.export: + showDismissibleSnackBar( + context, + content: Text(context.l10n.contacts_contactAdvertCopyFailed), + ); } - - if (_pendingOperations.contains(ContactOperationType.zeroHopShare)) { - showDismissibleSnackBar( - context, - content: Text(context.l10n.contacts_zeroHopContactAdvertFailed), - ); - } - if (_pendingOperations.contains(ContactOperationType.export)) { - showDismissibleSnackBar( - context, - content: Text(context.l10n.contacts_contactAdvertCopyFailed), - ); - } - - _pendingOperations.clear(); } } catch (e) { appLogger.error( @@ -251,17 +247,37 @@ class _ContactsScreenState extends State final connector = Provider.of(context, listen: false); final exportContactFrame = buildExportContactFrame(pubKey); _pendingOperations.add(ContactOperationType.export); - await connector.sendFrame(exportContactFrame, expectsGenericAck: true); + try { + await connector.sendFrame(exportContactFrame, expectsGenericAck: true); + } catch (e) { + _pendingOperations.remove(ContactOperationType.export); + if (mounted) { + showDismissibleSnackBar( + context, + content: Text(context.l10n.contacts_contactAdvertCopyFailed), + ); + } + } } Future _contactZeroHop(Uint8List pubKey) async { final connector = Provider.of(context, listen: false); final exportContactZeroHopFrame = buildZeroHopContact(pubKey); _pendingOperations.add(ContactOperationType.zeroHopShare); - await connector.sendFrame( - exportContactZeroHopFrame, - expectsGenericAck: true, - ); + try { + await connector.sendFrame( + exportContactZeroHopFrame, + expectsGenericAck: true, + ); + } catch (e) { + _pendingOperations.remove(ContactOperationType.zeroHopShare); + if (mounted) { + showDismissibleSnackBar( + context, + content: Text(context.l10n.contacts_zeroHopContactAdvertFailed), + ); + } + } } Future _contactImport() async { @@ -287,11 +303,10 @@ class _ContactsScreenState extends State return; } final hexString = text.substring('meshcore://'.length); + final Uint8List importContactFrame; try { final bytes = hex2Uint8List(hexString); - final importContactFrame = buildImportContactFrame(bytes); - _pendingOperations.add(ContactOperationType.import); - connector.importContact(importContactFrame); + importContactFrame = buildImportContactFrame(bytes); } catch (e) { if (mounted) { showDismissibleSnackBar( @@ -299,6 +314,19 @@ class _ContactsScreenState extends State content: Text(context.l10n.contacts_invalidAdvertFormat), ); } + return; + } + _pendingOperations.add(ContactOperationType.import); + try { + await connector.sendFrame(importContactFrame, expectsGenericAck: true); + } catch (e) { + _pendingOperations.remove(ContactOperationType.import); + if (mounted) { + showDismissibleSnackBar( + context, + content: Text(context.l10n.contacts_contactImportFailed), + ); + } } } @@ -318,9 +346,37 @@ class _ContactsScreenState extends State appBar: AppBar( title: AppBarTitle(context.l10n.contacts_title), automaticallyImplyLeading: false, + bottom: const SyncProgressAppBarBottom(), actions: [ PopupMenuButton( - itemBuilder: (context) => [ + tooltip: context.l10n.contacts_moreOptions, + itemBuilder: (context) => >[ + PopupMenuItem( + child: Row( + children: [ + const Icon(Icons.person_add_rounded), + const SizedBox(width: 8), + Text(context.l10n.discoveredContacts_Title), + ], + ), + onTap: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const DiscoveryScreen(), + ), + ), + ), + PopupMenuItem( + child: Row( + children: [ + const Icon(Icons.paste), + const SizedBox(width: 8), + Text(context.l10n.contacts_addContactFromClipboard), + ], + ), + onTap: () => _contactImport(), + ), + const PopupMenuDivider(), PopupMenuItem( child: Row( children: [ @@ -363,46 +419,20 @@ class _ContactsScreenState extends State ), onTap: () => _contactExport(Uint8List.fromList([])), ), + const PopupMenuDivider(), PopupMenuItem( child: Row( children: [ - const Icon(Icons.paste), - const SizedBox(width: 8), - Text(context.l10n.contacts_addContactFromClipboard), - ], - ), - onTap: () => _contactImport(), - ), - ], - icon: const Icon(Icons.connect_without_contact), - ), - PopupMenuButton( - itemBuilder: (context) => [ - PopupMenuItem( - child: Row( - children: [ - const Icon(Icons.logout, color: Colors.red), + Icon( + Icons.logout, + color: Theme.of(context).colorScheme.error, + ), const SizedBox(width: 8), Text(context.l10n.common_disconnect), ], ), onTap: () => _disconnect(context, connector), ), - PopupMenuItem( - child: Row( - children: [ - const Icon(Icons.person_add_rounded), - const SizedBox(width: 8), - Text(context.l10n.discoveredContacts_Title), - ], - ), - onTap: () => Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const DiscoveryScreen(), - ), - ), - ), PopupMenuItem( child: Row( children: [ @@ -424,6 +454,10 @@ class _ContactsScreenState extends State ], ), body: _buildContactsBody(context, connector), + floatingActionButton: FloatingActionButton( + onPressed: () => _showAddContactSheet(context), + child: const Icon(Icons.person_add), + ), bottomNavigationBar: SafeArea( top: false, child: QuickSwitchBar( @@ -438,6 +472,42 @@ class _ContactsScreenState extends State ); } + void _showAddContactSheet(BuildContext context) { + showMeshSheet( + context, + builder: (sheetContext) => SafeArea( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + BottomSheetHeader(title: context.l10n.contacts_title), + ListTile( + leading: const Icon(Icons.paste), + title: Text(context.l10n.contacts_addContactFromClipboard), + onTap: () { + Navigator.pop(sheetContext); + _contactImport(); + }, + ), + ListTile( + leading: const Icon(Icons.person_add_rounded), + title: Text(context.l10n.discoveredContacts_Title), + onTap: () { + Navigator.pop(sheetContext); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const DiscoveryScreen(), + ), + ); + }, + ), + const SizedBox(height: 8), + ], + ), + ), + ); + } + Future _disconnect( BuildContext context, MeshCoreConnector connector, @@ -569,7 +639,11 @@ class _ContactsScreenState extends State const SizedBox(width: 8), IconButton( tooltip: menuContext.l10n.contacts_deleteGroup, - icon: const Icon(Icons.delete, size: 20, color: Colors.red), + icon: Icon( + Icons.delete, + size: 20, + color: Theme.of(context).colorScheme.error, + ), onPressed: canManageGroups ? () => _closeDropdownAndRun( menuContext, @@ -587,16 +661,25 @@ class _ContactsScreenState extends State ], child: SizedBox( height: 48, - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10), - child: Row( - children: [ - Expanded( - child: Text(selectedGroupName, overflow: TextOverflow.ellipsis), - ), - const SizedBox(width: 8), - const Icon(Icons.arrow_drop_down), - ], + child: DecoratedBox( + decoration: BoxDecoration( + border: Border.all(color: Theme.of(context).colorScheme.outline), + borderRadius: BorderRadius.circular(12), + ), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10), + child: Row( + children: [ + Expanded( + child: Text( + selectedGroupName, + overflow: TextOverflow.ellipsis, + ), + ), + const SizedBox(width: 8), + const Icon(Icons.arrow_drop_down), + ], + ), ), ), ), @@ -606,15 +689,14 @@ class _ContactsScreenState extends State Widget _buildContactsBody(BuildContext context, MeshCoreConnector connector) { final viewState = context.watch(); final contacts = connector.contacts; - final shouldShowStartupSpinner = - contacts.isEmpty && - _groups.isEmpty && + final waitingForInitialContacts = connector.isConnected && - (connector.isLoadingContacts || - connector.isLoadingChannels || - connector.selfPublicKey == null); + !connector.hasLoadedContacts && + !connector.isLoadingContacts; + final waitingForFirstContact = + connector.isLoadingContacts && contacts.isEmpty; - if (shouldShowStartupSpinner) { + if (waitingForInitialContacts || waitingForFirstContact) { return const Center(child: CircularProgressIndicator()); } @@ -623,6 +705,14 @@ class _ContactsScreenState extends State icon: Icons.people_outline, title: context.l10n.contacts_noContacts, subtitle: context.l10n.contacts_contactsWillAppear, + action: FilledButton.icon( + onPressed: () => Navigator.push( + context, + MaterialPageRoute(builder: (context) => const DiscoveryScreen()), + ), + icon: const Icon(Icons.person_add_rounded), + label: Text(context.l10n.discoveredContacts_Title), + ), ); } @@ -758,6 +848,9 @@ class _ContactsScreenState extends State width: 48, height: 48, child: IconButton( + tooltip: viewState.contactsSearchExpanded + ? context.l10n.contacts_searchClose + : context.l10n.contacts_searchOpen, onPressed: () { if (viewState.contactsSearchExpanded) { _collapseContactsSearch(viewState); @@ -790,32 +883,37 @@ class _ContactsScreenState extends State ), ), Expanded( - child: filteredAndSorted.isEmpty - ? Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon(Icons.search_off, size: 64, color: Colors.grey[400]), - const SizedBox(height: 16), - Text( - viewState.contactsShowUnreadOnly - ? context.l10n.contacts_noUnreadContacts - : context.l10n.contacts_noContactsFound, - style: TextStyle(fontSize: 16, color: Colors.grey[600]), - ), - ], - ), - ) - : RefreshIndicator( - onRefresh: () => connector.getContacts(), - child: ListView.builder( + child: RefreshIndicator( + onRefresh: () => connector.getContacts(), + child: filteredAndSorted.isEmpty + ? LayoutBuilder( + builder: (context, constraints) => ListView( + physics: const AlwaysScrollableScrollPhysics(), + children: [ + ConstrainedBox( + constraints: BoxConstraints( + minHeight: constraints.maxHeight, + ), + child: EmptyState( + icon: Icons.search_off, + title: viewState.contactsShowUnreadOnly + ? context.l10n.contacts_noUnreadContacts + : context.l10n.contacts_noContactsFound, + ), + ), + ], + ), + ) + : ListView.builder( + padding: const EdgeInsets.only(bottom: 88), itemCount: filteredAndSorted.length, itemBuilder: (context, index) { final contact = filteredAndSorted[index]; final unreadCount = connector.getUnreadCountForContact( contact, ); - return _ContactTile( + return _ContactTileEntrance( + index: index, contact: contact, lastSeen: _resolveLastSeen(contact), unreadCount: unreadCount, @@ -826,7 +924,7 @@ class _ContactsScreenState extends State ); }, ), - ), + ), ), ], ); @@ -1047,7 +1145,7 @@ class _ContactsScreenState extends State }, child: Text( context.l10n.common_delete, - style: const TextStyle(color: Colors.red), + style: TextStyle(color: Theme.of(context).colorScheme.error), ), ), ], @@ -1249,17 +1347,22 @@ class _ContactsScreenState extends State final isRoom = contact.type == advTypeRoom; final isFavorite = contact.isFavorite; - showModalBottomSheet( - context: context, + showMeshSheet( + context, builder: (sheetContext) => SafeArea( child: Column( mainAxisSize: MainAxisSize.min, children: [ + BottomSheetHeader( + title: contact.name, + subtitle: contact.typeLabel(context.l10n), + ), if (isRepeater) ...[ ListTile( - leading: const Icon(Icons.radar, color: Colors.green), + leading: Icon(Icons.radar, color: MeshPalette.signal), title: Text(context.l10n.contacts_ping), onTap: () { + Navigator.pop(sheetContext); final hw = context .read() .pathHashByteWidth; @@ -1277,7 +1380,7 @@ class _ContactsScreenState extends State }, ), ListTile( - leading: const Icon(Icons.cell_tower, color: Colors.orange), + leading: Icon(Icons.cell_tower, color: MeshPalette.warn), title: Text(context.l10n.contacts_manageRepeater), onTap: () { Navigator.pop(sheetContext); @@ -1286,9 +1389,10 @@ class _ContactsScreenState extends State ), ] else if (isRoom) ...[ ListTile( - leading: const Icon(Icons.radar, color: Colors.green), + leading: Icon(Icons.radar, color: MeshPalette.signal), title: Text(context.l10n.contacts_pathTrace), onTap: () { + Navigator.pop(sheetContext); final hw = context .read() .pathHashByteWidth; @@ -1311,7 +1415,7 @@ class _ContactsScreenState extends State }, ), ListTile( - leading: const Icon(Icons.room, color: Colors.blue), + leading: Icon(Icons.meeting_room, color: MeshPalette.blue), title: Text(context.l10n.contacts_roomLogin), onTap: () { Navigator.pop(sheetContext); @@ -1319,10 +1423,7 @@ class _ContactsScreenState extends State }, ), ListTile( - leading: const Icon( - Icons.room_preferences, - color: Colors.orange, - ), + leading: Icon(Icons.room_preferences, color: MeshPalette.warn), title: Text(context.l10n.room_management), onTap: () { Navigator.pop(sheetContext); @@ -1336,9 +1437,10 @@ class _ContactsScreenState extends State ] else ...[ if (contact.pathLength > 0) ListTile( - leading: const Icon(Icons.radar, color: Colors.green), + leading: Icon(Icons.radar, color: MeshPalette.signal), title: Text(context.l10n.contacts_chatTraceRoute), onTap: () { + Navigator.pop(sheetContext); final hw = context .read() .pathHashByteWidth; @@ -1358,19 +1460,11 @@ class _ContactsScreenState extends State ); }, ), - ListTile( - leading: const Icon(Icons.chat), - title: Text(context.l10n.contacts_openChat), - onTap: () { - Navigator.pop(sheetContext); - _openChat(context, contact); - }, - ), ], ListTile( leading: Icon( isFavorite ? Icons.star : Icons.star_border, - color: Colors.amber[700], + color: MeshPalette.warn, ), title: Text( isFavorite @@ -1402,16 +1496,20 @@ class _ContactsScreenState extends State }, ), ListTile( - leading: const Icon(Icons.delete, color: Colors.red), + leading: Icon( + Icons.delete, + color: Theme.of(context).colorScheme.error, + ), title: Text( context.l10n.contacts_deleteContact, - style: const TextStyle(color: Colors.red), + style: TextStyle(color: Theme.of(context).colorScheme.error), ), onTap: () { Navigator.pop(sheetContext); _confirmDelete(context, connector, contact); }, ), + const SizedBox(height: 8), ], ), ), @@ -1440,7 +1538,7 @@ class _ContactsScreenState extends State }, child: Text( context.l10n.common_delete, - style: const TextStyle(color: Colors.red), + style: TextStyle(color: Theme.of(context).colorScheme.error), ), ), ], @@ -1466,118 +1564,176 @@ class _ContactTile extends StatelessWidget { required this.onLongPress, }); - @override - Widget build(BuildContext context) { - return GestureDetector( - onSecondaryTapUp: PlatformInfo.isDesktop ? (_) => onLongPress() : null, - child: ListTile( - leading: CircleAvatar( - backgroundColor: _getTypeColor(contact.type), - child: _buildContactAvatar(contact), - ), - title: Text(contact.name, maxLines: 1, overflow: TextOverflow.ellipsis), - subtitle: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - contact.pathLabel(context.l10n), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - Text( - contact.shortPubKeyHex, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: const TextStyle(fontSize: 12), - ), - ], - ), - // Clamp text scaling in trailing section to prevent overflow while - // maintaining accessibility. Primary content (title/subtitle) scales normally. - trailing: MediaQuery( - data: MediaQuery.of(context).copyWith( - textScaler: TextScaler.linear( - MediaQuery.textScalerOf(context).scale(1.0).clamp(1.0, 1.3), - ), - ), - child: SizedBox( - width: 120, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - if (unreadCount > 0) ...[ - UnreadBadge(count: unreadCount), - const SizedBox(height: 4), - ], - Text( - _formatLastSeen(context, lastSeen), - maxLines: 1, - overflow: TextOverflow.ellipsis, - textAlign: TextAlign.right, - style: TextStyle(fontSize: 12, color: Colors.grey[600]), - ), - Row( - mainAxisSize: MainAxisSize.min, - children: [ - if (isFavorite) - Icon(Icons.star, size: 14, color: Colors.amber[700]), - if (isFavorite && contact.hasLocation) - const SizedBox(width: 2), - if (contact.hasLocation) - Icon( - Icons.location_on, - size: 14, - color: Colors.grey[400], - ), - ], - ), - ], - ), - ), - ), - onTap: onTap, - onLongPress: onLongPress, - ), - ); - } - - Widget _buildContactAvatar(Contact contact) { - final emoji = firstEmoji(contact.name); - if (emoji != null) { - return Text(emoji, style: const TextStyle(fontSize: 18)); + /// Node-type avatar color per design language. + Color _avatarColor() { + switch (contact.type) { + case advTypeRepeater: + return MeshPalette.warn; + case advTypeRoom: + return MeshPalette.magenta; + case advTypeSensor: + return const Color(0xFF4ACCC4); // teal + default: + return MeshPalette + .blue; // chat — AvatarCircle handles deterministic hue } - return Icon(_getTypeIcon(contact.type), color: Colors.white, size: 20); } - IconData _getTypeIcon(int type) { - switch (type) { - case advTypeChat: - return Icons.chat; + /// Node-type avatar icon. Returns null for chat nodes so AvatarCircle shows initials. + IconData? _avatarIcon() { + switch (contact.type) { case advTypeRepeater: return Icons.cell_tower; case advTypeRoom: - return Icons.group; + return Icons.meeting_room; case advTypeSensor: return Icons.sensors; default: - return Icons.device_unknown; + return null; // chat uses initials } } - Color _getTypeColor(int type) { - switch (type) { - case advTypeChat: - return Colors.blue; - case advTypeRepeater: - return Colors.orange; - case advTypeRoom: - return Colors.purple; - case advTypeSensor: - return Colors.green; - default: - return Colors.grey; - } + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + final emoji = firstEmoji(contact.name); + final isChat = contact.type == advTypeChat; + final pathLen = contact.pathBytesForDisplay.length; + final isDirect = contact.pathLength >= 0; + final hasPath = pathLen > 0 || contact.pathLength == 0; + + return GestureDetector( + onSecondaryTapUp: PlatformInfo.isDesktop ? (_) => onLongPress() : null, + child: MeshCard( + onTap: onTap, + onLongPress: onLongPress, + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10), + child: Row( + children: [ + // Avatar + if (emoji != null) + Container( + width: 42, + height: 42, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: scheme.surfaceContainerHigh, + border: Border.all(color: scheme.outlineVariant), + ), + alignment: Alignment.center, + child: Text(emoji, style: const TextStyle(fontSize: 20)), + ) + else + AvatarCircle( + name: contact.name, + size: 42, + color: isChat ? null : _avatarColor(), + icon: _avatarIcon(), + ), + const SizedBox(width: 12), + // Main content + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + // Name row + route chip + Row( + children: [ + Expanded( + child: Text( + contact.name, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontWeight: unreadCount > 0 + ? FontWeight.w700 + : FontWeight.w500, + fontSize: 15, + color: scheme.onSurface, + ), + ), + ), + if (isFavorite) ...[ + const SizedBox(width: 4), + Icon(Icons.star, size: 13, color: MeshPalette.warn), + ], + if (contact.hasLocation) ...[ + const SizedBox(width: 4), + Icon( + Icons.location_on, + size: 13, + color: scheme.onSurfaceVariant.withValues( + alpha: 0.55, + ), + ), + ], + ], + ), + const SizedBox(height: 3), + // Path / subtitle row + Row( + children: [ + Expanded( + child: Text( + contact.pathLabel(context.l10n), + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12, + color: scheme.onSurfaceVariant, + ), + ), + ), + if (hasPath) ...[ + const SizedBox(width: 6), + RouteChip( + isDirect: isDirect, + hops: isDirect ? contact.pathLength : null, + ), + ], + ], + ), + ], + ), + ), + const SizedBox(width: 10), + // Trailing: time + unread badge + // Clamp text scale to prevent overflow in trailing section. + MediaQuery( + data: MediaQuery.of(context).copyWith( + textScaler: TextScaler.linear( + MediaQuery.textScalerOf(context).scale(1.0).clamp(1.0, 1.3), + ), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.min, + children: [ + if (unreadCount > 0) ...[ + UnreadBadge(count: unreadCount), + const SizedBox(height: 4), + ], + Text( + _formatLastSeen(context, lastSeen), + maxLines: 1, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.right, + style: MeshTheme.mono( + fontSize: 11, + color: unreadCount > 0 + ? MeshPalette.blue + : scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + ], + ), + ), + ); } String _formatLastSeen(BuildContext context, DateTime lastSeen) { @@ -1602,3 +1758,39 @@ class _ContactTile extends StatelessWidget { : context.l10n.contacts_lastSeenDaysAgo(days); } } + +// Wrap each contact tile with staggered entrance. +class _ContactTileEntrance extends StatelessWidget { + final int index; + final Contact contact; + final DateTime lastSeen; + final int unreadCount; + final bool isFavorite; + final VoidCallback onTap; + final VoidCallback onLongPress; + + const _ContactTileEntrance({ + required this.index, + required this.contact, + required this.lastSeen, + required this.unreadCount, + required this.isFavorite, + required this.onTap, + required this.onLongPress, + }); + + @override + Widget build(BuildContext context) { + return ListEntrance( + index: index, + child: _ContactTile( + contact: contact, + lastSeen: lastSeen, + unreadCount: unreadCount, + isFavorite: isFavorite, + onTap: onTap, + onLongPress: onLongPress, + ), + ); + } +} diff --git a/lib/screens/discovery_screen.dart b/lib/screens/discovery_screen.dart index f9f0e07e..415562c3 100644 --- a/lib/screens/discovery_screen.dart +++ b/lib/screens/discovery_screen.dart @@ -7,11 +7,14 @@ import 'package:provider/provider.dart'; import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; import '../l10n/l10n.dart'; +import '../l10n/contact_localization.dart'; import '../models/contact.dart'; +import '../theme/mesh_theme.dart'; import '../utils/contact_search.dart'; import '../utils/platform_info.dart'; import '../widgets/app_bar.dart'; import '../widgets/list_filter_widget.dart'; +import '../widgets/mesh_ui.dart'; import '../helpers/snack_bar_builder.dart'; enum DiscoverySortOption { lastSeen, name, type } @@ -46,6 +49,34 @@ class _DiscoveryScreenState extends State { : contact.lastSeen; } + /// Node-type avatar color per design language. + Color _avatarColor(int type) { + switch (type) { + case advTypeRepeater: + return MeshPalette.warn; + case advTypeRoom: + return MeshPalette.magenta; + case advTypeSensor: + return const Color(0xFF4ACCC4); // teal + default: + return MeshPalette.blue; + } + } + + /// Node-type avatar icon; null = show initials for chat nodes. + IconData? _avatarIcon(int type) { + switch (type) { + case advTypeRepeater: + return Icons.cell_tower; + case advTypeRoom: + return Icons.meeting_room; + case advTypeSensor: + return Icons.sensors; + default: + return null; + } + } + @override Widget build(BuildContext context) { final l10n = context.l10n; @@ -71,7 +102,10 @@ class _DiscoveryScreenState extends State { PopupMenuItem( child: Row( children: [ - const Icon(Icons.delete, color: Colors.red), + Icon( + Icons.delete, + color: Theme.of(context).colorScheme.error, + ), const SizedBox(width: 8), Text(context.l10n.discoveredContacts_deleteContactAll), ], @@ -89,103 +123,185 @@ class _DiscoveryScreenState extends State { children: [ _buildFilters(filteredAndSorted, connector), Expanded( - child: discoveredContacts.isEmpty - ? Center(child: Text(l10n.contacts_noContacts)) - : filteredAndSorted.isEmpty - ? Center(child: Text(l10n.discoveredContacts_noMatching)) - : ListView.builder( - itemCount: filteredAndSorted.length, - itemBuilder: (context, index) { - final contact = filteredAndSorted[index]; - final tile = ListTile( - leading: CircleAvatar( - backgroundColor: _getTypeColor(contact.type), - child: Icon( - _getTypeIcon(contact.type), - color: Colors.white, - size: 20, - ), - ), - title: Text( + child: AnimatedSwitcher( + duration: const Duration(milliseconds: 220), + child: discoveredContacts.isEmpty + ? Center( + key: const ValueKey('empty_all'), + child: Text(l10n.contacts_noContacts), + ) + : filteredAndSorted.isEmpty + ? Center( + key: const ValueKey('empty_filtered'), + child: Text(l10n.discoveredContacts_noMatching), + ) + : ListView.builder( + key: const ValueKey('list'), + padding: const EdgeInsets.only(bottom: 24), + itemCount: filteredAndSorted.length, + itemBuilder: (context, index) { + final contact = filteredAndSorted[index]; + final tile = _buildDiscoveryTile( + context, + contact, + connector, + index, + ); + if (PlatformInfo.isDesktop) { + return GestureDetector( + onSecondaryTapUp: (_) => + _showContactContextMenu(contact, connector), + child: tile, + ); + } + return tile; + }, + ), + ), + ), + ], + ), + ); + } + + Widget _buildDiscoveryTile( + BuildContext context, + Contact contact, + MeshCoreConnector connector, + int index, + ) { + final scheme = Theme.of(context).colorScheme; + final isChat = contact.type == advTypeChat; + + return ListEntrance( + index: index, + child: MeshCard( + onTap: () async { + try { + final imported = await connector.importDiscoveredContact(contact); + if (!context.mounted) return; + if (!imported) { + showDismissibleSnackBar( + context, + content: Text(context.l10n.contacts_contactImportFailed), + ); + return; + } + showDismissibleSnackBar( + context, + content: Text(context.l10n.discoveredContacts_contactAdded), + action: SnackBarAction( + label: context.l10n.common_undo, + onPressed: () => connector.removeContact(contact), + ), + ); + } catch (_) { + if (!context.mounted) return; + showDismissibleSnackBar( + context, + content: Text(context.l10n.contacts_contactImportFailed), + ); + } + }, + onLongPress: () => _showContactContextMenu(contact, connector), + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10), + child: Row( + children: [ + AvatarCircle( + name: contact.name, + size: 42, + color: isChat ? null : _avatarColor(contact.type), + icon: _avatarIcon(contact.type), + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + // Name + type chip + Row( + children: [ + Expanded( + child: Text( contact.name, maxLines: 1, overflow: TextOverflow.ellipsis, + style: const TextStyle( + fontWeight: FontWeight.w500, + fontSize: 15, + ), ), - subtitle: Text( + ), + const SizedBox(width: 6), + StatusChip( + label: contact.typeLabel(context.l10n).toUpperCase(), + color: _avatarColor(contact.type), + icon: _avatarIcon(contact.type), + ), + ], + ), + const SizedBox(height: 3), + // Short pub key + Row( + children: [ + Expanded( + child: Text( contact.shortPubKeyHex, maxLines: 1, overflow: TextOverflow.ellipsis, - ), - // Clamp text scaling in trailing section to prevent overflow while - // maintaining accessibility. Primary content (title/subtitle) scales normally. - trailing: MediaQuery( - data: MediaQuery.of(context).copyWith( - textScaler: TextScaler.linear( - MediaQuery.textScalerOf( - context, - ).scale(1.0).clamp(1.0, 1.3), - ), - ), - child: SizedBox( - width: 120, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - _formatLastSeen( - context, - _resolveLastSeen(contact), - ), - maxLines: 1, - overflow: TextOverflow.ellipsis, - textAlign: TextAlign.right, - style: TextStyle( - fontSize: 12, - color: Colors.grey[600], - ), - ), - Row( - mainAxisSize: MainAxisSize.min, - children: [ - if (contact.hasLocation) - Icon( - Icons.location_on, - size: 14, - color: Colors.grey[400], - ), - if (contact.rawPacket != null) - const SizedBox(width: 2), - if (contact.rawPacket != null) - Icon( - Icons.cell_tower, - size: 14, - color: Colors.grey[400], - ), - ], - ), - ], - ), + style: MeshTheme.mono( + fontSize: 11, + color: scheme.onSurfaceVariant, ), ), - onTap: () { - connector.importDiscoveredContact(contact); - }, - onLongPress: () => - _showContactContextMenu(contact, connector), - ); - if (PlatformInfo.isDesktop) { - return GestureDetector( - onSecondaryTapUp: (_) => - _showContactContextMenu(contact, connector), - child: tile, - ); - } - return tile; - }, + ), + if (contact.hasLocation) ...[ + const SizedBox(width: 6), + Icon( + Icons.location_on, + size: 13, + color: scheme.onSurfaceVariant.withValues( + alpha: 0.55, + ), + ), + ], + if (contact.rawPacket != null) ...[ + const SizedBox(width: 4), + Icon( + Icons.cell_tower, + size: 13, + color: scheme.onSurfaceVariant.withValues( + alpha: 0.55, + ), + ), + ], + ], ), - ), - ], + ], + ), + ), + const SizedBox(width: 10), + // Last seen time + MediaQuery( + data: MediaQuery.of(context).copyWith( + textScaler: TextScaler.linear( + MediaQuery.textScalerOf(context).scale(1.0).clamp(1.0, 1.3), + ), + ), + child: Text( + _formatLastSeen(context, _resolveLastSeen(contact)), + maxLines: 1, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.right, + style: MeshTheme.mono( + fontSize: 11, + color: scheme.onSurfaceVariant, + ), + ), + ), + ], + ), ), ); } @@ -194,19 +310,17 @@ class _DiscoveryScreenState extends State { Contact contact, MeshCoreConnector connector, ) async { - final action = await showModalBottomSheet( - context: context, - showDragHandle: true, + final action = await showMeshSheet( + context, builder: (sheetContext) { final l10n = context.l10n; return SafeArea( child: Column( mainAxisSize: MainAxisSize.min, children: [ - ListTile( - leading: const Icon(Icons.add_reaction_sharp), - title: Text(l10n.discoveredContacts_addContact), - onTap: () => Navigator.of(sheetContext).pop('import_contact'), + BottomSheetHeader( + title: contact.name, + subtitle: contact.typeLabel(l10n), ), ListTile( leading: const Icon(Icons.copy), @@ -218,6 +332,7 @@ class _DiscoveryScreenState extends State { title: Text(l10n.discoveredContacts_deleteContact), onTap: () => Navigator.of(sheetContext).pop('delete_contact'), ), + const SizedBox(height: 8), ], ), ); @@ -227,9 +342,6 @@ class _DiscoveryScreenState extends State { if (!mounted || action == null) return; switch (action) { - case 'import_contact': - connector.importDiscoveredContact(contact); - break; case 'copy_contact': if (contact.rawPacket == null) return; final hexString = pubKeyToHex(contact.rawPacket!); @@ -429,36 +541,6 @@ class _DiscoveryScreenState extends State { } } - IconData _getTypeIcon(int type) { - switch (type) { - case advTypeChat: - return Icons.chat; - case advTypeRepeater: - return Icons.cell_tower; - case advTypeRoom: - return Icons.group; - case advTypeSensor: - return Icons.sensors; - default: - return Icons.device_unknown; - } - } - - Color _getTypeColor(int type) { - switch (type) { - case advTypeChat: - return Colors.blue; - case advTypeRepeater: - return Colors.orange; - case advTypeRoom: - return Colors.purple; - case advTypeSensor: - return Colors.green; - default: - return Colors.grey; - } - } - String _formatLastSeen(BuildContext context, DateTime lastSeen) { final now = DateTime.now(); final diff = now.difference(lastSeen); diff --git a/lib/screens/line_of_sight_map_screen.dart b/lib/screens/line_of_sight_map_screen.dart index f908f5ea..57d7603f 100644 --- a/lib/screens/line_of_sight_map_screen.dart +++ b/lib/screens/line_of_sight_map_screen.dart @@ -19,6 +19,8 @@ import '../connector/meshcore_connector.dart'; import '../widgets/app_bar.dart'; import '../widgets/quick_switch_bar.dart'; import '../icons/los_icon.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/themed_map_tile_layer.dart'; class LineOfSightEndpoint { final String label; @@ -30,7 +32,7 @@ class LineOfSightEndpoint { const LineOfSightEndpoint({ required this.label, required this.point, - this.color = Colors.green, + this.color = LosPalette.clear, this.icon = Icons.location_on, this.isCustom = false, }); @@ -59,9 +61,12 @@ class _LineOfSightMapScreenState extends State { static const double _labelZoomThreshold = 8.5; static const double _mapMinZoom = 2.0; static const double _mapMaxZoom = 18.0; + static const double _marginalClearanceMeters = 5.0; final LineOfSightService _lineOfSightService = LineOfSightService(); final MapController _mapController = MapController(); + final DraggableScrollableController _panelController = + DraggableScrollableController(); bool _loading = false; String? _error; @@ -73,12 +78,13 @@ class _LineOfSightMapScreenState extends State { double _startAntennaHeight = 5.0; double _endAntennaHeight = 5.0; bool _showHud = true; - bool _menuExpanded = true; + bool _menuExpanded = false; bool _showDisplayNodes = true; bool _showMarkerLabels = true; bool _didReceivePositionUpdate = false; int _losRequestNonce = 0; bool _initialLosScheduled = false; + bool _showTerrainLayer = true; @override void initState() { @@ -104,6 +110,7 @@ class _LineOfSightMapScreenState extends State { @override void dispose() { _mapController.dispose(); + _panelController.dispose(); _lineOfSightService.dispose(); super.dispose(); } @@ -140,48 +147,6 @@ class _LineOfSightMapScreenState extends State { _mapController.move(initialCenter, initialZoom); } - Widget _buildDesktopMapControls({ - required LatLng initialCenter, - required double initialZoom, - required LatLngBounds? bounds, - }) { - final screenHeight = MediaQuery.of(context).size.height; - final topOffset = _showHud - ? math.min(screenHeight * 0.52 + 24, screenHeight - 220) - : 12.0; - return Positioned( - top: topOffset, - left: 12, - child: Card( - elevation: 4, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - IconButton( - icon: const Icon(Icons.add), - tooltip: 'Zoom in', - onPressed: () => _zoomMapBy(1), - ), - IconButton( - icon: const Icon(Icons.remove), - tooltip: 'Zoom out', - onPressed: () => _zoomMapBy(-1), - ), - IconButton( - icon: const Icon(Icons.my_location), - tooltip: 'Center map', - onPressed: () => _resetMapView( - initialCenter: initialCenter, - initialZoom: initialZoom, - bounds: bounds, - ), - ), - ], - ), - ), - ); - } - Future _runLos() async { final start = _start; final end = _end; @@ -224,6 +189,7 @@ class _LineOfSightMapScreenState extends State { setState(() { _result = result; _selectedObstruction = _defaultObstructionFor(result); + _menuExpanded = false; }); } catch (e) { if (!mounted) return; @@ -287,7 +253,7 @@ class _LineOfSightMapScreenState extends State { final endpoint = LineOfSightEndpoint( label: context.l10n.losCustomPointLabel(_customEndpoints.length + 1), point: point, - color: Colors.orange, + color: LosPalette.marginal, icon: Icons.push_pin, isCustom: true, ); @@ -414,16 +380,23 @@ class _LineOfSightMapScreenState extends State { title: AppBarTitle(widget.title), centerTitle: true, actions: [ - IconButton( - icon: _loading - ? const SizedBox( - width: 20, - height: 20, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.delete_outline), - onPressed: _loading ? null : _clearAllPoints, - tooltip: context.l10n.losClearAllPoints, + PopupMenuButton( + onSelected: (value) { + if (value == 'clear') _clearAllPoints(); + }, + itemBuilder: (context) => [ + PopupMenuItem( + value: 'clear', + enabled: !_loading, + child: Row( + children: [ + const Icon(Icons.delete_outline), + const SizedBox(width: 10), + Text(context.l10n.losClearAllPoints), + ], + ), + ), + ], ), ], ), @@ -469,11 +442,9 @@ class _LineOfSightMapScreenState extends State { }, ), children: [ - TileLayer( - urlTemplate: kMapTileUrlTemplate, - tileProvider: tileCache.tileProvider, - userAgentPackageName: MapTileCacheService.userAgentPackageName, - maxZoom: 19, + ThemedMapTileLayer( + tileCache: tileCache, + opacity: _showTerrainLayer ? 1 : 0.72, ), if (_result != null && _result!.segments.isNotEmpty) PolylineLayer(polylines: _buildSegmentPolylines(_result!)), @@ -482,58 +453,38 @@ class _LineOfSightMapScreenState extends State { ), ], ), - if (isDesktop) - _buildDesktopMapControls( - initialCenter: initialCenter, - initialZoom: initialZoom, - bounds: bounds, - ), + _buildLinkBanner(isImperial), + _buildMapControlRail( + initialCenter: initialCenter, + initialZoom: initialZoom, + bounds: bounds, + isImperial: isImperial, + ), if (_showHud) - Positioned( - left: 12, - right: 12, - top: 12, - child: ConstrainedBox( - constraints: BoxConstraints( - maxHeight: MediaQuery.of(context).size.height * 0.52, - ), - child: _buildControlPanel(isImperial), + DraggableScrollableSheet( + controller: _panelController, + initialChildSize: 0.43, + minChildSize: 0.14, + maxChildSize: 0.88, + snap: true, + snapSizes: const [0.14, 0.43, 0.88], + builder: (context, scrollController) => Theme( + data: MeshTheme.dark(), + child: _buildControlPanel(isImperial, scrollController), ), ), - if (!_showHud && _result != null && _result!.segments.isNotEmpty) + if (_loading) Positioned( - left: 12, - bottom: 12, - child: DecoratedBox( - decoration: BoxDecoration( - color: Colors.black54, - borderRadius: BorderRadius.circular(8), - ), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 8, - vertical: 4, - ), - child: Text( - context.l10n.losElevationAttribution, - style: const TextStyle(fontSize: 10, color: Colors.white), - ), - ), + left: 0, + right: 0, + top: 0, + child: LinearProgressIndicator( + color: LosPalette.selected, + backgroundColor: LosPalette.chartBackground, ), ), ], ), - floatingActionButton: FloatingActionButton( - onPressed: () { - setState(() { - _showHud = !_showHud; - }); - }, - tooltip: _showHud - ? context.l10n.losHidePanelTooltip - : context.l10n.losShowPanelTooltip, - child: Icon(_showHud ? Icons.visibility_off : Icons.tune), - ), bottomNavigationBar: SafeArea( top: false, child: QuickSwitchBar( @@ -545,12 +496,477 @@ class _LineOfSightMapScreenState extends State { channelsUnreadCount: context .watch() .getTotalChannelsUnreadCount(), + highContrast: true, ), ), ); } - Widget _buildControlPanel(bool isImperial) { + Widget _buildLinkBanner(bool isImperial) { + final connector = context.watch(); + final segment = _primarySegmentResult(); + final status = _losStatusFor(segment); + final battery = connector.batteryPercent; + final snr = connector.latestRadioStats?.lastSnrDb; + return Positioned( + top: 10, + left: 12, + right: 12, + child: IgnorePointer( + ignoring: false, + child: Material( + color: LosPalette.panelDark, + borderRadius: BorderRadius.circular(MeshRadii.md), + shadowColor: LosPalette.shadow, + elevation: 4, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10), + child: Row( + children: [ + Container( + width: 36, + height: 36, + decoration: BoxDecoration( + color: _statusColorFor(status).withValues(alpha: 0.18), + shape: BoxShape.circle, + border: Border.all(color: _statusColorFor(status)), + ), + child: Icon( + _statusIcon(status), + color: _statusColorFor(status), + size: 20, + ), + ), + const SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '${_start?.label ?? 'A'} → ${_end?.label ?? 'B'}', + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: const TextStyle( + color: LosPalette.text, + fontSize: 14, + fontWeight: FontWeight.w800, + ), + ), + const SizedBox(height: 2), + Text( + segment == null + ? _statusText() + : '${_statusLabel(status)} • ' + '${_formatDistanceValue(segment.totalDistanceMeters, isImperial)} ' + '${isImperial ? 'mi' : 'km'}', + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: const TextStyle( + color: LosPalette.textMuted, + fontSize: 11.5, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + ), + _headerMetric( + Icons.battery_5_bar, + battery == null ? '--' : '$battery%', + ), + const SizedBox(width: 10), + _headerMetric( + Icons.network_cell, + snr == null ? '--' : '${snr.toStringAsFixed(1)} dB', + ), + ], + ), + ), + ), + ), + ); + } + + Widget _headerMetric(IconData icon, String value) { + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(icon, color: LosPalette.textMuted, size: 16), + const SizedBox(height: 2), + Text( + value, + style: MeshTheme.mono( + color: LosPalette.text, + fontSize: 10, + fontWeight: FontWeight.w700, + ), + ), + ], + ); + } + + Widget _buildMapControlRail({ + required LatLng initialCenter, + required double initialZoom, + required LatLngBounds? bounds, + required bool isImperial, + }) { + return Positioned( + right: 12, + top: 92, + child: Material( + color: LosPalette.panelDark, + borderRadius: BorderRadius.circular(MeshRadii.md), + clipBehavior: Clip.antiAlias, + elevation: 4, + shadowColor: LosPalette.shadow, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + color: LosPalette.text, + icon: const Icon(Icons.add), + tooltip: context.l10n.map_zoomIn, + onPressed: () => _zoomMapBy(1), + ), + IconButton( + color: LosPalette.text, + icon: const Icon(Icons.remove), + tooltip: context.l10n.map_zoomOut, + onPressed: () => _zoomMapBy(-1), + ), + IconButton( + color: LosPalette.text, + icon: const Icon(Icons.center_focus_strong), + tooltip: context.l10n.map_centerMap, + onPressed: () => _resetMapView( + initialCenter: initialCenter, + initialZoom: initialZoom, + bounds: bounds, + ), + ), + IconButton( + color: _showTerrainLayer + ? LosPalette.selected + : LosPalette.textMuted, + icon: const Icon(Icons.layers_outlined), + tooltip: 'Map detail', + onPressed: () => + setState(() => _showTerrainLayer = !_showTerrainLayer), + ), + IconButton( + color: LosPalette.text, + icon: Text( + isImperial ? 'ft' : 'm', + style: const TextStyle( + color: LosPalette.text, + fontSize: 12, + fontWeight: FontWeight.w800, + ), + ), + tooltip: 'Units', + onPressed: () => context.read().setUnitSystem( + isImperial ? UnitSystem.metric : UnitSystem.imperial, + ), + ), + IconButton( + color: _showHud ? LosPalette.selected : LosPalette.text, + icon: Icon( + _showHud ? Icons.keyboard_arrow_down : Icons.analytics_outlined, + ), + tooltip: _showHud + ? context.l10n.losHidePanelTooltip + : context.l10n.losShowPanelTooltip, + onPressed: () => setState(() => _showHud = !_showHud), + ), + ], + ), + ), + ); + } + + Widget _buildResultSummary(LineOfSightResult? segment, bool isImperial) { + final status = _losStatusFor(segment); + final color = _statusColorFor(status); + final distanceUnit = isImperial ? 'mi' : 'km'; + final heightUnit = isImperial ? 'ft' : 'm'; + final worst = _defaultObstructionFor(_result); + final minClearance = segment == null || segment.samples.isEmpty + ? null + : segment.samples + .map((sample) => sample.clearanceMeters) + .reduce(math.min); + final amount = segment == null + ? '--' + : segment.isClear + ? '${_formatHeightValue(minClearance ?? 0, isImperial)} $heightUnit' + : '${_formatHeightValue(segment.maxObstructionMeters, isImperial)} $heightUnit'; + return Container( + padding: const EdgeInsets.all(14), + decoration: BoxDecoration( + color: color.withValues(alpha: 0.12), + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: color.withValues(alpha: 0.8)), + ), + child: Column( + children: [ + Row( + children: [ + Icon(_statusIcon(status), color: color, size: 24), + const SizedBox(width: 9), + Expanded( + child: Text( + _statusLabel(status), + style: TextStyle( + color: color, + fontSize: 19, + fontWeight: FontWeight.w900, + ), + ), + ), + if (_loading) + const SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator(strokeWidth: 2), + ), + ], + ), + const SizedBox(height: 12), + Row( + children: [ + _summaryMetric( + 'Distance', + segment == null + ? '--' + : '${_formatDistanceValue(segment.totalDistanceMeters, isImperial)} $distanceUnit', + ), + _summaryMetric( + segment?.isClear == true ? 'Clearance' : 'Blocked by', + amount, + valueColor: color, + ), + _summaryMetric( + 'Obstruction', + worst == null + ? '--' + : '${_formatDistanceValue(worst.distanceMeters, isImperial)} $distanceUnit from A', + ), + ], + ), + ], + ), + ); + } + + Widget _summaryMetric(String label, String value, {Color? valueColor}) { + return Expanded( + child: Padding( + padding: const EdgeInsets.only(right: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + label.toUpperCase(), + style: const TextStyle( + color: LosPalette.textMuted, + fontSize: 9, + fontWeight: FontWeight.w700, + ), + ), + const SizedBox(height: 3), + Text( + value, + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: MeshTheme.mono( + color: valueColor ?? LosPalette.text, + fontSize: 11.5, + fontWeight: FontWeight.w800, + ), + ), + ], + ), + ), + ); + } + + Widget _buildObstructionCard( + LineOfSightObstruction obstruction, + bool isImperial, { + required bool isWorst, + }) { + final selected = + _selectedObstruction?.sampleIndex == obstruction.sampleIndex; + final distanceUnit = isImperial ? 'mi' : 'km'; + final heightUnit = isImperial ? 'ft' : 'm'; + return InkWell( + onTap: () => _centerOnObstruction(obstruction), + borderRadius: BorderRadius.circular(MeshRadii.sm), + child: Container( + width: 154, + padding: const EdgeInsets.all(10), + decoration: BoxDecoration( + color: selected + ? LosPalette.selected.withValues(alpha: 0.18) + : LosPalette.chartBackground, + borderRadius: BorderRadius.circular(MeshRadii.sm), + border: Border.all( + color: selected ? LosPalette.selected : LosPalette.border, + width: selected ? 2 : 1, + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + const Icon( + Icons.warning_amber_rounded, + color: LosPalette.blocked, + size: 17, + ), + const SizedBox(width: 5), + Expanded( + child: Text( + '${_formatDistanceValue(obstruction.distanceMeters, isImperial)} $distanceUnit', + style: const TextStyle( + color: LosPalette.text, + fontSize: 12, + fontWeight: FontWeight.w800, + ), + ), + ), + if (isWorst) + Container( + padding: const EdgeInsets.symmetric( + horizontal: 5, + vertical: 2, + ), + decoration: BoxDecoration( + color: LosPalette.blocked, + borderRadius: BorderRadius.circular(99), + ), + child: const Text( + 'WORST', + style: TextStyle( + color: Colors.white, + fontSize: 8, + fontWeight: FontWeight.w900, + ), + ), + ), + ], + ), + const Spacer(), + Text( + 'Blocked ${_formatHeightValue(obstruction.obstructionMeters, isImperial)} $heightUnit', + style: const TextStyle( + color: LosPalette.textMuted, + fontSize: 11, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + ), + ); + } + + Widget _buildSelectedObstructionCard( + LineOfSightObstruction obstruction, + LineOfSightResult segment, + bool isImperial, + ) { + final distanceUnit = isImperial ? 'mi' : 'km'; + final heightUnit = isImperial ? 'ft' : 'm'; + return Container( + padding: const EdgeInsets.all(14), + decoration: BoxDecoration( + color: LosPalette.selected.withValues(alpha: 0.12), + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: LosPalette.selected), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text( + 'Selected obstruction', + style: TextStyle( + color: LosPalette.text, + fontSize: 14, + fontWeight: FontWeight.w800, + ), + ), + const SizedBox(height: 10), + Wrap( + spacing: 18, + runSpacing: 10, + children: [ + _detailValue( + 'Blocked by', + '${_formatHeightValue(obstruction.obstructionMeters, isImperial)} $heightUnit', + ), + _detailValue( + 'From A', + '${_formatDistanceValue(obstruction.distanceMeters, isImperial)} $distanceUnit', + ), + _detailValue( + 'From B', + '${_formatDistanceValue(segment.totalDistanceMeters - obstruction.distanceMeters, isImperial)} $distanceUnit', + ), + _detailValue( + 'Elevation', + '${_formatHeightValue(obstruction.terrainMeters, isImperial)} $heightUnit', + ), + ], + ), + const SizedBox(height: 10), + Align( + alignment: Alignment.centerRight, + child: OutlinedButton.icon( + onPressed: () => _centerOnObstruction(obstruction), + icon: const Icon(Icons.center_focus_strong, size: 17), + label: const Text('Center on map'), + ), + ), + ], + ), + ); + } + + Widget _detailValue(String label, String value) { + return SizedBox( + width: 120, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + label.toUpperCase(), + style: const TextStyle( + color: LosPalette.textMuted, + fontSize: 9, + fontWeight: FontWeight.w700, + ), + ), + const SizedBox(height: 2), + Text( + value, + style: MeshTheme.mono( + color: LosPalette.text, + fontSize: 12, + fontWeight: FontWeight.w700, + ), + ), + ], + ), + ); + } + + Widget _buildControlPanel( + bool isImperial, + ScrollController scrollController, + ) { _sanitizeSelection(); final segment = _primarySegmentResult(); final connector = context.read(); @@ -570,350 +986,265 @@ class _LineOfSightMapScreenState extends State { final antennaBDisplay = _toDisplayHeight(antennaBMeters, isImperial); final antennaSliderMax = isImperial ? _maxAntennaFeet : _maxAntennaMeters; final antennaSliderDivisions = isImperial ? 400 : 122; - return Card( - child: Padding( - padding: const EdgeInsets.all(12), - child: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, + final worst = _defaultObstructionFor(_result); + return Material( + color: LosPalette.panelDark, + borderRadius: const BorderRadius.vertical( + top: Radius.circular(MeshRadii.lg), + ), + clipBehavior: Clip.antiAlias, + child: ListView( + controller: scrollController, + padding: const EdgeInsets.fromLTRB(16, 8, 16, 28), + children: [ + Center( + child: Container( + width: 44, + height: 5, + decoration: BoxDecoration( + color: LosPalette.textMuted.withValues(alpha: 0.55), + borderRadius: BorderRadius.circular(99), + ), + ), + ), + const SizedBox(height: 10), + _buildResultSummary(segment, isImperial), + if (segment != null) ...[ + const SizedBox(height: 14), + _buildProfileView(segment, distanceUnit, heightUnit, isImperial), + const SizedBox(height: 10), + _LosLegend( + terrainLabel: context.l10n.losLegendTerrain, + losBeamLabel: context.l10n.losLegendLosBeam, + radioHorizonLabel: context.l10n.losLegendRadioHorizon, + ), + ], + if (obstructions.isNotEmpty) ...[ + const SizedBox(height: 18), + Text( + context.l10n.losBlockedSpotsTitle, + style: const TextStyle( + color: LosPalette.text, + fontSize: 15, + fontWeight: FontWeight.w800, + ), + ), + const SizedBox(height: 4), + Text( + context.l10n.losBlockedSpotsHint, + style: const TextStyle(color: LosPalette.textMuted, fontSize: 12), + ), + const SizedBox(height: 10), + SizedBox( + height: 86, + child: ListView.separated( + scrollDirection: Axis.horizontal, + itemCount: obstructions.length, + separatorBuilder: (_, _) => const SizedBox(width: 8), + itemBuilder: (context, index) { + final obstruction = obstructions[index]; + return _buildObstructionCard( + obstruction, + isImperial, + isWorst: obstruction.sampleIndex == worst?.sampleIndex, + ); + }, + ), + ), + ], + if (_selectedObstruction != null && segment != null) ...[ + const SizedBox(height: 14), + _buildSelectedObstructionCard( + _selectedObstruction!, + segment, + isImperial, + ), + ], + const SizedBox(height: 12), + ExpansionTile( + initiallyExpanded: _menuExpanded, + onExpansionChanged: (value) => + setState(() => _menuExpanded = value), + tilePadding: EdgeInsets.zero, + childrenPadding: EdgeInsets.zero, + iconColor: LosPalette.text, + collapsedIconColor: LosPalette.textMuted, + title: Text( + context.l10n.losMenuTitle, + style: const TextStyle( + color: LosPalette.text, + fontSize: 14, + fontWeight: FontWeight.w700, + ), + ), + subtitle: Text( + context.l10n.losMenuSubtitle, + style: const TextStyle(color: LosPalette.textMuted, fontSize: 11), + ), children: [ - if (segment != null) - _buildProfileView(segment, distanceUnit, heightUnit, isImperial) - else - SizedBox( - height: 44, - child: Center( - child: Text( - context.l10n.losRunToViewElevationProfile, - style: const TextStyle(fontSize: 11), - ), - ), + SwitchListTile( + dense: true, + contentPadding: EdgeInsets.zero, + title: Text( + context.l10n.losShowDisplayNodes, + style: const TextStyle(fontSize: 12), ), - if (segment != null) ...[ - const SizedBox(height: 8), - _LosLegend( - terrainLabel: context.l10n.losLegendTerrain, - losBeamLabel: context.l10n.losLegendLosBeam, - radioHorizonLabel: context.l10n.losLegendRadioHorizon, - ), - ], - const SizedBox(height: 8), - Text( - segment != null - ? _profileStats(segment, isImperial) - : _statusText(), - style: TextStyle( - fontSize: 12, - color: segment != null - ? (segment.isClear ? Colors.green : Colors.red) - : _statusColor(), - fontWeight: FontWeight.w600, - ), - ), - if (obstructions.isNotEmpty) ...[ - const SizedBox(height: 8), - Text( - context.l10n.losBlockedSpotsTitle, - style: const TextStyle( - fontSize: 12, - fontWeight: FontWeight.w700, - ), - ), - const SizedBox(height: 4), - Text( - context.l10n.losBlockedSpotsHint, - style: TextStyle(fontSize: 11, color: Colors.grey[700]), - ), - const SizedBox(height: 6), - Wrap( - spacing: 6, - runSpacing: 6, - children: [ - for (final obstruction in obstructions) - ChoiceChip( - label: Text( - _obstructionChipLabel(obstruction, isImperial), - style: const TextStyle(fontSize: 11), - ), - selected: - _selectedObstruction?.sampleIndex == - obstruction.sampleIndex, - onSelected: (_) => _selectObstruction(obstruction), - ), - ], - ), - if (_selectedObstruction != null) ...[ - const SizedBox(height: 8), - DecoratedBox( - decoration: BoxDecoration( - color: Colors.orange.withValues(alpha: 0.1), - borderRadius: BorderRadius.circular(10), - border: Border.all( - color: Colors.deepOrangeAccent.withValues(alpha: 0.45), - ), - ), - child: Padding( - padding: const EdgeInsets.all(10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - context.l10n.losSelectedObstructionTitle, - style: const TextStyle( - fontSize: 12, - fontWeight: FontWeight.w700, - ), - ), - const SizedBox(height: 4), - Text( - context.l10n.losSelectedObstructionDetails( - _formatHeightValue( - _selectedObstruction!.obstructionMeters, - isImperial, - ), - heightUnit, - _formatDistanceValue( - _selectedObstruction!.distanceMeters, - isImperial, - ), - distanceUnit, - _formatDistanceValue( - segment!.totalDistanceMeters - - _selectedObstruction!.distanceMeters, - isImperial, - ), - ), - style: const TextStyle(fontSize: 11), - ), - const SizedBox(height: 4), - Text( - '${_selectedObstruction!.point.latitude.toStringAsFixed(5)}, ' - '${_selectedObstruction!.point.longitude.toStringAsFixed(5)}', - style: TextStyle( - fontSize: 11, - color: Colors.grey[700], - ), - ), - ], - ), - ), - ), - ], - ], - const SizedBox(height: 4), - if (displayFrequencyMHz != null) - Padding( - padding: const EdgeInsets.only(top: 2, bottom: 4), - child: Row( - children: [ - Text( - context.l10n.losFrequencyLabel, - style: TextStyle( - fontSize: 11, - color: Colors.grey[700], - fontWeight: FontWeight.w600, - ), - ), - const SizedBox(width: 8), - Text( - '${displayFrequencyMHz.toStringAsFixed(3)} MHz', - style: TextStyle(fontSize: 11, color: Colors.grey[700]), - ), - if (kFactorUsed != null) ...[ - const SizedBox(width: 8), - Text( - 'k=${kFactorUsed.toStringAsFixed(3)}', - style: TextStyle( - fontSize: 11, - color: Colors.grey[700], - ), - ), - const SizedBox(width: 4), - IconButton( - padding: EdgeInsets.zero, - constraints: const BoxConstraints(), - icon: const Icon(Icons.info_outline, size: 16), - color: Colors.grey[600], - tooltip: context.l10n.losFrequencyInfoTooltip, - onPressed: () { - _showFrequencyInfoDialog( - context, - displayFrequencyMHz, - kFactorUsed, - ); - }, - ), - ], - ], - ), - ), - Text( - context.l10n.losElevationAttribution, - style: TextStyle(fontSize: 10, color: Colors.grey[700]), - ), - const SizedBox(height: 6), - ExpansionTile( - initiallyExpanded: _menuExpanded, - onExpansionChanged: (value) { + value: _showDisplayNodes, + onChanged: (value) { setState(() { - _menuExpanded = value; + _showDisplayNodes = value; + _sanitizeSelection(); + _result = null; + _selectedObstruction = null; }); }, - tilePadding: EdgeInsets.zero, - childrenPadding: EdgeInsets.zero, - title: Text( - context.l10n.losMenuTitle, - style: const TextStyle( - fontSize: 13, - fontWeight: FontWeight.w700, - ), + ), + if (_customEndpoints.isNotEmpty) ...[ + const SizedBox(height: 6), + Text( + context.l10n.losCustomPoints, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600), ), - subtitle: Text( - context.l10n.losMenuSubtitle, - style: const TextStyle(fontSize: 11), - ), - children: [ - SwitchListTile( + for (final point in _customEndpoints) + ListTile( dense: true, contentPadding: EdgeInsets.zero, title: Text( - context.l10n.losShowDisplayNodes, + point.label, style: const TextStyle(fontSize: 12), ), - value: _showDisplayNodes, - onChanged: (value) { - setState(() { - _showDisplayNodes = value; - _sanitizeSelection(); - _result = null; - _selectedObstruction = null; - }); - }, - ), - if (_customEndpoints.isNotEmpty) ...[ - const SizedBox(height: 6), - Text( - context.l10n.losCustomPoints, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - ), + subtitle: Text( + '${point.point.latitude.toStringAsFixed(5)}, ${point.point.longitude.toStringAsFixed(5)}', + style: const TextStyle(fontSize: 11), ), - for (final point in _customEndpoints) - ListTile( - dense: true, - contentPadding: EdgeInsets.zero, - title: Text( - point.label, - style: const TextStyle(fontSize: 12), + trailing: Row( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + icon: const Icon(Icons.edit, size: 18), + onPressed: () => _renameCustomPoint(point), + tooltip: context.l10n.common_edit, ), - subtitle: Text( - '${point.point.latitude.toStringAsFixed(5)}, ${point.point.longitude.toStringAsFixed(5)}', - style: const TextStyle(fontSize: 11), + IconButton( + icon: const Icon(Icons.delete_outline, size: 18), + onPressed: () => _deleteCustomPoint(point), + tooltip: context.l10n.common_delete, ), - trailing: Row( - mainAxisSize: MainAxisSize.min, - children: [ - IconButton( - icon: const Icon(Icons.edit, size: 18), - onPressed: () => _renameCustomPoint(point), - tooltip: context.l10n.common_edit, - ), - IconButton( - icon: const Icon(Icons.delete_outline, size: 18), - onPressed: () => _deleteCustomPoint(point), - tooltip: context.l10n.common_delete, - ), - ], - ), - ), - ], - const SizedBox(height: 8), - _buildEndpointRow( - label: context.l10n.losPointA, - value: _start, - candidates: endpoints, - onChanged: (value) { - setState(() { - _start = value; - _result = null; - _selectedObstruction = null; - }); - if (_start != null && _end != null) { - _runLos(); - } - }, - ), - const SizedBox(height: 8), - _buildEndpointRow( - label: context.l10n.losPointB, - value: _end, - candidates: endpoints, - onChanged: (value) { - setState(() { - _end = value; - _result = null; - _selectedObstruction = null; - }); - if (_start != null && _end != null) { - _runLos(); - } - }, - ), - const SizedBox(height: 10), - Text( - context.l10n.losAntennaA( - antennaADisplay.toStringAsFixed(1), - heightUnit, - ), - style: const TextStyle(fontSize: 12), - ), - Slider( - value: antennaADisplay, - min: 0, - max: antennaSliderMax, - divisions: antennaSliderDivisions, - onChanged: (value) { - setState(() { - _startAntennaHeight = _toMetersHeight( - value, - isImperial, - ); - }); - }, - ), - Text( - context.l10n.losAntennaB( - antennaBDisplay.toStringAsFixed(1), - heightUnit, - ), - style: const TextStyle(fontSize: 12), - ), - Slider( - value: antennaBDisplay, - min: 0, - max: antennaSliderMax, - divisions: antennaSliderDivisions, - onChanged: (value) { - setState(() { - _endAntennaHeight = _toMetersHeight(value, isImperial); - }); - }, - ), - Align( - alignment: Alignment.centerRight, - child: ElevatedButton.icon( - onPressed: _loading ? null : _runLos, - icon: const LosIcon(), - label: Text(context.l10n.losRun), + ], ), ), - ], + ], + const SizedBox(height: 8), + _buildEndpointRow( + label: context.l10n.losPointA, + value: _start, + candidates: endpoints, + onChanged: (value) { + setState(() { + _start = value; + _result = null; + _selectedObstruction = null; + }); + if (_start != null && _end != null) { + _runLos(); + } + }, + ), + const SizedBox(height: 8), + _buildEndpointRow( + label: context.l10n.losPointB, + value: _end, + candidates: endpoints, + onChanged: (value) { + setState(() { + _end = value; + _result = null; + _selectedObstruction = null; + }); + if (_start != null && _end != null) { + _runLos(); + } + }, + ), + const SizedBox(height: 10), + Text( + context.l10n.losAntennaA( + antennaADisplay.toStringAsFixed(1), + heightUnit, + ), + style: const TextStyle(fontSize: 12), + ), + Slider( + value: antennaADisplay, + min: 0, + max: antennaSliderMax, + divisions: antennaSliderDivisions, + onChanged: (value) { + setState(() { + _startAntennaHeight = _toMetersHeight(value, isImperial); + }); + }, + ), + Text( + context.l10n.losAntennaB( + antennaBDisplay.toStringAsFixed(1), + heightUnit, + ), + style: const TextStyle(fontSize: 12), + ), + Slider( + value: antennaBDisplay, + min: 0, + max: antennaSliderMax, + divisions: antennaSliderDivisions, + onChanged: (value) { + setState(() { + _endAntennaHeight = _toMetersHeight(value, isImperial); + }); + }, + ), + Align( + alignment: Alignment.centerRight, + child: FilledButton.icon( + onPressed: _loading ? null : _runLos, + icon: const LosIcon(), + label: Text(context.l10n.losRun), + ), ), ], ), - ), + if (displayFrequencyMHz != null) ...[ + const SizedBox(height: 10), + Row( + children: [ + Text( + '${context.l10n.losFrequencyLabel}: ' + '${displayFrequencyMHz.toStringAsFixed(3)} MHz' + '${kFactorUsed == null ? '' : ' k=${kFactorUsed.toStringAsFixed(3)}'}', + style: const TextStyle( + color: LosPalette.textMuted, + fontSize: 11, + ), + ), + if (kFactorUsed != null) + IconButton( + icon: const Icon(Icons.info_outline, size: 17), + color: LosPalette.textMuted, + tooltip: context.l10n.losFrequencyInfoTooltip, + onPressed: () => _showFrequencyInfoDialog( + context, + displayFrequencyMHz, + kFactorUsed, + ), + ), + ], + ), + ], + Text( + context.l10n.losElevationAttribution, + style: const TextStyle(color: LosPalette.textMuted, fontSize: 10), + ), + ], ), ); } @@ -976,6 +1307,14 @@ class _LineOfSightMapScreenState extends State { }); } + void _centerOnObstruction(LineOfSightObstruction obstruction) { + _selectObstruction(obstruction); + _mapController.move( + obstruction.point, + math.max(_mapController.camera.zoom, 15), + ); + } + String _formatDistanceValue(double meters, bool isImperial) { final value = isImperial ? (meters / 1000.0) * _kmToMiles : meters / 1000.0; return value.toStringAsFixed(2); @@ -1008,7 +1347,7 @@ class _LineOfSightMapScreenState extends State { ) { if (segment.samples.length < 2) { return SizedBox( - height: 160, + height: 190, width: double.infinity, child: CustomPaint( painter: _LosProfilePainter( @@ -1017,12 +1356,12 @@ class _LineOfSightMapScreenState extends State { heightUnit: heightUnit, badgeTextStyle: Theme.of(context).textTheme.labelSmall?.copyWith( - color: Colors.white70, + color: LosPalette.textMuted, fontSize: 10, fontWeight: FontWeight.w600, ) ?? const TextStyle( - color: Colors.white70, + color: LosPalette.textMuted, fontSize: 10, fontWeight: FontWeight.w600, ), @@ -1035,11 +1374,11 @@ class _LineOfSightMapScreenState extends State { ); } return SizedBox( - height: 160, + height: 190, width: double.infinity, child: LayoutBuilder( builder: (context, constraints) { - final size = Size(constraints.maxWidth, 160); + final size = Size(constraints.maxWidth, 190); final geometry = _LosProfileGeometry( samples: segment.samples, size: size, @@ -1055,12 +1394,12 @@ class _LineOfSightMapScreenState extends State { heightUnit: heightUnit, badgeTextStyle: Theme.of(context).textTheme.labelSmall?.copyWith( - color: Colors.white70, + color: LosPalette.textMuted, fontSize: 10, fontWeight: FontWeight.w600, ) ?? const TextStyle( - color: Colors.white70, + color: LosPalette.textMuted, fontSize: 10, fontWeight: FontWeight.w600, ), @@ -1095,23 +1434,26 @@ class _LineOfSightMapScreenState extends State { child: Tooltip( message: _obstructionChipLabel(obstruction, isImperial), child: GestureDetector( - onTap: () => _selectObstruction(obstruction), + onTap: () => _centerOnObstruction(obstruction), child: Container( width: markerSize, height: markerSize, decoration: BoxDecoration( color: isSelected - ? Colors.amberAccent - : Colors.deepOrangeAccent, + ? LosPalette.selected + : LosPalette.blocked, shape: BoxShape.circle, border: Border.all( color: isSelected - ? Colors.white - : Colors.black87, + ? LosPalette.text + : LosPalette.chartBackground, width: isSelected ? 2 : 1.5, ), boxShadow: const [ - BoxShadow(color: Colors.black45, blurRadius: 4), + BoxShadow( + color: LosPalette.shadow, + blurRadius: 4, + ), ], ), ), @@ -1127,51 +1469,19 @@ class _LineOfSightMapScreenState extends State { ); } - String _profileStats(LineOfSightResult result, bool isImperial) { - final distance = isImperial - ? (result.totalDistanceMeters / 1000.0) * _kmToMiles - : result.totalDistanceMeters / 1000.0; - final distanceUnit = isImperial ? 'mi' : 'km'; - final heightUnit = isImperial ? 'ft' : 'm'; - final minClearance = result.samples.isEmpty - ? 0.0 - : result.samples.map((s) => s.clearanceMeters).reduce(math.min); - final minClearanceDisplay = isImperial - ? minClearance * _metersToFeet - : minClearance; - final maxObstructionDisplay = isImperial - ? result.maxObstructionMeters * _metersToFeet - : result.maxObstructionMeters; - if (!result.hasData) { - return _localizedLosError(result.errorMessage); - } - if (result.isClear) { - return context.l10n.losProfileClear( - distance.toStringAsFixed(1), - distanceUnit, - minClearanceDisplay.toStringAsFixed(1), - heightUnit, - ); - } - return context.l10n.losProfileBlocked( - distance.toStringAsFixed(1), - distanceUnit, - maxObstructionDisplay.toStringAsFixed(1), - heightUnit, - ); - } - List _buildSegmentPolylines(LineOfSightPathResult result) { final polylines = []; for (final segment in result.segments) { final color = !segment.result.hasData - ? Colors.grey - : (segment.result.isClear ? Colors.green : Colors.red); + ? LosPalette.textMuted + : _statusColorFor(_losStatusFor(segment.result)); polylines.add( Polyline( points: [segment.start, segment.end], - strokeWidth: 4, + strokeWidth: 5, color: color, + borderStrokeWidth: 2, + borderColor: Colors.white, ), ); } @@ -1189,7 +1499,7 @@ class _LineOfSightMapScreenState extends State { width: 52, height: 52, child: GestureDetector( - onTap: () => _selectObstruction(obstruction), + onTap: () => _centerOnObstruction(obstruction), child: Center( child: Container( width: @@ -1207,16 +1517,20 @@ class _LineOfSightMapScreenState extends State { color: _selectedObstruction?.sampleIndex == obstruction.sampleIndex - ? Colors.amberAccent - : Colors.deepOrangeAccent, + ? LosPalette.selected + : LosPalette.blocked, width: _selectedObstruction?.sampleIndex == obstruction.sampleIndex ? 4 : 3, ), - boxShadow: const [ - BoxShadow(color: Colors.black26, blurRadius: 6), + boxShadow: [ + const BoxShadow( + color: LosPalette.shadow, + blurRadius: 8, + offset: Offset(0, 2), + ), ], ), ), @@ -1232,17 +1546,34 @@ class _LineOfSightMapScreenState extends State { onTap: () => _selectFromMap(endpoint), child: Container( decoration: BoxDecoration( - color: endpoint.color, shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), + color: (endpoint == _start || endpoint == _end) + ? endpoint.color + : LosPalette.panelDark, + border: Border.all( + color: (endpoint == _start || endpoint == _end) + ? Colors.white + : endpoint.color.withValues(alpha: 0.75), + width: (endpoint == _start || endpoint == _end) ? 2.5 : 1.5, + ), boxShadow: const [ - BoxShadow(color: Colors.black26, blurRadius: 4), + BoxShadow( + color: LosPalette.shadow, + blurRadius: 7, + offset: Offset(0, 2), + ), ], ), child: Stack( children: [ Center( - child: Icon(endpoint.icon, color: Colors.white, size: 16), + child: Icon( + endpoint.icon, + color: endpoint == _start || endpoint == _end + ? Colors.white + : endpoint.color, + size: 17, + ), ), if (endpoint == _start || endpoint == _end) Positioned( @@ -1252,17 +1583,17 @@ class _LineOfSightMapScreenState extends State { width: 14, height: 14, decoration: BoxDecoration( - color: Colors.black87, + color: LosPalette.chartBackground, borderRadius: BorderRadius.circular(7), - border: Border.all(color: Colors.white, width: 1), + border: Border.all(color: endpoint.color, width: 1), ), alignment: Alignment.center, child: Text( endpoint == _start ? 'A' : 'B', - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, + style: MeshTheme.mono( fontSize: 9, + fontWeight: FontWeight.w700, + color: endpoint.color, ), ), ), @@ -1290,18 +1621,19 @@ class _LineOfSightMapScreenState extends State { vertical: 2, ), decoration: BoxDecoration( - color: Colors.black54, - borderRadius: BorderRadius.circular(8), + color: LosPalette.panelDark, + borderRadius: BorderRadius.circular(MeshRadii.xs), + border: Border.all(color: LosPalette.border), ), alignment: Alignment.center, child: Text( endpoint.label, maxLines: 1, overflow: TextOverflow.ellipsis, - style: const TextStyle( - color: Colors.white, - fontSize: 11, - fontWeight: FontWeight.w500, + style: MeshTheme.mono( + fontSize: 10, + fontWeight: FontWeight.w700, + color: LosPalette.text, ), ), ), @@ -1328,13 +1660,55 @@ class _LineOfSightMapScreenState extends State { ); } - Color _statusColor() { - if (_error != null) return Colors.red; - if (_loading) return Colors.orange; - if (_result == null) return Colors.grey; - if (_result!.blockedSegments > 0) return Colors.red; - if (_result!.clearSegments > 0) return Colors.green; - return Colors.grey; + _LosDisplayStatus _losStatusFor(LineOfSightResult? result) { + if (result == null || !result.hasData) return _LosDisplayStatus.unknown; + if (!result.isClear) return _LosDisplayStatus.blocked; + if (result.samples.isEmpty) return _LosDisplayStatus.clear; + final minClearance = result.samples + .map((sample) => sample.clearanceMeters) + .reduce(math.min); + return minClearance <= _marginalClearanceMeters + ? _LosDisplayStatus.marginal + : _LosDisplayStatus.clear; + } + + String _statusLabel(_LosDisplayStatus status) { + switch (status) { + case _LosDisplayStatus.clear: + return 'Clear'; + case _LosDisplayStatus.marginal: + return 'Marginal'; + case _LosDisplayStatus.blocked: + return 'Blocked'; + case _LosDisplayStatus.unknown: + return _loading ? 'Checking' : 'No result'; + } + } + + Color _statusColorFor(_LosDisplayStatus status) { + switch (status) { + case _LosDisplayStatus.clear: + return LosPalette.clear; + case _LosDisplayStatus.marginal: + return LosPalette.marginal; + case _LosDisplayStatus.blocked: + return LosPalette.blocked; + case _LosDisplayStatus.unknown: + return LosPalette.textMuted; + } + } + + IconData _statusIcon(_LosDisplayStatus status) { + switch (status) { + case _LosDisplayStatus.clear: + return Icons.check_circle; + case _LosDisplayStatus.marginal: + return Icons.warning_amber_rounded; + case _LosDisplayStatus.blocked: + return Icons.block; + case _LosDisplayStatus.unknown: + return Icons.help_outline; + } } double _toDisplayHeight(double meters, bool isImperial) { @@ -1345,16 +1719,6 @@ class _LineOfSightMapScreenState extends State { return isImperial ? displayHeight / _metersToFeet : displayHeight; } - String _localizedLosError(String? message) { - if (message == LineOfSightService.errorElevationUnavailable) { - return context.l10n.losErrorElevationUnavailable; - } - if (message == LineOfSightService.errorInvalidInput) { - return context.l10n.losErrorInvalidInput; - } - return context.l10n.losNoElevationData; - } - void _handleQuickSwitch(int index, BuildContext context) { if (index == 2) { Navigator.pop(context); @@ -1411,9 +1775,13 @@ class _LineOfSightMapScreenState extends State { } } +enum _LosDisplayStatus { clear, marginal, blocked, unknown } + class _LosProfileGeometry { - static const horizontalPadding = 12.0; - static const verticalPadding = 12.0; + static const leftPadding = 38.0; + static const rightPadding = 14.0; + static const topPadding = 20.0; + static const bottomPadding = 28.0; final List samples; final Size size; @@ -1437,20 +1805,20 @@ class _LosProfileGeometry { late final double maxDist = math.max(1.0, samples.last.distanceMeters); late final double chartWidth = math.max( 1.0, - size.width - horizontalPadding * 2, + size.width - leftPadding - rightPadding, ); late final double chartHeight = math.max( 1.0, - size.height - verticalPadding * 2, + size.height - topPadding - bottomPadding, ); _LosProfileGeometry({required this.samples, required this.size}); Offset mapPoint(double distanceMeters, double elevationMeters) { - final px = horizontalPadding + (distanceMeters / maxDist) * chartWidth; + final px = leftPadding + (distanceMeters / maxDist) * chartWidth; final py = size.height - - verticalPadding - + bottomPadding - ((elevationMeters - minY) / ySpan) * chartHeight; return Offset(px, py); } @@ -1479,7 +1847,7 @@ class _LosProfilePainter extends CustomPainter { @override void paint(Canvas canvas, Size size) { - final bg = Paint()..color = const Color(0xFF243A63); + final bg = Paint()..color = LosPalette.chartBackground; canvas.drawRect(Offset.zero & size, bg); _drawUnitBadge(canvas, size); @@ -1503,18 +1871,52 @@ class _LosProfilePainter extends CustomPainter { .reduce(math.max); final ySpan = math.max(1.0, maxY - minY); final maxDist = math.max(1.0, samples.last.distanceMeters); - const horizontalPadding = 12.0; - const verticalPadding = 12.0; - final chartWidth = math.max(1.0, size.width - horizontalPadding * 2); - final chartHeight = math.max(1.0, size.height - verticalPadding * 2); + const leftPadding = _LosProfileGeometry.leftPadding; + const rightPadding = _LosProfileGeometry.rightPadding; + const topPadding = _LosProfileGeometry.topPadding; + const bottomPadding = _LosProfileGeometry.bottomPadding; + final chartWidth = math.max(1.0, size.width - leftPadding - rightPadding); + final chartHeight = math.max(1.0, size.height - topPadding - bottomPadding); Offset mapPoint(double x, double y) { - final px = horizontalPadding + (x / maxDist) * chartWidth; + final px = leftPadding + (x / maxDist) * chartWidth; final py = - size.height - verticalPadding - ((y - minY) / ySpan) * chartHeight; + size.height - bottomPadding - ((y - minY) / ySpan) * chartHeight; return Offset(px, py); } + final gridPaint = Paint() + ..color = LosPalette.textMuted.withValues(alpha: 0.16) + ..strokeWidth = 1; + for (var i = 0; i <= 4; i++) { + final x = leftPadding + chartWidth * i / 4; + final y = topPadding + chartHeight * i / 4; + canvas.drawLine( + Offset(x, topPadding), + Offset(x, size.height - bottomPadding), + gridPaint, + ); + canvas.drawLine( + Offset(leftPadding, y), + Offset(size.width - rightPadding, y), + gridPaint, + ); + final distance = maxDist * i / 4; + _paintLabel( + canvas, + _displayDistance(distance).toStringAsFixed(i == 0 ? 0 : 1), + Offset(x, size.height - bottomPadding + 7), + center: true, + ); + final elevation = maxY - ySpan * i / 4; + _paintLabel( + canvas, + _displayHeight(elevation).toStringAsFixed(0), + Offset(leftPadding - 6, y - 6), + alignRight: true, + ); + } + final firstTerrainPoint = mapPoint( samples.first.distanceMeters, samples.first.terrainMeters, @@ -1525,13 +1927,13 @@ class _LosProfilePainter extends CustomPainter { ); double distanceForCanvasX(double x) { - final normalized = ((x - horizontalPadding) / chartWidth).clamp(0.0, 1.0); + final normalized = ((x - leftPadding) / chartWidth).clamp(0.0, 1.0); return normalized * maxDist; } double elevationToPixel(double elevation) { final normalized = ((elevation - minY) / ySpan).clamp(0.0, 1.0); - return size.height - verticalPadding - normalized * chartHeight; + return size.height - bottomPadding - normalized * chartHeight; } double extrapolateTerrain(double distance, bool isLeft) { @@ -1573,10 +1975,10 @@ class _LosProfilePainter extends CustomPainter { ..lineTo(size.width, size.height) ..close(); - const terrainFillColor = Color(0xCC7C6F5D); - const terrainLineColor = Color(0xFF9FE870); - const losLineColor = Color(0xFFE0E7FF); - canvas.drawPath(terrainPath, Paint()..color = terrainFillColor); + canvas.drawPath( + terrainPath, + Paint()..color = LosPalette.terrain.withValues(alpha: 0.18), + ); final terrainLine = ui.Path()..moveTo(leftEdgePoint.dx, leftEdgePoint.dy); for (final sample in samples) { @@ -1587,9 +1989,9 @@ class _LosProfilePainter extends CustomPainter { canvas.drawPath( terrainLine, Paint() - ..color = terrainLineColor + ..color = LosPalette.terrain ..style = PaintingStyle.stroke - ..strokeWidth = 2, + ..strokeWidth = 2.5, ); final losLine = ui.Path(); @@ -1607,12 +2009,11 @@ class _LosProfilePainter extends CustomPainter { canvas.drawPath( losLine, Paint() - ..color = losLineColor + ..color = LosPalette.beam ..style = PaintingStyle.stroke - ..strokeWidth = 2, + ..strokeWidth = 2.5, ); - const refractedLineColor = Color(0xFFFFD57F); final refractedLine = ui.Path(); for (int i = 0; i < samples.length; i++) { final p = mapPoint( @@ -1628,7 +2029,7 @@ class _LosProfilePainter extends CustomPainter { canvas.drawPath( refractedLine, Paint() - ..color = refractedLineColor + ..color = LosPalette.horizon ..style = PaintingStyle.stroke ..strokeWidth = 1.5, ); @@ -1653,14 +2054,53 @@ class _LosProfilePainter extends CustomPainter { capPath.lineTo(p.dx, p.dy); } capPath.close(); - const horizonFillColor = Color(0x40FFD57F); canvas.drawPath( capPath, Paint() - ..color = horizonFillColor + ..color = LosPalette.horizon.withValues(alpha: 0.10) ..style = PaintingStyle.fill, ); + for (var i = 0; i < samples.length - 1; i++) { + if (samples[i].clearanceMeters >= 0 && + samples[i + 1].clearanceMeters >= 0) { + continue; + } + final terrainA = mapPoint( + samples[i].distanceMeters, + samples[i].terrainMeters, + ); + final terrainB = mapPoint( + samples[i + 1].distanceMeters, + samples[i + 1].terrainMeters, + ); + final lineB = mapPoint( + samples[i + 1].distanceMeters, + samples[i + 1].lineHeightMeters, + ); + final lineA = mapPoint( + samples[i].distanceMeters, + samples[i].lineHeightMeters, + ); + final blockedArea = ui.Path() + ..moveTo(terrainA.dx, terrainA.dy) + ..lineTo(terrainB.dx, terrainB.dy) + ..lineTo(lineB.dx, lineB.dy) + ..lineTo(lineA.dx, lineA.dy) + ..close(); + canvas.drawPath( + blockedArea, + Paint()..color = LosPalette.blocked.withValues(alpha: 0.42), + ); + } + + _paintEndpoint(canvas, mapPoint(0, samples.first.lineHeightMeters), 'A'); + _paintEndpoint( + canvas, + mapPoint(maxDist, samples.last.lineHeightMeters), + 'B', + ); + if (selectedSampleIndex != null && selectedSampleIndex! >= 0 && selectedSampleIndex! < samples.length) { @@ -1670,24 +2110,103 @@ class _LosProfilePainter extends CustomPainter { selectedSample.terrainMeters, ); canvas.drawLine( - Offset(selectedPoint.dx, verticalPadding), - Offset(selectedPoint.dx, size.height - verticalPadding), + Offset(selectedPoint.dx, topPadding), + Offset(selectedPoint.dx, size.height - bottomPadding), Paint() - ..color = Colors.amberAccent.withValues(alpha: 0.7) - ..strokeWidth = 1.5, + ..color = LosPalette.selected + ..strokeWidth = 2, ); - canvas.drawCircle(selectedPoint, 7, Paint()..color = Colors.amberAccent); + canvas.drawCircle(selectedPoint, 7, Paint()..color = LosPalette.selected); canvas.drawCircle( selectedPoint, 8.5, Paint() - ..color = Colors.white + ..color = LosPalette.text ..style = PaintingStyle.stroke ..strokeWidth = 1.5, ); + final labelY = math.max(topPadding + 2, selectedPoint.dy - 27); + _paintPill( + canvas, + 'Selected', + Offset( + selectedPoint.dx.clamp(42.0, size.width - 42).toDouble(), + labelY, + ), + ); } } + double _displayDistance(double meters) { + return distanceUnit == 'mi' + ? (meters / 1000.0) * 0.621371 + : meters / 1000.0; + } + + double _displayHeight(double meters) { + return heightUnit == 'ft' ? meters * 3.28084 : meters; + } + + void _paintLabel( + Canvas canvas, + String text, + Offset offset, { + bool center = false, + bool alignRight = false, + }) { + final painter = TextPainter( + text: TextSpan( + text: text, + style: const TextStyle( + color: LosPalette.textMuted, + fontSize: 9, + fontWeight: FontWeight.w600, + ), + ), + textDirection: TextDirection.ltr, + )..layout(); + var dx = offset.dx; + if (center) dx -= painter.width / 2; + if (alignRight) dx -= painter.width; + painter.paint(canvas, Offset(dx, offset.dy)); + } + + void _paintEndpoint(Canvas canvas, Offset point, String label) { + canvas.drawCircle(point, 9, Paint()..color = LosPalette.chartBackground); + canvas.drawCircle( + point, + 9, + Paint() + ..color = LosPalette.beam + ..style = PaintingStyle.stroke + ..strokeWidth = 2, + ); + _paintLabel(canvas, label, Offset(point.dx, point.dy - 5), center: true); + } + + void _paintPill(Canvas canvas, String text, Offset center) { + final painter = TextPainter( + text: TextSpan( + text: text, + style: const TextStyle( + color: LosPalette.text, + fontSize: 9, + fontWeight: FontWeight.w800, + ), + ), + textDirection: TextDirection.ltr, + )..layout(); + final rect = RRect.fromRectAndRadius( + Rect.fromCenter(center: center, width: painter.width + 12, height: 20), + const Radius.circular(10), + ); + canvas.drawRRect(rect, Paint()..color = LosPalette.selected); + painter.paint( + canvas, + Offset(center.dx - painter.width / 2, center.dy - painter.height / 2), + ); + } + @override bool shouldRepaint(covariant _LosProfilePainter oldDelegate) { return oldDelegate.samples != samples || @@ -1712,10 +2231,6 @@ class _LosProfilePainter extends CustomPainter { } class _LosLegend extends StatelessWidget { - static const _terrainColor = Color(0xFF9FE870); - static const _losColor = Color(0xFFE0E7FF); - static const _radioColor = Color(0xFFFFD57F); - final String terrainLabel; final String losBeamLabel; final String radioHorizonLabel; @@ -1730,23 +2245,24 @@ class _LosLegend extends StatelessWidget { Widget build(BuildContext context) { final textStyle = Theme.of(context).textTheme.labelSmall?.copyWith( - color: Colors.white70, - fontSize: 11, - fontWeight: FontWeight.w500, + color: LosPalette.text, + fontSize: 12, + fontWeight: FontWeight.w700, ) ?? const TextStyle( - color: Colors.white70, - fontSize: 11, - fontWeight: FontWeight.w500, + color: LosPalette.text, + fontSize: 12, + fontWeight: FontWeight.w700, ); final entries = [ - _LegendEntry(terrainLabel, _terrainColor), - _LegendEntry(losBeamLabel, _losColor), - _LegendEntry(radioHorizonLabel, _radioColor), + _LegendEntry(terrainLabel, LosPalette.terrain), + _LegendEntry(losBeamLabel, LosPalette.beam), + _LegendEntry(radioHorizonLabel, LosPalette.horizon), + const _LegendEntry('Blocked', LosPalette.blocked), ]; - const swatchSize = 10.0; + const swatchSize = 12.0; return Wrap( spacing: 16, diff --git a/lib/screens/map_cache_screen.dart b/lib/screens/map_cache_screen.dart index 4057e0ec..6455c15c 100644 --- a/lib/screens/map_cache_screen.dart +++ b/lib/screens/map_cache_screen.dart @@ -10,6 +10,9 @@ import '../services/app_settings_service.dart'; import '../services/map_tile_cache_service.dart'; import '../widgets/adaptive_app_bar_title.dart'; import '../helpers/snack_bar_builder.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/mesh_ui.dart'; +import '../widgets/themed_map_tile_layer.dart'; class MapCacheScreen extends StatefulWidget { const MapCacheScreen({super.key}); @@ -76,27 +79,34 @@ class _MapCacheScreenState extends State { return Positioned( top: 12, left: 12, - child: Card( - elevation: 4, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - IconButton( - icon: const Icon(Icons.add), - tooltip: 'Zoom in', - onPressed: () => _zoomMapBy(1), - ), - IconButton( - icon: const Icon(Icons.remove), - tooltip: 'Zoom out', - onPressed: () => _zoomMapBy(-1), - ), - IconButton( - icon: const Icon(Icons.my_location), - tooltip: 'Center map', - onPressed: _resetMapView, - ), - ], + child: DecoratedBox( + decoration: BoxDecoration( + color: MeshPalette.bg1.withValues(alpha: 0.90), + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: MeshPalette.line2), + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(MeshRadii.md), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + icon: const Icon(Icons.add), + tooltip: context.l10n.map_zoomIn, + onPressed: () => _zoomMapBy(1), + ), + IconButton( + icon: const Icon(Icons.remove), + tooltip: context.l10n.map_zoomOut, + onPressed: () => _zoomMapBy(-1), + ), + IconButton( + icon: const Icon(Icons.my_location), + tooltip: context.l10n.map_centerMap, + onPressed: _resetMapView, + ), + ], + ), ), ), ); @@ -281,6 +291,7 @@ class _MapCacheScreenState extends State { final tileCache = context.read(); final selectedBounds = _selectedBounds; final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; final isDesktop = _isDesktopPlatform(defaultTargetPlatform); final progressValue = _estimatedTiles == 0 ? 0.0 @@ -318,13 +329,7 @@ class _MapCacheScreenState extends State { ), ), children: [ - TileLayer( - urlTemplate: kMapTileUrlTemplate, - tileProvider: tileCache.tileProvider, - userAgentPackageName: - MapTileCacheService.userAgentPackageName, - maxZoom: 19, - ), + ThemedMapTileLayer(tileCache: tileCache), if (selectedBounds != null) PolygonLayer( polygons: [ @@ -342,14 +347,25 @@ class _MapCacheScreenState extends State { Positioned( top: 12, right: 12, - child: Card( + child: DecoratedBox( + decoration: BoxDecoration( + color: MeshPalette.bg1.withValues(alpha: 0.93), + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: MeshPalette.line2), + ), child: Padding( - padding: const EdgeInsets.all(8), + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 6, + ), child: Text( selectedBounds == null ? l10n.mapCache_noAreaSelected : _formatBounds(selectedBounds, l10n), - style: const TextStyle(fontSize: 12), + style: MeshTheme.mono( + fontSize: 11, + color: MeshPalette.ink2, + ), ), ), ), @@ -359,109 +375,133 @@ class _MapCacheScreenState extends State { ), SafeArea( top: false, - child: Padding( - padding: const EdgeInsets.fromLTRB(16, 12, 16, 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - l10n.mapCache_cacheArea, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, + child: DecoratedBox( + decoration: BoxDecoration( + color: scheme.surfaceContainerLow, + border: Border(top: BorderSide(color: scheme.outlineVariant)), + ), + child: Padding( + padding: const EdgeInsets.fromLTRB(16, 4, 16, 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + SectionHeader( + l10n.mapCache_cacheArea, + padding: const EdgeInsets.fromLTRB(0, 12, 0, 8), ), - ), - const SizedBox(height: 8), - Row( - children: [ - Expanded( - child: ElevatedButton.icon( - icon: const Icon(Icons.crop_free), - label: Text(l10n.mapCache_useCurrentView), - onPressed: _isDownloading ? null : _setBoundsFromView, + Row( + children: [ + Expanded( + child: ElevatedButton.icon( + icon: const Icon(Icons.crop_free), + label: Text(l10n.mapCache_useCurrentView), + onPressed: _isDownloading + ? null + : _setBoundsFromView, + ), ), - ), - const SizedBox(width: 12), - TextButton( - onPressed: _isDownloading || selectedBounds == null - ? null - : _clearBounds, - child: Text(l10n.common_clear), - ), - ], - ), - const SizedBox(height: 12), - Text( - l10n.mapCache_zoomRange, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, - ), - ), - RangeSlider( - values: RangeValues( - _minZoom.toDouble(), - _maxZoom.toDouble(), - ), - min: 3, - max: 18, - divisions: 15, - labels: RangeLabels('$_minZoom', '$_maxZoom'), - onChanged: _isDownloading - ? null - : (values) { - setState(() { - _minZoom = values.start.round(); - _maxZoom = values.end.round(); - }); - }, - onChangeEnd: _isDownloading - ? null - : (_) { - _saveZoomRange(); - }, - ), - Text(l10n.mapCache_estimatedTiles(_estimatedTiles)), - if (_isDownloading) ...[ - const SizedBox(height: 8), - LinearProgressIndicator(value: progressValue), - const SizedBox(height: 4), - Text( - l10n.mapCache_downloadedTiles( - _completedTiles, - _estimatedTiles, - ), - ), - ], - const SizedBox(height: 12), - Row( - children: [ - Expanded( - child: ElevatedButton.icon( - icon: const Icon(Icons.download), - label: Text(l10n.mapCache_downloadTilesButton), + const SizedBox(width: 12), + TextButton( onPressed: _isDownloading || selectedBounds == null ? null - : _startDownload, + : _clearBounds, + child: Text(l10n.common_clear), ), + ], + ), + const SizedBox(height: 12), + SectionHeader( + l10n.mapCache_zoomRange, + padding: const EdgeInsets.fromLTRB(0, 8, 0, 0), + ), + RangeSlider( + values: RangeValues( + _minZoom.toDouble(), + _maxZoom.toDouble(), ), - const SizedBox(width: 12), - OutlinedButton( - onPressed: _isDownloading ? null : _clearCache, - child: Text(l10n.mapCache_clearCacheButton), - ), - ], - ), - if (_failedTiles > 0 && !_isDownloading) - Padding( - padding: const EdgeInsets.only(top: 8), - child: Text( - l10n.mapCache_failedDownloads(_failedTiles), - style: TextStyle(color: Colors.orange[700]), + min: 3, + max: 18, + divisions: 15, + labels: RangeLabels('$_minZoom', '$_maxZoom'), + onChanged: _isDownloading + ? null + : (values) { + setState(() { + _minZoom = values.start.round(); + _maxZoom = values.end.round(); + }); + }, + onChangeEnd: _isDownloading + ? null + : (_) { + _saveZoomRange(); + }, + ), + Text( + l10n.mapCache_estimatedTiles(_estimatedTiles), + style: MeshTheme.mono( + fontSize: 12, + color: scheme.onSurfaceVariant, ), ), - ], + if (_isDownloading) ...[ + const SizedBox(height: 8), + LinearProgressIndicator( + value: progressValue, + color: MeshPalette.blue, + backgroundColor: scheme.surfaceContainerHighest, + ), + const SizedBox(height: 4), + Text( + l10n.mapCache_downloadedTiles( + _completedTiles, + _estimatedTiles, + ), + style: MeshTheme.mono( + fontSize: 12, + color: scheme.onSurfaceVariant, + ), + ), + ], + const SizedBox(height: 12), + Row( + children: [ + Expanded( + child: ElevatedButton.icon( + icon: const Icon(Icons.download), + label: Text(l10n.mapCache_downloadTilesButton), + onPressed: _isDownloading || selectedBounds == null + ? null + : _startDownload, + ), + ), + const SizedBox(width: 12), + OutlinedButton( + style: OutlinedButton.styleFrom( + foregroundColor: MeshPalette.alert, + side: const BorderSide( + color: MeshPalette.alertLine, + ), + ), + onPressed: _isDownloading ? null : _clearCache, + child: Text(l10n.mapCache_clearCacheButton), + ), + ], + ), + if (_failedTiles > 0 && !_isDownloading) + Padding( + padding: const EdgeInsets.only(top: 8), + child: Text( + l10n.mapCache_failedDownloads(_failedTiles), + style: MeshTheme.mono( + fontSize: 12, + color: MeshPalette.alert, + ), + ), + ), + ], + ), ), ), ), diff --git a/lib/screens/map_screen.dart b/lib/screens/map_screen.dart index be133240..3f57dfac 100644 --- a/lib/screens/map_screen.dart +++ b/lib/screens/map_screen.dart @@ -1,8 +1,8 @@ -import 'dart:collection'; import 'dart:math'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_map/flutter_map.dart'; import 'package:latlong2/latlong.dart'; import 'package:meshcore_open/screens/path_trace_map.dart'; @@ -21,12 +21,17 @@ import '../services/path_history_service.dart'; import '../services/map_marker_service.dart'; import '../services/map_tile_cache_service.dart'; import '../utils/contact_search.dart'; +import '../utils/battery_utils.dart'; import '../utils/route_transitions.dart'; import '../widgets/quick_switch_bar.dart'; +import '../widgets/sync_progress_overlay.dart'; +import '../widgets/themed_map_tile_layer.dart'; import '../icons/los_icon.dart'; import 'channels_screen.dart'; import 'chat_screen.dart'; import 'contacts_screen.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/mesh_ui.dart'; import '../widgets/repeater_login_dialog.dart'; import '../widgets/room_login_dialog.dart'; import '../helpers/snack_bar_builder.dart'; @@ -57,6 +62,11 @@ class MapScreen extends StatefulWidget { class _MapScreenState extends State { // Zoom level at which node labels start to appear static const double _labelZoomThreshold = 14.0; + // Below this zoom, nearby nodes collapse into clusters. + static const double _clusterOffZoom = 12.5; + // Guessed (estimated) locations only render at closer zooms to avoid a + // carpet of approximate markers at city-wide scale. + static const double _guessedZoomThreshold = 12.0; static const double _mapMinZoom = 2.0; static const double _mapMaxZoom = 18.0; @@ -72,10 +82,55 @@ class _MapScreenState extends State { final List _pathTraceContacts = []; final List _points = []; final List _polylines = []; - bool _legendExpanded = false; + bool _statsExpanded = false; bool _showNodeLabels = true; + double _zoom = 10.0; + String? _selectedKey; + LatLng? _selectedGuessPos; + _Freshness _freshness = _Freshness.all; + final TextEditingController _searchController = TextEditingController(); + final FocusNode _searchFocus = FocusNode(); + String _searchQuery = ''; List<_GuessedLocation> _cachedGuessedLocations = []; String _guessedLocationsCacheKey = ''; + int? _sharedMarkersCacheSignature; + Locale? _sharedMarkersCacheLocale; + List<_SharedMarker> _cachedSharedMarkers = const []; + _NodeMarkersCacheKey? _nodeMarkersCacheKey; + List _cachedNodeMarkers = const []; + + @override + void dispose() { + _searchController.dispose(); + _searchFocus.dispose(); + _mapController.dispose(); + super.dispose(); + } + + _NodeAge _ageOf(Contact contact) { + final d = DateTime.now().difference(contact.lastSeen); + if (d.inMinutes <= 60) return _NodeAge.online; + if (d.inHours <= 24) return _NodeAge.recent; + return _NodeAge.stale; + } + + void _selectNode(Contact contact, {LatLng? guessedPosition}) { + HapticFeedback.selectionClick(); + setState(() { + _selectedKey = contact.publicKeyHex; + _selectedGuessPos = guessedPosition; + _searchQuery = ''; + _searchController.clear(); + _searchFocus.unfocus(); + }); + } + + void _clearSelection() { + setState(() { + _selectedKey = null; + _selectedGuessPos = null; + }); + } @override void initState() { @@ -165,49 +220,90 @@ class _MapScreenState extends State { _mapController.move(camera.center, nextZoom); } - Widget _buildDesktopMapControls( + Widget _buildControlRail( BuildContext context, { required LatLng center, required double zoom, - required bool hasPathSelector, + required MeshCoreConnector connector, }) { + final hasSelf = + connector.selfLatitude != null && connector.selfLongitude != null; return Positioned( - left: 16, - top: hasPathSelector ? null : 16, - bottom: hasPathSelector ? 16 : null, - child: Card( - elevation: 4, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - IconButton( - icon: const Icon(Icons.add), - tooltip: 'Zoom in', - onPressed: () => _zoomMapBy(1), - ), - IconButton( - icon: const Icon(Icons.remove), - tooltip: 'Zoom out', - onPressed: () => _zoomMapBy(-1), - ), - IconButton( - icon: const Icon(Icons.my_location), - tooltip: 'Center map', - onPressed: () => _mapController.move(center, zoom), + left: 12, + bottom: 96, + child: DecoratedBox( + decoration: BoxDecoration( + color: MapPalette.panelDark, + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: MapPalette.border), + boxShadow: const [ + BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 8, + offset: Offset(0, 3), ), ], ), + child: ClipRRect( + borderRadius: BorderRadius.circular(MeshRadii.md), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + color: MapPalette.textPrimary, + icon: const Icon(Icons.add), + visualDensity: VisualDensity.standard, + tooltip: context.l10n.map_zoomIn, + onPressed: () => _zoomMapBy(1), + ), + IconButton( + color: MapPalette.textPrimary, + icon: const Icon(Icons.remove), + tooltip: context.l10n.map_zoomOut, + onPressed: () => _zoomMapBy(-1), + ), + IconButton( + color: MapPalette.textPrimary, + icon: const Icon(Icons.crop_free), + tooltip: context.l10n.map_centerMap, + onPressed: () => _mapController.move(center, zoom), + ), + if (hasSelf) + IconButton( + color: MapPalette.selected, + icon: const Icon(Icons.my_location), + tooltip: context.l10n.map_setAsMyLocation, + onPressed: () => _mapController.move( + LatLng(connector.selfLatitude!, connector.selfLongitude!), + max(_zoom, 14), + ), + ), + ], + ), + ), ), ); } @override Widget build(BuildContext context) { - return Consumer3( - builder: (context, connector, settingsService, pathHistory, child) { + return Builder( + builder: (context) { + final connectorSnapshot = context + .select( + _MapConnectorSnapshot.fromConnector, + ); + final connector = connectorSnapshot.connector; + final settings = context.select( + (service) => service.settings, + ); + final pathHistoryVersion = context.select( + (service) => service.version, + ); + final settingsService = context.read(); + final pathHistory = context.read(); final tileCache = context.read(); final isDesktop = _isDesktopPlatform(defaultTargetPlatform); - final settings = settingsService.settings; final allContacts = connector.allContacts; final contacts = settings.mapShowDiscoveryContacts @@ -216,7 +312,10 @@ class _MapScreenState extends State { final highlightPosition = widget.highlightPosition; final sharedMarkers = settings.mapShowMarkers - ? _collectSharedMarkers(connector) + ? _collectSharedMarkers( + connector, + connectorSnapshot.markerSignature, + ) .where( (marker) => !_hiddenMarkerIds.contains(marker.id) && @@ -234,16 +333,27 @@ class _MapScreenState extends State { return hoursSinceLastSeen <= settings.mapTimeFilterHours; }).toList(); + // Quick activity filter (search bar chips) + final filteredByFreshness = switch (_freshness) { + _Freshness.all => filteredByTime, + _Freshness.online => + filteredByTime.where((c) => _ageOf(c) == _NodeAge.online).toList(), + _Freshness.recent => + filteredByTime.where((c) => _ageOf(c) != _NodeAge.stale).toList(), + _Freshness.stale => + filteredByTime.where((c) => _ageOf(c) == _NodeAge.stale).toList(), + }; + // Filter by key prefix final keyPrefix = settings.mapKeyPrefix.trim(); final filteredByKeyPrefix = (settings.mapKeyPrefixEnabled && keyPrefix.isNotEmpty) - ? filteredByTime.where((c) { + ? filteredByFreshness.where((c) { return c.publicKeyHex.toLowerCase().startsWith( keyPrefix.toLowerCase(), ); }).toList() - : filteredByTime; + : filteredByFreshness; // Filter by location final contactsWithLocation = filteredByKeyPrefix.where((c) { @@ -256,9 +366,17 @@ class _MapScreenState extends State { .where((c) => c.hasLocation) .toList(); + // Guessed markers represent the same node types as known-location + // markers, so apply the node-type filters before estimating positions. + final guessCandidates = _filterContactsBySettings( + filteredByKeyPrefix, + settings, + noLocations: true, + ); + // Compute guessed locations with caching final maxRangeKm = _estimateLoRaRangeKm(connector); - final filteredKeys = filteredByKeyPrefix + final filteredKeys = guessCandidates .map((c) => '${c.publicKeyHex}:${c.path.join("-")}') .join(','); final anchorKeys = allContactsWithLocation @@ -268,12 +386,12 @@ class _MapScreenState extends State { ) .join(','); final cacheKey = - '$filteredKeys|$anchorKeys|${pathHistory.version}:${connector.currentSf}:${connector.currentBwHz}:${connector.currentTxPower}:${settings.mapShowGuessedLocations}'; + '$filteredKeys|$anchorKeys|$pathHistoryVersion:${connector.currentFreqHz}:${connector.currentSf}:${connector.currentBwHz}:${connector.currentTxPower}:${settings.mapShowGuessedLocations}'; if (cacheKey != _guessedLocationsCacheKey) { _guessedLocationsCacheKey = cacheKey; _cachedGuessedLocations = settings.mapShowGuessedLocations ? _computeGuessedLocations( - filteredByKeyPrefix, + guessCandidates, allContactsWithLocation, pathHistory, maxRangeKm, @@ -291,7 +409,7 @@ class _MapScreenState extends State { Polyline( points: _points, strokeWidth: 4, - color: Colors.blueAccent, + color: MapPalette.selected, ), ] : [], @@ -307,8 +425,10 @@ class _MapScreenState extends State { Polyline( points: points, color: marker.isChannel - ? (marker.isPublicChannel ? Colors.orange : Colors.purple) - : Colors.blue, + ? (marker.isPublicChannel + ? MapPalette.cluster + : MapPalette.router) + : MapPalette.shared, strokeWidth: 3, ), ); @@ -396,6 +516,7 @@ class _MapScreenState extends State { if (!_hasInitializedMap && _removedMarkersLoaded) { _hasInitializedMap = true; _showNodeLabels = initialZoom >= _labelZoomThreshold; + _zoom = initialZoom; if (hasMapContent) { WidgetsBinding.instance.addPostFrameCallback((_) { if (mounted) { @@ -407,69 +528,112 @@ class _MapScreenState extends State { final allowBack = !connector.isConnected; + final visibleContacts = _filterContactsBySettings( + contactsWithLocation, + settings, + ); + Contact? selectedContact; + if (_selectedKey != null) { + for (final c in allContacts) { + if (c.publicKeyHex == _selectedKey) { + selectedContact = c; + break; + } + } + } + final locatedTotal = allContacts.where((c) => c.hasLocation).length; + final hiddenCount = max(0, locatedTotal - visibleContacts.length); + final onlineCount = visibleContacts + .where((c) => _ageOf(c) == _NodeAge.online) + .length; + final repeaterCount = visibleContacts + .where((c) => c.type == advTypeRepeater) + .length; + return PopScope( canPop: allowBack, child: Scaffold( appBar: AppBar( + backgroundColor: MapPalette.panelDark, + foregroundColor: MapPalette.textPrimary, title: AppBarTitle(context.l10n.map_title), centerTitle: true, automaticallyImplyLeading: false, + bottom: const SyncProgressAppBarBottom(), actions: [ - if (!_isBuildingPathTrace) - IconButton( - icon: const Icon(Icons.radar), - onPressed: () => _startPath( - LatLng(connector.selfLatitude!, connector.selfLongitude!), - ), - tooltip: context.l10n.contacts_pathTrace, - ), - if (!_isBuildingPathTrace) - IconButton( - icon: const LosIcon(), - onPressed: () { - final candidates = []; - if (connector.selfLatitude != null && - connector.selfLongitude != null) { - candidates.add( - LineOfSightEndpoint( - label: context.l10n.pathTrace_you, - point: LatLng( - connector.selfLatitude!, - connector.selfLongitude!, - ), - color: Colors.teal, - icon: Icons.person_pin_circle, - ), - ); - } - for (final c in contactsWithLocation) { - candidates.add( - LineOfSightEndpoint( - label: c.name, - point: LatLng(c.latitude!, c.longitude!), - color: _getNodeColor(c.type), - icon: _getNodeIcon(c.type), - ), - ); - } - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => LineOfSightMapScreen( - title: context.l10n.map_losScreenTitle, - candidates: candidates, - ), - ), - ); - }, - tooltip: context.l10n.map_lineOfSight, - ), PopupMenuButton( itemBuilder: (context) => [ + if (!_isBuildingPathTrace && + connector.selfLatitude != null && + connector.selfLongitude != null) + PopupMenuItem( + child: Row( + children: [ + const Icon(Icons.radar), + const SizedBox(width: 8), + Text(context.l10n.contacts_pathTrace), + ], + ), + onTap: () => _startPath( + LatLng( + connector.selfLatitude!, + connector.selfLongitude!, + ), + ), + ), + if (!_isBuildingPathTrace) + PopupMenuItem( + child: Row( + children: [ + const LosIcon(), + const SizedBox(width: 8), + Text(context.l10n.map_lineOfSight), + ], + ), + onTap: () { + final candidates = []; + if (connector.selfLatitude != null && + connector.selfLongitude != null) { + candidates.add( + LineOfSightEndpoint( + label: context.l10n.pathTrace_you, + point: LatLng( + connector.selfLatitude!, + connector.selfLongitude!, + ), + color: MapPalette.selected, + icon: Icons.person_pin_circle, + ), + ); + } + for (final c in contactsWithLocation) { + candidates.add( + LineOfSightEndpoint( + label: c.name, + point: LatLng(c.latitude!, c.longitude!), + color: _getNodeColor(c.type), + icon: _getNodeIcon(c.type), + ), + ); + } + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => LineOfSightMapScreen( + title: context.l10n.map_losScreenTitle, + candidates: candidates, + ), + ), + ); + }, + ), PopupMenuItem( child: Row( children: [ - const Icon(Icons.logout, color: Colors.red), + Icon( + Icons.logout, + color: Theme.of(context).colorScheme.error, + ), const SizedBox(width: 8), Text(context.l10n.common_disconnect), ], @@ -530,6 +694,17 @@ class _MapScreenState extends State { defaultLabel: context.l10n.map_pointOfInterest, flags: 'poi', ); + return; + } + // Tapping empty map dismisses selection + search. + if (_selectedKey != null || _searchQuery.isNotEmpty) { + setState(() { + _selectedKey = null; + _selectedGuessPos = null; + _searchQuery = ''; + _searchController.clear(); + _searchFocus.unfocus(); + }); } }, onLongPress: (_, latLng) { @@ -553,22 +728,21 @@ class _MapScreenState extends State { ); }, onPositionChanged: (camera, hasGesture) { + // Track zoom in half-step buckets so cluster/marker + // detail levels update without rebuilding every frame. + final bucket = (camera.zoom * 2).roundToDouble() / 2; final shouldShow = camera.zoom >= _labelZoomThreshold; - if (shouldShow != _showNodeLabels && mounted) { + if ((bucket != _zoom || shouldShow != _showNodeLabels) && + mounted) { setState(() { + _zoom = bucket; _showNodeLabels = shouldShow; }); } }, ), children: [ - TileLayer( - urlTemplate: kMapTileUrlTemplate, - tileProvider: tileCache.tileProvider, - userAgentPackageName: - MapTileCacheService.userAgentPackageName, - maxZoom: 19, - ), + ThemedMapTileLayer(tileCache: tileCache), if (_polylines.isNotEmpty && _isBuildingPathTrace) PolylineLayer(polylines: _polylines), if (sharedMarkerPolylines.isNotEmpty) @@ -578,25 +752,57 @@ class _MapScreenState extends State { if (highlightPosition != null) Marker( point: highlightPosition, - width: 40, - height: 40, + width: 44, + height: 44, child: IgnorePointer( - child: Icon( - Icons.location_on_outlined, - color: Colors.red[600], - size: 34, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: MapPalette.batteryLow, + border: Border.all( + color: MapPalette.markerOutline, + width: 3, + ), + boxShadow: const [ + BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 8, + offset: Offset(0, 3), + ), + ], + ), + child: const Icon( + Icons.location_on, + color: Colors.white, + size: 25, + ), ), ), ), - if (!settings.mapShowOverlaps) + if (!settings.mapShowOverlaps && + (_zoom >= _guessedZoomThreshold || + _isBuildingPathTrace)) ..._buildGuessedMarker( guessedLocations, showLabels: _showNodeLabels, ), - ..._buildMarkers( - contactsWithLocation, + ..._buildNodeMarkersCached( + visibleContacts, settings, + connectorSnapshot.contactsSignature, + connectorSnapshot.batterySignature, + _freshness, + settings.mapTimeFilterHours, + settings.mapKeyPrefixEnabled, + settings.mapKeyPrefix, + settings.mapShowDiscoveryContacts, + Object.hashAllUnordered( + settings.batteryChemistryByRepeaterId.entries.map( + (entry) => Object.hash(entry.key, entry.value), + ), + ), showLabels: _showNodeLabels, + selectedContact: selectedContact, ), ...sharedMarkers.map(_buildSharedMarker), if (connector.selfLatitude != null && @@ -611,29 +817,28 @@ class _MapScreenState extends State { child: IgnorePointer( ignoring: true, child: Container( - padding: const EdgeInsets.all(4), + width: 36, + height: 36, decoration: BoxDecoration( - color: Colors.teal, shape: BoxShape.circle, + color: MapPalette.panelDark, border: Border.all( - color: Colors.white, - width: 2, + color: MapPalette.markerOutline, + width: 2.5, ), boxShadow: [ - BoxShadow( - color: Colors.black.withValues( - alpha: 0.3, - ), - blurRadius: 4, - offset: const Offset(0, 2), + const BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 8, + offset: Offset(0, 2), ), ], ), alignment: Alignment.center, child: const Icon( Icons.person_pin_circle, - color: Colors.white, - size: 20, + color: MapPalette.selected, + size: 22, ), ), ), @@ -652,22 +857,34 @@ class _MapScreenState extends State { ), ], ), - if (!_isBuildingPathTrace) - _buildLegend( - contacts, - contactsWithLocation, - settings, - sharedMarkers.length, - guessedLocations.length, - ), - if (isDesktop) - _buildDesktopMapControls( + if (selectedContact == null) + _buildControlRail( context, center: center, zoom: initialZoom, - hasPathSelector: _isBuildingPathTrace, + connector: connector, + ), + if (!_isBuildingPathTrace) + _buildTopOverlay( + context, + connector: connector, + settingsService: settingsService, + allContacts: allContacts, + guessedLocations: guessedLocations, + visibleCount: + visibleContacts.length + + ((settings.mapShowGuessedLocations && + _zoom >= _guessedZoomThreshold) + ? guessedLocations.length + : 0), + onlineCount: onlineCount, + repeaterCount: repeaterCount, + hiddenCount: hiddenCount, + pinCount: sharedMarkers.length, ), if (_isBuildingPathTrace) _buildPathTraceOverlay(), + if (selectedContact != null && !_isBuildingPathTrace) + _buildSelectedNodeCard(context, selectedContact, connector), ], ), bottomNavigationBar: SafeArea( @@ -678,19 +895,76 @@ class _MapScreenState extends State { _handleQuickSwitch(index, context), contactsUnreadCount: connector.getTotalContactsUnreadCount(), channelsUnreadCount: connector.getTotalChannelsUnreadCount(), + highContrast: true, ), ), - floatingActionButton: FloatingActionButton( - onPressed: () => _showFilterDialog(context, settingsService), - tooltip: context.l10n.map_filterNodes, - child: const Icon(Icons.filter_list), - ), + floatingActionButton: + (selectedContact == null && !_isBuildingPathTrace) + ? FloatingActionButton( + onPressed: () => _showFilterSheet(context, settingsService), + tooltip: context.l10n.map_filterNodes, + child: const Icon(Icons.filter_list), + ) + : null, ), ); }, ); } + List _buildNodeMarkersCached( + List contacts, + AppSettings settings, + int contactsSignature, + int batterySignature, + _Freshness freshness, + double timeFilterHours, + bool keyPrefixEnabled, + String keyPrefix, + bool showDiscoveryContacts, + int batteryChemistrySignature, { + required bool showLabels, + Contact? selectedContact, + }) { + final visibleContactsSignature = Object.hashAll( + contacts.map( + (contact) => + Object.hash(_mapContactSignature(contact), _ageOf(contact)), + ), + ); + final key = _NodeMarkersCacheKey( + contactsSignature: contactsSignature, + visibleContactsSignature: visibleContactsSignature, + batterySignature: batterySignature, + freshness: freshness, + timeFilterHours: timeFilterHours, + keyPrefixEnabled: keyPrefixEnabled, + keyPrefix: keyPrefix, + showDiscoveryContacts: showDiscoveryContacts, + batteryChemistrySignature: batteryChemistrySignature, + showLabels: showLabels, + selectedKey: selectedContact?.publicKeyHex, + zoom: _zoom, + overlapsMode: settings.mapShowOverlaps, + showRepeaters: settings.mapShowRepeaters, + showChatNodes: settings.mapShowChatNodes, + showOtherNodes: settings.mapShowOtherNodes, + isBuildingPathTrace: _isBuildingPathTrace, + ); + if (key != _nodeMarkersCacheKey) { + _nodeMarkersCacheKey = key; + _cachedNodeMarkers = List.unmodifiable( + _buildNodeMarkers( + contacts, + settings, + showLabels: showLabels, + selectedContact: selectedContact, + ), + ); + } + return _cachedNodeMarkers; + } + List<_GuessedLocation> _computeGuessedLocations( List allContacts, List withLocation, @@ -904,39 +1178,40 @@ class _MapScreenState extends State { final color = _getNodeColor(guess.contact.type); final marker = Marker( point: guess.position, - width: 35, - height: 35, + width: 48, + height: 48, child: GestureDetector( onLongPress: () => _isBuildingPathTrace ? _showNodeInfo(context, guess.contact) : null, onTap: () => _isBuildingPathTrace ? _addToPath(context, guess.contact, position: guess.position) - : _showNodeInfo( - context, - guess.contact, - guessedPosition: guess.position, + : _selectNode(guess.contact, guessedPosition: guess.position), + child: Center( + child: Container( + width: 36, + height: 36, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: MapPalette.panelDark, + border: Border.all( + color: guess.highConfidence ? color : MapPalette.textMuted, + width: guess.highConfidence ? 2.5 : 2, ), - child: Container( - padding: const EdgeInsets.all(4), - decoration: BoxDecoration( - color: color.withValues( - alpha: guess.highConfidence ? 0.55 : 0.30, + boxShadow: const [ + BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 7, + offset: Offset(0, 2), + ), + ], + ), + alignment: Alignment.center, + child: Icon( + Icons.not_listed_location, + color: MapPalette.textPrimary, + size: 19, ), - shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), - boxShadow: [ - BoxShadow( - color: Colors.black.withValues(alpha: 0.3), - blurRadius: 4, - offset: const Offset(0, 2), - ), - ], - ), - child: const Icon( - Icons.not_listed_location, - color: Colors.white, - size: 20, ), ), ), @@ -963,17 +1238,18 @@ class _MapScreenState extends State { }) { List filtered = []; bool addContact = false; + for (final contact in contacts) { addContact = false; if (!contact.hasLocation && !noLocations) { continue; } - // Apply node type filters + // Apply node type filters. The overlaps toggle is purely a visual + // highlight (applied in _buildNodeMarkers) and no longer affects which + // nodes are shown. if (contact.type == advTypeRepeater && - (settings.mapShowRepeaters || - _isBuildingPathTrace || - settings.mapShowOverlaps)) { + (settings.mapShowRepeaters || _isBuildingPathTrace)) { addContact = true; } if (contact.type == advTypeChat && @@ -982,9 +1258,7 @@ class _MapScreenState extends State { } if (contact.type != advTypeChat && contact.type != advTypeRepeater && - (settings.mapShowOtherNodes || - _isBuildingPathTrace || - settings.mapShowOverlaps)) { + (settings.mapShowOtherNodes || _isBuildingPathTrace)) { addContact = true; } @@ -992,25 +1266,6 @@ class _MapScreenState extends State { addContact = false; } - if (settings.mapShowOverlaps) { - final hasOverlap = contacts - .where( - (c) => - c.publicKeyHex != contact.publicKeyHex && - c.publicKey.first == contact.publicKey.first && - (c.type == advTypeRepeater || c.type == advTypeRoom) && - (contact.type == advTypeRepeater || - contact.type == advTypeRoom), - ) - .firstOrNull; - - if (hasOverlap == null && - settings.mapShowOverlaps && - !_isBuildingPathTrace) { - addContact = false; - } - } - if (addContact) { filtered.add(contact); } @@ -1018,59 +1273,45 @@ class _MapScreenState extends State { return filtered; } - List _buildMarkers( + List _buildNodeMarkers( List contacts, settings, { required bool showLabels, + Contact? selectedContact, }) { final markers = []; - final filteredContacts = _filterContactsBySettings(contacts, settings); - for (final contact in filteredContacts) { - final marker = Marker( - point: LatLng(contact.latitude!, contact.longitude!), - width: 35, - height: 35, - child: GestureDetector( - onLongPress: () => - _isBuildingPathTrace ? _showNodeInfo(context, contact) : null, - onTap: () => _isBuildingPathTrace - ? _addToPath(context, contact) - : _showNodeInfo(context, contact), - child: Column( - children: [ - Container( - padding: const EdgeInsets.all(4), - decoration: BoxDecoration( - color: settings.mapShowOverlaps && !_isBuildingPathTrace - ? Colors.red - : _getNodeColor(contact.type), - shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), - boxShadow: [ - BoxShadow( - color: Colors.black.withValues(alpha: 0.3), - blurRadius: 4, - offset: const Offset(0, 2), - ), - ], - ), - child: Icon( - _getNodeIcon(contact.type), - color: Colors.white, - size: 20, - ), - ), - ], - ), - ), - ); + final overlapsMode = settings.mapShowOverlaps && !_isBuildingPathTrace; + final selectedKey = selectedContact?.publicKeyHex; + final items = contacts.where((c) => c.publicKeyHex != selectedKey).toList(); - markers.add(marker); + // Key-prefix overlaps are a visual highlight only: flag the repeaters/rooms + // whose first key byte collides with another repeater/room on the map. + final overlapPrefixes = {}; + if (overlapsMode) { + final counts = {}; + for (final contact in contacts) { + if (contact.type == advTypeRepeater || contact.type == advTypeRoom) { + final prefix = contact.publicKey.first; + counts[prefix] = (counts[prefix] ?? 0) + 1; + } + } + counts.forEach((prefix, count) { + if (count > 1) overlapPrefixes.add(prefix); + }); + } + bool isOverlap(Contact contact) => + overlapsMode && + (contact.type == advTypeRepeater || contact.type == advTypeRoom) && + overlapPrefixes.contains(contact.publicKey.first); + + void addNode(Contact contact, {bool dot = false}) { + final overlap = isOverlap(contact); + markers.add(_nodeMarker(contact, overlapsMode: overlap, dot: dot)); if (showLabels) { markers.add( _buildNodeLabelMarker( point: LatLng(contact.latitude!, contact.longitude!), - label: settings.mapShowOverlaps && !_isBuildingPathTrace + label: overlap ? "${contact.publicKeyHex.substring(0, 2)}:${contact.name}" : contact.name, ), @@ -1078,9 +1319,196 @@ class _MapScreenState extends State { } } + if (_zoom >= _clusterOffZoom || overlapsMode || _isBuildingPathTrace) { + for (final contact in items) { + addNode(contact); + } + } else { + // Grid clustering: bucket markers into ~64px screen cells at the + // current zoom; cells with 2+ nodes render as a numbered cluster. + final cellDeg = 360.0 / (256.0 * pow(2.0, _zoom)) * 64.0; + final cells = >{}; + for (final contact in items) { + final key = + '${(contact.latitude! / cellDeg).floor()}:${(contact.longitude! / cellDeg).floor()}'; + (cells[key] ??= []).add(contact); + } + for (final cell in cells.values) { + if (cell.length == 1) { + addNode(cell.first, dot: true); + } else { + markers.add(_clusterMarker(cell)); + } + } + } + + // Selected node always renders individually on top, even when its + // neighbors are clustered or it is filtered out. + if (selectedContact != null && selectedContact.hasLocation) { + markers.add( + _nodeMarker( + selectedContact, + overlapsMode: isOverlap(selectedContact), + selected: true, + ), + ); + markers.add( + _buildNodeLabelMarker( + point: LatLng(selectedContact.latitude!, selectedContact.longitude!), + label: selectedContact.name, + ), + ); + } + return markers; } + Marker _nodeMarker( + Contact contact, { + bool overlapsMode = false, + bool dot = false, + bool selected = false, + }) { + final age = _ageOf(contact); + final baseColor = overlapsMode + ? MapPalette.batteryLow + : _markerColor(contact); + final stale = age == _NodeAge.stale; + final online = age == _NodeAge.online; + final batteryLow = _isBatteryLow(contact); + final size = selected ? 46.0 : (dot ? 22.0 : 40.0); + return Marker( + point: LatLng(contact.latitude!, contact.longitude!), + width: size, + height: size, + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onLongPress: () => + _isBuildingPathTrace ? _showNodeInfo(context, contact) : null, + onTap: () => _isBuildingPathTrace + ? _addToPath(context, contact) + : _selectNode(contact), + child: Center( + child: dot && !selected + ? Container( + width: 15, + height: 15, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: baseColor, + border: Border.all( + color: MapPalette.markerOutline, + width: 2, + ), + boxShadow: const [ + BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 6, + offset: Offset(0, 2), + ), + ], + ), + ) + : _buildNodeMarkerWidget( + color: baseColor, + icon: _getNodeIcon(contact.type), + selected: selected, + stale: stale, + online: online, + batteryLow: batteryLow, + ), + ), + ), + ); + } + + Marker _clusterMarker(List members) { + final count = members.length; + double lat = 0, lon = 0; + var online = 0; + for (final m in members) { + lat += m.latitude!; + lon += m.longitude!; + if (_ageOf(m) == _NodeAge.online) online++; + } + final center = LatLng(lat / count, lon / count); + final size = count >= 50 + ? 54.0 + : count >= 16 + ? 50.0 + : count >= 6 + ? 46.0 + : 42.0; + return Marker( + point: center, + width: size, + height: size, + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () => _zoomToCluster(members), + child: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: MapPalette.cluster, + border: Border.all(color: MapPalette.markerOutline, width: 3), + boxShadow: const [ + BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 8, + offset: Offset(0, 3), + ), + ], + ), + alignment: Alignment.center, + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + '$count', + style: MeshTheme.mono( + fontSize: count >= 100 ? 11.5 : 13.5, + fontWeight: FontWeight.w800, + color: Colors.white, + ), + ), + if (online > 0) + Container( + width: 7, + height: 7, + margin: const EdgeInsets.only(top: 1), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: MapPalette.online, + border: Border.all(color: Colors.white, width: 1), + ), + ), + ], + ), + ), + ), + ); + } + + void _zoomToCluster(List members) { + HapticFeedback.selectionClick(); + var minLat = double.infinity, maxLat = -double.infinity; + var minLon = double.infinity, maxLon = -double.infinity; + for (final m in members) { + minLat = min(minLat, m.latitude!); + maxLat = max(maxLat, m.latitude!); + minLon = min(minLon, m.longitude!); + maxLon = max(maxLon, m.longitude!); + } + _mapController.fitCamera( + CameraFit.bounds( + bounds: LatLngBounds(LatLng(minLat, minLon), LatLng(maxLat, maxLon)), + padding: const EdgeInsets.all(72), + maxZoom: 16, + ), + ); + } + Marker _buildNodeLabelMarker({required LatLng point, required String label}) { return Marker( point: point, @@ -1095,18 +1523,26 @@ class _MapScreenState extends State { child: Container( padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), decoration: BoxDecoration( - color: Colors.black54, - borderRadius: BorderRadius.circular(8), + color: MapPalette.panelDark, + borderRadius: BorderRadius.circular(MeshRadii.xs), + border: Border.all(color: MapPalette.border), + boxShadow: const [ + BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 4, + offset: Offset(0, 1), + ), + ], ), alignment: Alignment.center, child: Text( label, maxLines: 1, overflow: TextOverflow.ellipsis, - style: const TextStyle( - color: Colors.white, - fontSize: 11, - fontWeight: FontWeight.w500, + style: MeshTheme.mono( + fontSize: 10, + fontWeight: FontWeight.w700, + color: MapPalette.textPrimary, ), ), ), @@ -1119,18 +1555,44 @@ class _MapScreenState extends State { Color _getNodeColor(int type) { switch (type) { case advTypeChat: - return Colors.blue; + return MapPalette.selected; case advTypeRepeater: - return Colors.green; + return MapPalette.repeater; case advTypeRoom: - return Colors.purple; + return MapPalette.router; case advTypeSensor: - return Colors.orange; + return MapPalette.sensor; default: - return Colors.grey; + return MapPalette.offline; } } + Color _markerColor(Contact contact) { + switch (contact.type) { + case advTypeRepeater: + return MapPalette.repeater; + case advTypeRoom: + return MapPalette.router; + case advTypeSensor: + return MapPalette.sensor; + default: + return _ageColor(_ageOf(contact)); + } + } + + bool _isBatteryLow(Contact contact) { + if (contact.type != advTypeRepeater) return false; + final connector = context.read(); + final millivolts = connector.getRepeaterBatteryMillivolts( + contact.publicKeyHex, + ); + if (millivolts == null) return false; + final chemistry = context + .read() + .batteryChemistryForRepeater(contact.publicKeyHex); + return estimateBatteryPercentFromMillivolts(millivolts, chemistry) <= 20; + } + IconData _getNodeIcon(int type) { switch (type) { case advTypeChat: @@ -1146,206 +1608,872 @@ class _MapScreenState extends State { } } - Widget _buildLegend( - List contacts, - List contactsWithLocation, - settings, - int markerCount, - int guessedCount, - ) { - final filteredContacts = _filterContactsBySettings( - contacts, - settings, - noLocations: false, - ); - final filteredContactsAll = _filterContactsBySettings( - contacts, - settings, - noLocations: true, - ); - - final nodeCount = filteredContacts.length; - final nodeCountAll = filteredContactsAll.length; - - return Positioned( - top: 16, - right: 16, - child: Card( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - InkWell( - borderRadius: BorderRadius.circular(12), - onTap: () { - setState(() { - _legendExpanded = !_legendExpanded; - }); - }, - child: Padding( - padding: const EdgeInsets.fromLTRB(12, 10, 12, 10), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - context.l10n.map_nodesCount( - nodeCount + - (settings.mapShowGuessedLocations - ? guessedCount - : 0), - ), - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 14, - ), - ), - Row( - children: [ - Icon( - Icons.location_on, - size: 16, - color: Colors.grey, - ), - Text( - ": $nodeCount", - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 14, - ), - ), - ], - ), - Row( - children: [ - const Icon( - Icons.wrong_location, - size: 16, - color: Colors.grey, - ), - Text( - ": ${nodeCountAll - nodeCount}", - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 14, - ), - ), - ], - ), - Row( - children: [ - const Icon( - Icons.add_outlined, - size: 16, - color: Colors.grey, - ), - Text( - ": $nodeCountAll", - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 14, - ), - ), - ], - ), - Text( - context.l10n.map_pinsCount(markerCount), - style: const TextStyle( - fontWeight: FontWeight.w600, - fontSize: 12, - ), - ), - ], - ), - const SizedBox(width: 8), - AnimatedRotation( - turns: _legendExpanded ? 0.5 : 0, - duration: const Duration(milliseconds: 200), - child: const Icon(Icons.expand_more, size: 20), - ), - ], - ), - ), + Widget _buildNodeMarkerWidget({ + required Color color, + required IconData icon, + bool selected = false, + bool stale = false, + bool online = false, + bool batteryLow = false, + }) { + final statusColor = batteryLow + ? MapPalette.batteryLow + : online + ? MapPalette.online + : stale + ? MapPalette.offline + : MapPalette.stale; + return Stack( + clipBehavior: Clip.none, + alignment: Alignment.center, + children: [ + Container( + width: selected ? 44 : 36, + height: selected ? 44 : 36, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: selected ? MapPalette.selected : color, + border: Border.all( + color: MapPalette.markerOutline, + width: selected ? 3 : 2.5, ), - AnimatedCrossFade( - firstChild: const SizedBox.shrink(), - secondChild: Padding( - padding: const EdgeInsets.fromLTRB(12, 0, 12, 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const SizedBox(height: 6), - _buildLegendItem( - Icons.person, - context.l10n.map_chat, - Colors.blue, - ), - _buildLegendItem( - Icons.router, - context.l10n.map_repeater, - Colors.green, - ), - _buildLegendItem( - Icons.meeting_room, - context.l10n.map_room, - Colors.purple, - ), - _buildLegendItem( - Icons.sensors, - context.l10n.map_sensor, - Colors.orange, - ), - _buildLegendItem( - Icons.flag, - context.l10n.map_pinDm, - Colors.blue, - ), - _buildLegendItem( - Icons.flag, - context.l10n.map_pinPrivate, - Colors.purple, - ), - _buildLegendItem( - Icons.flag, - context.l10n.map_pinPublic, - Colors.orange, - ), - if (settings.mapShowGuessedLocations && guessedCount > 0) - _buildLegendItem( - Icons.not_listed_location, - context.l10n.map_guessedLocation, - Colors.grey, - ), - ], - ), + boxShadow: [ + const BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 8, + offset: Offset(0, 3), ), - crossFadeState: _legendExpanded - ? CrossFadeState.showSecond - : CrossFadeState.showFirst, - duration: const Duration(milliseconds: 200), - ), - ], + if (selected) + BoxShadow( + color: MapPalette.selected.withValues(alpha: 0.75), + blurRadius: 14, + spreadRadius: 3, + ), + ], + ), + alignment: Alignment.center, + child: Icon(icon, color: Colors.white, size: selected ? 22 : 19), ), - ), + Positioned( + right: selected ? -1 : -2, + bottom: selected ? 0 : -2, + child: Container( + width: batteryLow ? 16 : (selected ? 13 : 12), + height: batteryLow ? 16 : (selected ? 13 : 12), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: statusColor, + border: Border.all(color: MapPalette.panelDark, width: 2), + ), + alignment: Alignment.center, + child: batteryLow + ? const Icon(Icons.battery_alert, size: 10, color: Colors.white) + : null, + ), + ), + ], ); } Widget _buildLegendItem(IconData icon, String label, Color color) { return Padding( - padding: const EdgeInsets.symmetric(vertical: 1.0), + padding: const EdgeInsets.symmetric(vertical: 1.5), child: Row( mainAxisSize: MainAxisSize.min, children: [ - Icon(icon, size: 16, color: color), + Icon(icon, size: 15, color: color), const SizedBox(width: 8), - Text(label, style: const TextStyle(fontSize: 12)), + Expanded( + child: Text( + label, + style: const TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: MapPalette.textSecondary, + ), + overflow: TextOverflow.ellipsis, + ), + ), ], ), ); } - List<_SharedMarker> _collectSharedMarkers(MeshCoreConnector connector) { + Color _ageColor(_NodeAge age) { + switch (age) { + case _NodeAge.online: + return MapPalette.online; + case _NodeAge.recent: + return MapPalette.stale; + case _NodeAge.stale: + return MapPalette.textMuted; + } + } + + String _ageLabel(_NodeAge age) { + switch (age) { + case _NodeAge.online: + return context.l10n.map_online; + case _NodeAge.recent: + return context.l10n.map_recent; + case _NodeAge.stale: + return context.l10n.map_stale; + } + } + + Widget _buildTopOverlay( + BuildContext context, { + required MeshCoreConnector connector, + required AppSettingsService settingsService, + required List allContacts, + required List<_GuessedLocation> guessedLocations, + required int visibleCount, + required int onlineCount, + required int repeaterCount, + required int hiddenCount, + required int pinCount, + }) { + final settings = settingsService.settings; + final hasQuery = _searchQuery.trim().isNotEmpty; + return Positioned( + top: 8, + left: 12, + right: 12, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Material( + color: MapPalette.panelDark, + shape: StadiumBorder( + side: const BorderSide(color: MapPalette.border), + ), + clipBehavior: Clip.antiAlias, + child: TextField( + controller: _searchController, + focusNode: _searchFocus, + decoration: InputDecoration( + hintText: context.l10n.map_searchHint, + hintStyle: const TextStyle( + color: MapPalette.textSecondary, + ), + prefixIcon: const Icon( + Icons.search, + size: 20, + color: MapPalette.textPrimary, + ), + suffixIcon: hasQuery + ? IconButton( + color: MapPalette.textPrimary, + icon: const Icon(Icons.close, size: 18), + onPressed: () { + setState(() { + _searchQuery = ''; + _searchController.clear(); + }); + }, + ) + : null, + filled: false, + border: InputBorder.none, + enabledBorder: InputBorder.none, + focusedBorder: InputBorder.none, + isDense: true, + contentPadding: const EdgeInsets.symmetric( + horizontal: 4, + vertical: 12, + ), + ), + style: const TextStyle( + fontSize: 14, + color: MapPalette.textPrimary, + fontWeight: FontWeight.w600, + ), + cursorColor: MapPalette.selected, + onChanged: (value) { + setState(() => _searchQuery = value); + }, + ), + ), + ), + const SizedBox(width: 8), + Material( + color: MapPalette.panelDark, + shape: StadiumBorder( + side: const BorderSide(color: MapPalette.border), + ), + clipBehavior: Clip.antiAlias, + child: InkWell( + onTap: () => setState(() => _statsExpanded = !_statsExpanded), + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 11, + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon( + Icons.hub, + size: 15, + color: MapPalette.selected, + ), + const SizedBox(width: 6), + Text( + '$visibleCount', + style: MeshTheme.mono( + fontSize: 13, + fontWeight: FontWeight.w700, + color: MapPalette.textPrimary, + ), + ), + const SizedBox(width: 2), + AnimatedRotation( + turns: _statsExpanded ? 0.5 : 0, + duration: const Duration(milliseconds: 200), + child: const Icon( + Icons.expand_more, + size: 16, + color: MapPalette.textPrimary, + ), + ), + ], + ), + ), + ), + ), + ], + ), + const SizedBox(height: 6), + LayoutBuilder( + builder: (context, constraints) { + final chips = [ + _mapChip( + label: context.l10n.time_allTime, + selected: _freshness == _Freshness.all, + onTap: () => setState(() => _freshness = _Freshness.all), + ), + _mapChip( + label: context.l10n.map_online, + selected: _freshness == _Freshness.online, + color: MapPalette.online, + onTap: () => setState(() => _freshness = _Freshness.online), + ), + _mapChip( + label: context.l10n.map_recent, + selected: _freshness == _Freshness.recent, + color: MapPalette.stale, + onTap: () => setState(() => _freshness = _Freshness.recent), + ), + _mapChip( + label: context.l10n.map_stale, + selected: _freshness == _Freshness.stale, + color: MapPalette.offline, + onTap: () => setState(() => _freshness = _Freshness.stale), + ), + _mapChip( + label: context.l10n.map_repeaters, + selected: settings.mapShowRepeaters, + color: MapPalette.repeater, + onTap: () => settingsService.setMapShowRepeaters( + !settings.mapShowRepeaters, + ), + ), + _mapChip( + label: context.l10n.map_chatNodes, + selected: settings.mapShowChatNodes, + color: MapPalette.selected, + onTap: () => settingsService.setMapShowChatNodes( + !settings.mapShowChatNodes, + ), + ), + ]; + + if (constraints.maxWidth < 600) { + return Wrap(runSpacing: 6, children: chips); + } + + return SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row(children: chips), + ); + }, + ), + if (hasQuery) + _buildSearchResults(context, allContacts, guessedLocations) + else if (_statsExpanded) + Align( + alignment: Alignment.centerRight, + child: _buildStatsCard( + context, + settings: settings, + visibleCount: visibleCount, + onlineCount: onlineCount, + repeaterCount: repeaterCount, + hiddenCount: hiddenCount, + pinCount: pinCount, + guessedCount: guessedLocations.length, + ), + ), + ], + ), + ); + } + + Widget _mapChip({ + required String label, + required bool selected, + required VoidCallback onTap, + Color? color, + }) { + final accent = color ?? MapPalette.selected; + return Padding( + padding: const EdgeInsets.only(right: 6), + child: Material( + color: selected + ? Color.alphaBlend( + accent.withValues(alpha: 0.34), + MapPalette.panelDark, + ) + : MapPalette.panelDark, + shape: StadiumBorder( + side: BorderSide( + color: selected ? accent : MapPalette.border, + width: selected ? 1.5 : 1, + ), + ), + clipBehavior: Clip.antiAlias, + child: InkWell( + onTap: () { + HapticFeedback.selectionClick(); + onTap(); + }, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 7), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + if (selected) ...[ + const Icon( + Icons.check, + size: 13, + color: MapPalette.textPrimary, + ), + const SizedBox(width: 4), + ], + Text( + label, + style: TextStyle( + fontSize: 12.5, + fontWeight: FontWeight.w600, + color: selected + ? MapPalette.textPrimary + : MapPalette.textSecondary, + ), + ), + ], + ), + ), + ), + ), + ); + } + + Widget _buildSearchResults( + BuildContext context, + List allContacts, + List<_GuessedLocation> guessedLocations, + ) { + final query = _searchQuery.trim().toLowerCase(); + final matches = + allContacts.where((c) => matchesContactQuery(c, query)).toList() + ..sort((a, b) { + if (a.hasLocation != b.hasLocation) { + return a.hasLocation ? -1 : 1; + } + return b.lastSeen.compareTo(a.lastSeen); + }); + final results = matches.take(8).toList(); + return Container( + margin: const EdgeInsets.only(top: 6), + constraints: const BoxConstraints(maxHeight: 300), + decoration: BoxDecoration( + color: MapPalette.panelDark, + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: MapPalette.border), + boxShadow: const [ + BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 10, + offset: Offset(0, 4), + ), + ], + ), + child: results.isEmpty + ? Padding( + padding: const EdgeInsets.all(16), + child: Text( + context.l10n.map_noResults, + style: const TextStyle( + color: MapPalette.textSecondary, + fontSize: 13, + ), + ), + ) + : ListView.separated( + shrinkWrap: true, + padding: const EdgeInsets.symmetric(vertical: 4), + itemCount: results.length, + separatorBuilder: (_, _) => + const Divider(height: 1, color: MapPalette.border), + itemBuilder: (context, index) { + final c = results[index]; + final color = _getNodeColor(c.type); + return InkWell( + onTap: () => _onSearchResultTap(c, guessedLocations), + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + child: Row( + children: [ + Icon(_getNodeIcon(c.type), size: 18, color: color), + const SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + c.name, + style: const TextStyle( + fontSize: 13.5, + fontWeight: FontWeight.w600, + color: MapPalette.textPrimary, + ), + overflow: TextOverflow.ellipsis, + ), + Text( + c.publicKeyHex.substring(0, 12), + style: MeshTheme.mono( + fontSize: 10.5, + color: MapPalette.textSecondary, + ), + ), + ], + ), + ), + if (c.hasLocation) + Icon( + Icons.chevron_right, + size: 18, + color: MapPalette.textSecondary, + ) + else + Text( + context.l10n.map_noGps.toUpperCase(), + style: MeshTheme.accentLabel( + color: MapPalette.textMuted, + fontSize: 8.5, + ), + ), + ], + ), + ), + ); + }, + ), + ); + } + + void _onSearchResultTap( + Contact contact, + List<_GuessedLocation> guessedLocations, + ) { + if (contact.hasLocation) { + _selectNode(contact); + _mapController.move( + LatLng(contact.latitude!, contact.longitude!), + max(_zoom, 14), + ); + return; + } + _GuessedLocation? guess; + for (final g in guessedLocations) { + if (g.contact.publicKeyHex == contact.publicKeyHex) { + guess = g; + break; + } + } + if (guess != null) { + _selectNode(contact, guessedPosition: guess.position); + _mapController.move(guess.position, max(_zoom, 13)); + } else { + setState(() { + _searchQuery = ''; + _searchController.clear(); + _searchFocus.unfocus(); + }); + _showNodeInfo(context, contact); + } + } + + Widget _buildStatsCard( + BuildContext context, { + required dynamic settings, + required int visibleCount, + required int onlineCount, + required int repeaterCount, + required int hiddenCount, + required int pinCount, + required int guessedCount, + }) { + return Container( + margin: const EdgeInsets.only(top: 6), + width: 230, + padding: const EdgeInsets.fromLTRB(14, 12, 14, 12), + decoration: BoxDecoration( + color: MapPalette.panelDark, + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: MapPalette.border), + boxShadow: const [ + BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 10, + offset: Offset(0, 4), + ), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + _statRow(context.l10n.map_visible, visibleCount, MapPalette.selected), + _statRow(context.l10n.map_online, onlineCount, MapPalette.online), + _statRow( + context.l10n.map_repeaters, + repeaterCount, + MapPalette.repeater, + ), + _statRow(context.l10n.map_hidden, hiddenCount, MapPalette.offline), + _statRow(context.l10n.map_markers, pinCount, MapPalette.shared), + const Divider(height: 16, color: MapPalette.border), + _buildLegendItem( + Icons.person, + context.l10n.map_chat, + MapPalette.selected, + ), + _buildLegendItem( + Icons.router, + context.l10n.map_repeater, + MapPalette.repeater, + ), + _buildLegendItem( + Icons.meeting_room, + context.l10n.map_room, + MapPalette.router, + ), + _buildLegendItem( + Icons.sensors, + context.l10n.map_sensor, + MapPalette.sensor, + ), + _buildLegendItem( + Icons.flag, + context.l10n.map_pinDm, + MapPalette.shared, + ), + if (settings.mapShowGuessedLocations && guessedCount > 0) + _buildLegendItem( + Icons.not_listed_location, + context.l10n.map_guessedLocation, + MapPalette.textMuted, + ), + ], + ), + ); + } + + Widget _statRow(String label, int value, Color color) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 2), + child: Row( + children: [ + Container( + width: 7, + height: 7, + decoration: BoxDecoration(shape: BoxShape.circle, color: color), + ), + const SizedBox(width: 8), + Expanded( + child: Text( + label, + style: TextStyle(fontSize: 12.5, color: MapPalette.textSecondary), + overflow: TextOverflow.ellipsis, + ), + ), + Text( + '$value', + style: MeshTheme.mono( + fontSize: 13, + fontWeight: FontWeight.w700, + color: MapPalette.textPrimary, + ), + ), + ], + ), + ); + } + + Widget _buildSelectedNodeCard( + BuildContext context, + Contact contact, + MeshCoreConnector connector, + ) { + final color = _markerColor(contact); + final age = _ageOf(contact); + final pos = contact.hasLocation + ? LatLng(contact.latitude!, contact.longitude!) + : _selectedGuessPos; + return Positioned( + left: 12, + right: 12, + bottom: 12, + child: TweenAnimationBuilder( + tween: Tween(begin: 1, end: 0), + duration: const Duration(milliseconds: 220), + curve: Curves.easeOutCubic, + builder: (context, t, child) => Transform.translate( + offset: Offset(0, 32 * t), + child: Opacity(opacity: 1 - t, child: child), + ), + child: MeshCard( + margin: EdgeInsets.zero, + padding: const EdgeInsets.fromLTRB(14, 12, 8, 12), + color: MapPalette.panelDark, + borderColor: MapPalette.border, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + AvatarCircle( + name: contact.name, + size: 38, + color: color, + icon: _getNodeIcon(contact.type), + ), + const SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Flexible( + child: Text( + contact.name, + style: const TextStyle( + fontSize: 15, + fontWeight: FontWeight.w700, + color: MapPalette.textPrimary, + ), + overflow: TextOverflow.ellipsis, + ), + ), + if (contact.isFavorite) ...[ + const SizedBox(width: 4), + const Icon( + Icons.star, + size: 14, + color: MapPalette.stale, + ), + ], + ], + ), + const SizedBox(height: 3), + Row( + children: [ + StatusChip( + label: _ageLabel(age), + color: _ageColor(age), + fontSize: 9.5, + pulse: age == _NodeAge.online, + ), + const SizedBox(width: 6), + Flexible( + child: Text( + contact.typeLabel(context.l10n), + style: const TextStyle( + fontSize: 11.5, + color: MapPalette.textSecondary, + ), + overflow: TextOverflow.ellipsis, + ), + ), + ], + ), + ], + ), + ), + if (pos != null) + IconButton( + color: MapPalette.textPrimary, + icon: const Icon(Icons.center_focus_strong, size: 20), + tooltip: context.l10n.map_centerOnNode, + onPressed: () => _mapController.move(pos, max(_zoom, 15)), + ), + IconButton( + color: MapPalette.textPrimary, + icon: const Icon(Icons.close, size: 20), + onPressed: _clearSelection, + ), + ], + ), + const SizedBox(height: 8), + Wrap( + spacing: 14, + runSpacing: 4, + children: [ + _miniMeta( + context.l10n.map_lastSeen, + _formatLastSeen(contact.lastSeen), + ), + _miniMeta( + context.l10n.map_path, + contact.pathLabel(context.l10n), + ), + _miniMeta('ID', contact.publicKeyHex.substring(0, 12)), + if (pos != null) + _miniMeta( + context.l10n.map_location, + '${contact.hasLocation ? '' : '~'}${pos.latitude.toStringAsFixed(5)}, ${pos.longitude.toStringAsFixed(5)}', + ), + ], + ), + const SizedBox(height: 10), + Row( + children: [ + ..._selectedNodeActions(context, contact, connector), + TextButton( + style: TextButton.styleFrom( + foregroundColor: MapPalette.selected, + ), + onPressed: () => _showNodeInfo( + context, + contact, + guessedPosition: contact.hasLocation + ? null + : _selectedGuessPos, + ), + child: Text(context.l10n.map_details), + ), + ], + ), + ], + ), + ), + ), + ); + } + + Widget _miniMeta(String label, String value) { + return Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + label.toUpperCase(), + style: MeshTheme.accentLabel( + color: MapPalette.textMuted, + fontSize: 8, + ), + ), + const SizedBox(height: 1), + Text( + value, + style: MeshTheme.mono(fontSize: 11.5, color: MapPalette.textPrimary), + ), + ], + ); + } + + List _selectedNodeActions( + BuildContext context, + Contact contact, + MeshCoreConnector connector, + ) { + Widget action(String label, IconData icon, VoidCallback onPressed) { + return Padding( + padding: const EdgeInsets.only(right: 8), + child: FilledButton.icon( + style: FilledButton.styleFrom( + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8), + visualDensity: VisualDensity.compact, + ), + onPressed: onPressed, + icon: Icon(icon, size: 16), + label: Text(label, style: const TextStyle(fontSize: 12.5)), + ), + ); + } + + switch (contact.type) { + case advTypeChat: + return [ + action(context.l10n.contacts_openChat, Icons.chat_bubble_outline, () { + if (!contact.isActive) { + connector.importDiscoveredContact(contact); + } + final unread = connector.getUnreadCountForContactKey( + contact.publicKeyHex, + ); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + ChatScreen(contact: contact, initialUnreadCount: unread), + ), + ); + }), + ]; + case advTypeRepeater: + return [ + action(context.l10n.map_manageRepeater, Icons.cell_tower, () { + if (!contact.isActive) { + connector.importDiscoveredContact(contact); + } + _showRepeaterLogin(context, contact); + }), + ]; + case advTypeRoom: + return [ + action(context.l10n.map_joinRoom, Icons.meeting_room, () { + if (!contact.isActive) { + connector.importDiscoveredContact(contact); + } + _showRoomLogin(context, contact); + }), + ]; + default: + return const []; + } + } + + List<_SharedMarker> _collectSharedMarkers( + MeshCoreConnector connector, + int markerSignature, + ) { + final locale = Localizations.localeOf(context); + if (_sharedMarkersCacheSignature == markerSignature && + _sharedMarkersCacheLocale == locale) { + return _cachedSharedMarkers; + } + // Build a _SharedMarker per message (history empty), grouped by dedupe key. // Afterwards pick the latest per key and fill its history from older ones. final updatesByKey = >{}; @@ -1437,13 +2565,16 @@ class _MapScreenState extends State { }); markers.sort((a, b) => b.timestamp.compareTo(a.timestamp)); - return markers; + _sharedMarkersCacheSignature = markerSignature; + _sharedMarkersCacheLocale = locale; + _cachedSharedMarkers = List.unmodifiable(markers); + return _cachedSharedMarkers; } Marker _buildSharedMarker(_SharedMarker marker) { final markerColor = marker.isChannel - ? (marker.isPublicChannel ? Colors.orange : Colors.purple) - : Colors.blue; + ? (marker.isPublicChannel ? MapPalette.cluster : MapPalette.router) + : MapPalette.shared; return Marker( point: marker.position, width: 60, @@ -1461,20 +2592,22 @@ class _MapScreenState extends State { child: Column( children: [ Container( - padding: const EdgeInsets.all(6), + width: 36, + height: 36, decoration: BoxDecoration( - color: markerColor, shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), - boxShadow: [ + color: markerColor, + border: Border.all(color: MapPalette.markerOutline, width: 2.5), + boxShadow: const [ BoxShadow( - color: Colors.black.withValues(alpha: 0.3), - blurRadius: 4, - offset: const Offset(0, 2), + color: MapPalette.markerShadow, + blurRadius: 8, + offset: Offset(0, 3), ), ], ), - child: const Icon(Icons.flag, color: Colors.white, size: 20), + alignment: Alignment.center, + child: const Icon(Icons.flag, color: Colors.white, size: 19), ), ], ), @@ -1534,56 +2667,13 @@ class _MapScreenState extends State { LatLng? guessedPosition, }) { final connector = context.read(); - showDialog( - context: context, - builder: (dialogContext) => AlertDialog( - title: Row( - children: [ - Icon( - _getNodeIcon(contact.type), - color: _getNodeColor(contact.type), - ), - const SizedBox(width: 8), - Expanded(child: SelectableText(contact.name)), - ], - ), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildInfoRow( - context.l10n.map_type, - contact.typeLabel(context.l10n), - ), - _buildInfoRow( - context.l10n.map_path, - contact.pathLabel(context.l10n), - ), - if (contact.hasLocation) - _buildInfoRow( - context.l10n.map_location, - '${contact.latitude!.toStringAsFixed(6)}, ${contact.longitude!.toStringAsFixed(6)}', - ) - else if (guessedPosition != null) - _buildInfoRow( - context.l10n.map_estLocation, - '~${guessedPosition.latitude.toStringAsFixed(6)}, ${guessedPosition.longitude.toStringAsFixed(6)}', - ), - _buildInfoRow( - context.l10n.map_lastSeen, - _formatLastSeen(contact.lastSeen), - ), - _buildInfoRow(context.l10n.map_publicKey, contact.publicKeyHex), - ], - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(dialogContext), - child: Text(context.l10n.common_close), - ), - if (contact.type == - advTypeChat) // Only show chat button for chat nodes - TextButton( + showMeshSheet( + context, + builder: (sheetContext) { + final actions = []; + if (contact.type == advTypeChat) { + actions.add( + FilledButton( onPressed: () { if (!contact.isActive) { connector.importDiscoveredContact(contact); @@ -1591,7 +2681,7 @@ class _MapScreenState extends State { final unread = connector.getUnreadCountForContactKey( contact.publicKeyHex, ); - Navigator.pop(dialogContext); + Navigator.pop(sheetContext); Navigator.push( context, MaterialPageRoute( @@ -1604,30 +2694,88 @@ class _MapScreenState extends State { }, child: Text(context.l10n.contacts_openChat), ), - if (contact.type == advTypeRepeater) - TextButton( + ); + } + if (contact.type == advTypeRepeater) { + actions.add( + FilledButton( onPressed: () { if (!contact.isActive) { connector.importDiscoveredContact(contact); } - Navigator.pop(dialogContext); + Navigator.pop(sheetContext); _showRepeaterLogin(context, contact); }, child: Text(context.l10n.map_manageRepeater), ), - if (contact.type == advTypeRoom) - TextButton( + ); + } + if (contact.type == advTypeRoom) { + actions.add( + FilledButton( onPressed: () { if (!contact.isActive) { connector.importDiscoveredContact(contact); } - Navigator.pop(dialogContext); + Navigator.pop(sheetContext); _showRoomLogin(context, contact); }, child: Text(context.l10n.map_joinRoom), ), - ], - ), + ); + } + return SafeArea( + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + BottomSheetHeader( + title: contact.name, + subtitle: contact.typeLabel(context.l10n), + trailing: Icon( + _getNodeIcon(contact.type), + color: _getNodeColor(contact.type), + size: 20, + ), + ), + Padding( + padding: const EdgeInsets.fromLTRB(16, 0, 16, 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildInfoRow( + context.l10n.map_path, + contact.pathLabel(context.l10n), + ), + if (contact.hasLocation) + _buildInfoRow( + context.l10n.map_location, + '${contact.latitude!.toStringAsFixed(6)}, ${contact.longitude!.toStringAsFixed(6)}', + ) + else if (guessedPosition != null) + _buildInfoRow( + context.l10n.map_estLocation, + '~${guessedPosition.latitude.toStringAsFixed(6)}, ${guessedPosition.longitude.toStringAsFixed(6)}', + ), + _buildInfoRow( + context.l10n.map_lastSeen, + _formatLastSeen(contact.lastSeen), + ), + _buildInfoRow( + context.l10n.map_publicKey, + contact.publicKeyHex, + ), + const SizedBox(height: 16), + ...actions, + ], + ), + ), + ], + ), + ), + ); + }, ); } @@ -1712,6 +2860,9 @@ class _MapScreenState extends State { child: Text(context.l10n.common_hide), ), TextButton( + style: TextButton.styleFrom( + foregroundColor: Theme.of(context).colorScheme.error, + ), onPressed: () async { setState(() { _hiddenMarkerIds.add(marker.id); @@ -1743,12 +2894,18 @@ class _MapScreenState extends State { label, style: TextStyle( fontSize: 12, - color: Colors.grey[600], + color: Theme.of(context).colorScheme.onSurfaceVariant, fontWeight: FontWeight.w500, ), ), const SizedBox(height: 2), - SelectableText(value, style: const TextStyle(fontSize: 14)), + SelectableText( + value, + style: MeshTheme.mono( + fontSize: 13, + color: Theme.of(context).colorScheme.onSurface, + ), + ), ], ), ); @@ -1808,10 +2965,7 @@ class _MapScreenState extends State { ); await connector.refreshDeviceInfo(); if (!mounted) return; - showDismissibleSnackBar( - messenger.context, - content: Text(successMsg), - ); + messenger.showSnackBar(SnackBar(content: Text(successMsg))); }, ), ListTile( @@ -2010,7 +3164,9 @@ class _MapScreenState extends State { return ListTile( leading: Icon( isPublic ? Icons.public : Icons.tag, - color: isPublic ? Colors.orange : Colors.blue, + color: isPublic + ? MapPalette.cluster + : MapPalette.repeater, ), title: Text(label), onTap: () async { @@ -2068,161 +3224,205 @@ class _MapScreenState extends State { return result ?? false; } - void _showFilterDialog( + void _showFilterSheet( BuildContext context, AppSettingsService settingsService, ) { - showDialog( - context: context, - builder: (dialogContext) => AlertDialog( - title: Text(context.l10n.map_filterNodes), - contentPadding: const EdgeInsets.fromLTRB(24, 20, 24, 0), - content: SingleChildScrollView( - child: Consumer( + showMeshSheet( + context, + builder: (sheetContext) => StatefulBuilder( + builder: (sheetContext, setSheetState) { + return Consumer( builder: (consumerContext, service, child) { final settings = service.settings; - return Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - context.l10n.map_nodeTypes, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, - ), - ), - const SizedBox(height: 8), - CheckboxListTile( - title: Text(context.l10n.map_chatNodes), - value: settings.mapShowChatNodes, - onChanged: (value) { - service.setMapShowChatNodes(value ?? true); - }, - contentPadding: EdgeInsets.zero, - ), - CheckboxListTile( - title: Text(context.l10n.map_repeaters), - value: settings.mapShowRepeaters, - onChanged: (value) { - service.setMapShowRepeaters(value ?? true); - }, - contentPadding: EdgeInsets.zero, - ), - CheckboxListTile( - title: Text(context.l10n.map_otherNodes), - value: settings.mapShowOtherNodes, - onChanged: (value) { - service.setMapShowOtherNodes(value ?? true); - }, - contentPadding: EdgeInsets.zero, - ), - CheckboxListTile( - title: Text(context.l10n.map_showGuessedLocations), - value: settings.mapShowGuessedLocations, - onChanged: (value) { - service.setMapShowGuessedLocations(value ?? true); - }, - contentPadding: EdgeInsets.zero, - ), - CheckboxListTile( - title: Text(context.l10n.map_showDiscoveryContacts), - value: settings.mapShowDiscoveryContacts, - onChanged: (value) { - service.setMapShowDiscoveryContacts(value ?? true); - }, - contentPadding: EdgeInsets.zero, - ), - CheckboxListTile( - title: Text(context.l10n.map_showOverlaps), - value: settings.mapShowOverlaps, - onChanged: (value) { - service.setMapShowOverlaps(value ?? true); - }, - contentPadding: EdgeInsets.zero, - ), + final scheme = Theme.of(sheetContext).colorScheme; - const SizedBox(height: 16), - Text( - context.l10n.map_keyPrefix, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, + Widget freshnessChip(_Freshness value, String label) { + final selected = _freshness == value; + final accent = switch (value) { + _Freshness.all => MapPalette.selected, + _Freshness.online => MapPalette.online, + _Freshness.recent => MapPalette.stale, + _Freshness.stale => MapPalette.offline, + }; + return FilterChip( + label: Text(label), + selected: selected, + showCheckmark: true, + checkmarkColor: accent, + backgroundColor: scheme.surfaceContainerLow, + selectedColor: Color.alphaBlend( + accent.withValues(alpha: 0.22), + scheme.surfaceContainerHigh, + ), + side: BorderSide( + color: selected ? accent : scheme.outline, + width: selected ? 1.5 : 1, + ), + labelStyle: TextStyle( + color: selected + ? scheme.onSurface + : scheme.onSurfaceVariant, + fontWeight: selected ? FontWeight.w700 : FontWeight.w600, + ), + onSelected: (_) { + setSheetState(() {}); + setState(() => _freshness = value); + }, + ); + } + + return SafeArea( + child: ConstrainedBox( + constraints: BoxConstraints( + maxHeight: MediaQuery.sizeOf(sheetContext).height * 0.8, + ), + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + BottomSheetHeader( + title: sheetContext.l10n.map_filterNodes, + ), + SectionHeader(sheetContext.l10n.map_activity), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Wrap( + spacing: 8, + runSpacing: 4, + children: [ + freshnessChip( + _Freshness.all, + sheetContext.l10n.time_allTime, + ), + freshnessChip( + _Freshness.online, + sheetContext.l10n.map_online, + ), + freshnessChip( + _Freshness.recent, + sheetContext.l10n.map_recent, + ), + freshnessChip( + _Freshness.stale, + sheetContext.l10n.map_stale, + ), + ], + ), + ), + SectionHeader( + sheetContext.l10n.map_lastSeenTime, + trailing: Text( + _getTimeFilterLabel(settings.mapTimeFilterHours), + style: MeshTheme.mono( + fontSize: 11, + color: scheme.onSurfaceVariant, + ), + ), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Slider( + value: _hoursToSliderValue( + settings.mapTimeFilterHours, + ), + min: 0, + max: 100, + divisions: 100, + onChanged: (value) { + final hours = _sliderValueToHours(value); + service.setMapTimeFilterHours(hours); + }, + ), + ), + SectionHeader(sheetContext.l10n.map_nodeTypes), + SwitchListTile( + title: Text(sheetContext.l10n.map_chatNodes), + value: settings.mapShowChatNodes, + dense: true, + onChanged: (value) => + service.setMapShowChatNodes(value), + ), + SwitchListTile( + title: Text(sheetContext.l10n.map_repeaters), + value: settings.mapShowRepeaters, + dense: true, + onChanged: (value) => + service.setMapShowRepeaters(value), + ), + SwitchListTile( + title: Text(sheetContext.l10n.map_otherNodes), + value: settings.mapShowOtherNodes, + dense: true, + onChanged: (value) => + service.setMapShowOtherNodes(value), + ), + SectionHeader(sheetContext.l10n.map_markers), + SwitchListTile( + title: Text(sheetContext.l10n.map_showSharedMarkers), + value: settings.mapShowMarkers, + dense: true, + onChanged: (value) => + service.setMapShowMarkers(value), + ), + SwitchListTile( + title: Text( + sheetContext.l10n.map_showGuessedLocations, + ), + value: settings.mapShowGuessedLocations, + dense: true, + onChanged: (value) => + service.setMapShowGuessedLocations(value), + ), + SwitchListTile( + title: Text( + sheetContext.l10n.map_showDiscoveryContacts, + ), + value: settings.mapShowDiscoveryContacts, + dense: true, + onChanged: (value) => + service.setMapShowDiscoveryContacts(value), + ), + SwitchListTile( + title: Text(sheetContext.l10n.map_showOverlaps), + value: settings.mapShowOverlaps, + dense: true, + onChanged: (value) => + service.setMapShowOverlaps(value), + ), + SectionHeader(sheetContext.l10n.map_keyPrefix), + SwitchListTile( + title: Text(sheetContext.l10n.map_filterByKeyPrefix), + value: settings.mapKeyPrefixEnabled, + dense: true, + onChanged: (value) => + service.setMapKeyPrefixEnabled(value), + ), + Padding( + padding: const EdgeInsets.fromLTRB(16, 4, 16, 20), + child: TextFormField( + initialValue: settings.mapKeyPrefix, + enabled: settings.mapKeyPrefixEnabled, + decoration: InputDecoration( + labelText: sheetContext.l10n.map_publicKeyPrefix, + hintText: + sheetContext.l10n.map_publicKeyPrefixHint, + isDense: true, + ), + style: MeshTheme.mono(fontSize: 13), + onChanged: (value) => + service.setMapKeyPrefix(value), + ), + ), + ], ), ), - const SizedBox(height: 8), - CheckboxListTile( - title: Text(context.l10n.map_filterByKeyPrefix), - value: settings.mapKeyPrefixEnabled, - onChanged: (value) { - service.setMapKeyPrefixEnabled(value ?? false); - }, - contentPadding: EdgeInsets.zero, - ), - TextFormField( - initialValue: settings.mapKeyPrefix, - enabled: settings.mapKeyPrefixEnabled, - decoration: InputDecoration( - labelText: context.l10n.map_publicKeyPrefix, - hintText: context.l10n.map_publicKeyPrefixHint, - border: const OutlineInputBorder(), - isDense: true, - ), - onChanged: (value) { - service.setMapKeyPrefix(value); - }, - ), - const SizedBox(height: 16), - Text( - context.l10n.map_markers, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, - ), - ), - const SizedBox(height: 8), - CheckboxListTile( - title: Text(context.l10n.map_showSharedMarkers), - value: settings.mapShowMarkers, - onChanged: (value) { - service.setMapShowMarkers(value ?? true); - }, - contentPadding: EdgeInsets.zero, - ), - const SizedBox(height: 16), - Text( - context.l10n.map_lastSeenTime, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, - ), - ), - const SizedBox(height: 8), - Text( - _getTimeFilterLabel(settings.mapTimeFilterHours), - style: TextStyle(fontSize: 14, color: Colors.grey[700]), - ), - Slider( - value: _hoursToSliderValue(settings.mapTimeFilterHours), - min: 0, - max: 100, - divisions: 100, - onChanged: (value) { - final hours = _sliderValueToHours(value); - service.setMapTimeFilterHours(hours); - }, - ), - ], + ), ); }, - ), - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(dialogContext), - child: Text(context.l10n.common_close), - ), - ], + ); + }, ), ); } @@ -2335,107 +3535,129 @@ class _MapScreenState extends State { top: 16, left: 16, right: 16, - child: Card( - child: Padding( - padding: const EdgeInsets.all(12.0), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - l10n.contacts_pathTrace, - style: TextStyle(fontWeight: FontWeight.bold), - ), - if (_pathTrace.isEmpty) const SizedBox(height: 8), - if (_pathTrace.isEmpty) - Text(l10n.map_tapToAdd, style: TextStyle(fontSize: 12)), - const SizedBox(height: 6), - if (_pathTrace.isNotEmpty) + child: DecoratedBox( + decoration: BoxDecoration( + color: MapPalette.panelDark, + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: MapPalette.border), + boxShadow: const [ + BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 10, + offset: Offset(0, 4), + ), + ], + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(MeshRadii.md), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ Text( - "${l10n.path_currentPathLabel} ${formatDistance(getPathDistanceMeters(_points), isImperial: isImperial)}", - style: TextStyle(fontSize: 12, color: Colors.grey[700]), + l10n.contacts_pathTrace, + style: TextStyle(fontWeight: FontWeight.bold), ), - SelectableText( - _pathTrace - .map((b) => b.toRadixString(16).padLeft(2, '0')) - .join(','), - style: TextStyle(fontSize: 18), - ), - // const SizedBox(height: 6), - Wrap( - alignment: WrapAlignment.center, - spacing: 1, - runSpacing: 1, - children: [ - if (_pathTrace.isNotEmpty) - IconButton( - onPressed: () { - final hashW = context - .read() - .pathHashByteWidth; - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PathTraceMapScreen( - title: l10n.contacts_pathTrace, - path: Uint8List.fromList(_pathTrace), - pathHashByteWidth: hashW, - pathContacts: _pathTraceContacts, + if (_pathTrace.isEmpty) const SizedBox(height: 8), + if (_pathTrace.isEmpty) + Text(l10n.map_tapToAdd, style: TextStyle(fontSize: 12)), + const SizedBox(height: 6), + if (_pathTrace.isNotEmpty) + Text( + "${l10n.path_currentPathLabel} ${formatDistance(getPathDistanceMeters(_points), isImperial: isImperial)}", + style: MeshTheme.mono( + fontSize: 12, + color: MapPalette.textSecondary, + ), + ), + SelectableText( + _pathTrace + .map((b) => b.toRadixString(16).padLeft(2, '0')) + .join(','), + style: MeshTheme.mono( + fontSize: 18, + fontWeight: FontWeight.w700, + color: MapPalette.selected, + ), + ), + // const SizedBox(height: 6), + Wrap( + alignment: WrapAlignment.center, + spacing: 1, + runSpacing: 1, + children: [ + if (_pathTrace.isNotEmpty) + IconButton( + onPressed: () { + final hashW = context + .read() + .pathHashByteWidth; + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PathTraceMapScreen( + title: l10n.contacts_pathTrace, + path: Uint8List.fromList(_pathTrace), + pathHashByteWidth: hashW, + pathContacts: _pathTraceContacts, + ), ), - ), - ); - setState(() { - _isBuildingPathTrace = false; - }); - }, - tooltip: l10n.map_runTrace, - icon: const Icon(Icons.arrow_forward_outlined), - ), - if (_pathTrace.isNotEmpty) - IconButton( - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PathTraceMapScreen( - title: l10n.contacts_pathTrace, - path: Uint8List.fromList(_pathTrace), - flipPathAround: true, + ); + setState(() { + _isBuildingPathTrace = false; + }); + }, + tooltip: l10n.map_runTrace, + icon: const Icon(Icons.arrow_forward_outlined), + ), + if (_pathTrace.isNotEmpty) + IconButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PathTraceMapScreen( + title: l10n.contacts_pathTrace, + path: Uint8List.fromList(_pathTrace), + flipPathAround: true, + ), ), - ), - ); - setState(() { - _isBuildingPathTrace = false; - }); - }, - tooltip: l10n.map_runTraceWithReturnPath, - icon: const Icon(Icons.replay), - ), - if (_pathTrace.isNotEmpty) - IconButton( - onPressed: _removePath, - tooltip: l10n.map_removeLast, - icon: const Icon(Icons.undo), - ), - if (_pathTrace.isEmpty) - IconButton( - onPressed: () { - setState(() { - _isBuildingPathTrace = false; - _pathTrace.clear(); - _points.clear(); - _polylines.clear(); - }); - showDismissibleSnackBar( - context, - content: Text(l10n.map_pathTraceCancelled), - ); - }, - tooltip: l10n.common_cancel, - icon: const Icon(Icons.close), - ), - ], - ), - ], + ); + setState(() { + _isBuildingPathTrace = false; + }); + }, + tooltip: l10n.map_runTraceWithReturnPath, + icon: const Icon(Icons.replay), + ), + if (_pathTrace.isNotEmpty) + IconButton( + onPressed: _removePath, + tooltip: l10n.map_removeLast, + icon: const Icon(Icons.undo), + ), + if (_pathTrace.isEmpty) + IconButton( + onPressed: () { + setState(() { + _isBuildingPathTrace = false; + _pathTrace.clear(); + _points.clear(); + _polylines.clear(); + }); + showDismissibleSnackBar( + context, + content: Text(l10n.map_pathTraceCancelled), + ); + }, + tooltip: l10n.common_cancel, + icon: const Icon(Icons.close), + ), + ], + ), + ], + ), ), ), ), @@ -2443,6 +3665,223 @@ class _MapScreenState extends State { } } +enum _NodeAge { online, recent, stale } + +enum _Freshness { all, online, recent, stale } + +int _bytesSignature(Iterable? bytes) { + if (bytes == null) return 0; + return Object.hashAll(bytes); +} + +int _mapContactSignature(Contact contact) { + return Object.hash( + contact.publicKeyHex, + contact.name, + contact.type, + contact.flags, + contact.pathLength, + _bytesSignature(contact.path), + contact.pathOverride, + _bytesSignature(contact.pathOverrideBytes), + contact.latitude, + contact.longitude, + contact.lastSeen.millisecondsSinceEpoch, + contact.lastMessageAt.millisecondsSinceEpoch, + contact.isActive, + contact.wasPulled, + ); +} + +class _MapConnectorSnapshot { + final MeshCoreConnector connector; + final int contactsSignature; + final int markerSignature; + final int batterySignature; + final int uiSignature; + + const _MapConnectorSnapshot({ + required this.connector, + required this.contactsSignature, + required this.markerSignature, + required this.batterySignature, + required this.uiSignature, + }); + + factory _MapConnectorSnapshot.fromConnector(MeshCoreConnector connector) { + final allContacts = connector.allContacts; + final contactsSignature = Object.hashAll( + allContacts.map(_mapContactSignature), + ); + final batterySignature = Object.hashAll( + allContacts + .where((contact) => contact.type == advTypeRepeater) + .map( + (contact) => Object.hash( + contact.publicKeyHex, + connector.getRepeaterBatteryMillivolts(contact.publicKeyHex), + ), + ), + ); + + final markerParts = [connector.selfName]; + for (final contact in connector.contacts) { + markerParts.add(contact.publicKeyHex); + markerParts.add(contact.name); + for (final message in connector.getMessages(contact)) { + if (!message.text.trimLeft().startsWith('m:')) continue; + markerParts.add( + Object.hash( + message.messageId, + message.text, + message.timestamp.millisecondsSinceEpoch, + message.isOutgoing, + ), + ); + } + } + for (final channel in connector.channels) { + markerParts.add( + Object.hash( + channel.index, + channel.name, + channel.isPublicChannel, + channel.isEmpty, + ), + ); + for (final message in connector.getChannelMessages(channel)) { + if (!message.text.trimLeft().startsWith('m:')) continue; + markerParts.add( + Object.hash( + message.messageId, + message.text, + message.senderName, + message.timestamp.millisecondsSinceEpoch, + ), + ); + } + } + + return _MapConnectorSnapshot( + connector: connector, + contactsSignature: contactsSignature, + markerSignature: Object.hashAll(markerParts), + batterySignature: batterySignature, + uiSignature: Object.hash( + connector.isConnected, + connector.selfLatitude, + connector.selfLongitude, + connector.currentFreqHz, + connector.currentBwHz, + connector.currentSf, + connector.currentTxPower, + connector.getTotalContactsUnreadCount(), + connector.getTotalChannelsUnreadCount(), + ), + ); + } + + @override + bool operator ==(Object other) { + return other is _MapConnectorSnapshot && + contactsSignature == other.contactsSignature && + markerSignature == other.markerSignature && + batterySignature == other.batterySignature && + uiSignature == other.uiSignature; + } + + @override + int get hashCode => Object.hash( + contactsSignature, + markerSignature, + batterySignature, + uiSignature, + ); +} + +class _NodeMarkersCacheKey { + final int contactsSignature; + final int visibleContactsSignature; + final int batterySignature; + final _Freshness freshness; + final double timeFilterHours; + final bool keyPrefixEnabled; + final String keyPrefix; + final bool showDiscoveryContacts; + final int batteryChemistrySignature; + final bool showLabels; + final String? selectedKey; + final double zoom; + final bool overlapsMode; + final bool showRepeaters; + final bool showChatNodes; + final bool showOtherNodes; + final bool isBuildingPathTrace; + + const _NodeMarkersCacheKey({ + required this.contactsSignature, + required this.visibleContactsSignature, + required this.batterySignature, + required this.freshness, + required this.timeFilterHours, + required this.keyPrefixEnabled, + required this.keyPrefix, + required this.showDiscoveryContacts, + required this.batteryChemistrySignature, + required this.showLabels, + required this.selectedKey, + required this.zoom, + required this.overlapsMode, + required this.showRepeaters, + required this.showChatNodes, + required this.showOtherNodes, + required this.isBuildingPathTrace, + }); + + @override + bool operator ==(Object other) { + return other is _NodeMarkersCacheKey && + contactsSignature == other.contactsSignature && + visibleContactsSignature == other.visibleContactsSignature && + batterySignature == other.batterySignature && + freshness == other.freshness && + timeFilterHours == other.timeFilterHours && + keyPrefixEnabled == other.keyPrefixEnabled && + keyPrefix == other.keyPrefix && + showDiscoveryContacts == other.showDiscoveryContacts && + batteryChemistrySignature == other.batteryChemistrySignature && + showLabels == other.showLabels && + selectedKey == other.selectedKey && + zoom == other.zoom && + overlapsMode == other.overlapsMode && + showRepeaters == other.showRepeaters && + showChatNodes == other.showChatNodes && + showOtherNodes == other.showOtherNodes && + isBuildingPathTrace == other.isBuildingPathTrace; + } + + @override + int get hashCode => Object.hash( + contactsSignature, + visibleContactsSignature, + batterySignature, + freshness, + timeFilterHours, + keyPrefixEnabled, + keyPrefix, + showDiscoveryContacts, + batteryChemistrySignature, + showLabels, + selectedKey, + zoom, + overlapsMode, + showRepeaters, + showChatNodes, + showOtherNodes, + isBuildingPathTrace, + ); +} + class _GuessedLocation { final Contact contact; final LatLng position; diff --git a/lib/screens/neighbors_screen.dart b/lib/screens/neighbors_screen.dart index 77559d48..529a00dd 100644 --- a/lib/screens/neighbors_screen.dart +++ b/lib/screens/neighbors_screen.dart @@ -9,8 +9,10 @@ import '../models/path_selection.dart'; import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; import '../services/repeater_command_service.dart'; -import '../widgets/path_management_dialog.dart'; -import '../widgets/snr_indicator.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/empty_state.dart'; +import '../widgets/mesh_ui.dart'; +import '../widgets/routing_sheet.dart'; import '../helpers/snack_bar_builder.dart'; class NeighborsScreen extends StatefulWidget { @@ -167,7 +169,7 @@ class _NeighborsScreenState extends State { showDismissibleSnackBar( context, content: Text(context.l10n.neighbors_receivedData), - backgroundColor: Colors.green, + backgroundColor: Theme.of(context).colorScheme.tertiary, ); _statusTimeout?.cancel(); if (!mounted) return; @@ -227,7 +229,7 @@ class _NeighborsScreenState extends State { showDismissibleSnackBar( context, content: Text(context.l10n.neighbors_requestTimedOut), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); _recordStatusResult(false); }); @@ -241,7 +243,7 @@ class _NeighborsScreenState extends State { showDismissibleSnackBar( context, content: Text(context.l10n.neighbors_errorLoading(e.toString())), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); } } @@ -279,7 +281,9 @@ class _NeighborsScreenState extends State { children: [ Text( l10n.neighbors_repeatersNeighbors, - style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), Text( repeater.name, @@ -287,75 +291,18 @@ class _NeighborsScreenState extends State { fontSize: 14, fontWeight: FontWeight.normal, ), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), ], ), centerTitle: false, actions: [ - PopupMenuButton( + IconButton( icon: Icon(isFloodMode ? Icons.waves : Icons.route), tooltip: l10n.repeater_routingMode, - onSelected: (mode) async { - if (mode == 'flood') { - await connector.setPathOverride(repeater, pathLen: -1); - } else { - await connector.setPathOverride(repeater, pathLen: null); - } - }, - itemBuilder: (context) => [ - PopupMenuItem( - value: 'auto', - child: Row( - children: [ - Icon( - Icons.auto_mode, - size: 20, - color: !isFloodMode - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_autoUseSavedPath, - style: TextStyle( - fontWeight: !isFloodMode - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - PopupMenuItem( - value: 'flood', - child: Row( - children: [ - Icon( - Icons.waves, - size: 20, - color: isFloodMode - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_forceFloodMode, - style: TextStyle( - fontWeight: isFloodMode - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - ], - ), - IconButton( - icon: const Icon(Icons.timeline), - tooltip: l10n.repeater_pathManagement, onPressed: () => - PathManagementDialog.show(context, contact: repeater), + ContactRoutingSheet.show(context, contact: repeater), ), IconButton( icon: _isLoading @@ -375,23 +322,16 @@ class _NeighborsScreenState extends State { child: RefreshIndicator( onRefresh: _loadNeighbors, child: ListView( - padding: const EdgeInsets.all(16), + padding: const EdgeInsets.fromLTRB(16, 8, 16, 24), children: [ if (!_isLoaded && !_hasData && (_parsedNeighbors == null || _parsedNeighbors!.isEmpty)) - Center( - child: Text( - l10n.neighbors_noData, - style: TextStyle(fontSize: 16, color: Colors.grey), - ), - ), + EmptyState(icon: Icons.wifi_find, title: l10n.neighbors_noData), if (_isLoaded || _hasData && !(_parsedNeighbors == null || _parsedNeighbors!.isEmpty)) - _buildNeighborsInfoCard( - "${l10n.repeater_neighbors} - $_neighborCount", - ), + _buildNeighborsList(connector), ], ), ), @@ -399,81 +339,97 @@ class _NeighborsScreenState extends State { ); } - Widget _buildNeighborsInfoCard(String title) { - final connector = Provider.of(context, listen: false); - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( + Widget _buildNeighborsList(MeshCoreConnector connector) { + final l10n = context.l10n; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SectionHeader( + '${l10n.repeater_neighbors} — $_neighborCount', + padding: const EdgeInsets.fromLTRB(4, 8, 4, 10), + ), + for (var i = 0; i < _parsedNeighbors!.length; i++) + ListEntrance( + index: i, + child: _buildNeighborRow(_parsedNeighbors![i], connector.currentSf), + ), + ], + ); + } + + Widget _buildNeighborRow(Map data, int? spreadingFactor) { + final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; + final Contact? contact = data['contact'] as Contact?; + final double snr = data['snr'] as double; + final int lastHeardSeconds = data['lastHeard'] as int; + + final name = contact != null + ? contact.name + : l10n.neighbors_unknownContact( + '<${pubKeyToHex(data['publicKey'] as Uint8List)}>', + ); + + final snrColor = MeshTheme.snrColor(snr, blocked: false); + final heardLabel = l10n.neighbors_heardAgo( + fmtDuration(lastHeardSeconds + 0.0), + ); + + return MeshCard( + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10), + margin: const EdgeInsets.symmetric(vertical: 4), + child: Row( + children: [ + AvatarCircle( + name: name, + size: 40, + color: contact != null ? MeshPalette.warn : scheme.onSurfaceVariant, + icon: contact != null ? Icons.cell_tower : Icons.device_unknown, + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ - Icon( - Icons.info_outline, - color: Theme.of(context).textTheme.headlineSmall?.color, - ), - const SizedBox(width: 8), Text( - title, + name, + maxLines: 1, + overflow: TextOverflow.ellipsis, style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, + fontWeight: FontWeight.w500, + fontSize: 15, + ), + ), + const SizedBox(height: 2), + Text( + heardLabel, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), ), ], ), - const Divider(), - for (final entry in _parsedNeighbors!.asMap().entries) - _buildInfoRow( - entry.value['contact'] != null - ? entry.value['contact'].name - : context.l10n.neighbors_unknownContact( - "<${pubKeyToHex(entry.value['publicKey'])}>", - ), - context.l10n.neighbors_heardAgo( - fmtDuration(entry.value['lastHeard'] + 0.0), + ), + const SizedBox(width: 10), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.min, + children: [ + SignalBars(snr: snr, height: 16), + const SizedBox(height: 4), + Text( + '${snr.toStringAsFixed(1)} dB', + style: MeshTheme.mono( + fontSize: 11, + fontWeight: FontWeight.w600, + color: snrColor, ), - entry.value['snr'], - connector.currentSf!, ), - ], - ), - ), - ); - } - - Widget _buildInfoRow( - String label, - String value, - double snr, - int spreadingFactor, - ) { - final snrUi = snrUiFromSNR(snr, spreadingFactor); - return Padding( - padding: const EdgeInsets.symmetric(vertical: 3), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: ListTile( - contentPadding: EdgeInsets.zero, - title: Text( - label, - style: const TextStyle(fontWeight: FontWeight.w500), - ), - subtitle: Text(value), - trailing: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon(snrUi.icon, color: snrUi.color, size: 18.0), - Text( - snrUi.text, - style: TextStyle(fontSize: 10, color: snrUi.color), - ), - ], - ), - ), + ], ), ], ), diff --git a/lib/screens/path_trace_map.dart b/lib/screens/path_trace_map.dart index c810570d..2eebdc71 100644 --- a/lib/screens/path_trace_map.dart +++ b/lib/screens/path_trace_map.dart @@ -10,31 +10,21 @@ import 'package:meshcore_open/connector/meshcore_protocol.dart'; import 'package:meshcore_open/l10n/l10n.dart'; import 'package:meshcore_open/models/app_settings.dart'; import 'package:meshcore_open/models/contact.dart'; +import 'package:meshcore_open/models/display_path.dart'; +import 'package:meshcore_open/models/path_history.dart'; +import 'package:meshcore_open/models/path_playback.dart'; import 'package:meshcore_open/services/app_settings_service.dart'; import 'package:meshcore_open/services/map_tile_cache_service.dart'; +import 'package:meshcore_open/services/path_history_service.dart'; import 'package:meshcore_open/utils/app_logger.dart'; +import 'package:meshcore_open/widgets/path_map_ui.dart'; import 'package:meshcore_open/widgets/snr_indicator.dart'; +import 'package:meshcore_open/widgets/themed_map_tile_layer.dart'; import 'package:provider/provider.dart'; +import '../theme/mesh_theme.dart'; -double getPathDistanceMeters(List points) { - if (points.length <= 1) return 0.0; - - double distanceMeters = 0.0; - final distanceCalculator = Distance(); - - for (int i = 0; i < points.length - 1; i++) { - distanceMeters += distanceCalculator(points[i], points[i + 1]); - } - - return distanceMeters; -} - -String formatDistance(double distanceMeters, {required bool isImperial}) { - if (isImperial) { - return '(${(distanceMeters / 1609.34).toStringAsFixed(2)} mi)'; - } - return '(${(distanceMeters / 1000).toStringAsFixed(2)} km)'; -} +export 'package:meshcore_open/widgets/path_map_ui.dart' + show formatDistance, getPathDistanceMeters; class PathTraceData { final Uint8List pathData; @@ -74,7 +64,8 @@ class PathTraceMapScreen extends StatefulWidget { State createState() => _PathTraceMapScreenState(); } -class _PathTraceMapScreenState extends State { +class _PathTraceMapScreenState extends State + with SingleTickerProviderStateMixin { static const double _labelZoomThreshold = 8.5; static const double _mapMinZoom = 2.0; static const double _mapMaxZoom = 18.0; @@ -103,6 +94,21 @@ class _PathTraceMapScreenState extends State { double _pathDistanceMeters = 0.0; bool _showNodeLabels = true; Contact? _targetContact; + // Live path resolved at trace time; used by the response handler for + // endpoint inference so it matches the path that was actually traced. + Uint8List _tracedPath = Uint8List(0); + + // Packet-flow animation + multi-path view state. + late final PathPlaybackController _playback; + PathHistoryService? _pathHistory; + PathViewMode _viewMode = PathViewMode.single; + List _displayPaths = []; + List _primaryOutboundHops = []; + String _selectedPathId = 'primary'; + final Set _hiddenPathIds = {}; + bool _panelCollapsed = false; + bool _animationEnabled = true; + bool _followPacket = false; String _formatPathPrefixes(Uint8List pathBytes) { return pathBytes @@ -113,18 +119,51 @@ class _PathTraceMapScreenState extends State { @override void initState() { super.initState(); + _playback = PathPlaybackController(this); + _playback.addListener(_followPacketCamera); + _pathHistory = context.read(); + _pathHistory!.addListener(_onPathHistoryChanged); _setupFrameListener(); _doPathTrace(); } @override void dispose() { + _pathHistory?.removeListener(_onPathHistoryChanged); + _playback.dispose(); _mapController.dispose(); _frameSubscription?.cancel(); _timeoutTimer?.cancel(); super.dispose(); } + void _onPathHistoryChanged() { + if (!mounted || !_hasData) return; + setState(() { + _rebuildDisplayPaths(context.read()); + }); + } + + /// Keeps the camera centered on the packet while the follow lock is on. + void _followPacketCamera() { + if (!_followPacket || + !_animationEnabled || + !_playback.started || + !_playback.hasPath || + !mounted || + !_hasData) { + return; + } + _mapController.move(_playback.position, _mapController.camera.zoom); + } + + void _toggleFollowPacket() { + setState(() { + _followPacket = !_followPacket; + }); + _followPacketCamera(); + } + bool _isDesktopPlatform(TargetPlatform platform) { return platform == TargetPlatform.linux || platform == TargetPlatform.windows || @@ -161,27 +200,34 @@ class _PathTraceMapScreenState extends State { return Positioned( top: 16, left: 16, - child: Card( - elevation: 4, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - IconButton( - icon: const Icon(Icons.add), - tooltip: 'Zoom in', - onPressed: () => _zoomMapBy(1), - ), - IconButton( - icon: const Icon(Icons.remove), - tooltip: 'Zoom out', - onPressed: () => _zoomMapBy(-1), - ), - IconButton( - icon: const Icon(Icons.my_location), - tooltip: 'Center map', - onPressed: _resetMapView, - ), - ], + child: DecoratedBox( + decoration: BoxDecoration( + color: MeshPalette.bg1.withValues(alpha: 0.90), + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: MeshPalette.line2), + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(MeshRadii.md), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + icon: const Icon(Icons.add), + tooltip: context.l10n.map_zoomIn, + onPressed: () => _zoomMapBy(1), + ), + IconButton( + icon: const Icon(Icons.remove), + tooltip: context.l10n.map_zoomOut, + onPressed: () => _zoomMapBy(-1), + ), + IconButton( + icon: const Icon(Icons.my_location), + tooltip: context.l10n.map_centerMap, + onPressed: _resetMapView, + ), + ], + ), ), ), ); @@ -228,7 +274,25 @@ class _PathTraceMapScreenState extends State { return traceBytes; } + /// Resolves the path bytes to trace. When tracing a specific contact's + /// route (flipPathAround), re-read that contact's live forced/auto path from + /// the connector so a path the user just changed (force flood / set path / + /// reset to auto) is honored immediately, instead of the value captured when + /// this screen was first pushed. + Uint8List _resolveLivePath(MeshCoreConnector connector) { + final target = widget.targetContact; + if (!widget.flipPathAround || target == null) { + return widget.path; + } + final live = connector.allContactsUnfiltered.firstWhere( + (c) => c.publicKeyHex == target.publicKeyHex, + orElse: () => target, + ); + return live.pathBytesForDisplay; + } + Future _doPathTrace() async { + _playback.stop(); if (mounted) { setState(() { _isLoading = true; @@ -236,9 +300,13 @@ class _PathTraceMapScreenState extends State { }); } + final connector = Provider.of(context, listen: false); + final livePath = _resolveLivePath(connector); + _tracedPath = livePath; + final pathTmp = widget.reversePathAround - ? Uint8List.fromList(widget.path.reversed.toList()) - : widget.path; + ? Uint8List.fromList(livePath.reversed.toList()) + : livePath; final path = widget.flipPathAround ? buildPath(pathTmp) : pathTmp; @@ -248,11 +316,10 @@ class _PathTraceMapScreenState extends State { noNotify: !mounted, ); - final connector = Provider.of(context, listen: false); final frame = buildTraceReq( DateTime.now().millisecondsSinceEpoch ~/ 1000, - 0, //flags 0, //auth + 0, //flag payload: path, ); connector.sendFrame(frame); @@ -327,11 +394,16 @@ class _PathTraceMapScreenState extends State { try { buffer.skipBytes(2); // Skip push code and reserved byte int pathLength = buffer.readUInt8(); - buffer.skipBytes(5); // Skip Flag byte and tag data + final int flags = buffer + .readUInt8(); // path_sz = flags & 0x03 (path-hash mode, fw v1.11+) + buffer.skipBytes(4); // Skip tag data buffer.skipBytes(4); // Skip auth code + final int pathSz = flags & 0x03; Uint8List pathData = buffer.readBytes(pathLength); + // Firmware emits (path_len >> path_sz) hop SNRs plus 1 final SNR (to this node). + final int snrCount = (pathLength >> pathSz) + 1; List snrData = buffer - .readRemainingBytes() + .readBytes(snrCount) .map((snr) => snr.toSigned(8).toDouble() / 4) .toList(); @@ -414,13 +486,13 @@ class _PathTraceMapScreenState extends State { final tc = _targetContact!; if (tc.hasLocation) { targetPos = LatLng(tc.latitude!, tc.longitude!); - } else if (widget.path.length > 1) { + } else if (_tracedPath.length > 1) { // Infer from the last hop: average GPS contacts sharing that hop. // For a round-trip path (flipPathAround/reversePathAround), the target-side hop // sits in the middle of the symmetric sequence; .last is the local side. final lastHop = widget.reversePathAround - ? widget.path.first - : widget.path.last; + ? _tracedPath.first + : _tracedPath.last; final peers = connector.allContacts .where( @@ -514,6 +586,8 @@ class _PathTraceMapScreenState extends State { '${context.l10n.pathTrace_you},${_formatPathPrefixes(_traceData!.pathData)}', ); _pathDistanceMeters = getPathDistanceMeters(_points); + _primaryOutboundHops = _outboundHops(pathData); + _rebuildDisplayPaths(connector); }); } catch (e) { appLogger.error( @@ -529,6 +603,250 @@ class _PathTraceMapScreenState extends State { } } + /// Outbound hop bytes of the traced path, mirroring the round-trip + /// dedup logic used when building [_points]. + List _outboundHops(Uint8List pathData) { + final hops = []; + int hopLast = 0; + int hopLastLast = 0; + for (final hop in pathData) { + if (hop == hopLastLast && widget.flipPathAround) break; + hops.add(hop); + hopLastLast = hopLast; + hopLast = hop; + } + return hops; + } + + Contact? _contactForHop(int hop, MeshCoreConnector connector) { + final traced = _traceData?.pathContacts[hop]; + if (traced != null) return traced; + for (final c in connector.allContactsUnfiltered) { + if (c.type != advTypeChat && + c.publicKey.isNotEmpty && + c.publicKey[0] == hop) { + return c; + } + } + return null; + } + + LatLng? _inferredPositionForHop(int hop, MeshCoreConnector connector) { + final cached = _inferredHopPositions[hop]; + if (cached != null) return cached; + final peers = connector.contacts + .where((c) => c.hasLocation && c.path.isNotEmpty && c.path.last == hop) + .toList(); + if (peers.isEmpty) return null; + final lat = + peers.map((c) => c.latitude!).reduce((a, b) => a + b) / peers.length; + final lon = + peers.map((c) => c.longitude!).reduce((a, b) => a + b) / peers.length; + final pos = LatLng(lat, lon); + _inferredHopPositions[hop] = pos; + return pos; + } + + /// Rebuilds the renderable paths: the traced path as primary plus up to + /// four distinct alternates from the target contact's path history. + void _rebuildDisplayPaths(MeshCoreConnector connector) { + final paths = []; + final primary = _buildDisplayPath( + id: 'primary', + label: context.l10n.pathMap_primary, + color: kPrimaryPathColor, + isPrimary: true, + hops: _primaryOutboundHops, + connector: connector, + ); + if (primary != null) paths.add(primary); + + final target = widget.targetContact; + final history = _pathHistory; + if (target != null && history != null) { + final seen = {_primaryOutboundHops.join(',')}; + var altIndex = 0; + for (final record in history.getRecentPaths(target.publicKeyHex)) { + if (record.pathBytes.isEmpty) continue; + if (!seen.add(record.pathBytes.join(','))) continue; + if (altIndex >= kAlternatePathColors.length) break; + final alt = _buildDisplayPath( + id: 'alt-${record.pathBytes.join('-')}', + label: context.l10n.pathMap_alternate(altIndex + 1), + color: kAlternatePathColors[altIndex], + isPrimary: false, + hops: record.pathBytes, + record: record, + connector: connector, + ); + if (alt != null) { + paths.add(alt); + altIndex++; + } + } + } + + _displayPaths = paths; + _hiddenPathIds.removeWhere((id) => !paths.any((p) => p.id == id)); + if (!paths.any((p) => p.id == _selectedPathId)) { + _selectedPathId = paths.isNotEmpty ? paths.first.id : 'primary'; + } + if (paths.length < 2) _viewMode = PathViewMode.single; + _syncPlaybackToSelection(); + } + + DisplayPath? _buildDisplayPath({ + required String id, + required String label, + required Color color, + required bool isPrimary, + required List hops, + required MeshCoreConnector connector, + PathRecord? record, + }) { + final selfLat = connector.selfLatitude; + final selfLon = connector.selfLongitude; + if (selfLat == null || selfLon == null) return null; + + final points = [LatLng(selfLat, selfLon)]; + final labels = [context.l10n.pathTrace_you]; + final confirmed = [true]; + final hopOrdinals = [-1]; + final gapBefore = [false]; + int gpsConfirmedHops = 0; + int unresolvedHops = 0; + bool pendingGap = false; + + for (var i = 0; i < hops.length; i++) { + final hop = hops[i]; + final hex = hop.toRadixString(16).padLeft(2, '0').toUpperCase(); + final contact = _contactForHop(hop, connector); + LatLng? pos; + var isGps = false; + if (contact != null && contact.hasLocation) { + pos = LatLng(contact.latitude!, contact.longitude!); + isGps = true; + gpsConfirmedHops++; + } else { + pos = _inferredPositionForHop(hop, connector); + } + if (pos == null) { + unresolvedHops++; + pendingGap = true; + continue; + } + points.add(pos); + labels.add(contact?.name ?? '~$hex'); + confirmed.add(isGps); + hopOrdinals.add(i); + gapBefore.add(pendingGap); + pendingGap = false; + } + + // Append the chat-target endpoint the same way the traced path does. + final target = widget.targetContact; + final targetPos = _targetContactPosition; + final hasTargetEndpoint = + target != null && target.type == advTypeChat && targetPos != null; + if (hasTargetEndpoint) { + points.add(targetPos); + labels.add(target.name); + confirmed.add(!_targetContactIsGuessed); + hopOrdinals.add(hops.length); + gapBefore.add(pendingGap); + pendingGap = false; + } + + if (points.length < 2) return null; + + final segmentEstimated = []; + final rowForSegment = []; + for (var i = 0; i < points.length - 1; i++) { + segmentEstimated.add( + !confirmed[i] || !confirmed[i + 1] || gapBefore[i + 1], + ); + rowForSegment.add(hopOrdinals[i + 1] < 0 ? 0 : hopOrdinals[i + 1]); + } + + return DisplayPath( + id: id, + label: label, + color: color, + isPrimary: isPrimary, + hopBytes: List.from(hops), + points: points, + pointLabels: labels, + pointConfirmed: confirmed, + segmentEstimated: segmentEstimated, + rowForSegment: rowForSegment, + totalTransmissions: hops.length + (hasTargetEndpoint ? 1 : 0), + hasTargetEndpoint: hasTargetEndpoint, + gpsConfirmedHops: gpsConfirmedHops, + unresolvedHops: unresolvedHops, + distanceMeters: getPathDistanceMeters(points), + record: record, + ); + } + + DisplayPath? get _selectedPath { + if (_displayPaths.isEmpty) return null; + return _displayPaths.firstWhere( + (p) => p.id == _selectedPathId, + orElse: () => _displayPaths.first, + ); + } + + List get _visiblePaths { + if (_viewMode == PathViewMode.single) { + final selected = _selectedPath; + return selected != null ? [selected] : const []; + } + return _displayPaths.where((p) => !_hiddenPathIds.contains(p.id)).toList(); + } + + /// Updates the playback path, but only when the selected path's geometry + /// actually changed, so unrelated path-history updates don't reset a + /// running animation. + void _syncPlaybackToSelection() { + final points = _selectedPath?.points ?? const []; + if (points.length == _playback.points.length) { + var same = true; + for (var i = 0; i < points.length; i++) { + if (points[i] != _playback.points[i]) { + same = false; + break; + } + } + if (same) return; + } + _playback.setPath(points); + } + + void _selectPath(DisplayPath path) { + setState(() { + _selectedPathId = path.id; + _hiddenPathIds.remove(path.id); + _syncPlaybackToSelection(); + }); + } + + void _togglePathVisibility(DisplayPath path) { + setState(() { + if (!_hiddenPathIds.remove(path.id)) { + _hiddenPathIds.add(path.id); + if (path.id == _selectedPathId) { + final visible = _displayPaths.where( + (p) => !_hiddenPathIds.contains(p.id), + ); + if (visible.isNotEmpty) { + _selectedPathId = visible.first.id; + _syncPlaybackToSelection(); + } + } + } + }); + } + @override Widget build(BuildContext context) { return Consumer( @@ -536,23 +854,12 @@ class _PathTraceMapScreenState extends State { final settings = context.watch().settings; final isImperial = settings.unitSystem == UnitSystem.imperial; final tileCache = context.read(); + final scheme = Theme.of(context).colorScheme; return Scaffold( appBar: AppBar( - title: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - FittedBox( - fit: BoxFit.scaleDown, - child: Text( - widget.title, - style: const TextStyle(fontSize: 24), - ), - ), - ], - ), - centerTitle: false, + title: Text(widget.title), + centerTitle: true, actions: [ IconButton( icon: _isLoading @@ -576,10 +883,14 @@ class _PathTraceMapScreenState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - if (_isLoading) const CircularProgressIndicator(), + if (_isLoading) + CircularProgressIndicator(color: MeshPalette.blue), const SizedBox(height: 16), if (!_isLoading && _failed2Loaded) - Text(context.l10n.pathTrace_notAvailable), + Text( + context.l10n.pathTrace_notAvailable, + style: TextStyle(color: scheme.onSurfaceVariant), + ), ], ), ), @@ -587,23 +898,33 @@ class _PathTraceMapScreenState extends State { _buildMapPathTrace(context, tileCache, _targetContact), if (_hasData && _isDesktopPlatform(defaultTargetPlatform)) _buildDesktopMapControls(), + if (_hasData && _displayPaths.length > 1) + PathViewModeToggle( + mode: _viewMode, + onChanged: (mode) => setState(() => _viewMode = mode), + ), if (_points.isEmpty && !_hasData && !_isLoading && !_failed2Loaded) Center( - child: Card( - color: Colors.white.withValues(alpha: 0.9), + child: DecoratedBox( + decoration: BoxDecoration( + color: scheme.surfaceContainerLow, + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: scheme.outlineVariant), + ), child: Padding( - padding: EdgeInsets.all(12), + padding: const EdgeInsets.all(12), child: Text( context.l10n.channelPath_noRepeaterLocations, + style: TextStyle(color: scheme.onSurfaceVariant), ), ), ), ), if (_hasData) - _buildLegendCard(context, _traceData!, isImperial), + _buildBottomPanel(context, _traceData!, isImperial), ], ), ), @@ -640,31 +961,40 @@ class _PathTraceMapScreenState extends State { markers.add( Marker( point: point, - width: 35, - height: 35, - child: Container( - padding: const EdgeInsets.all(4), - decoration: BoxDecoration( - color: hasGps - ? Colors.green - : Colors.orange.withValues(alpha: 0.75), - shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), - boxShadow: [ - BoxShadow( - color: Colors.black.withValues(alpha: 0.3), - blurRadius: 4, - offset: const Offset(0, 2), + width: 48, + height: 48, + child: Center( + child: Container( + width: 35, + height: 35, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: hasGps + ? MeshPalette.signal.withValues(alpha: 0.18) + : MeshPalette.warn.withValues(alpha: 0.18), + border: Border.all( + color: hasGps + ? MeshPalette.signal.withValues(alpha: 0.7) + : MeshPalette.warn.withValues(alpha: 0.7), + width: 1.5, + ), + boxShadow: [ + BoxShadow( + color: hasGps + ? MeshPalette.signal.withValues(alpha: 0.3) + : MeshPalette.warn.withValues(alpha: 0.3), + blurRadius: 5, + ), + ], + ), + alignment: Alignment.center, + child: Text( + hasGps ? label : '~$label', + style: MeshTheme.mono( + fontSize: 10, + fontWeight: FontWeight.w700, + color: hasGps ? MeshPalette.signal : MeshPalette.warn, ), - ], - ), - alignment: Alignment.center, - child: Text( - hasGps ? label : '~$label', - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 12, ), ), ), @@ -682,6 +1012,17 @@ class _PathTraceMapScreenState extends State { hopLast = hop; } + _addEndpointMarkers(markers, showLabels: showLabels, target: target); + + return markers; + } + + /// Self and target endpoint markers, shared by single and combined views. + void _addEndpointMarkers( + List markers, { + required bool showLabels, + required Contact? target, + }) { final selfLat = context.read().selfLatitude; final selfLon = context.read().selfLongitude; if (selfLat != null && selfLon != null) { @@ -689,29 +1030,34 @@ class _PathTraceMapScreenState extends State { markers.add( Marker( point: selfPoint, - width: 35, - height: 35, - child: Container( - padding: const EdgeInsets.all(4), - decoration: BoxDecoration( - color: Colors.blue, - shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), - boxShadow: [ - BoxShadow( - color: Colors.black.withValues(alpha: 0.3), - blurRadius: 4, - offset: const Offset(0, 2), + width: 48, + height: 48, + child: Center( + child: Container( + width: 35, + height: 35, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: MeshPalette.blue.withValues(alpha: 0.18), + border: Border.all( + color: MeshPalette.blue.withValues(alpha: 0.7), + width: 2, + ), + boxShadow: [ + BoxShadow( + color: MeshPalette.blue.withValues(alpha: 0.35), + blurRadius: 6, + ), + ], + ), + alignment: Alignment.center, + child: Text( + context.l10n.pathTrace_you, + style: MeshTheme.mono( + fontSize: 9, + fontWeight: FontWeight.w700, + color: MeshPalette.blue, ), - ], - ), - alignment: Alignment.center, - child: Text( - context.l10n.pathTrace_you, - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 12, ), ), ), @@ -735,26 +1081,39 @@ class _PathTraceMapScreenState extends State { markers.add( Marker( point: targetPos, - width: 35, - height: 35, - child: Container( - padding: const EdgeInsets.all(4), - decoration: BoxDecoration( - color: isGuessed - ? Colors.purple.withValues(alpha: 0.55) - : Colors.red, - shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), - boxShadow: [ - BoxShadow( - color: Colors.black.withValues(alpha: 0.3), - blurRadius: 4, - offset: const Offset(0, 2), + width: 48, + height: 48, + child: Center( + child: Container( + width: 35, + height: 35, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: isGuessed + ? MeshPalette.magenta.withValues(alpha: 0.18) + : MeshPalette.alert.withValues(alpha: 0.18), + border: Border.all( + color: isGuessed + ? MeshPalette.magenta.withValues(alpha: 0.7) + : MeshPalette.alert.withValues(alpha: 0.7), + width: 1.5, ), - ], + boxShadow: [ + BoxShadow( + color: isGuessed + ? MeshPalette.magenta.withValues(alpha: 0.3) + : MeshPalette.alert.withValues(alpha: 0.3), + blurRadius: 5, + ), + ], + ), + alignment: Alignment.center, + child: Icon( + Icons.person, + color: isGuessed ? MeshPalette.magenta : MeshPalette.alert, + size: 18, + ), ), - alignment: Alignment.center, - child: const Icon(Icons.person, color: Colors.white, size: 18), ), ), ); @@ -767,10 +1126,134 @@ class _PathTraceMapScreenState extends State { ); } } + } + + /// Markers for the union of hops across all visible paths, with a badge on + /// repeaters used by more than one path. + List _buildCombinedHopMarkers({ + required bool showLabels, + required Contact? target, + }) { + final connector = context.read(); + final markers = []; + + // Hop byte -> paths that use it, in display order. + final hopPaths = >{}; + for (final path in _visiblePaths) { + for (final hop in path.hopBytes) { + final list = hopPaths.putIfAbsent(hop, () => []); + if (!list.contains(path)) list.add(path); + } + } + + for (final entry in hopPaths.entries) { + final hop = entry.key; + final paths = entry.value; + final contact = _contactForHop(hop, connector); + final hasGps = contact != null && contact.hasLocation; + final point = hasGps + ? LatLng(contact.latitude!, contact.longitude!) + : _inferredPositionForHop(hop, connector); + if (point == null) continue; + final label = hop.toRadixString(16).padLeft(2, '0').toUpperCase(); + final baseColor = hasGps ? MeshPalette.signal : MeshPalette.warn; + final shared = paths.length > 1; + + markers.add( + Marker( + point: point, + width: 48, + height: 48, + child: GestureDetector( + onTap: () => _showSharedNodeSheet(hop, contact, paths), + child: Stack( + alignment: Alignment.center, + children: [ + Container( + width: 35, + height: 35, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: baseColor.withValues(alpha: 0.18), + border: Border.all( + color: baseColor.withValues(alpha: 0.7), + width: shared ? 2.5 : 1.5, + ), + boxShadow: [ + BoxShadow( + color: baseColor.withValues(alpha: 0.3), + blurRadius: 5, + ), + ], + ), + alignment: Alignment.center, + child: Text( + hasGps ? label : '~$label', + style: MeshTheme.mono( + fontSize: 10, + fontWeight: FontWeight.w700, + color: baseColor, + ), + ), + ), + if (shared) + Positioned( + top: 0, + right: 0, + child: Container( + width: 17, + height: 17, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: MeshPalette.bg1, + border: Border.all(color: MeshPalette.line3), + ), + alignment: Alignment.center, + child: Text( + '${paths.length}', + style: MeshTheme.mono( + fontSize: 9, + fontWeight: FontWeight.w700, + color: MeshPalette.ink, + ), + ), + ), + ), + ], + ), + ), + ), + ); + if (showLabels) { + markers.add( + _buildNodeLabelMarker( + point: point, + label: contact?.name ?? '~$label', + ), + ); + } + } + + _addEndpointMarkers(markers, showLabels: showLabels, target: target); return markers; } + void _showSharedNodeSheet( + int hop, + Contact? contact, + List paths, + ) { + final hex = hop.toRadixString(16).padLeft(2, '0').toUpperCase(); + showSharedNodeSheet( + context, + title: + '$hex: ${contact?.name ?? context.l10n.channelPath_unknownRepeater}', + paths: paths, + onSelect: _selectPath, + ); + } + Marker _buildNodeLabelMarker({required LatLng point, required String label}) { return Marker( point: point, @@ -785,18 +1268,19 @@ class _PathTraceMapScreenState extends State { child: Container( padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), decoration: BoxDecoration( - color: Colors.black54, - borderRadius: BorderRadius.circular(8), + color: MeshPalette.bg.withValues(alpha: 0.82), + borderRadius: BorderRadius.circular(MeshRadii.xs), + border: Border.all(color: MeshPalette.line, width: 0.5), ), alignment: Alignment.center, child: Text( label, maxLines: 1, overflow: TextOverflow.ellipsis, - style: const TextStyle( - color: Colors.white, - fontSize: 11, + style: MeshTheme.mono( + fontSize: 10, fontWeight: FontWeight.w500, + color: MeshPalette.ink2, ), ), ), @@ -899,8 +1383,15 @@ class _PathTraceMapScreenState extends State { minZoom: _mapMinZoom, maxZoom: _mapMaxZoom, onPositionChanged: (camera, hasGesture) { + if (!mounted) return; + // A manual pan/zoom releases the follow lock. + if (hasGesture && _followPacket) { + setState(() { + _followPacket = false; + }); + } final shouldShow = camera.zoom >= _labelZoomThreshold; - if (shouldShow != _showNodeLabels && mounted) { + if (shouldShow != _showNodeLabels) { setState(() { _showNodeLabels = shouldShow; }); @@ -908,14 +1399,23 @@ class _PathTraceMapScreenState extends State { }, ), children: [ - TileLayer( - urlTemplate: kMapTileUrlTemplate, - tileProvider: tileCache.tileProvider, - userAgentPackageName: MapTileCacheService.userAgentPackageName, - maxZoom: 19, + ThemedMapTileLayer(tileCache: tileCache), + AnimatedBuilder( + animation: _playback, + builder: (context, _) { + final lines = _buildDisplayPolylines(); + if (lines.isEmpty) return const SizedBox.shrink(); + return PolylineLayer(polylines: lines); + }, ), - if (_polylines.isNotEmpty) PolylineLayer(polylines: _polylines), - if (_traceData!.pathData.isNotEmpty) + if (_viewMode == PathViewMode.combined) + MarkerLayer( + markers: _buildCombinedHopMarkers( + showLabels: _showNodeLabels, + target: target, + ), + ) + else if (_traceData!.pathData.isNotEmpty) MarkerLayer( markers: _buildHopMarkers( _traceData!.pathData, @@ -923,19 +1423,70 @@ class _PathTraceMapScreenState extends State { target: target, ), ), + AnimatedBuilder( + animation: _playback, + builder: (context, _) { + final markers = _buildPacketMarkers(); + if (markers.isEmpty) return const SizedBox.shrink(); + return MarkerLayer(markers: markers); + }, + ), ], ); } - Widget _buildLegendCard( + /// Polylines for the visible paths. While the packet animation is running, + /// the selected path's base line is dimmed and the traversed portion plus + /// the active segment are redrawn brightly by the playback overlay. + List _buildDisplayPolylines() { + final visible = _visiblePaths; + if (_displayPaths.isEmpty) return List.of(_polylines); + if (visible.isEmpty) return const []; + + final selected = _selectedPath; + final animating = + _animationEnabled && _playback.started && _playback.hasPath; + + final lines = buildMultiPathPolylines( + visible: visible, + selected: selected, + combined: _viewMode == PathViewMode.combined, + animating: animating, + ); + if (animating && selected != null) { + lines.addAll(buildPacketTrailPolylines(_playback, selected.color)); + } + return lines; + } + + List _buildPacketMarkers() { + final selected = _selectedPath; + if (!_animationEnabled || selected == null) return const []; + return buildPacketMarkers(_playback, selected.color); + } + + Widget _buildBottomPanel( BuildContext context, PathTraceData pathTraceData, bool isImperial, ) { final l10n = context.l10n; - final maxHeight = MediaQuery.of(context).size.height * 0.35; - final estimatedHeight = 72.0 + (pathTraceData.pathData.length * 56.0); - final cardHeight = max(96.0, min(maxHeight, estimatedHeight)); + final selected = _selectedPath; + final combined = _viewMode == PathViewMode.combined; + final maxHeight = + MediaQuery.of(context).size.height * (combined ? 0.45 : 0.35); + + double cardHeight; + if (_panelCollapsed) { + cardHeight = 128; + } else { + final summaryHeight = combined ? 34.0 + _displayPaths.length * 36.0 : 0; + final hopRows = combined + ? (selected?.totalTransmissions ?? 0) + : pathTraceData.pathData.length + 1; + final estimatedHeight = 132.0 + summaryHeight + hopRows * 56.0; + cardHeight = max(176.0, min(maxHeight, estimatedHeight)); + } return Positioned( left: 16, @@ -943,84 +1494,275 @@ class _PathTraceMapScreenState extends State { bottom: 16, child: SizedBox( height: cardHeight, - child: Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(12), - child: Text( - '${l10n.channelPath_repeaterHops} ${formatDistance(_pathDistanceMeters, isImperial: isImperial)}', - style: const TextStyle(fontWeight: FontWeight.w600), - ), - ), - const Divider(height: 1), - Expanded( - child: pathTraceData.pathData.isEmpty - ? Center( - child: Text(l10n.channelPath_noHopDetailsAvailable), - ) - : Scrollbar( - child: ListView.separated( - padding: const EdgeInsets.symmetric(vertical: 4), - itemCount: pathTraceData.pathData.length + 1, - separatorBuilder: (_, _) => const Divider(height: 1), - itemBuilder: (context, index) { - final snrUi = snrUiFromSNR( - index < pathTraceData.snrData.length - ? pathTraceData.snrData[index] - : null, - context.read().currentSf, - ); - return Column( - children: [ - ListTile( - leading: - index >= pathTraceData.snrData.length / 2 - ? Icon(Icons.call_received) - : Icon(Icons.call_made), - title: Text( - formatDirectionText(pathTraceData, index), - style: const TextStyle(fontSize: 14), - ), - subtitle: Text( - formatDirectionSubText( - pathTraceData, - index, - ), - style: const TextStyle(fontSize: 14), - ), - trailing: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - snrUi.icon, - color: snrUi.color, - size: 18.0, - ), - Text( - snrUi.text, - style: TextStyle( - fontSize: 10, - color: snrUi.color, - ), - ), - ], - ), - onTap: () { - // Handle item tap - }, - ), - ], - ); - }, + child: DecoratedBox( + decoration: BoxDecoration( + color: MeshPalette.bg1.withValues(alpha: 0.95), + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: MeshPalette.line2), + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(MeshRadii.md), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(12, 8, 4, 0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '${l10n.channelPath_repeaterHops} ${formatDistance(selected?.distanceMeters ?? _pathDistanceMeters, isImperial: isImperial)}', + style: MeshTheme.mono( + fontWeight: FontWeight.w600, + fontSize: 13, + color: MeshPalette.ink, + ), + ), + const SizedBox(height: 4), + PathMiniLegend(combined: combined), + ], ), ), - ), - ], + IconButton( + visualDensity: VisualDensity.compact, + icon: Icon( + _panelCollapsed + ? Icons.expand_less + : Icons.expand_more, + size: 20, + ), + tooltip: _panelCollapsed + ? l10n.pathMap_expandPanel + : l10n.pathMap_collapsePanel, + onPressed: () => + setState(() => _panelCollapsed = !_panelCollapsed), + ), + ], + ), + ), + PathAnimationControls( + playback: _playback, + selected: selected, + animationEnabled: _animationEnabled, + onToggleAnimation: () => setState(() { + _animationEnabled = !_animationEnabled; + if (!_animationEnabled) _playback.stop(); + }), + followEnabled: _followPacket, + onToggleFollow: _toggleFollowPacket, + ), + if (!_panelCollapsed) ...[ + if (selected != null && selected.unresolvedHops > 0) + Padding( + padding: const EdgeInsets.fromLTRB(12, 0, 12, 4), + child: Text( + l10n.pathMap_partialAnimation(selected.unresolvedHops), + style: TextStyle( + fontSize: 10.5, + color: MeshPalette.warn, + ), + ), + ), + if (combined) + PathSummaryList( + paths: _displayPaths, + selectedId: _selectedPathId, + hiddenIds: _hiddenPathIds, + isImperial: isImperial, + onSelect: _selectPath, + onToggleVisibility: _togglePathVisibility, + onShowAll: () => setState(_hiddenPathIds.clear), + ), + const Divider(height: 1), + Expanded(child: _buildHopList(pathTraceData, selected)), + ], + ], + ), ), ), ), ); } + + Widget _buildHopList(PathTraceData pathTraceData, DisplayPath? selected) { + final useSnrList = + _viewMode == PathViewMode.single && (selected?.isPrimary ?? true); + return ValueListenableBuilder( + valueListenable: _playback.activeSegment, + builder: (context, activeSegment, _) { + int highlightRow = -1; + if (_animationEnabled && + selected != null && + activeSegment >= 0 && + activeSegment < selected.rowForSegment.length) { + highlightRow = selected.rowForSegment[activeSegment]; + } + if (useSnrList) { + return _buildSnrHopList(pathTraceData, highlightRow); + } + if (selected == null) { + return Center( + child: Text(context.l10n.channelPath_noHopDetailsAvailable), + ); + } + return _buildGenericHopList(selected, pathTraceData, highlightRow); + }, + ); + } + + Widget _buildSnrHopList(PathTraceData pathTraceData, int highlightRow) { + final l10n = context.l10n; + if (pathTraceData.pathData.isEmpty) { + return Center(child: Text(l10n.channelPath_noHopDetailsAvailable)); + } + return Scrollbar( + child: ListView.separated( + padding: const EdgeInsets.symmetric(vertical: 4), + itemCount: pathTraceData.pathData.length + 1, + separatorBuilder: (_, _) => const Divider(height: 1), + itemBuilder: (context, index) { + final snrUi = snrUiFromSNR( + index < pathTraceData.snrData.length + ? pathTraceData.snrData[index] + : null, + context.read().currentSf, + ); + return ListTile( + tileColor: index == highlightRow + ? kPrimaryPathColor.withValues(alpha: 0.14) + : null, + leading: index >= pathTraceData.snrData.length / 2 + ? Icon(Icons.call_received) + : Icon(Icons.call_made), + title: Text( + formatDirectionText(pathTraceData, index), + style: MeshTheme.mono(fontSize: 13, color: MeshPalette.ink), + ), + subtitle: Text( + formatDirectionSubText(pathTraceData, index), + style: MeshTheme.mono(fontSize: 12, color: MeshPalette.ink3), + ), + trailing: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(snrUi.icon, color: snrUi.color, size: 18.0), + Text( + snrUi.text, + style: MeshTheme.mono(fontSize: 10, color: snrUi.color), + ), + ], + ), + ); + }, + ), + ); + } + + Widget _buildGenericHopList( + DisplayPath path, + PathTraceData pathTraceData, + int highlightRow, + ) { + final connector = context.read(); + final l10n = context.l10n; + + final hopUseCount = {}; + if (_viewMode == PathViewMode.combined) { + for (final p in _visiblePaths) { + for (final hop in p.hopBytes.toSet()) { + hopUseCount.update(hop, (v) => v + 1, ifAbsent: () => 1); + } + } + } + + return Scrollbar( + child: ListView.separated( + padding: const EdgeInsets.symmetric(vertical: 4), + itemCount: path.totalTransmissions, + separatorBuilder: (_, _) => const Divider(height: 1), + itemBuilder: (context, index) { + String title; + String subtitle; + Widget? trailing; + if (index < path.hopBytes.length) { + final hop = path.hopBytes[index]; + final hex = hop.toRadixString(16).padLeft(2, '0').toUpperCase(); + final contact = _contactForHop(hop, connector); + title = contact != null + ? '$hex: ${contact.name}' + : '$hex: ${l10n.channelPath_unknownRepeater}'; + final hasGps = contact != null && contact.hasLocation; + final inferred = + !hasGps && _inferredPositionForHop(hop, connector) != null; + final status = hasGps + ? l10n.pathTrace_legendGpsConfirmed + : inferred + ? l10n.pathTrace_legendInferred + : l10n.pathMap_noLocation; + final sharedCount = hopUseCount[hop] ?? 0; + subtitle = sharedCount > 1 + ? '$status · ${l10n.pathMap_sharedNodeCount(sharedCount)}' + : status; + if (path.isPrimary && index < pathTraceData.snrData.length) { + final snrUi = snrUiFromSNR( + pathTraceData.snrData[index], + connector.currentSf, + ); + trailing = Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(snrUi.icon, color: snrUi.color, size: 18.0), + Text( + snrUi.text, + style: MeshTheme.mono(fontSize: 10, color: snrUi.color), + ), + ], + ); + } + } else { + title = widget.targetContact?.name ?? ''; + subtitle = _targetContactIsGuessed + ? l10n.pathTrace_legendInferred + : l10n.pathTrace_legendGpsConfirmed; + } + return ListTile( + dense: true, + tileColor: index == highlightRow + ? path.color.withValues(alpha: 0.14) + : null, + leading: Container( + width: 26, + height: 26, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all(color: path.color, width: 1.5), + ), + alignment: Alignment.center, + child: Text( + '${index + 1}', + style: MeshTheme.mono( + fontSize: 11, + fontWeight: FontWeight.w700, + color: path.color, + ), + ), + ), + title: Text( + title, + style: MeshTheme.mono(fontSize: 13, color: MeshPalette.ink), + ), + subtitle: Text( + subtitle, + style: MeshTheme.mono(fontSize: 11, color: MeshPalette.ink3), + ), + trailing: trailing, + ); + }, + ), + ); + } } diff --git a/lib/screens/repeater_cli_screen.dart b/lib/screens/repeater_cli_screen.dart index 10e325ac..5024f334 100644 --- a/lib/screens/repeater_cli_screen.dart +++ b/lib/screens/repeater_cli_screen.dart @@ -1,14 +1,15 @@ import 'dart:async'; -import 'dart:typed_data'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; import '../l10n/l10n.dart'; import '../models/contact.dart'; import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; +import '../theme/mesh_theme.dart'; import '../widgets/debug_frame_viewer.dart'; import '../services/repeater_command_service.dart'; -import '../widgets/path_management_dialog.dart'; +import '../widgets/routing_sheet.dart'; import '../helpers/snack_bar_builder.dart'; class RepeaterCliScreen extends StatefulWidget { @@ -34,7 +35,6 @@ class _RepeaterCliScreenState extends State { StreamSubscription? _frameSubscription; RepeaterCommandService? _commandService; - // Common commands for quick access late final List> _quickCommands = [ {'labelKey': 'advertise', 'command': 'advert'}, {'labelKey': 'getName', 'command': 'get name'}, @@ -67,12 +67,8 @@ class _RepeaterCliScreenState extends State { void _setupMessageListener() { final connector = Provider.of(context, listen: false); - - // Listen for incoming text messages from the repeater _frameSubscription = connector.receivedFrames.listen((frame) { if (frame.isEmpty) return; - - // Check if it's a text message response if (frame[0] == respCodeContactMsgRecv || frame[0] == respCodeContactMsgRecvV3) { _handleTextMessageResponse(frame); @@ -102,12 +98,7 @@ class _RepeaterCliScreenState extends State { final parsed = parseContactMessageText(frame); if (parsed == null) return; if (!_matchesRepeaterPrefix(parsed.senderPrefix)) return; - - // Notify command service of response (for retry handling) _commandService?.handleResponse(widget.repeater, parsed.text); - - // Note: The command service will handle the response via the Future - // We don't need to add it to history here anymore as _sendCommand will do it } bool _matchesRepeaterPrefix(Uint8List prefix) { @@ -131,7 +122,6 @@ class _RepeaterCliScreenState extends State { }); }); - // Show debug info if requested if (showDebug && mounted) { final frame = buildSendCliCommandFrame( widget.repeater.publicKey, @@ -144,7 +134,6 @@ class _RepeaterCliScreenState extends State { ); } - // Send CLI command to repeater with retry try { if (_commandService != null) { final connector = Provider.of( @@ -157,7 +146,6 @@ class _RepeaterCliScreenState extends State { command, retries: 1, ); - if (mounted) { setState(() { _commandHistory.add({ @@ -184,7 +172,6 @@ class _RepeaterCliScreenState extends State { _historyIndex = -1; _commandFocusNode.requestFocus(); - // Auto-scroll to bottom Future.delayed(const Duration(milliseconds: 100), () { if (_scrollController.hasClients) { _scrollController.animateTo( @@ -239,161 +226,6 @@ class _RepeaterCliScreenState extends State { }); } - @override - Widget build(BuildContext context) { - final l10n = context.l10n; - final connector = context.watch(); - final repeater = _resolveRepeater(connector); - final isFloodMode = repeater.pathOverride == -1; - - return Scaffold( - appBar: AppBar( - title: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text(l10n.repeater_cliTitle), - Text( - repeater.name, - style: const TextStyle( - fontSize: 14, - fontWeight: FontWeight.normal, - ), - ), - ], - ), - centerTitle: false, - actions: [ - PopupMenuButton( - icon: Icon(isFloodMode ? Icons.waves : Icons.route), - tooltip: l10n.repeater_routingMode, - onSelected: (mode) async { - if (mode == 'flood') { - await connector.setPathOverride(repeater, pathLen: -1); - } else { - await connector.setPathOverride(repeater, pathLen: null); - } - }, - itemBuilder: (context) => [ - PopupMenuItem( - value: 'auto', - child: Row( - children: [ - Icon( - Icons.auto_mode, - size: 20, - color: !isFloodMode - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_autoUseSavedPath, - style: TextStyle( - fontWeight: !isFloodMode - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - PopupMenuItem( - value: 'flood', - child: Row( - children: [ - Icon( - Icons.waves, - size: 20, - color: isFloodMode - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_forceFloodMode, - style: TextStyle( - fontWeight: isFloodMode - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - ], - ), - IconButton( - icon: const Icon(Icons.timeline), - tooltip: l10n.repeater_pathManagement, - onPressed: () => - PathManagementDialog.show(context, contact: repeater), - ), - IconButton( - icon: const Icon(Icons.bug_report), - tooltip: l10n.repeater_debugNextCommand, - onPressed: () { - // Set a flag or just send next command with debug - if (_commandController.text.trim().isNotEmpty) { - _sendCommand(showDebug: true); - } else { - showDismissibleSnackBar( - context, - content: Text(l10n.repeater_enterCommandFirst), - ); - } - }, - ), - IconButton( - icon: const Icon(Icons.help_outline), - tooltip: l10n.repeater_commandHelp, - onPressed: () => _showCommandHelp(context), - ), - IconButton( - icon: const Icon(Icons.clear_all), - tooltip: l10n.repeater_clearHistory, - onPressed: _commandHistory.isEmpty ? null : _clearHistory, - ), - ], - ), - body: Column( - children: [ - _buildQuickCommandsBar(), - const Divider(height: 1), - Expanded( - child: _commandHistory.isEmpty - ? _buildEmptyState() - : _buildCommandHistory(), - ), - const Divider(height: 1), - _buildCommandInput(), - ], - ), - ); - } - - Widget _buildQuickCommandsBar() { - return Container( - padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 8), - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( - children: _quickCommands.map((cmd) { - final label = _quickCommandLabel(cmd['labelKey']!); - return Padding( - padding: const EdgeInsets.only(right: 8), - child: ActionChip( - label: Text(label), - onPressed: () => _useQuickCommand(cmd['command']!), - avatar: const Icon(Icons.play_arrow, size: 16), - ), - ); - }).toList(), - ), - ), - ); - } - String _quickCommandLabel(String key) { final l10n = context.l10n; switch (key) { @@ -420,22 +252,234 @@ class _RepeaterCliScreenState extends State { } } + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; + final connector = context.watch(); + final repeater = _resolveRepeater(connector); + final isFloodMode = repeater.pathOverride == -1; + + return Scaffold( + backgroundColor: MeshPalette.bg, + appBar: AppBar( + backgroundColor: MeshPalette.bg1, + title: Text(l10n.repeater_cliTitle), + centerTitle: true, + actions: [ + IconButton( + icon: Icon(isFloodMode ? Icons.waves : Icons.route), + tooltip: l10n.repeater_routingMode, + onPressed: () => + ContactRoutingSheet.show(context, contact: repeater), + ), + IconButton( + icon: const Icon(Icons.help_outline), + tooltip: l10n.repeater_commandHelp, + onPressed: () => _showCommandHelp(context), + ), + IconButton( + icon: const Icon(Icons.clear_all), + tooltip: l10n.repeater_clearHistory, + onPressed: _commandHistory.isEmpty ? null : _clearHistory, + ), + PopupMenuButton( + icon: const Icon(Icons.more_vert), + onSelected: (value) { + if (value == 'debug') { + if (_commandController.text.trim().isNotEmpty) { + _sendCommand(showDebug: true); + } else { + showDismissibleSnackBar( + context, + content: Text(l10n.repeater_enterCommandFirst), + ); + } + } + }, + itemBuilder: (context) => [ + PopupMenuItem( + value: 'debug', + child: Row( + children: [ + const Icon(Icons.bug_report), + const SizedBox(width: 8), + Text(l10n.repeater_debugNextCommand), + ], + ), + ), + ], + ), + ], + ), + body: Column( + children: [ + // Quick commands bar + Container( + color: MeshPalette.bg1, + padding: const EdgeInsets.fromLTRB(8, 6, 8, 6), + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + children: _quickCommands.map((cmd) { + final label = _quickCommandLabel(cmd['labelKey']!); + return Padding( + padding: const EdgeInsets.only(right: 6), + child: ActionChip( + label: Text( + label, + style: MeshTheme.mono( + fontSize: 11, + fontWeight: FontWeight.w600, + color: MeshPalette.blue, + ), + ), + backgroundColor: MeshPalette.blueBg, + side: const BorderSide(color: MeshPalette.blueLine), + visualDensity: VisualDensity.compact, + onPressed: () => _useQuickCommand(cmd['command']!), + ), + ); + }).toList(), + ), + ), + ), + Divider(height: 1, color: MeshPalette.line), + + // Output area + Expanded( + child: _commandHistory.isEmpty + ? _buildEmptyState() + : _buildCommandHistory(), + ), + + Divider(height: 1, color: MeshPalette.line), + + // Command input + Container( + color: MeshPalette.bg1, + padding: const EdgeInsets.fromLTRB(8, 8, 8, 8), + child: SafeArea( + child: Row( + children: [ + IconButton( + icon: Icon( + Icons.arrow_upward, + size: 18, + color: scheme.onSurfaceVariant, + ), + tooltip: l10n.repeater_previousCommand, + onPressed: () => _navigateHistory(true), + visualDensity: VisualDensity.compact, + ), + IconButton( + icon: Icon( + Icons.arrow_downward, + size: 18, + color: scheme.onSurfaceVariant, + ), + tooltip: l10n.repeater_nextCommand, + onPressed: () => _navigateHistory(false), + visualDensity: VisualDensity.compact, + ), + const SizedBox(width: 4), + Expanded( + child: TextField( + controller: _commandController, + focusNode: _commandFocusNode, + style: MeshTheme.mono( + fontSize: 13, + color: MeshPalette.ink, + ), + decoration: InputDecoration( + hintText: context.l10n.repeater_enterCommandHint, + hintStyle: MeshTheme.mono( + fontSize: 13, + color: MeshPalette.ink4, + ), + prefixText: '> ', + prefixStyle: MeshTheme.mono( + fontSize: 13, + color: MeshPalette.blue, + fontWeight: FontWeight.w700, + ), + filled: true, + fillColor: MeshPalette.bg2, + contentPadding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 10, + ), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(MeshRadii.pill), + borderSide: const BorderSide( + color: MeshPalette.line2, + ), + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(MeshRadii.pill), + borderSide: const BorderSide( + color: MeshPalette.line2, + ), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(MeshRadii.pill), + borderSide: const BorderSide( + color: MeshPalette.blue, + width: 1.5, + ), + ), + ), + textInputAction: TextInputAction.send, + onSubmitted: (_) => _sendCommand(), + ), + ), + const SizedBox(width: 6), + Material( + color: MeshPalette.blue.withValues(alpha: 0.15), + shape: const CircleBorder( + side: BorderSide(color: MeshPalette.blueLine), + ), + child: InkWell( + customBorder: const CircleBorder(), + onTap: () { + HapticFeedback.lightImpact(); + _sendCommand(); + }, + child: const Padding( + padding: EdgeInsets.all(10), + child: Icon( + Icons.send, + size: 18, + color: MeshPalette.blue, + ), + ), + ), + ), + ], + ), + ), + ), + ], + ), + ); + } + Widget _buildEmptyState() { final l10n = context.l10n; return Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon(Icons.terminal, size: 64, color: Colors.grey[400]), - const SizedBox(height: 16), + const Icon(Icons.terminal, size: 48, color: MeshPalette.ink4), + const SizedBox(height: 12), Text( l10n.repeater_noCommandsSent, - style: TextStyle(fontSize: 16, color: Colors.grey[600]), + style: MeshTheme.mono(fontSize: 13, color: MeshPalette.ink3), ), - const SizedBox(height: 8), + const SizedBox(height: 4), Text( l10n.repeater_typeCommandOrUseQuick, - style: TextStyle(fontSize: 14, color: Colors.grey[500]), + style: const TextStyle(fontSize: 12, color: MeshPalette.ink4), ), ], ), @@ -445,49 +489,37 @@ class _RepeaterCliScreenState extends State { Widget _buildCommandHistory() { return ListView.builder( controller: _scrollController, - padding: const EdgeInsets.all(16), + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), itemCount: _commandHistory.length, itemBuilder: (context, index) { final entry = _commandHistory[index]; final isCommand = entry['type'] == 'command'; return Padding( - padding: const EdgeInsets.only(bottom: 12), + padding: const EdgeInsets.only(bottom: 2), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - padding: const EdgeInsets.all(6), - decoration: BoxDecoration( - color: isCommand - ? Theme.of(context).colorScheme.primaryContainer - : Theme.of(context).colorScheme.secondaryContainer, - borderRadius: BorderRadius.circular(4), - ), - child: Icon( - isCommand ? Icons.chevron_right : Icons.arrow_back, - size: 16, - color: isCommand - ? Theme.of(context).colorScheme.onPrimaryContainer - : Theme.of(context).colorScheme.onSecondaryContainer, + // Gutter prefix + SizedBox( + width: 20, + child: Text( + isCommand ? '>' : ' ', + style: MeshTheme.mono( + fontSize: 12, + fontWeight: FontWeight.w700, + color: isCommand ? MeshPalette.blue : MeshPalette.ink3, + ), ), ), - const SizedBox(width: 12), + const SizedBox(width: 6), Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SelectableText( - entry['text']!, - style: TextStyle( - fontFamily: 'monospace', - fontSize: 13, - color: isCommand - ? Theme.of(context).colorScheme.primary - : Theme.of(context).colorScheme.onSurface, - ), - ), - ], + child: SelectableText( + entry['text']!, + style: MeshTheme.mono( + fontSize: 12.5, + color: isCommand ? MeshPalette.blue : MeshPalette.ink, + ), ), ), ], @@ -497,54 +529,6 @@ class _RepeaterCliScreenState extends State { ); } - Widget _buildCommandInput() { - final l10n = context.l10n; - return Container( - padding: const EdgeInsets.all(12), - color: Theme.of(context).colorScheme.surface, - child: SafeArea( - child: Row( - children: [ - IconButton( - icon: const Icon(Icons.arrow_upward, size: 20), - tooltip: l10n.repeater_previousCommand, - onPressed: () => _navigateHistory(true), - ), - IconButton( - icon: const Icon(Icons.arrow_downward, size: 20), - tooltip: l10n.repeater_nextCommand, - onPressed: () => _navigateHistory(false), - ), - const SizedBox(width: 8), - Expanded( - child: TextField( - controller: _commandController, - focusNode: _commandFocusNode, - decoration: InputDecoration( - hintText: l10n.repeater_enterCommandHint, - border: const OutlineInputBorder(), - contentPadding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 12, - ), - prefixText: '> ', - ), - style: const TextStyle(fontFamily: 'monospace'), - textInputAction: TextInputAction.send, - onSubmitted: (_) => _sendCommand(), - ), - ), - const SizedBox(width: 8), - IconButton.filled( - icon: const Icon(Icons.send), - onPressed: _sendCommand, - ), - ], - ), - ), - ); - } - void _applyHelpCommand(String command) { _commandController.text = command; _commandController.selection = TextSelection.fromPosition( @@ -1165,16 +1149,20 @@ class _RepeaterCliScreenState extends State { List<_CommandHelpEntry> commands, { String? note, }) { + final scheme = Theme.of(context).colorScheme; return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( title, - style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 16), + style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 15), ), if (note != null) ...[ - const SizedBox(height: 6), - Text(note, style: const TextStyle(fontSize: 12)), + const SizedBox(height: 4), + Text( + note, + style: TextStyle(fontSize: 11, color: scheme.onSurfaceVariant), + ), ], const SizedBox(height: 8), ...commands.map((entry) => _buildHelpCommandCard(context, entry)), @@ -1183,39 +1171,35 @@ class _RepeaterCliScreenState extends State { } Widget _buildHelpCommandCard(BuildContext context, _CommandHelpEntry entry) { - final colorScheme = Theme.of(context).colorScheme; + final scheme = Theme.of(context).colorScheme; return Card( elevation: 0, - margin: const EdgeInsets.only(bottom: 8), - color: colorScheme.surfaceContainerHighest, + margin: const EdgeInsets.only(bottom: 6), + color: scheme.surfaceContainerHighest, shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - side: BorderSide(color: colorScheme.outlineVariant), + borderRadius: BorderRadius.circular(MeshRadii.sm), + side: BorderSide(color: scheme.outlineVariant), ), child: InkWell( - borderRadius: BorderRadius.circular(8), + borderRadius: BorderRadius.circular(MeshRadii.sm), onTap: () => _applyHelpCommand(entry.command), child: Padding( - padding: const EdgeInsets.all(12), + padding: const EdgeInsets.all(10), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( entry.command, - style: TextStyle( - fontFamily: 'monospace', - fontSize: 13, - fontWeight: FontWeight.bold, - color: colorScheme.onSurfaceVariant, + style: MeshTheme.mono( + fontSize: 12, + fontWeight: FontWeight.w600, + color: MeshPalette.blue, ), ), - const SizedBox(height: 6), + const SizedBox(height: 4), Text( entry.description, - style: TextStyle( - fontSize: 12, - color: colorScheme.onSurfaceVariant, - ), + style: TextStyle(fontSize: 12, color: scheme.onSurfaceVariant), ), ], ), @@ -1228,6 +1212,5 @@ class _RepeaterCliScreenState extends State { class _CommandHelpEntry { final String command; final String description; - const _CommandHelpEntry({required this.command, required this.description}); } diff --git a/lib/screens/repeater_hub_screen.dart b/lib/screens/repeater_hub_screen.dart index 5b1e30ca..ab15e01e 100644 --- a/lib/screens/repeater_hub_screen.dart +++ b/lib/screens/repeater_hub_screen.dart @@ -1,10 +1,13 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:meshcore_open/connector/meshcore_protocol.dart'; import 'package:provider/provider.dart'; import '../l10n/l10n.dart'; import '../models/contact.dart'; import '../l10n/contact_localization.dart'; import '../services/app_settings_service.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/mesh_ui.dart'; import 'repeater_status_screen.dart'; import 'repeater_cli_screen.dart'; import 'repeater_settings_screen.dart'; @@ -26,175 +29,157 @@ class RepeaterHubScreen extends StatelessWidget { @override Widget build(BuildContext context) { final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; final settingsService = context.watch(); final chemistry = settingsService.batteryChemistryForRepeater( repeater.publicKeyHex, ); + return Scaffold( appBar: AppBar( - title: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - if (isAdmin) - Text( - repeater.type == advTypeRepeater - ? l10n.repeater_management - : l10n.room_management, - ), - if (!isAdmin) - Text( - repeater.type == advTypeRepeater - ? l10n.repeater_guest - : l10n.room_guest, - ), - Text( - repeater.name, - style: const TextStyle( - fontSize: 14, - fontWeight: FontWeight.normal, - ), - ), - ], + title: Text( + repeater.type == advTypeRepeater + ? (isAdmin ? l10n.repeater_management : l10n.repeater_guest) + : (isAdmin ? l10n.room_management : l10n.room_guest), ), - centerTitle: false, + centerTitle: true, ), body: SafeArea( top: false, child: ListView( - padding: const EdgeInsets.all(16), + padding: const EdgeInsets.only(bottom: 24), children: [ - // Repeater info card - Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( + // ── Identity card ───────────────────────────────────────────── + Padding( + padding: const EdgeInsets.fromLTRB(16, 20, 16, 4), + child: MeshCard( + margin: EdgeInsets.zero, + padding: const EdgeInsets.all(20), + child: Row( children: [ - CircleAvatar( - radius: 40, - backgroundColor: Colors.orange, - child: const Icon( - Icons.cell_tower, - size: 40, - color: Colors.white, - ), + AvatarCircle( + name: repeater.name, + size: 52, + color: MeshPalette.warn, + icon: Icons.cell_tower, ), - const SizedBox(height: 16), - Text( - repeater.name, - style: const TextStyle( - fontSize: 24, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 8), - Text( - repeater.shortPubKeyHex, - style: TextStyle(fontSize: 14, color: Colors.grey[600]), - ), - const SizedBox(height: 8), - Text( - repeater.pathLabel(context.l10n), - style: TextStyle(fontSize: 14, color: Colors.grey[600]), - ), - if (repeater.hasLocation) ...[ - const SizedBox(height: 4), - Row( - mainAxisAlignment: MainAxisAlignment.center, + const SizedBox(width: 16), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Icon( - Icons.location_on, - size: 14, - color: Colors.grey[600], - ), - const SizedBox(width: 4), Text( - '${repeater.latitude?.toStringAsFixed(4)}, ${repeater.longitude?.toStringAsFixed(4)}', - style: TextStyle( - fontSize: 12, - color: Colors.grey[600], + repeater.name, + style: Theme.of(context).textTheme.titleMedium + ?.copyWith(fontWeight: FontWeight.w700), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + const SizedBox(height: 2), + Text( + repeater.shortPubKeyHex, + style: MeshTheme.mono( + fontSize: 11, + color: scheme.onSurfaceVariant, ), ), + const SizedBox(height: 4), + Text( + repeater.pathLabel(l10n), + style: Theme.of(context).textTheme.bodySmall + ?.copyWith(color: scheme.onSurfaceVariant), + ), + if (repeater.hasLocation) ...[ + const SizedBox(height: 2), + Row( + children: [ + Icon( + Icons.location_on, + size: 12, + color: scheme.onSurfaceVariant, + ), + const SizedBox(width: 3), + Expanded( + child: Text( + '${repeater.latitude?.toStringAsFixed(4)}, ' + '${repeater.longitude?.toStringAsFixed(4)}', + style: MeshTheme.mono( + fontSize: 10, + color: scheme.onSurfaceVariant, + ), + overflow: TextOverflow.ellipsis, + ), + ), + ], + ), + ], ], ), - ], + ), + StatusChip( + label: isAdmin ? 'ADMIN' : 'GUEST', + color: isAdmin + ? MeshPalette.blue + : scheme.onSurfaceVariant, + ), ], ), ), ), - const SizedBox(height: 24), - if (isAdmin) - Card( - child: Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - const Icon(Icons.battery_full), - const SizedBox(width: 10), - Expanded( - child: Text( - l10n.appSettings_batteryChemistry, - style: const TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - ), - ), - ), - ], - ), - const SizedBox(height: 12), - DropdownButtonFormField( - initialValue: chemistry, - isExpanded: true, - decoration: const InputDecoration( - border: UnderlineInputBorder(), - isDense: true, - ), - onChanged: (value) { - if (value == null) return; - settingsService.setBatteryChemistryForRepeater( - repeater.publicKeyHex, - value, - ); - }, - items: [ - DropdownMenuItem( - value: 'nmc', - child: Text(l10n.appSettings_batteryNmc), - ), - DropdownMenuItem( - value: 'lifepo4', - child: Text(l10n.appSettings_batteryLifepo4), - ), - DropdownMenuItem( - value: 'lipo', - child: Text(l10n.appSettings_batteryLipo), - ), - ], - ), - ], + + // ── Battery chemistry (admin only) ───────────────────────────── + if (isAdmin) ...[ + SectionHeader(l10n.appSettings_batteryChemistry), + MeshCard( + margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + padding: const EdgeInsets.fromLTRB(14, 10, 14, 14), + child: DropdownButtonFormField( + initialValue: chemistry, + isExpanded: true, + decoration: InputDecoration( + prefixIcon: const Icon(Icons.battery_full, size: 18), + labelText: l10n.appSettings_batteryChemistry, ), + onChanged: (value) { + if (value == null) return; + settingsService.setBatteryChemistryForRepeater( + repeater.publicKeyHex, + value, + ); + }, + items: [ + DropdownMenuItem( + value: 'nmc', + child: Text(l10n.appSettings_batteryNmc), + ), + DropdownMenuItem( + value: 'lifepo4', + child: Text(l10n.appSettings_batteryLifepo4), + ), + DropdownMenuItem( + value: 'lipo', + child: Text(l10n.appSettings_batteryLipo), + ), + ], ), ), - const SizedBox(height: 24), - Text( + ], + + // ── Tools ────────────────────────────────────────────────────── + SectionHeader( isAdmin ? l10n.repeater_managementTools : l10n.repeater_guestTools, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), ), - const SizedBox(height: 16), - // Status button - _buildManagementCard( - context, + + _HubActionTile( + index: 0, icon: Icons.analytics, title: l10n.repeater_status, subtitle: l10n.repeater_statusSubtitle, - color: Colors.blue, + accentColor: MeshPalette.blue, onTap: () { + HapticFeedback.selectionClick(); Navigator.push( context, MaterialPageRoute( @@ -206,15 +191,15 @@ class RepeaterHubScreen extends StatelessWidget { ); }, ), - const SizedBox(height: 16), - // Telemetry button - _buildManagementCard( - context, + + _HubActionTile( + index: 1, icon: Icons.bar_chart_sharp, title: l10n.repeater_telemetry, subtitle: l10n.repeater_telemetrySubtitle, - color: Colors.teal, + accentColor: MeshPalette.magenta, onTap: () { + HapticFeedback.selectionClick(); Navigator.push( context, MaterialPageRoute( @@ -223,16 +208,34 @@ class RepeaterHubScreen extends StatelessWidget { ); }, ), - if (isAdmin) const SizedBox(height: 12), - // CLI button - if (isAdmin) - _buildManagementCard( - context, + + _HubActionTile( + index: 2, + icon: Icons.group, + title: l10n.repeater_neighbors, + subtitle: l10n.repeater_neighborsSubtitle, + accentColor: MeshPalette.signal, + onTap: () { + HapticFeedback.selectionClick(); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + NeighborsScreen(repeater: repeater, password: password), + ), + ); + }, + ), + + if (isAdmin) ...[ + _HubActionTile( + index: 3, icon: Icons.terminal, title: l10n.repeater_cli, subtitle: l10n.repeater_cliSubtitle, - color: Colors.green, + accentColor: MeshPalette.warn, onTap: () { + HapticFeedback.selectionClick(); Navigator.push( context, MaterialPageRoute( @@ -244,34 +247,14 @@ class RepeaterHubScreen extends StatelessWidget { ); }, ), - const SizedBox(height: 12), - // Neighbors button - _buildManagementCard( - context, - icon: Icons.group, - title: l10n.repeater_neighbors, - subtitle: l10n.repeater_neighborsSubtitle, - color: Colors.orange, - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - NeighborsScreen(repeater: repeater, password: password), - ), - ); - }, - ), - if (isAdmin) const SizedBox(height: 12), - // Settings button - if (isAdmin) - _buildManagementCard( - context, + _HubActionTile( + index: 4, icon: Icons.settings, title: l10n.repeater_settings, subtitle: l10n.repeater_settingsSubtitle, - color: Colors.deepOrange, + accentColor: MeshPalette.alert, onTap: () { + HapticFeedback.selectionClick(); Navigator.push( context, MaterialPageRoute( @@ -283,60 +266,76 @@ class RepeaterHubScreen extends StatelessWidget { ); }, ), + ], ], ), ), ); } +} - Widget _buildManagementCard( - BuildContext context, { - required IconData icon, - required String title, - required String subtitle, - required Color color, - required VoidCallback onTap, - }) { - return Card( - elevation: 2, - child: InkWell( +class _HubActionTile extends StatelessWidget { + final int index; + final IconData icon; + final String title; + final String subtitle; + final Color accentColor; + final VoidCallback onTap; + + const _HubActionTile({ + required this.index, + required this.icon, + required this.title, + required this.subtitle, + required this.accentColor, + required this.onTap, + }); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + return ListEntrance( + index: index, + child: MeshCard( onTap: onTap, - borderRadius: BorderRadius.circular(12), - child: Padding( - padding: const EdgeInsets.all(16), - child: Row( - children: [ - Container( - padding: const EdgeInsets.all(12), - decoration: BoxDecoration( - color: color.withValues(alpha: 0.1), - borderRadius: BorderRadius.circular(12), - ), - child: Icon(icon, color: color, size: 32), + child: Row( + children: [ + Container( + width: 44, + height: 44, + decoration: BoxDecoration( + color: accentColor.withValues(alpha: 0.12), + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: accentColor.withValues(alpha: 0.3)), ), - const SizedBox(width: 16), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - title, - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), + alignment: Alignment.center, + child: Icon(icon, size: 22, color: accentColor), + ), + const SizedBox(width: 14), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: const TextStyle( + fontWeight: FontWeight.w600, + fontSize: 15, ), - const SizedBox(height: 4), - Text( - subtitle, - style: TextStyle(fontSize: 14, color: Colors.grey[600]), + ), + const SizedBox(height: 2), + Text( + subtitle, + style: TextStyle( + fontSize: 12.5, + color: scheme.onSurfaceVariant, ), - ], - ), + ), + ], ), - Icon(Icons.chevron_right, color: Colors.grey[400]), - ], - ), + ), + Icon(Icons.chevron_right, color: scheme.onSurfaceVariant, size: 20), + ], ), ), ); diff --git a/lib/screens/repeater_settings_screen.dart b/lib/screens/repeater_settings_screen.dart index 9ffd1b37..dca0d7f4 100644 --- a/lib/screens/repeater_settings_screen.dart +++ b/lib/screens/repeater_settings_screen.dart @@ -8,7 +8,9 @@ import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; import '../services/repeater_command_service.dart'; import '../services/storage_service.dart'; -import '../widgets/path_management_dialog.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/mesh_ui.dart'; +import '../widgets/routing_sheet.dart'; import '../helpers/snack_bar_builder.dart'; class RepeaterSettingsScreen extends StatefulWidget { @@ -126,6 +128,8 @@ class _RepeaterSettingsScreenState extends State { // Location settings final TextEditingController _latController = TextEditingController(); final TextEditingController _lonController = TextEditingController(); + bool _latInvalid = false; + bool _lonInvalid = false; // Feature toggles bool _repeatEnabled = true; @@ -457,7 +461,9 @@ class _RepeaterSettingsScreenState extends State { ? l10n.repeater_refreshed(label) : l10n.repeater_errorRefreshing(label), ), - backgroundColor: successCount > 0 ? Colors.green : Colors.red, + backgroundColor: successCount > 0 + ? null + : Theme.of(context).colorScheme.error, ); setState(() => setRefreshing(false)); } @@ -667,15 +673,15 @@ class _RepeaterSettingsScreenState extends State { : l10n.repeater_actionSucceeded(label), ), backgroundColor: outcome == _SaveOutcome.error - ? Colors.red - : Colors.green, + ? Theme.of(context).colorScheme.error + : null, ); } catch (e) { if (!mounted) return; showDismissibleSnackBar( context, content: Text(l10n.repeater_actionFailed(label, e.toString())), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); } finally { if (mounted) setState(() => _runningAction = false); @@ -768,14 +774,16 @@ class _RepeaterSettingsScreenState extends State { } if (_dirtyFields.contains(_SettingField.lat) && - _latController.text.isNotEmpty) { + _latController.text.isNotEmpty && + _isValidCoordinate(_latController.text, 90)) { pending.add(( field: _SettingField.lat, command: 'set lat ${_latController.text}', )); } if (_dirtyFields.contains(_SettingField.lon) && - _lonController.text.isNotEmpty) { + _lonController.text.isNotEmpty && + _isValidCoordinate(_lonController.text, 180)) { pending.add(( field: _SettingField.lon, command: 'set lon ${_lonController.text}', @@ -944,13 +952,12 @@ class _RepeaterSettingsScreenState extends State { showDismissibleSnackBar( context, content: Text(l10n.repeater_settingsSavedRebootNeeded), - backgroundColor: Colors.orange, + backgroundColor: Theme.of(context).colorScheme.tertiary, ); } else if (failures.isEmpty) { showDismissibleSnackBar( context, content: Text(l10n.repeater_settingsSaved), - backgroundColor: Colors.green, ); } else { showDismissibleSnackBar( @@ -958,7 +965,7 @@ class _RepeaterSettingsScreenState extends State { content: Text( l10n.repeater_settingsPartialFailure(failures.join('; ')), ), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); } } @@ -973,7 +980,7 @@ class _RepeaterSettingsScreenState extends State { content: Text( context.l10n.repeater_errorSavingSettings(e.toString()), ), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); } } @@ -984,6 +991,12 @@ class _RepeaterSettingsScreenState extends State { _flagHasChanges(); } + static bool _isValidCoordinate(String text, double max) { + if (text.trim().isEmpty) return true; + final value = double.tryParse(text.trim()); + return value != null && value >= -max && value <= max; + } + void _flagHasChanges() { if (!_hasChanges) { setState(() { @@ -992,39 +1005,6 @@ class _RepeaterSettingsScreenState extends State { } } - Widget _buildSectionHeader({ - required IconData icon, - required String title, - String? tooltip, - bool isRefreshing = false, - VoidCallback? onRefresh, - }) { - return Row( - children: [ - Icon(icon, color: Theme.of(context).textTheme.headlineSmall?.color), - const SizedBox(width: 8), - Text( - title, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), - if (onRefresh != null) ...[ - const Spacer(), - IconButton( - icon: isRefreshing - ? const SizedBox( - width: 18, - height: 18, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.refresh), - onPressed: isRefreshing ? null : onRefresh, - tooltip: tooltip, - ), - ], - ], - ); - } - Widget _buildInlineRefreshButton({ required bool isRefreshing, required VoidCallback onRefresh, @@ -1056,89 +1036,14 @@ class _RepeaterSettingsScreenState extends State { return Scaffold( appBar: AppBar( - title: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text(l10n.repeater_settingsTitle), - Text( - repeater.name, - style: const TextStyle( - fontSize: 14, - fontWeight: FontWeight.normal, - ), - ), - ], - ), - centerTitle: false, + title: Text(l10n.repeater_settingsTitle), + centerTitle: true, actions: [ - PopupMenuButton( + IconButton( icon: Icon(isFloodMode ? Icons.waves : Icons.route), tooltip: l10n.repeater_routingMode, - onSelected: (mode) async { - if (mode == 'flood') { - await connector.setPathOverride(repeater, pathLen: -1); - } else { - await connector.setPathOverride(repeater, pathLen: null); - } - if (mounted) { - setState(() {}); - } - }, - itemBuilder: (context) => [ - PopupMenuItem( - value: 'auto', - child: Row( - children: [ - Icon( - Icons.auto_mode, - size: 20, - color: !isFloodMode - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_autoUseSavedPath, - style: TextStyle( - fontWeight: !isFloodMode - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - PopupMenuItem( - value: 'flood', - child: Row( - children: [ - Icon( - Icons.waves, - size: 20, - color: isFloodMode - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_forceFloodMode, - style: TextStyle( - fontWeight: isFloodMode - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - ], - ), - IconButton( - icon: const Icon(Icons.timeline), - tooltip: l10n.repeater_pathManagement, onPressed: () => - PathManagementDialog.show(context, contact: repeater), + ContactRoutingSheet.show(context, contact: repeater), ), if (_hasChanges) TextButton.icon( @@ -1153,26 +1058,18 @@ class _RepeaterSettingsScreenState extends State { child: _isLoading && _nameController.text.isEmpty ? const Center(child: CircularProgressIndicator()) : ListView( - padding: const EdgeInsets.all(16), + padding: const EdgeInsets.only(bottom: 32), children: [ _buildBasicSettingsCard(), - const SizedBox(height: 16), _buildRadioSettingsCard(), - const SizedBox(height: 16), _buildLocationSettingsCard(), - const SizedBox(height: 16), _buildFeatureTogglesCard(), - const SizedBox(height: 16), _buildNetworkHealthCard(), - const SizedBox(height: 16), _buildAdvertisementSettingsCard(), - const SizedBox(height: 16), _buildOwnerInfoCard(), - const SizedBox(height: 16), _buildActionsCard(), - const SizedBox(height: 16), _buildAdvancedCard(), - const SizedBox(height: 32), + const SizedBox(height: 16), _buildDangerZoneCard(), ], ), @@ -1182,345 +1079,348 @@ class _RepeaterSettingsScreenState extends State { Widget _buildBasicSettingsCard() { final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildSectionHeader( - icon: Icons.settings, - title: l10n.repeater_basicSettings, - tooltip: l10n.repeater_refreshBasicSettings, - isRefreshing: _refreshingBasic, - onRefresh: _refreshBasicSettings, - ), - const Divider(), - TextField( - controller: _nameController, - decoration: InputDecoration( - labelText: l10n.repeater_repeaterName, - helperText: l10n.repeater_repeaterNameHelper, - border: const OutlineInputBorder(), + final refreshButton = _refreshingBasic + ? const SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : IconButton( + icon: const Icon(Icons.refresh, size: 18), + onPressed: _refreshBasicSettings, + tooltip: l10n.repeater_refreshBasicSettings, + visualDensity: VisualDensity.compact, + padding: EdgeInsets.zero, + ); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SectionHeader(l10n.repeater_basicSettings, trailing: refreshButton), + MeshCard( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + TextField( + controller: _nameController, + decoration: InputDecoration( + labelText: l10n.repeater_repeaterName, + helperText: l10n.repeater_repeaterNameHelper, + ), + onChanged: (_) => _markChanged(_SettingField.name), ), - onChanged: (_) => _markChanged(_SettingField.name), - ), - const SizedBox(height: 16), - TextField( - controller: _passwordController, - decoration: InputDecoration( - labelText: l10n.repeater_adminPassword, - helperText: l10n.repeater_adminPasswordHelper, - border: const OutlineInputBorder(), + const SizedBox(height: 12), + TextField( + controller: _passwordController, + decoration: InputDecoration( + labelText: l10n.repeater_adminPassword, + helperText: l10n.repeater_adminPasswordHelper, + ), + obscureText: true, + onChanged: (_) => _flagHasChanges(), ), - obscureText: true, - onChanged: (_) => _flagHasChanges(), - ), - const SizedBox(height: 16), - TextField( - controller: _guestPasswordController, - decoration: InputDecoration( - labelText: l10n.repeater_guestPassword, - helperText: l10n.repeater_guestPasswordHelper, - border: const OutlineInputBorder(), + const SizedBox(height: 12), + TextField( + controller: _guestPasswordController, + decoration: InputDecoration( + labelText: l10n.repeater_guestPassword, + helperText: l10n.repeater_guestPasswordHelper, + ), + obscureText: true, + onChanged: (_) => _flagHasChanges(), ), - obscureText: true, - onChanged: (_) => _flagHasChanges(), - ), - ], + ], + ), ), - ), + ], ); } Widget _buildRadioSettingsCard() { final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildSectionHeader( - icon: Icons.radio, - title: l10n.repeater_radioSettings, - tooltip: l10n.repeater_refreshRadioSettings, - isRefreshing: _refreshingRadio, - onRefresh: _refreshRadioSettings, - ), - const Divider(), - TextField( - controller: _freqController, - decoration: InputDecoration( - labelText: l10n.repeater_frequencyMhz, - helperText: l10n.repeater_frequencyHelper, - border: const OutlineInputBorder(), - suffixText: 'MHz', + final refreshButton = _refreshingRadio + ? const SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : IconButton( + icon: const Icon(Icons.refresh, size: 18), + onPressed: _refreshRadioSettings, + tooltip: l10n.repeater_refreshRadioSettings, + visualDensity: VisualDensity.compact, + padding: EdgeInsets.zero, + ); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SectionHeader(l10n.repeater_radioSettings, trailing: refreshButton), + MeshCard( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + TextField( + controller: _freqController, + decoration: InputDecoration( + labelText: l10n.repeater_frequencyMhz, + helperText: l10n.repeater_frequencyHelper, + suffixText: 'MHz', + ), + keyboardType: const TextInputType.numberWithOptions( + decimal: true, + ), + onChanged: (_) => _markChanged(_SettingField.radio), ), - keyboardType: const TextInputType.numberWithOptions( - decimal: true, - ), - onChanged: (_) => _markChanged(_SettingField.radio), - ), - const SizedBox(height: 16), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: TextField( - controller: _txPowerController, - decoration: InputDecoration( - labelText: l10n.repeater_txPower, - helperText: l10n.repeater_txPowerHelper, - border: const OutlineInputBorder(), - suffixText: 'dBm', + const SizedBox(height: 12), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: TextField( + controller: _txPowerController, + decoration: InputDecoration( + labelText: l10n.repeater_txPower, + helperText: l10n.repeater_txPowerHelper, + suffixText: 'dBm', + ), + keyboardType: TextInputType.number, + onChanged: (_) => _markChanged(_SettingField.txPower), ), - keyboardType: TextInputType.number, - onChanged: (_) => _markChanged(_SettingField.txPower), ), + _buildInlineRefreshButton( + isRefreshing: _refreshingTxPower, + onRefresh: _refreshTxPower, + tooltip: l10n.repeater_refreshTxPower, + ), + ], + ), + const SizedBox(height: 12), + DropdownButtonFormField( + initialValue: _bandwidth, + decoration: InputDecoration(labelText: l10n.repeater_bandwidth), + items: _bandwidthOptions.map((bw) { + return DropdownMenuItem( + value: bw, + child: Text(_formatBandwidthLabel(bw)), + ); + }).toList(), + onChanged: (value) { + if (value != null) { + setState(() { + _bandwidth = value; + }); + _markChanged(_SettingField.radio); + } + }, + ), + const SizedBox(height: 12), + DropdownButtonFormField( + initialValue: _spreadingFactor, + decoration: InputDecoration( + labelText: l10n.repeater_spreadingFactor, ), - const SizedBox(width: 8), - _buildInlineRefreshButton( - isRefreshing: _refreshingTxPower, - onRefresh: _refreshTxPower, - tooltip: l10n.repeater_refreshTxPower, + items: _spreadingFactorOptions.map((sf) { + return DropdownMenuItem(value: sf, child: Text('SF$sf')); + }).toList(), + onChanged: (value) { + if (value != null) { + setState(() { + _spreadingFactor = value; + }); + _markChanged(_SettingField.radio); + } + }, + ), + const SizedBox(height: 12), + DropdownButtonFormField( + initialValue: _codingRate, + decoration: InputDecoration( + labelText: l10n.repeater_codingRate, ), - ], - ), - const SizedBox(height: 16), - DropdownButtonFormField( - initialValue: _bandwidth, - decoration: InputDecoration( - labelText: l10n.repeater_bandwidth, - border: const OutlineInputBorder(), + items: _codingRateOptions.map((cr) { + return DropdownMenuItem(value: cr, child: Text('4/$cr')); + }).toList(), + onChanged: (value) { + if (value != null) { + setState(() { + _codingRate = value; + }); + _markChanged(_SettingField.radio); + } + }, ), - items: _bandwidthOptions.map((bw) { - return DropdownMenuItem( - value: bw, - child: Text(_formatBandwidthLabel(bw)), - ); - }).toList(), - onChanged: (value) { - if (value != null) { - setState(() { - _bandwidth = value; - }); - _markChanged(_SettingField.radio); - } - }, - ), - const SizedBox(height: 16), - DropdownButtonFormField( - initialValue: _spreadingFactor, - decoration: InputDecoration( - labelText: l10n.repeater_spreadingFactor, - border: const OutlineInputBorder(), + const SizedBox(height: 4), + _buildFeatureToggleRow( + title: l10n.repeater_rxGain, + subtitle: l10n.repeater_rxGainHelper, + value: _rxGainBoosted, + isRefreshing: _refreshingRxGain, + onChanged: (v) { + setState(() => _rxGainBoosted = v); + _markChanged(_SettingField.rxGain); + }, + onRefresh: _refreshRxGain, + refreshTooltip: l10n.repeater_refreshRxGain, ), - items: _spreadingFactorOptions.map((sf) { - return DropdownMenuItem(value: sf, child: Text('SF$sf')); - }).toList(), - onChanged: (value) { - if (value != null) { - setState(() { - _spreadingFactor = value; - }); - _markChanged(_SettingField.radio); - } - }, - ), - const SizedBox(height: 16), - DropdownButtonFormField( - initialValue: _codingRate, - decoration: InputDecoration( - labelText: l10n.repeater_codingRate, - border: const OutlineInputBorder(), - ), - items: _codingRateOptions.map((cr) { - return DropdownMenuItem(value: cr, child: Text('4/$cr')); - }).toList(), - onChanged: (value) { - if (value != null) { - setState(() { - _codingRate = value; - }); - _markChanged(_SettingField.radio); - } - }, - ), - const SizedBox(height: 8), - _buildFeatureToggleRow( - title: l10n.repeater_rxGain, - subtitle: l10n.repeater_rxGainHelper, - value: _rxGainBoosted, - isRefreshing: _refreshingRxGain, - onChanged: (v) { - setState(() => _rxGainBoosted = v); - _markChanged(_SettingField.rxGain); - }, - onRefresh: _refreshRxGain, - refreshTooltip: l10n.repeater_refreshRxGain, - ), - ], + ], + ), ), - ), + ], ); } Widget _buildLocationSettingsCard() { final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildSectionHeader( - icon: Icons.location_on, - title: l10n.repeater_locationSettings, - ), - const Divider(), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: TextField( - controller: _latController, - decoration: InputDecoration( - labelText: l10n.repeater_latitude, - helperText: l10n.repeater_latitudeHelper, - border: const OutlineInputBorder(), + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SectionHeader(l10n.repeater_locationSettings), + MeshCard( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: TextField( + controller: _latController, + decoration: InputDecoration( + labelText: l10n.repeater_latitude, + helperText: l10n.repeater_latitudeHelper, + errorText: _latInvalid + ? l10n.settings_locationInvalid + : null, + ), + keyboardType: const TextInputType.numberWithOptions( + decimal: true, + signed: true, + ), + onChanged: (value) { + _markChanged(_SettingField.lat); + final invalid = !_isValidCoordinate(value, 90); + if (invalid != _latInvalid) { + setState(() => _latInvalid = invalid); + } + }, ), - keyboardType: const TextInputType.numberWithOptions( - decimal: true, - signed: true, - ), - onChanged: (_) => _markChanged(_SettingField.lat), ), - ), - const SizedBox(width: 8), - _buildInlineRefreshButton( - isRefreshing: _refreshingLat, - onRefresh: _refreshLat, - tooltip: l10n.repeater_latitude, - ), - ], - ), - const SizedBox(height: 16), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: TextField( - controller: _lonController, - decoration: InputDecoration( - labelText: l10n.repeater_longitude, - helperText: l10n.repeater_longitudeHelper, - border: const OutlineInputBorder(), - ), - keyboardType: const TextInputType.numberWithOptions( - decimal: true, - signed: true, - ), - onChanged: (_) => _markChanged(_SettingField.lon), + _buildInlineRefreshButton( + isRefreshing: _refreshingLat, + onRefresh: _refreshLat, + tooltip: l10n.repeater_latitude, ), - ), - const SizedBox(width: 8), - _buildInlineRefreshButton( - isRefreshing: _refreshingLon, - onRefresh: _refreshLon, - tooltip: l10n.repeater_longitude, - ), - ], - ), - ], + ], + ), + const SizedBox(height: 12), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: TextField( + controller: _lonController, + decoration: InputDecoration( + labelText: l10n.repeater_longitude, + helperText: l10n.repeater_longitudeHelper, + errorText: _lonInvalid + ? l10n.settings_locationInvalid + : null, + ), + keyboardType: const TextInputType.numberWithOptions( + decimal: true, + signed: true, + ), + onChanged: (value) { + _markChanged(_SettingField.lon); + final invalid = !_isValidCoordinate(value, 180); + if (invalid != _lonInvalid) { + setState(() => _lonInvalid = invalid); + } + }, + ), + ), + _buildInlineRefreshButton( + isRefreshing: _refreshingLon, + onRefresh: _refreshLon, + tooltip: l10n.repeater_longitude, + ), + ], + ), + ], + ), ), - ), + ], ); } Widget _buildFeatureTogglesCard() { final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Icon( - Icons.toggle_on, - color: Theme.of(context).textTheme.headlineSmall?.color, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_features, - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - const Divider(), - _buildFeatureToggleRow( - title: l10n.repeater_packetForwarding, - subtitle: l10n.repeater_packetForwardingSubtitle, - value: _repeatEnabled, - isRefreshing: _refreshingRepeat, - onChanged: (value) { - setState(() { - _repeatEnabled = value; - }); - _markChanged(_SettingField.repeat); - }, - onRefresh: _refreshRepeat, - refreshTooltip: l10n.repeater_refreshPacketForwarding, - ), - _buildFeatureToggleRow( - title: l10n.repeater_guestAccess, - subtitle: l10n.repeater_guestAccessSubtitle, - value: _allowReadOnly, - isRefreshing: _refreshingAllowReadOnly, - onChanged: (value) { - setState(() { - _allowReadOnly = value; - }); - _markChanged(_SettingField.allowReadOnly); - }, - onRefresh: _refreshAllowReadOnly, - refreshTooltip: l10n.repeater_refreshGuestAccess, - ), - _buildFeatureToggleRow( - title: l10n.repeater_multiAcks, - subtitle: l10n.repeater_multiAcksSubtitle, - value: _multiAcks, - isRefreshing: _refreshingMultiAcks, - onChanged: (v) { - setState(() => _multiAcks = v); - _markChanged(_SettingField.multiAcks); - }, - onRefresh: _refreshMultiAcks, - refreshTooltip: l10n.repeater_refreshMultiAcks, - ), - SwitchListTile( - title: Text(l10n.repeater_clockSyncAfterLogin), - subtitle: Text(l10n.repeater_clockSyncAfterLoginSubtitle), - value: _autoClockSyncAfterLogin, - onChanged: (value) async { - setState(() { - _autoClockSyncAfterLogin = value; - }); - await _storage.setRepeaterAutoClockSyncAfterLoginEnabled( - widget.repeater.publicKeyHex, - value, - ); - }, - contentPadding: EdgeInsets.zero, - ), - ], + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SectionHeader(l10n.repeater_features), + MeshCard( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildFeatureToggleRow( + title: l10n.repeater_packetForwarding, + subtitle: l10n.repeater_packetForwardingSubtitle, + value: _repeatEnabled, + isRefreshing: _refreshingRepeat, + onChanged: (value) { + setState(() { + _repeatEnabled = value; + }); + _markChanged(_SettingField.repeat); + }, + onRefresh: _refreshRepeat, + refreshTooltip: l10n.repeater_refreshPacketForwarding, + ), + _buildFeatureToggleRow( + title: l10n.repeater_guestAccess, + subtitle: l10n.repeater_guestAccessSubtitle, + value: _allowReadOnly, + isRefreshing: _refreshingAllowReadOnly, + onChanged: (value) { + setState(() { + _allowReadOnly = value; + }); + _markChanged(_SettingField.allowReadOnly); + }, + onRefresh: _refreshAllowReadOnly, + refreshTooltip: l10n.repeater_refreshGuestAccess, + ), + _buildFeatureToggleRow( + title: l10n.repeater_multiAcks, + subtitle: l10n.repeater_multiAcksSubtitle, + value: _multiAcks, + isRefreshing: _refreshingMultiAcks, + onChanged: (v) { + setState(() => _multiAcks = v); + _markChanged(_SettingField.multiAcks); + }, + onRefresh: _refreshMultiAcks, + refreshTooltip: l10n.repeater_refreshMultiAcks, + ), + SwitchListTile( + title: Text(l10n.repeater_clockSyncAfterLogin), + subtitle: Text(l10n.repeater_clockSyncAfterLoginSubtitle), + value: _autoClockSyncAfterLogin, + onChanged: (value) async { + setState(() { + _autoClockSyncAfterLogin = value; + }); + await _storage.setRepeaterAutoClockSyncAfterLoginEnabled( + widget.repeater.publicKeyHex, + value, + ); + }, + contentPadding: EdgeInsets.zero, + ), + ], + ), ), - ), + ], ); } @@ -1562,388 +1462,374 @@ class _RepeaterSettingsScreenState extends State { Widget _buildAdvertisementSettingsCard() { final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildSectionHeader( - icon: Icons.broadcast_on_personal, - title: l10n.repeater_advertisementSettings, - ), - const Divider(), - Row( - children: [ - Expanded( - child: ListTile( - title: Text(l10n.repeater_localAdvertInterval), - subtitle: Text( - l10n.repeater_localAdvertIntervalMinutes(_advertInterval), + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SectionHeader(l10n.repeater_advertisementSettings), + MeshCard( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: ListTile( + title: Text(l10n.repeater_localAdvertInterval), + subtitle: Text( + l10n.repeater_localAdvertIntervalMinutes( + _advertInterval, + ), + ), + trailing: Switch( + value: _advertEnable, + onChanged: (value) { + setState(() { + _advertInterval = value ? 60 : 0; + _advertEnable = value; + }); + _markChanged(_SettingField.advertInterval); + }, + ), + contentPadding: EdgeInsets.zero, ), - trailing: Switch( - value: _advertEnable, - onChanged: (value) { + ), + IconButton( + icon: _refreshingAdvertInterval + ? const SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : const Icon(Icons.refresh, size: 20), + onPressed: _refreshingAdvertInterval + ? null + : _refreshAdvertInterval, + tooltip: l10n.repeater_localAdvertInterval, + visualDensity: VisualDensity.compact, + ), + ], + ), + Slider( + value: _advertInterval == 0 + ? 60.toDouble() + : _advertInterval.toDouble(), + min: 60, + max: 240, + divisions: 18, + label: l10n.repeater_localAdvertIntervalMinutes( + _advertInterval, + ), + onChanged: _advertEnable + ? (value) { setState(() { - _advertInterval = value ? 60 : 0; - _advertEnable = value; + _advertInterval = value.toInt(); }); _markChanged(_SettingField.advertInterval); - }, - ), - contentPadding: EdgeInsets.zero, - ), - ), - IconButton( - icon: _refreshingAdvertInterval - ? const SizedBox( - width: 18, - height: 18, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.refresh, size: 20), - onPressed: _refreshingAdvertInterval - ? null - : _refreshAdvertInterval, - tooltip: l10n.repeater_localAdvertInterval, - visualDensity: VisualDensity.compact, - ), - ], - ), - Slider( - value: _advertInterval == 0 - ? 60.toDouble() - : _advertInterval.toDouble(), - min: 60, - max: 240, - divisions: 18, - label: l10n.repeater_localAdvertIntervalMinutes(_advertInterval), - onChanged: _advertEnable - ? (value) { - setState(() { - _advertInterval = value.toInt(); - }); - _markChanged(_SettingField.advertInterval); - } - : null, - ), - const SizedBox(height: 16), - Row( - children: [ - Expanded( - child: ListTile( - title: Text(l10n.repeater_floodAdvertInterval), - subtitle: Text( - l10n.repeater_floodAdvertIntervalHours( - _floodAdvertInterval, + } + : null, + ), + const SizedBox(height: 8), + Row( + children: [ + Expanded( + child: ListTile( + title: Text(l10n.repeater_floodAdvertInterval), + subtitle: Text( + l10n.repeater_floodAdvertIntervalHours( + _floodAdvertInterval, + ), ), + trailing: Switch( + value: _floodAdvertEnable, + onChanged: (value) { + setState(() { + _floodAdvertInterval = value ? 3 : 0; + _floodAdvertEnable = value; + }); + _markChanged(_SettingField.floodAdvertInterval); + }, + ), + contentPadding: EdgeInsets.zero, ), - trailing: Switch( - value: _floodAdvertEnable, - onChanged: (value) { + ), + IconButton( + icon: _refreshingFloodAdvertInterval + ? const SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : const Icon(Icons.refresh, size: 20), + onPressed: _refreshingFloodAdvertInterval + ? null + : _refreshFloodAdvertInterval, + tooltip: l10n.repeater_floodAdvertInterval, + visualDensity: VisualDensity.compact, + ), + ], + ), + Slider( + value: _floodAdvertInterval == 0 + ? 3.toDouble() + : _floodAdvertInterval.toDouble(), + min: 3, + max: 168, + divisions: 165, + label: l10n.repeater_floodAdvertIntervalHours( + _floodAdvertInterval, + ), + onChanged: _floodAdvertEnable + ? (value) { setState(() { - _floodAdvertInterval = value ? 3 : 0; - _floodAdvertEnable = value; + _floodAdvertInterval = value.toInt(); }); _markChanged(_SettingField.floodAdvertInterval); - }, - ), - contentPadding: EdgeInsets.zero, - ), - ), - IconButton( - icon: _refreshingFloodAdvertInterval - ? const SizedBox( - width: 18, - height: 18, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.refresh, size: 20), - onPressed: _refreshingFloodAdvertInterval - ? null - : _refreshFloodAdvertInterval, - tooltip: l10n.repeater_floodAdvertInterval, - visualDensity: VisualDensity.compact, - ), - ], - ), - Slider( - value: _floodAdvertInterval == 0 - ? 3.toDouble() - : _floodAdvertInterval.toDouble(), - min: 3, - max: 168, - divisions: 165, - label: l10n.repeater_floodAdvertIntervalHours( - _floodAdvertInterval, + } + : null, ), - onChanged: _floodAdvertEnable - ? (value) { - setState(() { - _floodAdvertInterval = value.toInt(); - }); - _markChanged(_SettingField.floodAdvertInterval); - } - : null, - ), - const SizedBox(height: 16), - Row( - children: [ - Expanded( - child: ListTile( - title: Text(l10n.repeater_floodMax), - subtitle: Text(l10n.repeater_floodMaxHelper), - trailing: Text( - '$_floodMax', - style: const TextStyle(fontWeight: FontWeight.bold), + const SizedBox(height: 8), + Row( + children: [ + Expanded( + child: ListTile( + title: Text(l10n.repeater_floodMax), + subtitle: Text(l10n.repeater_floodMaxHelper), + trailing: Text( + '$_floodMax', + style: const TextStyle(fontWeight: FontWeight.bold), + ), + contentPadding: EdgeInsets.zero, ), - contentPadding: EdgeInsets.zero, ), - ), - IconButton( - icon: _refreshingFloodMax - ? const SizedBox( - width: 18, - height: 18, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.refresh, size: 20), - onPressed: _refreshingFloodMax ? null : _refreshFloodMax, - tooltip: l10n.repeater_floodMax, - visualDensity: VisualDensity.compact, - ), - ], - ), - Slider( - value: _floodMax.toDouble(), - min: 0, - max: 64, - divisions: 64, - label: '$_floodMax', - onChanged: (v) { - setState(() => _floodMax = v.toInt()); - _markChanged(_SettingField.floodMax); - }, - ), - ], + IconButton( + icon: _refreshingFloodMax + ? const SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : const Icon(Icons.refresh, size: 20), + onPressed: _refreshingFloodMax ? null : _refreshFloodMax, + tooltip: l10n.repeater_floodMax, + visualDensity: VisualDensity.compact, + ), + ], + ), + Slider( + value: _floodMax.toDouble(), + min: 0, + max: 64, + divisions: 64, + label: '$_floodMax', + onChanged: (v) { + setState(() => _floodMax = v.toInt()); + _markChanged(_SettingField.floodMax); + }, + ), + ], + ), ), - ), + ], ); } Widget _buildNetworkHealthCard() { final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildSectionHeader( - icon: Icons.health_and_safety, - title: l10n.repeater_networkHealth, - ), - const Divider(), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: DropdownButtonFormField( - initialValue: _loopDetect, - decoration: InputDecoration( - labelText: l10n.repeater_loopDetect, - helperText: l10n.repeater_loopDetectHelper, - helperMaxLines: 3, - border: const OutlineInputBorder(), + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SectionHeader(l10n.repeater_networkHealth), + MeshCard( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: DropdownButtonFormField( + initialValue: _loopDetect, + decoration: InputDecoration( + labelText: l10n.repeater_loopDetect, + helperText: l10n.repeater_loopDetectHelper, + helperMaxLines: 3, + ), + items: [ + DropdownMenuItem( + value: 'off', + child: Text(l10n.repeater_loopDetectOff), + ), + DropdownMenuItem( + value: 'minimal', + child: Text(l10n.repeater_loopDetectMinimal), + ), + DropdownMenuItem( + value: 'moderate', + child: Text(l10n.repeater_loopDetectModerate), + ), + DropdownMenuItem( + value: 'strict', + child: Text(l10n.repeater_loopDetectStrict), + ), + ], + onChanged: (v) { + if (v != null) { + setState(() => _loopDetect = v); + _markChanged(_SettingField.loopDetect); + } + }, ), - items: [ - DropdownMenuItem( - value: 'off', - child: Text(l10n.repeater_loopDetectOff), - ), - DropdownMenuItem( - value: 'minimal', - child: Text(l10n.repeater_loopDetectMinimal), - ), - DropdownMenuItem( - value: 'moderate', - child: Text(l10n.repeater_loopDetectModerate), - ), - DropdownMenuItem( - value: 'strict', - child: Text(l10n.repeater_loopDetectStrict), - ), - ], - onChanged: (v) { - if (v != null) { - setState(() => _loopDetect = v); - _markChanged(_SettingField.loopDetect); - } - }, ), - ), - const SizedBox(width: 8), - _buildInlineRefreshButton( - isRefreshing: _refreshingLoopDetect, - onRefresh: _refreshLoopDetect, - tooltip: l10n.repeater_loopDetect, - ), - ], - ), - const SizedBox(height: 16), - Row( - children: [ - Expanded( - child: ListTile( - title: Text(l10n.repeater_dutyCycle), - subtitle: Text(l10n.repeater_dutyCycleHelper), - trailing: Text( - l10n.repeater_dutyCyclePercent(_dutyCycle), - style: const TextStyle(fontWeight: FontWeight.bold), + _buildInlineRefreshButton( + isRefreshing: _refreshingLoopDetect, + onRefresh: _refreshLoopDetect, + tooltip: l10n.repeater_loopDetect, + ), + ], + ), + const SizedBox(height: 12), + Row( + children: [ + Expanded( + child: ListTile( + title: Text(l10n.repeater_dutyCycle), + subtitle: Text(l10n.repeater_dutyCycleHelper), + trailing: Text( + l10n.repeater_dutyCyclePercent(_dutyCycle), + style: const TextStyle(fontWeight: FontWeight.bold), + ), + contentPadding: EdgeInsets.zero, ), - contentPadding: EdgeInsets.zero, ), - ), - IconButton( - icon: _refreshingDutyCycle - ? const SizedBox( - width: 18, - height: 18, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.refresh, size: 20), - onPressed: _refreshingDutyCycle ? null : _refreshDutyCycle, - tooltip: l10n.repeater_dutyCycle, - visualDensity: VisualDensity.compact, - ), - ], - ), - Slider( - value: _dutyCycle.toDouble(), - min: 1, - max: 100, - divisions: 99, - label: l10n.repeater_dutyCyclePercent(_dutyCycle), - onChanged: (v) { - setState(() => _dutyCycle = v.toInt()); - _markChanged(_SettingField.dutyCycle); - }, - ), - ], + IconButton( + icon: _refreshingDutyCycle + ? const SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : const Icon(Icons.refresh, size: 20), + onPressed: _refreshingDutyCycle ? null : _refreshDutyCycle, + tooltip: l10n.repeater_dutyCycle, + visualDensity: VisualDensity.compact, + ), + ], + ), + Slider( + value: _dutyCycle.toDouble(), + min: 1, + max: 100, + divisions: 99, + label: l10n.repeater_dutyCyclePercent(_dutyCycle), + onChanged: (v) { + setState(() => _dutyCycle = v.toInt()); + _markChanged(_SettingField.dutyCycle); + }, + ), + ], + ), ), - ), + ], ); } Widget _buildOwnerInfoCard() { final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildSectionHeader( - icon: Icons.person_outline, - title: l10n.repeater_ownerInfo, - tooltip: l10n.repeater_refreshOwnerInfo, - isRefreshing: _refreshingOwnerInfo, - onRefresh: _refreshOwnerInfo, + final refreshButton = _refreshingOwnerInfo + ? const SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : IconButton( + icon: const Icon(Icons.refresh, size: 18), + onPressed: _refreshOwnerInfo, + tooltip: l10n.repeater_refreshOwnerInfo, + visualDensity: VisualDensity.compact, + padding: EdgeInsets.zero, + ); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SectionHeader(l10n.repeater_ownerInfo, trailing: refreshButton), + MeshCard( + child: TextField( + controller: _ownerInfoController, + decoration: InputDecoration( + labelText: l10n.repeater_ownerInfo, + helperText: l10n.repeater_ownerInfoHelper, + helperMaxLines: 3, ), - const Divider(), - TextField( - controller: _ownerInfoController, - decoration: InputDecoration( - labelText: l10n.repeater_ownerInfo, - helperText: l10n.repeater_ownerInfoHelper, - helperMaxLines: 3, - border: const OutlineInputBorder(), - ), - maxLines: 4, - minLines: 2, - onChanged: (_) => _markChanged(_SettingField.ownerInfo), - ), - ], + maxLines: 4, + minLines: 2, + onChanged: (_) => _markChanged(_SettingField.ownerInfo), + ), ), - ), + ], ); } Widget _buildActionsCard() { final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Icon( - Icons.flash_on, - color: Theme.of(context).textTheme.headlineSmall?.color, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_actionsTitle, - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - const Divider(), - ListTile( - leading: const Icon(Icons.podcasts), - title: Text(l10n.repeater_sendAdvert), - subtitle: Text(l10n.repeater_sendAdvertSubtitle), - enabled: !_runningAction, - onTap: _runningAction - ? null - : () => _runAction('advert', l10n.repeater_sendAdvert), - contentPadding: EdgeInsets.zero, - ), - ListTile( - leading: const Icon(Icons.cell_tower), - title: Text(l10n.repeater_sendAdvertZeroHop), - subtitle: Text(l10n.repeater_sendAdvertZeroHopSubtitle), - enabled: !_runningAction, - onTap: _runningAction - ? null - : () => _runAction( - 'advert.zerohop', - l10n.repeater_sendAdvertZeroHop, - ), - contentPadding: EdgeInsets.zero, - ), - ListTile( - leading: const Icon(Icons.access_time), - title: Text(l10n.repeater_clockSync), - subtitle: Text(l10n.repeater_clockSyncSubtitle), - enabled: !_runningAction, - onTap: _runningAction - ? null - : () => _runAction('clock sync', l10n.repeater_clockSync), - contentPadding: EdgeInsets.zero, - ), - ], + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SectionHeader(l10n.repeater_actionsTitle), + MeshCard( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ListTile( + leading: const Icon(Icons.podcasts), + title: Text(l10n.repeater_sendAdvert), + subtitle: Text(l10n.repeater_sendAdvertSubtitle), + enabled: !_runningAction, + onTap: _runningAction + ? null + : () => _runAction('advert', l10n.repeater_sendAdvert), + contentPadding: EdgeInsets.zero, + ), + ListTile( + leading: const Icon(Icons.cell_tower), + title: Text(l10n.repeater_sendAdvertZeroHop), + subtitle: Text(l10n.repeater_sendAdvertZeroHopSubtitle), + enabled: !_runningAction, + onTap: _runningAction + ? null + : () => _runAction( + 'advert.zerohop', + l10n.repeater_sendAdvertZeroHop, + ), + contentPadding: EdgeInsets.zero, + ), + ListTile( + leading: const Icon(Icons.access_time), + title: Text(l10n.repeater_clockSync), + subtitle: Text(l10n.repeater_clockSyncSubtitle), + enabled: !_runningAction, + onTap: _runningAction + ? null + : () => _runAction('clock sync', l10n.repeater_clockSync), + contentPadding: EdgeInsets.zero, + ), + ], + ), ), - ), + ], ); } Widget _buildAdvancedCard() { final l10n = context.l10n; - return Card( + return MeshCard( child: ExpansionTile( leading: const Icon(Icons.tune), title: Text( l10n.repeater_advancedSettings, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w600), ), subtitle: Text(l10n.repeater_advancedSettingsSubtitle), - childrenPadding: const EdgeInsets.fromLTRB(16, 12, 16, 16), + childrenPadding: const EdgeInsets.fromLTRB(0, 8, 0, 4), children: [ Row( crossAxisAlignment: CrossAxisAlignment.start, @@ -1955,7 +1841,6 @@ class _RepeaterSettingsScreenState extends State { labelText: l10n.repeater_pathHashMode, helperText: l10n.repeater_pathHashModeHelper, helperMaxLines: 5, - border: const OutlineInputBorder(), ), items: const [ DropdownMenuItem(value: 0, child: Text('0')), @@ -1970,7 +1855,6 @@ class _RepeaterSettingsScreenState extends State { }, ), ), - const SizedBox(width: 8), _buildInlineRefreshButton( isRefreshing: _refreshingPathHashMode, onRefresh: _refreshPathHashMode, @@ -1978,7 +1862,7 @@ class _RepeaterSettingsScreenState extends State { ), ], ), - const SizedBox(height: 16), + const SizedBox(height: 12), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -1989,7 +1873,6 @@ class _RepeaterSettingsScreenState extends State { labelText: l10n.repeater_txDelay, helperText: l10n.repeater_txDelayHelper, helperMaxLines: 3, - border: const OutlineInputBorder(), ), keyboardType: const TextInputType.numberWithOptions( decimal: true, @@ -1997,7 +1880,6 @@ class _RepeaterSettingsScreenState extends State { onChanged: (_) => _markChanged(_SettingField.txDelay), ), ), - const SizedBox(width: 8), _buildInlineRefreshButton( isRefreshing: _refreshingTxDelay, onRefresh: _refreshTxDelay, @@ -2005,7 +1887,7 @@ class _RepeaterSettingsScreenState extends State { ), ], ), - const SizedBox(height: 16), + const SizedBox(height: 12), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -2016,7 +1898,6 @@ class _RepeaterSettingsScreenState extends State { labelText: l10n.repeater_directTxDelay, helperText: l10n.repeater_directTxDelayHelper, helperMaxLines: 3, - border: const OutlineInputBorder(), ), keyboardType: const TextInputType.numberWithOptions( decimal: true, @@ -2024,7 +1905,6 @@ class _RepeaterSettingsScreenState extends State { onChanged: (_) => _markChanged(_SettingField.directTxDelay), ), ), - const SizedBox(width: 8), _buildInlineRefreshButton( isRefreshing: _refreshingDirectTxDelay, onRefresh: _refreshDirectTxDelay, @@ -2032,7 +1912,7 @@ class _RepeaterSettingsScreenState extends State { ), ], ), - const SizedBox(height: 16), + const SizedBox(height: 12), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -2043,13 +1923,11 @@ class _RepeaterSettingsScreenState extends State { labelText: l10n.repeater_intThresh, helperText: l10n.repeater_intThreshHelper, helperMaxLines: 3, - border: const OutlineInputBorder(), ), keyboardType: TextInputType.number, onChanged: (_) => _markChanged(_SettingField.intThresh), ), ), - const SizedBox(width: 8), _buildInlineRefreshButton( isRefreshing: _refreshingIntThresh, onRefresh: _refreshIntThresh, @@ -2057,7 +1935,7 @@ class _RepeaterSettingsScreenState extends State { ), ], ), - const SizedBox(height: 16), + const SizedBox(height: 12), Row( children: [ Expanded( @@ -2108,85 +1986,65 @@ class _RepeaterSettingsScreenState extends State { Widget _buildDangerZoneCard() { final l10n = context.l10n; - final colorScheme = Theme.of(context).colorScheme; - return Card( - color: colorScheme.errorContainer, - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Icon(Icons.warning, color: colorScheme.onErrorContainer), - const SizedBox(width: 8), - Text( - l10n.repeater_dangerZone, - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - color: colorScheme.onErrorContainer, - ), - ), - ], - ), - const Divider(), - ListTile( - leading: Icon(Icons.refresh, color: colorScheme.onErrorContainer), - title: Text( - l10n.repeater_rebootRepeater, - style: TextStyle(color: colorScheme.onErrorContainer), - ), - subtitle: Text( - l10n.repeater_rebootRepeaterSubtitle, - style: TextStyle( - color: colorScheme.onErrorContainer.withValues(alpha: 0.8), + return MeshCard( + color: MeshPalette.alertBg, + borderColor: MeshPalette.alertLine, + margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + const Icon(Icons.warning, color: MeshPalette.alert), + const SizedBox(width: 8), + Text( + l10n.repeater_dangerZone, + style: const TextStyle( + fontSize: 15, + fontWeight: FontWeight.w700, + color: MeshPalette.alert, ), ), - onTap: () => _confirmAction( - l10n.repeater_rebootRepeater, - l10n.repeater_rebootRepeaterConfirm, - () => _sendDangerCommand('reboot'), - ), + ], + ), + const Divider(height: 20, color: MeshPalette.alertLine), + ListTile( + leading: const Icon(Icons.refresh, color: MeshPalette.alert), + title: Text( + l10n.repeater_rebootRepeater, + style: const TextStyle(color: MeshPalette.alert), ), - // Regenerate identity key - hidden until fully implemented - // ListTile( - // leading: Icon(Icons.vpn_key, color: colorScheme.onErrorContainer), - // title: Text('Regenerate Identity Key', style: TextStyle(color: colorScheme.onErrorContainer)), - // subtitle: Text( - // 'Generate new public/private key pair', - // style: TextStyle(color: colorScheme.onErrorContainer.withValues(alpha: 0.8)), - // ), - // onTap: () => _confirmAction( - // 'Regenerate Identity', - // 'This will generate a new identity for the repeater. Continue?', - // () => _sendDangerCommand('regen key'), - // ), - // ), - ListTile( - leading: Icon( - Icons.delete_forever, - color: colorScheme.onErrorContainer, - ), - title: Text( - l10n.repeater_eraseFileSystem, - style: TextStyle(color: colorScheme.onErrorContainer), - ), - subtitle: Text( - l10n.repeater_eraseFileSystemSubtitle, - style: TextStyle( - color: colorScheme.onErrorContainer.withValues(alpha: 0.8), - ), - ), - onTap: () => _confirmAction( - l10n.repeater_eraseFileSystem, - l10n.repeater_eraseFileSystemConfirm, - () => _sendDangerCommand('erase'), - isDestructive: true, - ), + subtitle: Text( + l10n.repeater_rebootRepeaterSubtitle, + style: const TextStyle(color: MeshPalette.warnDim), ), - ], - ), + onTap: () => _confirmAction( + l10n.repeater_rebootRepeater, + l10n.repeater_rebootRepeaterConfirm, + () => _sendDangerCommand('reboot'), + ), + contentPadding: EdgeInsets.zero, + ), + // Regenerate identity key - hidden until fully implemented + ListTile( + leading: const Icon(Icons.delete_forever, color: MeshPalette.alert), + title: Text( + l10n.repeater_eraseFileSystem, + style: const TextStyle(color: MeshPalette.alert), + ), + subtitle: Text( + l10n.repeater_eraseFileSystemSubtitle, + style: const TextStyle(color: MeshPalette.warnDim), + ), + onTap: () => _confirmAction( + l10n.repeater_eraseFileSystem, + l10n.repeater_eraseFileSystemConfirm, + () => _sendDangerCommand('erase'), + isDestructive: true, + ), + contentPadding: EdgeInsets.zero, + ), + ], ), ); } @@ -2233,7 +2091,7 @@ class _RepeaterSettingsScreenState extends State { showDismissibleSnackBar( context, content: Text(l10n.repeater_errorSendingCommand(e.toString())), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); } } @@ -2262,7 +2120,9 @@ class _RepeaterSettingsScreenState extends State { onConfirm(); }, style: isDestructive - ? FilledButton.styleFrom(backgroundColor: Colors.red) + ? FilledButton.styleFrom( + backgroundColor: Theme.of(context).colorScheme.error, + ) : null, child: Text(l10n.repeater_confirm), ), diff --git a/lib/screens/repeater_status_screen.dart b/lib/screens/repeater_status_screen.dart index 9dbd8e31..42c97fa5 100644 --- a/lib/screens/repeater_status_screen.dart +++ b/lib/screens/repeater_status_screen.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:convert'; import 'dart:typed_data'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; import '../l10n/l10n.dart'; import '../models/contact.dart'; @@ -10,8 +11,10 @@ import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; import '../services/app_settings_service.dart'; import '../services/repeater_command_service.dart'; +import '../theme/mesh_theme.dart'; import '../utils/battery_utils.dart'; -import '../widgets/path_management_dialog.dart'; +import '../widgets/mesh_ui.dart'; +import '../widgets/routing_sheet.dart'; import '../helpers/snack_bar_builder.dart'; class RepeaterStatusScreen extends StatefulWidget { @@ -64,8 +67,6 @@ class _RepeaterStatusScreenState extends State { final connector = Provider.of(context, listen: false); _commandService = RepeaterCommandService(connector); _setupMessageListener(); - // Defer until after the first frame so any notifyListeners() triggered - // during preparePathForContactSend doesn't fire mid-build. WidgetsBinding.instance.addPostFrameCallback((_) { if (mounted) _loadStatus(); }); @@ -81,12 +82,8 @@ class _RepeaterStatusScreenState extends State { void _setupMessageListener() { final connector = Provider.of(context, listen: false); - - // Listen for incoming text messages from the repeater _frameSubscription = connector.receivedFrames.listen((frame) { if (frame.isEmpty) return; - - // Check if it's a text message response if (frame[0] == pushCodeStatusResponse) { _handleStatusResponse(frame); } else if (frame[0] == respCodeContactMsgRecv || @@ -118,11 +115,7 @@ class _RepeaterStatusScreenState extends State { final parsed = parseContactMessageText(frame); if (parsed == null) return; if (!_matchesRepeaterPrefix(parsed.senderPrefix)) return; - - // Notify command service of response (for retry handling) _commandService?.handleResponse(widget.repeater, parsed.text); - - // Parse status responses _parseStatusResponse(parsed.text); _recordStatusResult(true); } @@ -131,7 +124,6 @@ class _RepeaterStatusScreenState extends State { if (frame.length < 8) return; final prefix = frame.sublist(2, 8); if (!_matchesRepeaterPrefix(prefix)) return; - if (frame.length < _statusResponseBytes) return; final data = ByteData.sublistView( @@ -254,14 +246,9 @@ class _RepeaterStatusScreenState extends State { _dupFlood = _asInt(data['dup_flood']); _dupDirect = _asInt(data['dup_direct']); } - } catch (_) { - // Ignore parse failures for non-JSON responses. - } - } - - if (mounted) { - setState(() {}); + } catch (_) {} } + if (mounted) setState(() {}); } Future _loadStatus() async { @@ -302,9 +289,7 @@ class _RepeaterStatusScreenState extends State { var messageBytes = frame.length >= _statusResponseBytes ? frame.length : _statusResponseBytes; - if (messageBytes < maxFrameSize) { - messageBytes = maxFrameSize; - } + if (messageBytes < maxFrameSize) messageBytes = maxFrameSize; final timeoutMs = connector.calculateTimeout( pathLength: pathLengthValue, messageBytes: messageBytes, @@ -312,26 +297,21 @@ class _RepeaterStatusScreenState extends State { _statusTimeout?.cancel(); _statusTimeout = Timer(Duration(milliseconds: timeoutMs), () { if (!mounted) return; - setState(() { - _isLoading = false; - }); + setState(() => _isLoading = false); showDismissibleSnackBar( context, content: Text(context.l10n.repeater_statusRequestTimeout), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); _recordStatusResult(false); }); } catch (e) { if (mounted) { - setState(() { - _isLoading = false; - }); - + setState(() => _isLoading = false); showDismissibleSnackBar( context, content: Text(context.l10n.repeater_errorLoadingStatus(e.toString())), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); } _recordStatusResult(false); @@ -347,268 +327,6 @@ class _RepeaterStatusScreenState extends State { _pendingStatusSelection = null; } - @override - Widget build(BuildContext context) { - final l10n = context.l10n; - final connector = context.watch(); - final repeater = _resolveRepeater(connector); - final isFloodMode = repeater.pathOverride == -1; - - return Scaffold( - appBar: AppBar( - title: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text(l10n.repeater_statusTitle), - Text( - repeater.name, - style: const TextStyle( - fontSize: 14, - fontWeight: FontWeight.normal, - ), - ), - ], - ), - centerTitle: false, - actions: [ - PopupMenuButton( - icon: Icon(isFloodMode ? Icons.waves : Icons.route), - tooltip: l10n.repeater_routingMode, - onSelected: (mode) async { - if (mode == 'flood') { - await connector.setPathOverride(repeater, pathLen: -1); - } else { - await connector.setPathOverride(repeater, pathLen: null); - } - }, - itemBuilder: (context) => [ - PopupMenuItem( - value: 'auto', - child: Row( - children: [ - Icon( - Icons.auto_mode, - size: 20, - color: !isFloodMode - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_autoUseSavedPath, - style: TextStyle( - fontWeight: !isFloodMode - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - PopupMenuItem( - value: 'flood', - child: Row( - children: [ - Icon( - Icons.waves, - size: 20, - color: isFloodMode - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_forceFloodMode, - style: TextStyle( - fontWeight: isFloodMode - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - ], - ), - IconButton( - icon: const Icon(Icons.timeline), - tooltip: l10n.repeater_pathManagement, - onPressed: () => - PathManagementDialog.show(context, contact: repeater), - ), - IconButton( - icon: _isLoading - ? const SizedBox( - width: 20, - height: 20, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.refresh), - onPressed: _isLoading ? null : _loadStatus, - tooltip: l10n.repeater_refresh, - ), - ], - ), - body: SafeArea( - top: false, - child: RefreshIndicator( - onRefresh: _loadStatus, - child: ListView( - padding: const EdgeInsets.all(16), - children: [ - _buildSystemInfoCard(), - const SizedBox(height: 16), - _buildRadioStatsCard(), - const SizedBox(height: 16), - _buildPacketStatsCard(), - ], - ), - ), - ), - ); - } - - Widget _buildSystemInfoCard() { - final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Icon( - Icons.info_outline, - color: Theme.of(context).textTheme.headlineSmall?.color, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_systemInformation, - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - const Divider(), - _buildInfoRow(l10n.repeater_battery, _batteryText()), - _buildInfoRow(l10n.repeater_clockAtLogin, _clockText()), - _buildInfoRow(l10n.repeater_uptime, _formatDuration(_uptimeSecs)), - _buildInfoRow(l10n.repeater_queueLength, _formatValue(_queueLen)), - _buildInfoRow(l10n.repeater_debugFlags, _formatValue(_debugFlags)), - ], - ), - ), - ); - } - - Widget _buildRadioStatsCard() { - final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Icon( - Icons.radio, - color: Theme.of(context).textTheme.headlineSmall?.color, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_radioStatistics, - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - const Divider(), - _buildInfoRow( - l10n.repeater_lastRssi, - _formatValue(_lastRssi, suffix: ' dB'), - ), - _buildInfoRow(l10n.repeater_lastSnr, _formatSnr(_lastSnr)), - _buildInfoRow( - l10n.repeater_noiseFloor, - _formatValue(_noiseFloor, suffix: ' dB'), - ), - _buildInfoRow(l10n.repeater_txAirtime, _formatDuration(_txAirSecs)), - _buildInfoRow(l10n.repeater_rxAirtime, _formatDuration(_rxAirSecs)), - ], - ), - ), - ); - } - - Widget _buildPacketStatsCard() { - final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Icon( - Icons.analytics, - color: Theme.of(context).textTheme.headlineSmall?.color, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_packetStatistics, - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - const Divider(), - _buildInfoRow(l10n.repeater_sent, _packetTxText()), - _buildInfoRow(l10n.repeater_received, _packetRxText()), - _buildInfoRow(l10n.repeater_duplicates, _duplicateText()), - _buildInfoRow(l10n.repeater_chanUtil, _chanUtilText()), - ], - ), - ), - ); - } - - Widget _buildInfoRow(String label, String value) { - return Padding( - padding: const EdgeInsets.symmetric(vertical: 6), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - width: 130, - child: Text( - label, - style: TextStyle( - color: Colors.grey[600], - fontWeight: FontWeight.w500, - ), - ), - ), - Expanded( - child: Text( - value, - style: const TextStyle(fontWeight: FontWeight.w400), - ), - ), - ], - ), - ); - } - int? _asInt(dynamic value) { if (value == null) return null; if (value is int) return value; @@ -715,4 +433,221 @@ class _RepeaterStatusScreenState extends State { if (snr == null) return '—'; return snr.toStringAsFixed(2); } + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + final connector = context.watch(); + final repeater = _resolveRepeater(connector); + final isFloodMode = repeater.pathOverride == -1; + + return Scaffold( + appBar: AppBar( + title: Text(l10n.repeater_statusTitle), + centerTitle: true, + actions: [ + IconButton( + icon: Icon(isFloodMode ? Icons.waves : Icons.route), + tooltip: l10n.repeater_routingMode, + onPressed: () => + ContactRoutingSheet.show(context, contact: repeater), + ), + IconButton( + icon: _isLoading + ? const SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : const Icon(Icons.refresh), + onPressed: _isLoading ? null : _loadStatus, + tooltip: l10n.repeater_refresh, + ), + ], + ), + body: SafeArea( + top: false, + child: RefreshIndicator( + onRefresh: _loadStatus, + child: _isLoading && _batteryMv == null + ? const Center(child: CircularProgressIndicator()) + : _buildBody(l10n, repeater.name), + ), + ), + ); + } + + Widget _buildBody(dynamic l10n, String name) { + final scheme = Theme.of(context).colorScheme; + return ListView( + padding: const EdgeInsets.only(bottom: 24), + children: [ + // ── System ───────────────────────────────────────────────────────── + SectionHeader(l10n.repeater_systemInformation), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: _buildStatGrid([ + _StatItem( + icon: Icons.battery_std, + label: l10n.repeater_battery, + value: _batteryText(), + color: _batteryColor(), + ), + _StatItem( + icon: Icons.timer_outlined, + label: l10n.repeater_uptime, + value: _formatDuration(_uptimeSecs), + color: MeshPalette.blue, + ), + _StatItem( + icon: Icons.schedule, + label: l10n.repeater_clockAtLogin, + value: _clockText(), + color: scheme.onSurfaceVariant, + ), + _StatItem( + icon: Icons.inbox, + label: l10n.repeater_queueLength, + value: _formatValue(_queueLen), + color: scheme.onSurfaceVariant, + ), + _StatItem( + icon: Icons.bug_report_outlined, + label: l10n.repeater_debugFlags, + value: _formatValue(_debugFlags), + color: _debugFlags != null && _debugFlags! > 0 + ? MeshPalette.warn + : scheme.onSurfaceVariant, + ), + ]), + ), + + // ── Radio ────────────────────────────────────────────────────────── + SectionHeader(l10n.repeater_radioStatistics), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: _buildStatGrid([ + _StatItem( + icon: Icons.signal_cellular_alt, + label: l10n.repeater_lastRssi, + value: _formatValue(_lastRssi, suffix: ' dB'), + color: MeshPalette.blue, + ), + _StatItem( + icon: Icons.waves, + label: l10n.repeater_lastSnr, + value: _formatSnr(_lastSnr), + color: MeshTheme.snrColor(_lastSnr, blocked: false), + ), + _StatItem( + icon: Icons.noise_control_off, + label: l10n.repeater_noiseFloor, + value: _formatValue(_noiseFloor, suffix: ' dB'), + color: scheme.onSurfaceVariant, + ), + _StatItem( + icon: Icons.upload, + label: l10n.repeater_txAirtime, + value: _formatDuration(_txAirSecs), + color: MeshPalette.warn, + ), + _StatItem( + icon: Icons.download, + label: l10n.repeater_rxAirtime, + value: _formatDuration(_rxAirSecs), + color: MeshPalette.signal, + ), + ]), + ), + + // ── Packets ──────────────────────────────────────────────────────── + SectionHeader(l10n.repeater_packetStatistics), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: _buildStatGrid([ + _StatItem( + icon: Icons.send, + label: l10n.repeater_sent, + value: _packetTxText(), + color: MeshPalette.blue, + ), + _StatItem( + icon: Icons.call_received, + label: l10n.repeater_received, + value: _packetRxText(), + color: MeshPalette.signal, + ), + _StatItem( + icon: Icons.content_copy, + label: l10n.repeater_duplicates, + value: _duplicateText(), + color: scheme.onSurfaceVariant, + ), + _StatItem( + icon: Icons.percent, + label: l10n.repeater_chanUtil, + value: _chanUtilText(), + color: _chanUtil != null && _chanUtil! > 80 + ? MeshPalette.alert + : _chanUtil != null && _chanUtil! > 50 + ? MeshPalette.warn + : MeshPalette.signal, + ), + ]), + ), + const SizedBox(height: 8), + ], + ); + } + + Color _batteryColor() { + final connector = context.watch(); + final batteryMv = + connector.getRepeaterBatteryMillivolts(widget.repeater.publicKeyHex) ?? + _batteryMv; + if (batteryMv == null) + return Theme.of(context).colorScheme.onSurfaceVariant; + final percent = estimateBatteryPercentFromMillivolts( + batteryMv, + _batteryChemistry(), + ); + if (percent < 20) return MeshPalette.alert; + if (percent < 40) return MeshPalette.warn; + return MeshPalette.signal; + } + + Widget _buildStatGrid(List<_StatItem> items) { + return GridView.count( + crossAxisCount: 2, + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + mainAxisSpacing: 8, + crossAxisSpacing: 8, + childAspectRatio: 2.2, + children: items + .map( + (item) => StatTile( + icon: item.icon, + label: item.label, + value: item.value, + color: item.color, + ), + ) + .toList(), + ); + } +} + +class _StatItem { + final IconData icon; + final String label; + final String value; + final Color color; + + const _StatItem({ + required this.icon, + required this.label, + required this.value, + required this.color, + }); } diff --git a/lib/screens/scanner_screen.dart b/lib/screens/scanner_screen.dart index a503ec0e..a8c83723 100644 --- a/lib/screens/scanner_screen.dart +++ b/lib/screens/scanner_screen.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import '../utils/platform_info.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:provider/provider.dart'; @@ -7,11 +8,14 @@ import 'package:provider/provider.dart'; import '../connector/meshcore_connector.dart'; import '../l10n/l10n.dart'; import '../services/linux_ble_error_classifier.dart'; +import '../theme/mesh_theme.dart'; import '../utils/app_logger.dart'; import '../widgets/adaptive_app_bar_title.dart'; import '../widgets/device_tile.dart'; +import '../widgets/empty_state.dart'; +import '../widgets/mesh_ui.dart'; import '../helpers/snack_bar_builder.dart'; -import 'contacts_screen.dart'; +import 'channels_screen.dart'; import 'tcp_screen.dart'; import 'usb_screen.dart'; @@ -25,6 +29,7 @@ class ScannerScreen extends StatefulWidget { class _ScannerScreenState extends State { bool _changedNavigation = false; + String? _connectingDeviceId; late final MeshCoreConnector _connector; late final VoidCallback _connectionListener; BluetoothAdapterState _bluetoothState = BluetoothAdapterState.unknown; @@ -46,7 +51,7 @@ class _ScannerScreenState extends State { _changedNavigation = true; if (mounted) { Navigator.of(context).push( - MaterialPageRoute(builder: (context) => const ContactsScreen()), + MaterialPageRoute(builder: (context) => const ChannelsScreen()), ); } } @@ -101,6 +106,32 @@ class _ScannerScreenState extends State { title: AdaptiveAppBarTitle(context.l10n.scanner_title), centerTitle: true, automaticallyImplyLeading: false, + actions: [ + if (PlatformInfo.supportsUsbSerial) + IconButton( + icon: const Icon(Icons.usb), + tooltip: context.l10n.connectionChoiceUsbLabel, + onPressed: () { + appLogger.info( + 'USB selected, opening UsbScreen', + tag: 'ScannerScreen', + ); + Navigator.of( + context, + ).push(MaterialPageRoute(builder: (_) => const UsbScreen())); + }, + ), + if (!PlatformInfo.isWeb) + IconButton( + icon: const Icon(Icons.lan), + tooltip: context.l10n.connectionChoiceTcpLabel, + onPressed: () { + Navigator.of( + context, + ).push(MaterialPageRoute(builder: (_) => const TcpScreen())); + }, + ), + ], ), body: SafeArea( top: false, @@ -108,12 +139,21 @@ class _ScannerScreenState extends State { builder: (context, connector, child) { return Column( children: [ - // Bluetooth off warning - if (_bluetoothState == BluetoothAdapterState.off) - _bluetoothOffWarning(context), + // Bluetooth off warning — slides in/out with AnimatedSize + AnimatedSize( + duration: const Duration(milliseconds: 250), + curve: Curves.easeInOut, + child: _bluetoothState == BluetoothAdapterState.off + ? _BluetoothOffBanner( + onEnable: PlatformInfo.isAndroid + ? () => FlutterBluePlus.turnOn() + : null, + ) + : const SizedBox.shrink(), + ), - // Status bar - _buildStatusBar(context, connector), + // Connection status header + _ConnectionStatusHeader(connector: connector), // Device list Expanded(child: _buildDeviceList(context, connector)), @@ -122,84 +162,43 @@ class _ScannerScreenState extends State { }, ), ), - bottomNavigationBar: Consumer( + floatingActionButton: Consumer( builder: (context, connector, child) { final isScanning = connector.state == MeshCoreConnectionState.scanning; final isBluetoothOff = _bluetoothState == BluetoothAdapterState.off; - final usbSupported = PlatformInfo.supportsUsbSerial; - final tcpSupported = !PlatformInfo.isWeb; - return SafeArea( - top: false, - minimum: const EdgeInsets.fromLTRB(16, 8, 16, 16), - child: FittedBox( - fit: BoxFit.scaleDown, - alignment: Alignment.centerRight, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - if (usbSupported) - FloatingActionButton.extended( - onPressed: () { - appLogger.info( - 'USB selected, opening UsbScreen', - tag: 'ScannerScreen', - ); - Navigator.of(context).push( - MaterialPageRoute(builder: (_) => const UsbScreen()), - ); - }, - heroTag: 'scanner_usb_action', - icon: const Icon(Icons.usb), - label: Text(context.l10n.connectionChoiceUsbLabel), + return FloatingActionButton.extended( + heroTag: 'scanner_ble_action', + onPressed: isBluetoothOff + ? null + : () { + HapticFeedback.lightImpact(); + _toggleScan(connector); + }, + icon: AnimatedSwitcher( + duration: const Duration(milliseconds: 220), + transitionBuilder: (child, anim) => + ScaleTransition(scale: anim, child: child), + child: isScanning + ? SizedBox( + key: const ValueKey('scanning'), + width: 20, + height: 20, + child: CircularProgressIndicator( + strokeWidth: 2, + color: Theme.of(context).colorScheme.onPrimary, + ), + ) + : const Icon( + Icons.bluetooth_searching, + key: ValueKey('idle'), ), - if (usbSupported) const SizedBox(width: 12), - if (tcpSupported) - FloatingActionButton.extended( - onPressed: () { - Navigator.of(context).push( - MaterialPageRoute(builder: (_) => const TcpScreen()), - ); - }, - heroTag: 'scanner_tcp_action', - icon: const Icon(Icons.lan), - label: Text(context.l10n.connectionChoiceTcpLabel), - ), - if (tcpSupported) const SizedBox(width: 12), - FloatingActionButton.extended( - heroTag: 'scanner_ble_action', - onPressed: isBluetoothOff - ? null - : () { - if (isScanning) { - connector.stopScan(); - } else { - unawaited( - connector.startScan().catchError((e) { - appLogger.warn( - 'startScan error: $e', - tag: 'ScannerScreen', - ); - }), - ); - } - }, - icon: isScanning - ? const SizedBox( - width: 20, - height: 20, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.bluetooth_searching), - label: Text( - isScanning - ? context.l10n.scanner_stop - : context.l10n.scanner_scan, - ), - ), - ], - ), + ), + label: Text( + isScanning + ? context.l10n.scanner_stop + : context.l10n.scanner_scan, ), ); }, @@ -207,79 +206,70 @@ class _ScannerScreenState extends State { ); } - Widget _buildStatusBar(BuildContext context, MeshCoreConnector connector) { - String statusText; - Color statusColor; - - final l10n = context.l10n; - switch (connector.state) { - case MeshCoreConnectionState.scanning: - statusText = l10n.scanner_scanning; - statusColor = Colors.blue; - break; - case MeshCoreConnectionState.connecting: - statusText = l10n.scanner_connecting; - statusColor = Colors.orange; - break; - case MeshCoreConnectionState.connected: - statusText = l10n.scanner_connectedTo(connector.deviceDisplayName); - statusColor = Colors.green; - break; - case MeshCoreConnectionState.disconnecting: - statusText = l10n.scanner_disconnecting; - statusColor = Colors.orange; - break; - case MeshCoreConnectionState.disconnected: - statusText = l10n.scanner_notConnected; - statusColor = Colors.grey; - break; + void _toggleScan(MeshCoreConnector connector) { + if (PlatformInfo.isWeb) { + // flutter_blue_plus has no web backend, so a BLE scan silently no-ops in + // the browser. Tell the user instead of leaving them staring at a button. + showDismissibleSnackBar( + context, + content: Text(context.l10n.scanner_bluetoothWebUnsupported), + ); + return; + } + if (connector.state == MeshCoreConnectionState.scanning) { + connector.stopScan(); + } else { + unawaited( + connector.startScan().catchError((e) { + appLogger.warn('startScan error: $e', tag: 'ScannerScreen'); + }), + ); } - - return Container( - width: double.infinity, - padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16), - color: statusColor.withValues(alpha: 0.1), - child: Row( - children: [ - Icon(Icons.circle, size: 12, color: statusColor), - const SizedBox(width: 8), - Text( - statusText, - style: TextStyle(color: statusColor, fontWeight: FontWeight.w500), - ), - ], - ), - ); } Widget _buildDeviceList(BuildContext context, MeshCoreConnector connector) { if (connector.scanResults.isEmpty) { - return Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon(Icons.bluetooth, size: 64, color: Colors.grey[400]), - const SizedBox(height: 16), - Text( - connector.state == MeshCoreConnectionState.scanning - ? context.l10n.scanner_searchingDevices - : context.l10n.scanner_tapToScan, - style: TextStyle(fontSize: 16, color: Colors.grey[600]), - ), - ], - ), + final isBluetoothOff = _bluetoothState == BluetoothAdapterState.off; + final isScanning = connector.state == MeshCoreConnectionState.scanning; + return EmptyState( + icon: isBluetoothOff ? Icons.bluetooth_disabled : Icons.bluetooth, + title: isBluetoothOff + ? context.l10n.scanner_bluetoothOff + : isScanning + ? context.l10n.scanner_searchingDevices + : context.l10n.scanner_tapToScan, + subtitle: isBluetoothOff + ? context.l10n.scanner_bluetoothOffMessage + : null, + action: (isBluetoothOff || isScanning) + ? null + : FilledButton.icon( + onPressed: () { + HapticFeedback.lightImpact(); + _toggleScan(connector); + }, + icon: const Icon(Icons.bluetooth_searching), + label: Text(context.l10n.scanner_scan), + ), ); } - return ListView.separated( - padding: const EdgeInsets.all(8), + final isConnecting = connector.state == MeshCoreConnectionState.connecting; + return ListView.builder( + padding: const EdgeInsets.fromLTRB(0, 8, 0, 96), itemCount: connector.scanResults.length, - separatorBuilder: (context, index) => const Divider(), itemBuilder: (context, index) { final result = connector.scanResults[index]; - return DeviceTile( - scanResult: result, - onTap: () => _connectToDevice(context, connector, result), + final deviceId = result.device.remoteId.toString(); + return ListEntrance( + index: index, + child: DeviceTile( + scanResult: result, + isConnecting: isConnecting && _connectingDeviceId == deviceId, + onTap: isConnecting + ? null + : () => _connectToDevice(context, connector, result), + ), ); }, ); @@ -293,6 +283,9 @@ class _ScannerScreenState extends State { final name = result.device.platformName.isNotEmpty ? result.device.platformName : result.advertisementData.advName; + setState(() { + _connectingDeviceId = result.device.remoteId.toString(); + }); try { await connector.connect( result.device, @@ -321,9 +314,15 @@ class _ScannerScreenState extends State { showDismissibleSnackBar( context, content: Text(context.l10n.scanner_connectionFailed(e.toString())), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); } + } finally { + if (mounted) { + setState(() { + _connectingDeviceId = null; + }); + } } } @@ -412,47 +411,113 @@ class _ScannerScreenState extends State { ); return pin; } +} - Widget _bluetoothOffWarning(BuildContext context) { - final errorColor = Theme.of(context).colorScheme.error; - return Container( - width: double.infinity, - padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), - color: errorColor.withValues(alpha: 0.15), +// ── Private sub-widgets ──────────────────────────────────────────────────── + +/// Bluetooth-off warning banner — styled as an alert MeshCard. +class _BluetoothOffBanner extends StatelessWidget { + final VoidCallback? onEnable; + + const _BluetoothOffBanner({this.onEnable}); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + return MeshCard( + color: scheme.error.withValues(alpha: 0.08), + borderColor: scheme.error.withValues(alpha: 0.35), + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12), child: Row( children: [ - Icon(Icons.bluetooth_disabled, size: 24, color: errorColor), - const SizedBox(width: 12), + Icon(Icons.bluetooth_disabled, size: 20, color: scheme.error), + const SizedBox(width: 10), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ Text( context.l10n.scanner_bluetoothOff, style: TextStyle( - color: errorColor, + color: scheme.error, fontWeight: FontWeight.w600, - fontSize: 14, + fontSize: 13.5, ), ), - const SizedBox(height: 4), + const SizedBox(height: 2), Text( context.l10n.scanner_bluetoothOffMessage, style: TextStyle( - color: errorColor.withValues(alpha: 0.85), + color: scheme.error.withValues(alpha: 0.8), fontSize: 12, ), ), ], ), ), - if (PlatformInfo.isAndroid) + if (onEnable != null) ...[ + const SizedBox(width: 8), TextButton( - onPressed: () => FlutterBluePlus.turnOn(), + onPressed: onEnable, child: Text(context.l10n.scanner_enableBluetooth), ), + ], ], ), ); } } + +/// Connection status header with AnimatedSwitcher between states. +class _ConnectionStatusHeader extends StatelessWidget { + final MeshCoreConnector connector; + + const _ConnectionStatusHeader({required this.connector}); + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; + + final (String label, Color color, bool pulse) = switch (connector.state) { + MeshCoreConnectionState.scanning => ( + l10n.scanner_scanning, + MeshPalette.blue, + true, + ), + MeshCoreConnectionState.connecting => ( + l10n.scanner_connecting, + MeshPalette.warn, + true, + ), + MeshCoreConnectionState.connected => ( + l10n.scanner_connectedTo(connector.deviceDisplayName), + MeshPalette.signal, + false, + ), + MeshCoreConnectionState.disconnecting => ( + l10n.scanner_disconnecting, + MeshPalette.warn, + true, + ), + MeshCoreConnectionState.disconnected => ( + l10n.scanner_notConnected, + scheme.onSurfaceVariant, + false, + ), + }; + + return Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 4), + child: AnimatedSwitcher( + duration: const Duration(milliseconds: 300), + child: Align( + key: ValueKey(connector.state), + alignment: Alignment.centerLeft, + child: StatusChip(label: label, color: color, pulse: pulse), + ), + ), + ); + } +} diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart index 5679f757..ef7ae08e 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/screens/settings_screen.dart @@ -10,12 +10,15 @@ import '../connector/meshcore_protocol.dart'; import '../l10n/l10n.dart'; import '../models/radio_settings.dart'; import '../services/app_debug_log_service.dart'; +import '../theme/mesh_theme.dart'; import '../widgets/app_bar.dart'; import '../helpers/snack_bar_builder.dart'; +import '../widgets/mesh_ui.dart'; import 'app_settings_screen.dart'; import 'app_debug_log_screen.dart'; import 'ble_debug_log_screen.dart'; import '../widgets/radio_stats_entry.dart'; +import '../widgets/sync_progress_overlay.dart'; /// Convert device coding-rate value (1-4 on some firmware, 5-8 on others) /// to the UI enum range (always 5-8). @@ -52,6 +55,7 @@ class _SettingsScreenState extends State { Future _loadVersionInfo() async { final packageInfo = await PackageInfo.fromPlatform(); + if (!mounted) return; setState(() { _appVersion = packageInfo.version; }); @@ -67,27 +71,89 @@ class _SettingsScreenState extends State { indicators: false, subtitle: false, ), + centerTitle: true, + bottom: const SyncProgressAppBarBottom(), ), body: SafeArea( top: false, child: Consumer( builder: (context, connector, child) { return ListView( - padding: const EdgeInsets.all(16), + padding: const EdgeInsets.fromLTRB(0, 8, 0, 24), children: [ - _buildDeviceInfoCard(context, connector), - const SizedBox(height: 16), - _buildAppSettingsCard(context), - const SizedBox(height: 16), - _buildNodeSettingsCard(context, connector), - const SizedBox(height: 16), - _buildActionsCard(context, connector), - const SizedBox(height: 16), - _buildDebugCard(context), - const SizedBox(height: 16), - _buildExportCard(connector), - const SizedBox(height: 16), - _buildAboutCard(context), + // IDENTITY section + SectionHeader(l10n.settings_deviceInfo), + MeshCard( + padding: EdgeInsets.zero, + child: _buildIdentityCardContent(context, connector), + ), + + // NODE section + SectionHeader(l10n.settings_nodeSettings), + MeshCard( + padding: EdgeInsets.zero, + child: _buildNodeCardContent(context, connector), + ), + + // LOCATION section + SectionHeader(l10n.settings_location), + MeshCard( + padding: EdgeInsets.zero, + child: _buildLocationCardContent(context, connector), + ), + + // APP SETTINGS + SectionHeader(l10n.settings_appSettings), + MeshCard( + onTap: () => Navigator.push( + context, + MaterialPageRoute( + builder: (_) => const AppSettingsScreen(), + ), + ), + child: _buildNavTileContent( + context, + icon: Icons.settings_outlined, + title: l10n.settings_appSettings, + subtitle: l10n.settings_appSettingsSubtitle, + ), + ), + + // ACTIONS section + SectionHeader(l10n.settings_actions), + MeshCard( + padding: EdgeInsets.zero, + child: _buildActionsCardContent(context, connector), + ), + + // EXPORT section + SectionHeader(l10n.settings_gpxExportRepeaters), + MeshCard( + padding: EdgeInsets.zero, + child: _buildExportCardContent(context, connector), + ), + + // DEBUG section + SectionHeader(l10n.settings_debug), + MeshCard( + padding: EdgeInsets.zero, + child: _buildDebugCardContent(context), + ), + + // ABOUT + SectionHeader(l10n.settings_about), + MeshCard( + onTap: () => _showAbout(context), + child: _buildNavTileContent( + context, + icon: Icons.info_outline, + title: l10n.settings_about, + subtitle: l10n.settings_aboutVersion( + _appVersion.isEmpty ? l10n.common_loading : _appVersion, + ), + showChevron: false, + ), + ), ], ); }, @@ -96,91 +162,213 @@ class _SettingsScreenState extends State { ); } - Widget _buildDeviceInfoCard( + Widget _buildNavTileContent( + BuildContext context, { + required IconData icon, + required String title, + required String subtitle, + bool showChevron = true, + }) { + final scheme = Theme.of(context).colorScheme; + final textTheme = Theme.of(context).textTheme; + return Row( + children: [ + Icon(icon, size: 20, color: scheme.onSurfaceVariant), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 2), + Text( + subtitle, + style: textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + if (showChevron) + Icon(Icons.chevron_right, color: scheme.onSurfaceVariant, size: 16), + ], + ); + } + + Widget _buildIdentityCardContent( BuildContext context, MeshCoreConnector connector, ) { final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; - return Card( + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Header row: device name + status chip + expand toggle + InkWell( + onTap: () { + setState(() { + _deviceInfoExpanded = !_deviceInfoExpanded; + }); + }, + child: Padding( + padding: const EdgeInsets.fromLTRB(16, 14, 16, 14), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + connector.deviceDisplayName, + style: MeshTheme.mono( + fontSize: 16, + fontWeight: FontWeight.w700, + color: scheme.onSurface, + ), + ), + const SizedBox(height: 4), + StatusChip( + label: connector.isConnected + ? l10n.common_connected + : l10n.common_disconnected, + color: connector.isConnected + ? MeshPalette.blue + : scheme.onSurfaceVariant, + pulse: connector.isConnected, + ), + ], + ), + ), + AnimatedRotation( + turns: _deviceInfoExpanded ? 0.5 : 0, + duration: const Duration(milliseconds: 200), + child: Icon( + Icons.expand_more, + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + ), + + // Expandable detail rows + AnimatedSize( + duration: const Duration(milliseconds: 200), + alignment: Alignment.topCenter, + child: _deviceInfoExpanded + ? Padding( + padding: const EdgeInsets.fromLTRB(16, 0, 16, 14), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Divider(height: 1), + const SizedBox(height: 10), + _infoRow( + context, + label: l10n.settings_infoId, + value: connector.deviceIdLabel, + ), + _buildBatteryInfoRow(context, connector), + if (connector.selfName != null) + _infoRow( + context, + label: l10n.settings_nodeName, + value: connector.selfName!, + ), + if (connector.selfPublicKey != null) + _infoRow( + context, + label: l10n.settings_infoPublicKey, + value: + '${pubKeyToHex(connector.selfPublicKey!).substring(0, 16)}...', + mono: true, + ), + _infoRow( + context, + label: l10n.settings_infoContactsCount, + value: '${connector.contacts.length}', + ), + _infoRow( + context, + label: l10n.settings_infoChannelCount, + value: '${connector.channels.length}', + ), + ], + ), + ) + : const SizedBox.shrink(), + ), + ], + ); + } + + Widget _infoRow( + BuildContext context, { + required String label, + required String value, + bool mono = false, + Widget? leading, + Color? valueColor, + VoidCallback? onTap, + }) { + final scheme = Theme.of(context).colorScheme; + final textTheme = Theme.of(context).textTheme; + + final content = Padding( + padding: const EdgeInsets.symmetric(vertical: 6), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - InkWell( - borderRadius: BorderRadius.circular(12), - onTap: () { - setState(() { - _deviceInfoExpanded = !_deviceInfoExpanded; - }); - }, - child: Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 16), - child: Row( - children: [ - Expanded( - child: Text( - l10n.settings_deviceInfo, - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ), - AnimatedRotation( - turns: _deviceInfoExpanded ? 0.5 : 0, - duration: const Duration(milliseconds: 200), - child: const Icon(Icons.expand_more), - ), - ], + Row( + children: [ + if (leading != null) ...[leading, const SizedBox(width: 6)], + Text( + label, + style: textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + fontWeight: FontWeight.w500, + ), ), - ), + ], ), - - AnimatedCrossFade( - firstChild: const SizedBox.shrink(), - secondChild: Padding( - padding: const EdgeInsets.fromLTRB(16, 0, 16, 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildInfoRow( - l10n.settings_infoName, - connector.deviceDisplayName, + const SizedBox(height: 2), + mono + ? Text( + value, + style: MeshTheme.mono( + fontSize: 13, + fontWeight: FontWeight.w500, + color: valueColor ?? scheme.onSurface, ), - _buildInfoRow(l10n.settings_infoId, connector.deviceIdLabel), - _buildInfoRow( - l10n.settings_infoStatus, - connector.isConnected - ? l10n.common_connected - : l10n.common_disconnected, + ) + : Text( + value, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w500, + color: valueColor, ), - _buildBatteryInfoRow(context, connector), - if (connector.selfName != null) - _buildInfoRow(l10n.settings_nodeName, connector.selfName!), - if (connector.selfPublicKey != null) - _buildInfoRow( - l10n.settings_infoPublicKey, - '${pubKeyToHex(connector.selfPublicKey!).substring(0, 16)}...', - ), - _buildInfoRow( - l10n.settings_infoContactsCount, - '${connector.contacts.length}', - ), - _buildInfoRow( - l10n.settings_infoChannelCount, - '${connector.channels.length}', - ), - ], - ), - ), - crossFadeState: _deviceInfoExpanded - ? CrossFadeState.showSecond - : CrossFadeState.showFirst, - duration: const Duration(milliseconds: 200), - ), + ), ], ), ); + + if (onTap != null) { + return InkWell( + borderRadius: BorderRadius.circular(MeshRadii.xs), + onTap: onTap, + child: content, + ); + } + return content; } Widget _buildBatteryInfoRow( @@ -191,7 +379,6 @@ class _SettingsScreenState extends State { final percent = connector.batteryPercent; final millivolts = connector.batteryMillivolts; - // figure out display value final String displayValue; if (millivolts == null) { displayValue = l10n.common_notAvailable; @@ -211,22 +398,23 @@ class _SettingsScreenState extends State { if (percent == null) { icon = Icons.battery_unknown; - iconColor = Colors.grey; + iconColor = Theme.of(context).colorScheme.onSurfaceVariant; valueColor = null; } else if (percent <= 15) { icon = Icons.battery_alert; - iconColor = Colors.orange; - valueColor = Colors.orange; + iconColor = Theme.of(context).colorScheme.tertiary; + valueColor = Theme.of(context).colorScheme.tertiary; } else { icon = Icons.battery_full; iconColor = null; valueColor = null; } - return _buildInfoRow( - l10n.settings_infoBattery, - displayValue, - leading: Icon(icon, size: 18, color: iconColor), + return _infoRow( + context, + label: l10n.settings_infoBattery, + value: displayValue, + leading: Icon(icon, size: 14, color: iconColor), valueColor: valueColor, onTap: millivolts != null ? () { @@ -238,266 +426,275 @@ class _SettingsScreenState extends State { ); } - Widget _buildAppSettingsCard(BuildContext context) { - final l10n = context.l10n; - return Card( - child: ListTile( - leading: const Icon(Icons.settings_outlined), - title: Text(l10n.settings_appSettings), - subtitle: Text(l10n.settings_appSettingsSubtitle), - trailing: const Icon(Icons.chevron_right), - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => const AppSettingsScreen()), - ); - }, - ), - ); - } - - Widget _buildNodeSettingsCard( + Widget _buildNodeCardContent( BuildContext context, MeshCoreConnector connector, ) { final l10n = context.l10n; - return Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - child: Text( - l10n.settings_nodeSettings, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), - ), - ListTile( - leading: const Icon(Icons.person_outline), - title: Text(l10n.settings_nodeName), - subtitle: Text(connector.selfName ?? l10n.settings_nodeNameNotSet), - trailing: const Icon(Icons.chevron_right), - onTap: () => _editNodeName(context, connector), - ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.radio), - title: Text(l10n.settings_radioSettings), - subtitle: Text(l10n.settings_radioSettingsSubtitle), - trailing: const Icon(Icons.chevron_right), - onTap: () => _showRadioSettings(context, connector), - ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.sensors_outlined), - title: Text(l10n.radioStats_settingsTile), - subtitle: Text(l10n.radioStats_settingsSubtitle), - trailing: const Icon(Icons.chevron_right), - enabled: - connector.isConnected && connector.supportsCompanionRadioStats, - onTap: () => pushCompanionRadioStatsScreen(context), - ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.location_on_outlined), - title: Text(l10n.settings_location), - subtitle: Text(l10n.settings_locationSubtitle), - trailing: const Icon(Icons.chevron_right), - onTap: () => _editLocation(context, connector), - ), - if (connector.currentCustomVars?.containsKey('gps') ?? false) ...[ - const Divider(height: 1), - SwitchListTile( - secondary: const Icon(Icons.gps_fixed), - title: Text(l10n.settings_locationGPSEnable), - subtitle: Text(l10n.settings_locationGPSEnableSubtitle), - value: connector.currentCustomVars?['gps'] == '1', - onChanged: (value) async { - await connector.setCustomVar(value ? 'gps:1' : 'gps:0'); - }, - ), - ], - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.group_add_outlined), - title: Text(l10n.settings_contactSettings), - subtitle: Text(l10n.settings_contactSettingsSubtitle), - trailing: const Icon(Icons.chevron_right), - onTap: () => _editAutoAddConfig(context, connector), - ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.visibility_off_outlined), - title: Text(l10n.settings_privacy), - subtitle: Text(l10n.settings_privacySubtitle), - trailing: const Icon(Icons.chevron_right), - onTap: () => _privacySettings(context, connector), - ), - ], - ), - ); - } - - Widget _buildActionsCard(BuildContext context, MeshCoreConnector connector) { - final l10n = context.l10n; - return Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - child: Text( - l10n.settings_actions, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), - ), - ListTile( - leading: const Icon(Icons.delete_outline, color: Colors.red), - title: Text(l10n.settings_deleteAllPaths), - subtitle: Text( - l10n.settings_deleteAllPathsSubtitle, - style: TextStyle(color: Colors.red[700]), - ), - onTap: () => connector.deleteAllPaths(), - ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.sync), - title: Text(l10n.settings_syncTime), - subtitle: Text(l10n.settings_syncTimeSubtitle), - onTap: () => _syncTime(context, connector), - ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.refresh), - title: Text(l10n.settings_refreshContacts), - subtitle: Text(l10n.settings_refreshContactsSubtitle), - onTap: () => connector.getContacts(), - ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.restart_alt, color: Colors.orange), - title: Text(l10n.settings_rebootDevice), - subtitle: Text(l10n.settings_rebootDeviceSubtitle), - onTap: () => _confirmReboot(context, connector), - ), - ], - ), - ); - } - - Widget _buildAboutCard(BuildContext context) { - final l10n = context.l10n; - return Card( - child: ListTile( - leading: const Icon(Icons.info_outline), - title: Text(l10n.settings_about), - subtitle: Text( - l10n.settings_aboutVersion( - _appVersion.isEmpty ? l10n.common_loading : _appVersion, - ), + return Column( + children: [ + _tappableTile( + context, + icon: Icons.person_outline, + title: l10n.settings_nodeName, + subtitle: connector.selfName ?? l10n.settings_nodeNameNotSet, + onTap: () => _editNodeName(context, connector), ), - onTap: () => _showAbout(context), - ), + const Divider(height: 1, indent: 16), + _tappableTile( + context, + icon: Icons.radio, + title: l10n.settings_radioSettings, + subtitle: l10n.settings_radioSettingsSubtitle, + onTap: () => _showRadioSettings(context, connector), + ), + const Divider(height: 1, indent: 16), + _tappableTile( + context, + icon: Icons.sensors_outlined, + title: l10n.radioStats_settingsTile, + subtitle: l10n.radioStats_settingsSubtitle, + onTap: connector.isConnected && connector.supportsCompanionRadioStats + ? () => pushCompanionRadioStatsScreen(context) + : null, + ), + ], ); } - Widget _buildDebugCard(BuildContext context) { + Widget _buildLocationCardContent( + BuildContext context, + MeshCoreConnector connector, + ) { final l10n = context.l10n; - return Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - child: Text( - l10n.settings_debug, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), - ), - ListTile( - leading: const Icon(Icons.bluetooth_outlined), - title: Text(l10n.settings_companionDebugLog), - subtitle: Text(l10n.settings_companionDebugLogSubtitle), - trailing: const Icon(Icons.chevron_right), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const BleDebugLogScreen(), - ), - ); - }, - ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.code_outlined), - title: Text(l10n.settings_appDebugLog), - subtitle: Text(l10n.settings_appDebugLogSubtitle), - trailing: const Icon(Icons.chevron_right), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const AppDebugLogScreen(), - ), - ); - }, - ), - ], - ), + return Column( + children: [ + _tappableTile( + context, + icon: Icons.location_on_outlined, + title: l10n.settings_location, + subtitle: l10n.settings_locationSubtitle, + onTap: () => _editLocation(context, connector), + ), + const Divider(height: 1, indent: 16), + _tappableTile( + context, + icon: Icons.group_add_outlined, + title: l10n.settings_contactSettings, + subtitle: l10n.settings_contactSettingsSubtitle, + onTap: () => _editAutoAddConfig(context, connector), + ), + const Divider(height: 1, indent: 16), + _tappableTile( + context, + icon: Icons.visibility_off_outlined, + title: l10n.settings_privacy, + subtitle: l10n.settings_privacySubtitle, + onTap: () => _privacySettings(context, connector), + ), + ], ); } - Widget _buildInfoRow( - String label, - String value, { - Widget? leading, - Color? valueColor, - VoidCallback? onTap, - }) { - final theme = Theme.of(context); + Widget _buildActionsCardContent( + BuildContext context, + MeshCoreConnector connector, + ) { + final l10n = context.l10n; + return Column( + children: [ + _tappableTile( + context, + icon: Icons.sync, + title: l10n.settings_syncTime, + subtitle: l10n.settings_syncTimeSubtitle, + onTap: () => _syncTime(context, connector), + ), + const Divider(height: 1, indent: 16), + _tappableTile( + context, + icon: Icons.refresh, + title: l10n.settings_refreshContacts, + subtitle: l10n.settings_refreshContactsSubtitle, + onTap: () => connector.getContacts(), + ), + const Divider(height: 1, indent: 16), + _tappableTile( + context, + icon: Icons.restart_alt, + title: l10n.settings_rebootDevice, + subtitle: l10n.settings_rebootDeviceSubtitle, + titleColor: MeshPalette.warn, + iconColor: MeshPalette.warn, + onTap: () => _confirmReboot(context, connector), + ), + const Divider(height: 1, indent: 16), + _tappableTile( + context, + icon: Icons.delete_outline, + title: l10n.settings_deleteAllPaths, + subtitle: l10n.settings_deleteAllPathsSubtitle, + titleColor: MeshPalette.alert, + iconColor: MeshPalette.alert, + onTap: () => _confirmDeleteAllPaths(context, connector), + ), + ], + ); + } - final row = Padding( - padding: const EdgeInsets.symmetric(vertical: 10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - if (leading != null) ...[leading, const SizedBox(width: 8)], - Expanded( - child: Text( - label, - style: theme.textTheme.bodySmall?.copyWith( - color: theme.colorScheme.onSurfaceVariant, - fontWeight: FontWeight.w500, - ), - ), + Widget _buildExportCardContent( + BuildContext context, + MeshCoreConnector connector, + ) { + final l10n = context.l10n; + return Column( + children: [ + _tappableTile( + context, + icon: Icons.download_outlined, + title: l10n.settings_gpxExportRepeaters, + subtitle: l10n.settings_gpxExportRepeatersSubtitle, + onTap: () async { + final exporter = GpxExport(connector); + exporter.addRepeaters(); + _gpxExport( + exporter, + l10n.map_repeater, + l10n.settings_gpxExportRepeatersRoom, + 'meshcore_repeaters_', + l10n.settings_gpxExportShareText, + l10n.settings_gpxExportShareSubject, + ); + }, + ), + const Divider(height: 1, indent: 16), + _tappableTile( + context, + icon: Icons.download_outlined, + title: l10n.settings_gpxExportContacts, + subtitle: l10n.settings_gpxExportContactsSubtitle, + onTap: () async { + final exporter = GpxExport(connector); + exporter.addContacts(); + _gpxExport( + exporter, + l10n.map_repeater, + l10n.settings_gpxExportChat, + 'meshcore_contacts_', + l10n.settings_gpxExportShareText, + l10n.settings_gpxExportShareSubject, + ); + }, + ), + const Divider(height: 1, indent: 16), + _tappableTile( + context, + icon: Icons.download_outlined, + title: l10n.settings_gpxExportAll, + subtitle: l10n.settings_gpxExportAllSubtitle, + onTap: () async { + final exporter = GpxExport(connector); + exporter.addAll(); + _gpxExport( + exporter, + l10n.map_repeater, + l10n.settings_gpxExportAllContacts, + 'meshcore_all_', + l10n.settings_gpxExportShareText, + l10n.settings_gpxExportShareSubject, + ); + }, + ), + ], + ); + } + + Widget _buildDebugCardContent(BuildContext context) { + final l10n = context.l10n; + return Column( + children: [ + _tappableTile( + context, + icon: Icons.bluetooth_outlined, + title: l10n.settings_companionDebugLog, + subtitle: l10n.settings_companionDebugLogSubtitle, + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const BleDebugLogScreen(), + ), + ); + }, + ), + const Divider(height: 1, indent: 16), + _tappableTile( + context, + icon: Icons.code_outlined, + title: l10n.settings_appDebugLog, + subtitle: l10n.settings_appDebugLogSubtitle, + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const AppDebugLogScreen(), + ), + ); + }, + ), + ], + ); + } + + Widget _tappableTile( + BuildContext context, { + required IconData icon, + required String title, + required String subtitle, + VoidCallback? onTap, + Color? titleColor, + Color? iconColor, + }) { + final scheme = Theme.of(context).colorScheme; + final textTheme = Theme.of(context).textTheme; + final effectiveIconColor = iconColor ?? scheme.onSurfaceVariant; + + return InkWell( + onTap: onTap, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + child: Row( + children: [ + Icon(icon, size: 20, color: effectiveIconColor), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + color: titleColor, + ), + ), + const SizedBox(height: 2), + Text( + subtitle, + style: textTheme.bodySmall?.copyWith( + color: titleColor != null + ? titleColor.withValues(alpha: 0.7) + : scheme.onSurfaceVariant, + ), + ), + ], ), - ], - ), - const SizedBox(height: 4), - Text( - value, - style: theme.textTheme.bodyLarge?.copyWith( - color: valueColor, - fontWeight: FontWeight.w500, ), - ), - ], + Icon(Icons.chevron_right, color: scheme.onSurfaceVariant, size: 16), + ], + ), ), ); - - if (onTap != null) { - return InkWell( - borderRadius: BorderRadius.circular(6), - onTap: onTap, - child: row, - ); - } - - return row; } void _editNodeName(BuildContext context, MeshCoreConnector connector) { @@ -520,18 +717,26 @@ class _SettingsScreenState extends State { onPressed: () => Navigator.pop(context), child: Text(l10n.common_cancel), ), - TextButton( - onPressed: () async { - Navigator.pop(context); - await connector.setNodeName(controller.text); - await connector.refreshDeviceInfo(); - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text(l10n.settings_nodeNameUpdated), + ListenableBuilder( + listenable: controller, + builder: (context, _) { + final name = controller.text.trim(); + return TextButton( + onPressed: name.isEmpty + ? null + : () async { + Navigator.pop(context); + await connector.setNodeName(name); + await connector.refreshDeviceInfo(); + if (!context.mounted) return; + showDismissibleSnackBar( + context, + content: Text(l10n.settings_nodeNameUpdated), + ); + }, + child: Text(l10n.common_save), ); }, - child: Text(l10n.common_save), ), ], ), @@ -563,6 +768,8 @@ class _SettingsScreenState extends State { int.tryParse(customVars["gps_interval"] ?? "") ?? 900; intervalController.text = currentInterval.toString(); + String? intervalError; + showDialog( context: context, builder: (dialogContext) => StatefulBuilder( @@ -598,9 +805,15 @@ class _SettingsScreenState extends State { const SizedBox(height: 16), TextField( controller: intervalController, + onChanged: (_) { + if (intervalError != null) { + setDialogState(() => intervalError = null); + } + }, decoration: InputDecoration( labelText: l10n.settings_locationIntervalSec, border: const OutlineInputBorder(), + errorText: intervalError, ), keyboardType: const TextInputType.numberWithOptions( decimal: false, @@ -631,24 +844,25 @@ class _SettingsScreenState extends State { ), TextButton( onPressed: () async { - Navigator.pop(context); - + int? interval; if (hasGPS) { final intervalText = intervalController.text.trim(); - if (intervalText.isEmpty) { - return; + if (intervalText.isNotEmpty) { + interval = int.tryParse(intervalText); + if (interval == null || + interval < 60 || + interval >= 86400) { + setDialogState(() { + intervalError = l10n.settings_locationIntervalInvalid; + }); + return; + } } + } - final interval = int.tryParse(intervalText); - if (interval == null || interval < 60 || interval >= 86400) { - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text(l10n.settings_locationIntervalInvalid), - ); - return; - } + Navigator.pop(context); + if (interval != null) { await connector.setCustomVar("gps_interval:$interval"); await connector.refreshDeviceInfo(); if (!context.mounted) return; @@ -714,6 +928,36 @@ class _SettingsScreenState extends State { ); } + void _confirmDeleteAllPaths( + BuildContext context, + MeshCoreConnector connector, + ) { + final l10n = context.l10n; + showDialog( + context: context, + builder: (context) => AlertDialog( + title: Text(l10n.settings_deleteAllPaths), + content: Text(l10n.settings_deleteAllPathsSubtitle), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context), + child: Text(l10n.common_cancel), + ), + TextButton( + onPressed: () { + Navigator.pop(context); + connector.deleteAllPaths(); + }, + child: Text( + l10n.common_deleteAll, + style: TextStyle(color: Theme.of(context).colorScheme.error), + ), + ), + ], + ), + ); + } + void _confirmReboot(BuildContext context, MeshCoreConnector connector) { final l10n = context.l10n; showDialog( @@ -733,7 +977,7 @@ class _SettingsScreenState extends State { }, child: Text( l10n.common_reboot, - style: const TextStyle(color: Colors.orange), + style: TextStyle(color: Theme.of(context).colorScheme.tertiary), ), ), ], @@ -801,70 +1045,6 @@ class _SettingsScreenState extends State { } } - Widget _buildExportCard(MeshCoreConnector connector) { - final l10n = context.l10n; - return Card( - child: Column( - children: [ - ListTile( - leading: const Icon(Icons.download_outlined), - title: Text(l10n.settings_gpxExportRepeaters), - subtitle: Text(l10n.settings_gpxExportRepeatersSubtitle), - trailing: const Icon(Icons.chevron_right), - onTap: () async { - final exporter = GpxExport(connector); - exporter.addRepeaters(); - _gpxExport( - exporter, - l10n.map_repeater, - l10n.settings_gpxExportRepeatersRoom, - "meshcore_repeaters_", - l10n.settings_gpxExportShareText, - l10n.settings_gpxExportShareSubject, - ); - }, - ), - ListTile( - leading: const Icon(Icons.download_outlined), - title: Text(l10n.settings_gpxExportContacts), - subtitle: Text(l10n.settings_gpxExportContactsSubtitle), - trailing: const Icon(Icons.chevron_right), - onTap: () async { - final exporter = GpxExport(connector); - exporter.addContacts(); - _gpxExport( - exporter, - l10n.map_repeater, - l10n.settings_gpxExportChat, - "meshcore_contacts_", - l10n.settings_gpxExportShareText, - l10n.settings_gpxExportShareSubject, - ); - }, - ), - ListTile( - leading: const Icon(Icons.download_outlined), - title: Text(l10n.settings_gpxExportAll), - subtitle: Text(l10n.settings_gpxExportAllSubtitle), - trailing: const Icon(Icons.chevron_right), - onTap: () async { - final exporter = GpxExport(connector); - exporter.addAll(); - _gpxExport( - exporter, - l10n.map_repeater, - l10n.settings_gpxExportAllContacts, - "meshcore_all_", - l10n.settings_gpxExportShareText, - l10n.settings_gpxExportShareSubject, - ); - }, - ), - ], - ), - ); - } - void _editAutoAddConfig(BuildContext context, MeshCoreConnector connector) { final l10n = context.l10n; bool autoAddChat = false; @@ -897,7 +1077,7 @@ class _SettingsScreenState extends State { setDialogState(() => autoAddChat = value); }, ), - SizedBox(height: 8), + const SizedBox(height: 8), FeatureToggleRow( title: l10n.contactsSettings_autoAddRepeatersTitle, subtitle: l10n.contactsSettings_autoAddRepeatersSubtitle, @@ -906,7 +1086,7 @@ class _SettingsScreenState extends State { setDialogState(() => autoAddRepeater = value); }, ), - SizedBox(height: 8), + const SizedBox(height: 8), FeatureToggleRow( title: l10n.contactsSettings_autoAddRoomServersTitle, subtitle: l10n.contactsSettings_autoAddRoomServersSubtitle, @@ -915,7 +1095,7 @@ class _SettingsScreenState extends State { setDialogState(() => autoAddRoomServer = value); }, ), - SizedBox(height: 8), + const SizedBox(height: 8), FeatureToggleRow( title: l10n.contactsSettings_autoAddSensorsTitle, subtitle: l10n.contactsSettings_autoAddSensorsSubtitle, @@ -924,7 +1104,7 @@ class _SettingsScreenState extends State { setDialogState(() => autoAddSensor = value); }, ), - Divider(height: 4), + const Divider(height: 4), FeatureToggleRow( title: l10n.contactsSettings_overwriteOldestTitle, subtitle: l10n.contactsSettings_overwriteOldestSubtitle, @@ -1124,6 +1304,8 @@ class _RadioSettingsDialogState extends State<_RadioSettingsDialog> { bool _clientRepeat = false; int? _selectedPresetIndex; _RadioSettingsSnapshot? _lastNonRepeatSnapshot; + String? _frequencyError; + String? _txPowerError; AppDebugLogService get _appLog => Provider.of(context, listen: false); @@ -1390,7 +1572,24 @@ class _RadioSettingsDialogState extends State<_RadioSettingsDialog> { void _handleManualSettingsChanged(String source) { _logRadioSettingsState('Manual settings edit: $source'); - setState(_syncPresetSelection); + setState(() { + _validateFields(); + _syncPresetSelection(); + }); + } + + void _validateFields() { + final l10n = context.l10n; + final freqMHz = double.tryParse(_frequencyController.text); + _frequencyError = (freqMHz == null || freqMHz < 300 || freqMHz > 2500) + ? l10n.settings_frequencyInvalid + : null; + + final maxTxPower = widget.connector.maxTxPower ?? 22; + final txPower = int.tryParse(_txPowerController.text); + _txPowerError = (txPower == null || txPower < 0 || txPower > maxTxPower) + ? '${l10n.settings_txPowerInvalid} (0-$maxTxPower dBm)' + : null; } void _handleClientRepeatChanged(bool enabled) { @@ -1502,6 +1701,7 @@ class _RadioSettingsDialogState extends State<_RadioSettingsDialog> { content: Text(l10n.settings_error(e.toString())), ); } + if (!mounted) return; Navigator.pop(context); } @@ -1577,6 +1777,7 @@ class _RadioSettingsDialogState extends State<_RadioSettingsDialog> { labelText: l10n.settings_frequency, border: const OutlineInputBorder(), helperText: l10n.settings_frequencyHelper, + errorText: _frequencyError, ), keyboardType: const TextInputType.numberWithOptions( decimal: true, @@ -1660,6 +1861,7 @@ class _RadioSettingsDialogState extends State<_RadioSettingsDialog> { helperText: widget.connector.maxTxPower != null ? '${l10n.settings_txPowerHelper} (max: ${widget.connector.maxTxPower} dBm)' : l10n.settings_txPowerHelper, + errorText: _txPowerError, ), keyboardType: TextInputType.number, ), @@ -1681,7 +1883,12 @@ class _RadioSettingsDialogState extends State<_RadioSettingsDialog> { onPressed: () => Navigator.pop(context), child: Text(l10n.common_cancel), ), - FilledButton(onPressed: _saveSettings, child: Text(l10n.common_save)), + FilledButton( + onPressed: (_frequencyError != null || _txPowerError != null) + ? null + : _saveSettings, + child: Text(l10n.common_save), + ), ], ); } diff --git a/lib/screens/tcp_screen.dart b/lib/screens/tcp_screen.dart index 3bd1b0bf..85ac929f 100644 --- a/lib/screens/tcp_screen.dart +++ b/lib/screens/tcp_screen.dart @@ -1,15 +1,18 @@ import 'dart:async'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; import '../connector/meshcore_connector.dart'; import '../l10n/l10n.dart'; import '../services/app_settings_service.dart'; +import '../theme/mesh_theme.dart'; import '../utils/platform_info.dart'; import '../widgets/adaptive_app_bar_title.dart'; +import '../widgets/mesh_ui.dart'; import '../helpers/snack_bar_builder.dart'; -import 'contacts_screen.dart'; +import 'channels_screen.dart'; import 'usb_screen.dart'; class TcpScreen extends StatefulWidget { @@ -24,7 +27,7 @@ class _TcpScreenState extends State { late final TextEditingController _portController; late final MeshCoreConnector _connector; late final VoidCallback _connectionListener; - bool _navigatedToContacts = false; + bool _navigatedToChannels = false; @override void initState() { @@ -42,20 +45,20 @@ class _TcpScreenState extends State { _connectionListener = () { if (!mounted) return; if (_connector.state == MeshCoreConnectionState.disconnected) { - _navigatedToContacts = false; + _navigatedToChannels = false; } if (_connector.state == MeshCoreConnectionState.connected && _connector.isTcpTransportConnected && - !_navigatedToContacts) { + !_navigatedToChannels) { context.read().setTcpServerAddress( _hostController.text, ); context.read().setTcpServerPort( int.tryParse(_portController.text) ?? 0, ); - _navigatedToContacts = true; + _navigatedToChannels = true; Navigator.of(context).pushReplacement( - MaterialPageRoute(builder: (_) => const ContactsScreen()), + MaterialPageRoute(builder: (_) => const ChannelsScreen()), ); } }; @@ -67,7 +70,7 @@ class _TcpScreenState extends State { _hostController.dispose(); _portController.dispose(); _connector.removeListener(_connectionListener); - if (!_navigatedToContacts && + if (!_navigatedToChannels && _connector.activeTransport == MeshCoreTransportType.tcp && _connector.state != MeshCoreConnectionState.disconnected) { WidgetsBinding.instance.addPostFrameCallback((_) { @@ -95,13 +98,32 @@ class _TcpScreenState extends State { final isConnecting = connector.state == MeshCoreConnectionState.connecting && connector.activeTransport == MeshCoreTransportType.tcp; + // Connect is only available from a fully disconnected state — + // scanning, connecting, or an active session must settle first. final isButtonDisabled = - isConnecting || - connector.state == MeshCoreConnectionState.scanning; - return Column( + connector.state != MeshCoreConnectionState.disconnected; + return ListView( + padding: const EdgeInsets.only(bottom: 32), children: [ - _buildStatusBar(context, connector), + // Status header Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 4), + child: AnimatedSwitcher( + duration: const Duration(milliseconds: 300), + child: Align( + key: ValueKey(connector.state), + alignment: Alignment.centerLeft, + child: _buildStatusChip(context, connector), + ), + ), + ), + + // Transport switcher + _buildTransportLinks(context), + + // Connection form + const SectionHeader('TCP / IP'), + MeshCard( padding: const EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, @@ -111,7 +133,6 @@ class _TcpScreenState extends State { decoration: InputDecoration( labelText: context.l10n.tcpHostLabel, hintText: context.l10n.tcpHostHint, - border: const OutlineInputBorder(), ), enabled: !isConnecting, keyboardType: TextInputType.url, @@ -122,7 +143,6 @@ class _TcpScreenState extends State { decoration: InputDecoration( labelText: context.l10n.tcpPortLabel, hintText: context.l10n.tcpPortHint, - border: const OutlineInputBorder(), ), enabled: !isConnecting, keyboardType: TextInputType.number, @@ -130,7 +150,12 @@ class _TcpScreenState extends State { const SizedBox(height: 16), FilledButton.icon( key: const Key('tcp_connect_button'), - onPressed: isButtonDisabled ? null : _connectTcp, + onPressed: isButtonDisabled + ? null + : () { + HapticFeedback.lightImpact(); + _connectTcp(); + }, icon: isConnecting ? const SizedBox( width: 18, @@ -149,94 +174,100 @@ class _TcpScreenState extends State { ], ), ), + + // Last used endpoint + if (connector.activeTcpEndpoint != null && + connector.isTcpTransportConnected) ...[ + const SectionHeader('CONNECTED TO'), + MeshCard( + padding: const EdgeInsets.symmetric( + horizontal: 14, + vertical: 10, + ), + child: Row( + children: [ + Icon( + Icons.lan, + size: 16, + color: Theme.of(context).colorScheme.primary, + ), + const SizedBox(width: 10), + Expanded( + child: Text( + connector.activeTcpEndpoint!, + style: MeshTheme.mono( + fontSize: 13, + color: Theme.of(context).colorScheme.onSurface, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ), + ], + ), + ), + ], ], ); }, ), ), - bottomNavigationBar: SafeArea( - top: false, - minimum: const EdgeInsets.fromLTRB(16, 8, 16, 16), - child: FittedBox( - fit: BoxFit.scaleDown, - alignment: Alignment.centerRight, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - if (PlatformInfo.supportsUsbSerial) - FloatingActionButton.extended( - onPressed: () { - Navigator.of(context).pushReplacement( - MaterialPageRoute(builder: (_) => const UsbScreen()), - ); - }, - heroTag: 'tcp_usb_action', - extendedPadding: const EdgeInsets.symmetric(horizontal: 12), - icon: const Icon(Icons.usb), - label: Text(context.l10n.connectionChoiceUsbLabel), - ), - if (PlatformInfo.supportsUsbSerial) const SizedBox(width: 12), - FloatingActionButton.extended( - onPressed: () { - Navigator.of(context).maybePop(); - }, - heroTag: 'tcp_ble_action', - extendedPadding: const EdgeInsets.symmetric(horizontal: 12), - icon: const Icon(Icons.bluetooth), - label: Text(context.l10n.connectionChoiceBluetoothLabel), - ), - ], - ), - ), - ), ); } - Widget _buildStatusBar(BuildContext context, MeshCoreConnector connector) { + Widget _buildStatusChip(BuildContext context, MeshCoreConnector connector) { final l10n = context.l10n; - String statusText; - Color statusColor; if (connector.isTcpTransportConnected) { - statusText = l10n.scanner_connectedTo( - connector.activeTcpEndpoint ?? 'TCP', + return StatusChip( + label: l10n.scanner_connectedTo(connector.activeTcpEndpoint ?? 'TCP'), + color: MeshPalette.signal, ); - statusColor = Colors.green; } else if (connector.state == MeshCoreConnectionState.connecting && connector.activeTransport == MeshCoreTransportType.tcp) { - statusText = l10n.tcpStatus_connectingTo( - '${_hostController.text}:${_portController.text}', + return StatusChip( + label: l10n.tcpStatus_connectingTo( + '${_hostController.text}:${_portController.text}', + ), + color: MeshPalette.warn, + pulse: true, ); - statusColor = Colors.orange; } else if (connector.state == MeshCoreConnectionState.disconnecting && connector.activeTransport == MeshCoreTransportType.tcp) { - statusText = l10n.scanner_disconnecting; - statusColor = Colors.orange; + return StatusChip( + label: l10n.scanner_disconnecting, + color: MeshPalette.warn, + pulse: true, + ); } else { - statusText = l10n.tcpStatus_notConnected; - statusColor = Colors.grey; + return StatusChip( + label: l10n.tcpStatus_notConnected, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ); } + } - return Container( - width: double.infinity, - padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16), - color: statusColor.withValues(alpha: 0.1), - child: Row( + Widget _buildTransportLinks(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: Wrap( + spacing: 12, + runSpacing: 8, children: [ - Icon(Icons.circle, size: 12, color: statusColor), - const SizedBox(width: 8), - Expanded( - child: FittedBox( - fit: BoxFit.scaleDown, - alignment: Alignment.centerLeft, - child: Text( - statusText, - style: TextStyle( - color: statusColor, - fontWeight: FontWeight.w500, - ), - ), + if (PlatformInfo.supportsUsbSerial) + OutlinedButton.icon( + onPressed: () { + Navigator.of(context).pushReplacement( + MaterialPageRoute(builder: (_) => const UsbScreen()), + ); + }, + icon: const Icon(Icons.usb), + label: Text(context.l10n.connectionChoiceUsbLabel), ), + OutlinedButton.icon( + onPressed: () => Navigator.of(context).maybePop(), + icon: const Icon(Icons.bluetooth), + label: Text(context.l10n.connectionChoiceBluetoothLabel), ), ], ), @@ -274,7 +305,7 @@ class _TcpScreenState extends State { showDismissibleSnackBar( context, content: Text(message), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); } diff --git a/lib/screens/telemetry_screen.dart b/lib/screens/telemetry_screen.dart index 47593a3f..fafa68f2 100644 --- a/lib/screens/telemetry_screen.dart +++ b/lib/screens/telemetry_screen.dart @@ -1,20 +1,26 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; import '../l10n/l10n.dart'; import '../models/contact.dart'; import '../models/path_selection.dart'; import '../models/app_settings.dart'; +import '../storage/prefs_manager.dart'; import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; import '../services/app_settings_service.dart'; import '../services/repeater_command_service.dart'; import '../utils/app_logger.dart'; -import '../widgets/path_management_dialog.dart'; +import '../widgets/routing_sheet.dart'; import '../helpers/cayenne_lpp.dart'; import '../utils/battery_utils.dart'; import '../helpers/snack_bar_builder.dart'; +import '../widgets/sync_progress_overlay.dart'; +import '../widgets/telemetry_location_map.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/mesh_ui.dart'; class TelemetryScreen extends StatefulWidget { final Contact contact; @@ -26,6 +32,13 @@ class TelemetryScreen extends StatefulWidget { } class _TelemetryScreenState extends State { + static const int _autoRefreshDefaultIntervalSeconds = 20; + static const int _autoRefreshDefaultQuantity = 10; + static const int _autoRefreshMinIntervalSeconds = 10; + static const int _autoRefreshMaxIntervalSeconds = 300; + static const int _autoRefreshMinQuantity = 1; + static const int _autoRefreshMaxQuantity = 10; + int _tagData = 0; bool _isLoading = false; @@ -36,6 +49,17 @@ class _TelemetryScreenState extends State { RepeaterCommandService? _commandService; PathSelection? _pendingStatusSelection; List>? _parsedTelemetry; + final TextEditingController _autoRefreshIntervalController = + TextEditingController(text: '$_autoRefreshDefaultIntervalSeconds'); + final TextEditingController _autoRefreshQuantityController = + TextEditingController(text: '$_autoRefreshDefaultQuantity'); + Timer? _autoRefreshTimer; + bool _isAutoRefreshEnabled = false; + bool _activeTelemetryRequestIsAutoRefresh = false; + bool _autoRefreshLastAttemptFailed = false; + int _autoRefreshCurrentAttempt = 0; + int _autoRefreshTotalAttempts = 0; + int _autoRefreshIntervalSeconds = _autoRefreshDefaultIntervalSeconds; int _tripTime = 0; @@ -62,6 +86,7 @@ class _TelemetryScreenState extends State { super.initState(); final connector = Provider.of(context, listen: false); _commandService = RepeaterCommandService(connector); + _loadAutoRefreshSettings(); _setupMessageListener(); _loadTelemetry(); _hasData = false; @@ -81,17 +106,26 @@ class _TelemetryScreenState extends State { _tagData = reader.readUInt32LE(); _tripTime = reader.readUInt32LE(); _statusTimeout?.cancel(); + final isAutoRefreshRequest = _activeTelemetryRequestIsAutoRefresh; _statusTimeout = Timer(Duration(milliseconds: _tripTime), () { if (!mounted) return; setState(() { _isLoading = false; _isLoaded = false; + if (isAutoRefreshRequest && _isAutoRefreshEnabled) { + _autoRefreshLastAttemptFailed = true; + } }); - showDismissibleSnackBar( - context, - content: Text(context.l10n.telemetry_requestTimeout), - backgroundColor: Colors.red, - ); + if (!isAutoRefreshRequest) { + showDismissibleSnackBar( + context, + content: Text(context.l10n.telemetry_requestTimeout), + backgroundColor: Theme.of(context).colorScheme.error, + ); + } + if (isAutoRefreshRequest && _isAutoRefreshEnabled) { + _scheduleNextAutoRefreshAttempt(); + } _recordTelemetryResult(false); }); } @@ -133,15 +167,21 @@ class _TelemetryScreenState extends State { ); } if (!mounted) return; + final isAutoRefreshRequest = _activeTelemetryRequestIsAutoRefresh; setState(() { _parsedTelemetry = parsedTelemetry; + if (isAutoRefreshRequest) { + _autoRefreshLastAttemptFailed = false; + } + _activeTelemetryRequestIsAutoRefresh = false; }); - showDismissibleSnackBar( - context, - content: Text(context.l10n.telemetry_receivedData), - backgroundColor: Colors.green, - ); + if (!isAutoRefreshRequest) { + showDismissibleSnackBar( + context, + content: Text(context.l10n.telemetry_receivedData), + ); + } _statusTimeout?.cancel(); if (!mounted) return; setState(() { @@ -149,14 +189,18 @@ class _TelemetryScreenState extends State { _isLoaded = true; _hasData = true; }); + if (isAutoRefreshRequest) { + _scheduleNextAutoRefreshAttempt(); + } } - Future _loadTelemetry() async { + Future _loadTelemetry({bool isAutoRefresh = false}) async { if (_commandService == null) return; setState(() { _isLoading = true; _isLoaded = false; + _activeTelemetryRequestIsAutoRefresh = isAutoRefresh; }); try { final connector = Provider.of(context, listen: false); @@ -168,7 +212,7 @@ class _TelemetryScreenState extends State { if (widget.contact.type != advTypeChat) { frame = buildSendBinaryReq( widget.contact.publicKey, - payload: Uint8List.fromList([reqTypeGetTelemetry]), + payload: buildTelemetryBinaryPayload(), ); } else { frame = buildSendTelemetryReq(widget.contact.publicKey); @@ -179,17 +223,76 @@ class _TelemetryScreenState extends State { setState(() { _isLoading = false; _isLoaded = false; + if (isAutoRefresh) { + _autoRefreshLastAttemptFailed = true; + } + _activeTelemetryRequestIsAutoRefresh = false; }); + if (isAutoRefresh) { + _scheduleNextAutoRefreshAttempt(); + } - showDismissibleSnackBar( - context, - content: Text(context.l10n.telemetry_errorLoading(e.toString())), - backgroundColor: Colors.red, - ); + if (!isAutoRefresh) { + showDismissibleSnackBar( + context, + content: Text(context.l10n.telemetry_errorLoading(e.toString())), + backgroundColor: Theme.of(context).colorScheme.error, + ); + } } } } + void _loadAutoRefreshSettings() { + final prefs = PrefsManager.instance; + final contactKey = widget.contact.publicKeyHex; + final interval = + (prefs.getInt(_autoRefreshIntervalKey(contactKey)) ?? + _autoRefreshDefaultIntervalSeconds) + .clamp( + _autoRefreshMinIntervalSeconds, + _autoRefreshMaxIntervalSeconds, + ) + .toInt(); + final quantity = + (prefs.getInt(_autoRefreshQuantityKey(contactKey)) ?? + _autoRefreshDefaultQuantity) + .clamp(_autoRefreshMinQuantity, _autoRefreshMaxQuantity) + .toInt(); + + _autoRefreshIntervalSeconds = interval; + _autoRefreshIntervalController.text = interval.toString(); + _autoRefreshQuantityController.text = quantity.toString(); + } + + Future _saveAutoRefreshSettings() async { + final contactKey = widget.contact.publicKeyHex; + final interval = _clampControllerValue( + controller: _autoRefreshIntervalController, + min: _autoRefreshMinIntervalSeconds, + max: _autoRefreshMaxIntervalSeconds, + fallback: _autoRefreshIntervalSeconds, + ); + final quantity = _clampControllerValue( + controller: _autoRefreshQuantityController, + min: _autoRefreshMinQuantity, + max: _autoRefreshMaxQuantity, + fallback: _autoRefreshDefaultQuantity, + ); + + final prefs = PrefsManager.instance; + await prefs.setInt(_autoRefreshIntervalKey(contactKey), interval); + await prefs.setInt(_autoRefreshQuantityKey(contactKey), quantity); + } + + String _autoRefreshIntervalKey(String contactKey) { + return 'telemetry_auto_refresh_interval_$contactKey'; + } + + String _autoRefreshQuantityKey(String contactKey) { + return 'telemetry_auto_refresh_quantity_$contactKey'; + } + void _recordTelemetryResult(bool success) { final selection = _pendingStatusSelection; if (selection == null) return; @@ -205,19 +308,28 @@ class _TelemetryScreenState extends State { @override void dispose() { + unawaited(_saveAutoRefreshSettings()); _frameSubscription?.cancel(); _commandService?.dispose(); _statusTimeout?.cancel(); + _autoRefreshTimer?.cancel(); + _autoRefreshIntervalController.dispose(); + _autoRefreshQuantityController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; final connector = context.watch(); final settings = context.watch().settings; final isImperialUnits = settings.unitSystem == UnitSystem.imperial; - final isFloodMode = widget.contact.pathOverride == -1; + final contact = connector.contacts.firstWhere( + (c) => c.publicKeyHex == widget.contact.publicKeyHex, + orElse: () => widget.contact, + ); + final isFloodMode = contact.pathOverride == -1; return Scaffold( appBar: AppBar( @@ -239,71 +351,13 @@ class _TelemetryScreenState extends State { ], ), centerTitle: false, + bottom: const SyncProgressAppBarBottom(), actions: [ - PopupMenuButton( + IconButton( icon: Icon(isFloodMode ? Icons.waves : Icons.route), tooltip: l10n.repeater_routingMode, - onSelected: (mode) async { - if (mode == 'flood') { - await connector.setPathOverride(widget.contact, pathLen: -1); - } else { - await connector.setPathOverride(widget.contact, pathLen: null); - } - }, - itemBuilder: (context) => [ - PopupMenuItem( - value: 'auto', - child: Row( - children: [ - Icon( - Icons.auto_mode, - size: 20, - color: !isFloodMode - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_autoUseSavedPath, - style: TextStyle( - fontWeight: !isFloodMode - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - PopupMenuItem( - value: 'flood', - child: Row( - children: [ - Icon( - Icons.waves, - size: 20, - color: isFloodMode - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_forceFloodMode, - style: TextStyle( - fontWeight: isFloodMode - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - ], - ), - IconButton( - icon: const Icon(Icons.timeline), - tooltip: l10n.repeater_pathManagement, onPressed: () => - PathManagementDialog.show(context, contact: widget.contact), + ContactRoutingSheet.show(context, contact: widget.contact), ), IconButton( icon: _isLoading @@ -313,7 +367,9 @@ class _TelemetryScreenState extends State { child: CircularProgressIndicator(strokeWidth: 2), ) : const Icon(Icons.refresh), - onPressed: _isLoading ? null : _loadTelemetry, + onPressed: (_isLoading || _isAutoRefreshEnabled) + ? null + : () => _loadTelemetry(), tooltip: l10n.repeater_refresh, ), ], @@ -321,7 +377,8 @@ class _TelemetryScreenState extends State { body: SafeArea( top: false, child: RefreshIndicator( - onRefresh: _loadTelemetry, + onRefresh: () => + _isAutoRefreshEnabled ? Future.value() : _loadTelemetry(), child: ListView( padding: const EdgeInsets.all(16), children: [ @@ -331,7 +388,10 @@ class _TelemetryScreenState extends State { Center( child: Text( l10n.telemetry_noData, - style: const TextStyle(fontSize: 16, color: Colors.grey), + style: TextStyle( + fontSize: 16, + color: scheme.onSurfaceVariant, + ), ), ), if ((_isLoaded || _hasData) && @@ -344,6 +404,7 @@ class _TelemetryScreenState extends State { entry['channel'], isImperialUnits, ), + _buildAutoRefreshCard(), ], ), ), @@ -357,85 +418,504 @@ class _TelemetryScreenState extends State { int channel, bool isImperialUnits, ) { - final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Icon( - Icons.info_outline, - color: Theme.of(context).textTheme.headlineSmall?.color, - ), - const SizedBox(width: 8), - Text( - title, - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - const Divider(), - for (final entry in channelData.entries) - if (entry.key == 'voltage' && channel == 1) - _buildInfoRow( - l10n.telemetry_batteryLabel, - _batteryText(entry.value), - ) - else if (entry.key == 'voltage') - _buildInfoRow( - l10n.telemetry_voltageLabel, - l10n.telemetry_voltageValue(entry.value.toString()), - ) - else if (entry.key == 'temperature' && channel == 1) - _buildInfoRow( - l10n.telemetry_mcuTemperatureLabel, - _temperatureText(entry.value, isImperialUnits), - ) - else if (entry.key == 'temperature') - _buildInfoRow( - l10n.telemetry_temperatureLabel, - _temperatureText(entry.value, isImperialUnits), - ) - else if (entry.key == 'current' && channel == 1) - _buildInfoRow( - l10n.telemetry_currentLabel, - l10n.telemetry_currentValue(entry.value.toString()), - ) - else - _buildInfoRow(entry.key, entry.value.toString()), - ], + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SectionHeader(title, padding: const EdgeInsets.fromLTRB(16, 16, 16, 8)), + MeshCard( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + for (final entry in channelData.entries) + _buildTelemetryField(entry, channel, isImperialUnits), + ], + ), ), - ), + ], ); } + Widget _buildTelemetryField( + MapEntry entry, + int channel, + bool isImperialUnits, + ) { + if (entry.key == 'gps') { + return _buildGpsInfo(entry.value); + } + + final display = _formatTelemetryField( + entry.key, + entry.value, + channel, + isImperialUnits, + ); + return _buildInfoRow(display.label, display.value); + } + + _TelemetryFieldDisplay _formatTelemetryField( + String key, + dynamic value, + int channel, + bool isImperialUnits, + ) { + final l10n = context.l10n; + final text = _telemetryValueText(value); + + switch (key) { + case 'digitalInput': + return _TelemetryFieldDisplay(l10n.telemetry_digitalInputLabel, text); + case 'digitalOutput': + return _TelemetryFieldDisplay(l10n.telemetry_digitalOutputLabel, text); + case 'analogInput': + return _TelemetryFieldDisplay( + l10n.telemetry_analogInputLabel, + l10n.telemetry_analogValue(text), + ); + case 'analogOutput': + return _TelemetryFieldDisplay( + l10n.telemetry_analogOutputLabel, + l10n.telemetry_analogValue(text), + ); + case 'generic': + return _TelemetryFieldDisplay(l10n.telemetry_genericLabel, text); + case 'luminosity': + return _TelemetryFieldDisplay( + l10n.telemetry_luminosityLabel, + l10n.telemetry_luminosityValue(text), + ); + case 'presence': + return _TelemetryFieldDisplay(l10n.telemetry_presenceLabel, text); + case 'temperature': + return _TelemetryFieldDisplay( + channel == 1 + ? l10n.telemetry_mcuTemperatureLabel + : l10n.telemetry_temperatureLabel, + _temperatureText(value, isImperialUnits), + ); + case 'humidity': + return _TelemetryFieldDisplay(l10n.telemetry_humidityLabel, text); + case 'accelerometer': + return _TelemetryFieldDisplay( + l10n.telemetry_accelerometerLabel, + _telemetryAxisText(value), + ); + case 'pressure': + return _TelemetryFieldDisplay( + l10n.telemetry_pressureLabel, + l10n.telemetry_pressureValue(text), + ); + case 'altitude': + return _TelemetryFieldDisplay( + l10n.telemetry_altitudeLabel, + l10n.telemetry_altitudeValue(text), + ); + case 'voltage': + return _TelemetryFieldDisplay( + channel == 1 + ? l10n.telemetry_batteryLabel + : l10n.telemetry_voltageLabel, + channel == 1 + ? _batteryText(value) + : l10n.telemetry_voltageValue(text), + ); + case 'current': + return _TelemetryFieldDisplay( + l10n.telemetry_currentLabel, + l10n.telemetry_currentValue(text), + ); + case 'frequency': + return _TelemetryFieldDisplay( + l10n.telemetry_frequencyLabel, + l10n.telemetry_frequencyValue(text), + ); + case 'percentage': + return _TelemetryFieldDisplay( + l10n.telemetry_percentageLabel, + l10n.telemetry_percentageValue(text), + ); + case 'concentration': + return _TelemetryFieldDisplay( + l10n.telemetry_concentrationLabel, + l10n.telemetry_concentrationValue(text), + ); + case 'power': + return _TelemetryFieldDisplay( + l10n.telemetry_powerLabel, + l10n.telemetry_powerValue(text), + ); + case 'distance': + return _TelemetryFieldDisplay( + l10n.telemetry_distanceLabel, + l10n.telemetry_distanceValue(text), + ); + case 'energy': + return _TelemetryFieldDisplay( + l10n.telemetry_energyLabel, + l10n.telemetry_energyValue(text), + ); + case 'direction': + return _TelemetryFieldDisplay( + l10n.telemetry_directionLabel, + l10n.telemetry_directionValue(text), + ); + case 'time': + return _TelemetryFieldDisplay( + l10n.telemetry_timeLabel, + _telemetryTimeText(value), + ); + case 'gyrometer': + return _TelemetryFieldDisplay( + l10n.telemetry_gyrometerLabel, + _telemetryAxisText(value), + ); + case 'colour': + return _TelemetryFieldDisplay( + l10n.telemetry_colourLabel, + _telemetryColorText(value), + ); + case 'switch': + return _TelemetryFieldDisplay(l10n.telemetry_switchLabel, text); + case 'polyline': + return _TelemetryFieldDisplay( + l10n.telemetry_polylineLabel, + _telemetryMapText(value), + ); + default: + return _TelemetryFieldDisplay(key, text); + } + } + + Widget _buildAutoRefreshCard() { + final l10n = context.l10n; + final counterText = _autoRefreshCounterText(); + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SectionHeader( + l10n.common_autoRefresh, + padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), + ), + MeshCard( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + _buildAutoRefreshNumberField( + controller: _autoRefreshIntervalController, + label: l10n.common_interval, + min: _autoRefreshMinIntervalSeconds, + max: _autoRefreshMaxIntervalSeconds, + fallback: _autoRefreshIntervalSeconds, + ), + const SizedBox(height: 12), + _buildAutoRefreshNumberField( + controller: _autoRefreshQuantityController, + label: l10n.telemetry_autoFetchQuantity, + min: _autoRefreshMinQuantity, + max: _autoRefreshMaxQuantity, + fallback: _autoRefreshDefaultQuantity, + ), + if (counterText != null) ...[ + const SizedBox(height: 12), + Text( + counterText, + textAlign: TextAlign.center, + style: TextStyle( + color: _autoRefreshLastAttemptFailed + ? Theme.of(context).colorScheme.error + : null, + fontWeight: FontWeight.w600, + ), + ), + ], + const SizedBox(height: 12), + FilledButton( + onPressed: _isLoading && !_isAutoRefreshEnabled + ? null + : _toggleAutoRefresh, + child: _isAutoRefreshEnabled + ? SizedBox( + width: double.infinity, + height: 20, + child: Stack( + alignment: Alignment.center, + children: [ + Center(child: Text(l10n.common_disable)), + Positioned( + right: 0, + child: SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator( + strokeWidth: 2, + color: Theme.of( + context, + ).colorScheme.onPrimary, + ), + ), + ), + ], + ), + ) + : Text(l10n.common_enable), + ), + ], + ), + ), + ], + ); + } + + Widget _buildAutoRefreshNumberField({ + required TextEditingController controller, + required String label, + required int min, + required int max, + required int fallback, + }) { + return TextField( + controller: controller, + enabled: !_isAutoRefreshEnabled, + keyboardType: TextInputType.number, + inputFormatters: [FilteringTextInputFormatter.digitsOnly], + decoration: InputDecoration( + labelText: label, + border: const OutlineInputBorder(), + isDense: true, + ), + onEditingComplete: () { + _clampControllerValue( + controller: controller, + min: min, + max: max, + fallback: fallback, + ); + unawaited(_saveAutoRefreshSettings()); + FocusScope.of(context).unfocus(); + }, + onSubmitted: (_) => unawaited(_saveAutoRefreshSettings()), + onTapOutside: (_) { + unawaited(_saveAutoRefreshSettings()); + FocusScope.of(context).unfocus(); + }, + ); + } + + String? _autoRefreshCounterText() { + if (!_isAutoRefreshEnabled && _autoRefreshCurrentAttempt == 0) return null; + final counter = '$_autoRefreshCurrentAttempt/$_autoRefreshTotalAttempts'; + if (_autoRefreshLastAttemptFailed) { + return '${context.l10n.telemetry_error}: $counter'; + } + return counter; + } + + void _toggleAutoRefresh() { + if (_isAutoRefreshEnabled) { + _stopAutoRefresh(); + return; + } + _startAutoRefresh(); + } + + void _startAutoRefresh() { + final interval = _clampControllerValue( + controller: _autoRefreshIntervalController, + min: _autoRefreshMinIntervalSeconds, + max: _autoRefreshMaxIntervalSeconds, + fallback: _autoRefreshIntervalSeconds, + ); + final quantity = _clampControllerValue( + controller: _autoRefreshQuantityController, + min: _autoRefreshMinQuantity, + max: _autoRefreshMaxQuantity, + fallback: _autoRefreshDefaultQuantity, + ); + unawaited(_saveAutoRefreshSettings()); + + setState(() { + _isAutoRefreshEnabled = true; + _autoRefreshIntervalSeconds = interval; + _autoRefreshTotalAttempts = quantity; + _autoRefreshCurrentAttempt = 0; + _autoRefreshLastAttemptFailed = false; + }); + _runAutoRefreshAttempt(); + } + + void _stopAutoRefresh() { + _autoRefreshTimer?.cancel(); + _autoRefreshTimer = null; + if (!mounted) return; + setState(() { + _isAutoRefreshEnabled = false; + }); + } + + Future _runAutoRefreshAttempt() async { + if (!_isAutoRefreshEnabled || !mounted) return; + if (_autoRefreshCurrentAttempt >= _autoRefreshTotalAttempts) { + _stopAutoRefresh(); + return; + } + + setState(() { + _autoRefreshCurrentAttempt += 1; + }); + await _loadTelemetry(isAutoRefresh: true); + } + + void _scheduleNextAutoRefreshAttempt() { + if (!_isAutoRefreshEnabled || !mounted) return; + _autoRefreshTimer?.cancel(); + if (_autoRefreshCurrentAttempt >= _autoRefreshTotalAttempts) { + _stopAutoRefresh(); + return; + } + // Start the interval only after the current request has finished: after a + // telemetry response, timeout, or send error. This keeps slow replies from + // shortening the intended pause between requests. + _autoRefreshTimer = Timer( + Duration(seconds: _autoRefreshIntervalSeconds), + _runAutoRefreshAttempt, + ); + } + + int _clampControllerValue({ + required TextEditingController controller, + required int min, + required int max, + required int fallback, + }) { + final parsed = int.tryParse(controller.text); + final value = (parsed ?? fallback).clamp(min, max).toInt(); + controller.text = value.toString(); + controller.selection = TextSelection.collapsed( + offset: controller.text.length, + ); + return value; + } + + Widget _buildGpsInfo(dynamic value) { + final latitude = _readGpsValue(value, 'latitude'); + final longitude = _readGpsValue(value, 'longitude'); + final altitude = _readGpsValue(value, 'altitude'); + final isValidPosition = _isValidGpsPosition(latitude, longitude); + final gpsText = isValidPosition + ? [ + latitude!.toStringAsFixed(5), + longitude!.toStringAsFixed(5), + if (altitude != null) '${altitude.toStringAsFixed(1)} m', + ].join(', ') + : value.toString(); + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildInfoRow(context.l10n.telemetry_gpsLabel, gpsText), + if (isValidPosition) + TelemetryLocationMap( + // The map renders only after bounds validation, keeping malformed + // Cayenne payloads from creating an invalid FlutterMap center. + latitude: latitude!, + longitude: longitude!, + label: widget.contact.name, + contactType: widget.contact.type, + contactPublicKeyHex: widget.contact.publicKeyHex, + ), + ], + ); + } + + double? _readGpsValue(dynamic value, String key) { + if (value is! Map) return null; + final rawValue = value[key]; + if (rawValue is num) return rawValue.toDouble(); + return null; + } + + bool _isValidGpsPosition(double? latitude, double? longitude) { + if (latitude == null || longitude == null) return false; + const double epsilon = 1e-6; + return (latitude.abs() > epsilon || longitude.abs() > epsilon) && + latitude >= -90.0 && + latitude <= 90.0 && + longitude >= -180.0 && + longitude <= 180.0; + } + + String _telemetryValueText(dynamic value) { + if (value == null) return context.l10n.common_notAvailable; + if (value is double) { + return value.toStringAsFixed(value.truncateToDouble() == value ? 0 : 2); + } + if (value is num) { + return value.toString(); + } + return value.toString(); + } + + String _telemetryAxisText(dynamic value) { + if (value is! Map) return _telemetryValueText(value); + final x = _telemetryValueText(value['x']); + final y = _telemetryValueText(value['y']); + final z = _telemetryValueText(value['z']); + return 'X: $x, Y: $y, Z: $z'; + } + + String _telemetryColorText(dynamic value) { + if (value is! Map) return _telemetryValueText(value); + final red = _telemetryValueText(value['red']); + final green = _telemetryValueText(value['green']); + final blue = _telemetryValueText(value['blue']); + return 'R: $red, G: $green, B: $blue'; + } + + String _telemetryMapText(dynamic value) { + if (value is! Map) return _telemetryValueText(value); + return value.entries + .map((entry) => '${entry.key}: ${entry.value}') + .join(', '); + } + + String _telemetryTimeText(dynamic value) { + if (value is! num || value <= 0) return _telemetryValueText(value); + final dateTime = DateTime.fromMillisecondsSinceEpoch( + value.toInt() * 1000, + isUtc: true, + ).toLocal(); + final localizations = MaterialLocalizations.of(context); + final time = localizations.formatTimeOfDay( + TimeOfDay.fromDateTime(dateTime), + ); + return '${localizations.formatFullDate(dateTime)} $time'; + } + Widget _buildInfoRow(String label, String value) { + final scheme = Theme.of(context).colorScheme; return Padding( padding: const EdgeInsets.symmetric(vertical: 6), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - width: 130, + Expanded( child: Text( label, style: TextStyle( - color: Colors.grey[600], + color: scheme.onSurfaceVariant, + fontSize: 13, fontWeight: FontWeight.w500, ), ), ), - Expanded( - child: Text( - value, - style: const TextStyle(fontWeight: FontWeight.w400), - ), + const SizedBox(width: 8), + Text( + value, + style: MeshTheme.mono(fontSize: 13, color: scheme.onSurface), + textAlign: TextAlign.end, ), ], ), @@ -483,3 +963,10 @@ class _TelemetryScreenState extends State { return '${tempC.toStringAsFixed(1)}°C'; } } + +class _TelemetryFieldDisplay { + final String label; + final String value; + + const _TelemetryFieldDisplay(this.label, this.value); +} diff --git a/lib/screens/usb_screen.dart b/lib/screens/usb_screen.dart index 6b8fe9d9..9bd5a5ca 100644 --- a/lib/screens/usb_screen.dart +++ b/lib/screens/usb_screen.dart @@ -6,13 +6,15 @@ import 'package:provider/provider.dart'; import '../connector/meshcore_connector.dart'; import '../l10n/l10n.dart'; +import '../theme/mesh_theme.dart'; import '../utils/app_logger.dart'; import '../utils/platform_info.dart'; import '../utils/usb_port_labels.dart'; import '../widgets/adaptive_app_bar_title.dart'; +import '../widgets/empty_state.dart'; +import '../widgets/mesh_ui.dart'; import '../helpers/snack_bar_builder.dart'; -import 'contacts_screen.dart'; -import 'scanner_screen.dart'; +import 'channels_screen.dart'; import 'tcp_screen.dart'; class UsbScreen extends StatefulWidget { @@ -25,7 +27,7 @@ class UsbScreen extends StatefulWidget { class _UsbScreenState extends State { final List _ports = []; bool _isLoadingPorts = true; - bool _navigatedToContacts = false; + bool _navigatedToChannels = false; bool _didScheduleInitialLoad = false; Timer? _hotPlugTimer; late final MeshCoreConnector _connector; @@ -41,14 +43,14 @@ class _UsbScreenState extends State { _connectionListener = () { if (!mounted) return; if (_connector.state == MeshCoreConnectionState.disconnected) { - _navigatedToContacts = false; + _navigatedToChannels = false; } if (_connector.state == MeshCoreConnectionState.connected && _connector.isUsbTransportConnected && - !_navigatedToContacts) { - _navigatedToContacts = true; + !_navigatedToChannels) { + _navigatedToChannels = true; Navigator.of(context).pushReplacement( - MaterialPageRoute(builder: (_) => const ContactsScreen()), + MaterialPageRoute(builder: (_) => const ChannelsScreen()), ); } }; @@ -72,7 +74,7 @@ class _UsbScreenState extends State { _hotPlugTimer?.cancel(); _hotPlugTimer = null; _connector.removeListener(_connectionListener); - if (!_navigatedToContacts && + if (!_navigatedToChannels && _connector.activeTransport == MeshCoreTransportType.usb && _connector.state != MeshCoreConnectionState.disconnected) { WidgetsBinding.instance.addPostFrameCallback((_) { @@ -98,138 +100,124 @@ class _UsbScreenState extends State { child: Consumer( builder: (context, connector, child) { return Column( + crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - _buildStatusBar(context, connector), + // Status header + Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 4), + child: AnimatedSwitcher( + duration: const Duration(milliseconds: 300), + child: Align( + key: ValueKey('${connector.state}_$_isLoadingPorts'), + alignment: Alignment.centerLeft, + child: _buildStatusChip(context, connector), + ), + ), + ), + + // Transport switcher + _buildTransportLinks(context), + + // Port list Expanded(child: _buildPortList(context, connector)), ], ); }, ), ), - bottomNavigationBar: Consumer( - builder: (context, connector, child) { - final isLoading = _isLoadingPorts; - final showBle = true; - final showTcp = !PlatformInfo.isWeb; - - return SafeArea( - top: false, - minimum: const EdgeInsets.fromLTRB(16, 8, 16, 16), - child: FittedBox( - fit: BoxFit.scaleDown, - alignment: Alignment.centerRight, + bottomNavigationBar: _supportsHotPlug + ? null + : SafeArea( + top: false, + minimum: const EdgeInsets.fromLTRB(16, 8, 16, 16), child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ - if (showTcp) - FloatingActionButton.extended( - onPressed: () { - Navigator.of(context).pushReplacement( - MaterialPageRoute(builder: (_) => const TcpScreen()), - ); - }, - heroTag: 'usb_tcp_action', - extendedPadding: const EdgeInsets.symmetric( - horizontal: 12, - ), - icon: const Icon(Icons.lan), - label: Text(context.l10n.connectionChoiceTcpLabel), - ), - if (showTcp && showBle) const SizedBox(width: 12), - if (showBle) - FloatingActionButton.extended( - onPressed: () { - Navigator.of(context).pushReplacement( - MaterialPageRoute( - builder: (_) => const ScannerScreen(), - ), - ); - }, - heroTag: 'usb_ble_action', - extendedPadding: const EdgeInsets.symmetric( - horizontal: 12, - ), - icon: const Icon(Icons.bluetooth), - label: Text(context.l10n.connectionChoiceBluetoothLabel), - ), - if ((showTcp || showBle) && !_supportsHotPlug) - const SizedBox(width: 12), - if (!_supportsHotPlug) - FloatingActionButton.extended( - onPressed: isLoading ? null : _loadPorts, - heroTag: 'usb_refresh_action', - extendedPadding: const EdgeInsets.symmetric( - horizontal: 12, - ), - icon: isLoading - ? const SizedBox( - width: 20, - height: 20, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.usb), - label: Text(context.l10n.scanner_scan), - ), + FloatingActionButton.extended( + onPressed: _isLoadingPorts ? null : _loadPorts, + heroTag: 'usb_refresh_action', + icon: _isLoadingPorts + ? const SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : const Icon(Icons.usb), + label: Text(context.l10n.scanner_scan), + ), ], ), ), - ); - }, - ), ); } - Widget _buildStatusBar(BuildContext context, MeshCoreConnector connector) { + Widget _buildStatusChip(BuildContext context, MeshCoreConnector connector) { final l10n = context.l10n; - String statusText; - Color statusColor; + final scheme = Theme.of(context).colorScheme; if (_isLoadingPorts) { - statusText = l10n.usbStatus_searching; - statusColor = Colors.blue; + return StatusChip( + label: l10n.usbStatus_searching, + color: scheme.primary, + pulse: true, + ); } else if (connector.isUsbTransportConnected) { switch (connector.state) { case MeshCoreConnectionState.connected: - statusText = l10n.scanner_connectedTo( - connector.activeUsbPortDisplayLabel ?? 'USB', + return StatusChip( + label: l10n.scanner_connectedTo( + connector.activeUsbPortDisplayLabel ?? 'USB', + ), + color: MeshPalette.signal, ); - statusColor = Colors.green; case MeshCoreConnectionState.disconnecting: - statusText = l10n.scanner_disconnecting; - statusColor = Colors.orange; + return StatusChip( + label: l10n.scanner_disconnecting, + color: MeshPalette.warn, + pulse: true, + ); default: - statusText = l10n.usbStatus_notConnected; - statusColor = Colors.grey; + return StatusChip( + label: l10n.usbStatus_notConnected, + color: scheme.onSurfaceVariant, + ); } } else if (connector.state == MeshCoreConnectionState.connecting && connector.activeTransport == MeshCoreTransportType.usb) { - statusText = l10n.usbStatus_connecting; - statusColor = Colors.orange; + return StatusChip( + label: l10n.usbStatus_connecting, + color: MeshPalette.warn, + pulse: true, + ); } else { - statusText = l10n.usbStatus_notConnected; - statusColor = Colors.grey; + return StatusChip( + label: l10n.usbStatus_notConnected, + color: scheme.onSurfaceVariant, + ); } + } - return Container( - width: double.infinity, - padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16), - color: statusColor.withValues(alpha: 0.1), - child: Row( + Widget _buildTransportLinks(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: Wrap( + spacing: 12, + runSpacing: 8, children: [ - Icon(Icons.circle, size: 12, color: statusColor), - const SizedBox(width: 8), - Expanded( - child: FittedBox( - fit: BoxFit.scaleDown, - alignment: Alignment.centerLeft, - child: Text( - statusText, - style: TextStyle( - color: statusColor, - fontWeight: FontWeight.w500, - ), - ), + if (!PlatformInfo.isWeb) + OutlinedButton.icon( + onPressed: () { + Navigator.of(context).pushReplacement( + MaterialPageRoute(builder: (_) => const TcpScreen()), + ); + }, + icon: const Icon(Icons.lan), + label: Text(context.l10n.connectionChoiceTcpLabel), ), + OutlinedButton.icon( + onPressed: () => Navigator.of(context).maybePop(), + icon: const Icon(Icons.bluetooth), + label: Text(context.l10n.connectionChoiceBluetoothLabel), ), ], ), @@ -240,46 +228,20 @@ class _UsbScreenState extends State { final l10n = context.l10n; if (_isLoadingPorts) { - return Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon(Icons.usb, size: 64, color: Colors.grey[400]), - const SizedBox(height: 16), - Text( - l10n.usbStatus_searching, - style: TextStyle(fontSize: 16, color: Colors.grey[600]), - ), - ], - ), - ); + return EmptyState(icon: Icons.usb, title: l10n.usbStatus_searching); } if (_ports.isEmpty) { - return Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon(Icons.usb, size: 64, color: Colors.grey[400]), - const SizedBox(height: 16), - Text( - l10n.usbScreenEmptyState, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 16, color: Colors.grey[600]), - ), - ], - ), - ); + return EmptyState(icon: Icons.usb, title: l10n.usbScreenEmptyState); } final isConnecting = connector.state == MeshCoreConnectionState.connecting && connector.activeTransport == MeshCoreTransportType.usb; - return ListView.separated( - padding: const EdgeInsets.all(8), + return ListView.builder( + padding: const EdgeInsets.only(bottom: 32), itemCount: _ports.length, - separatorBuilder: (context, index) => const Divider(), itemBuilder: (context, index) { final port = _ports[index]; final displayName = friendlyUsbPortName(port); @@ -287,18 +249,50 @@ class _UsbScreenState extends State { final showRawName = rawName != displayName && !rawName.startsWith('web:'); - return ListTile( - leading: const Icon(Icons.usb), - title: Text( - displayName, - style: const TextStyle(fontWeight: FontWeight.w500), + return ListEntrance( + index: index, + child: MeshCard( + padding: EdgeInsets.zero, + child: ListTile( + onTap: isConnecting + ? null + : () { + HapticFeedback.selectionClick(); + _connectPort(port); + }, + leading: AvatarCircle( + name: displayName, + size: 40, + icon: Icons.usb, + color: Theme.of(context).colorScheme.primary, + ), + title: Text( + displayName, + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + color: Theme.of(context).colorScheme.onSurface, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + subtitle: showRawName + ? Text( + rawName, + style: MeshTheme.mono( + fontSize: 11, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ) + : null, + trailing: Icon( + Icons.chevron_right, + size: 18, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + ), ), - subtitle: showRawName ? Text(rawName) : null, - trailing: ElevatedButton( - onPressed: isConnecting ? null : () => _connectPort(port), - child: Text(l10n.common_connect), - ), - onTap: isConnecting ? null : () => _connectPort(port), ); }, ); @@ -384,13 +378,27 @@ class _UsbScreenState extends State { void _showError(Object error) { if (!mounted) return; + // Cancelling the browser's serial port picker is a normal user action, not + // an error — don't show a scary red toast (and never leak the raw + // DOMException text). + if (_isUserCancelledPortPicker(error)) return; showDismissibleSnackBar( context, content: Text(_friendlyErrorMessage(error)), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); } + bool _isUserCancelledPortPicker(Object error) { + if (error is StateError && + error.message.contains('No USB serial device selected')) { + return true; + } + final text = error.toString(); + return text.contains('No port selected by the user') || + text.contains("Failed to execute 'requestPort'"); + } + String _friendlyErrorMessage(Object error) { final l10n = context.l10n; diff --git a/lib/services/app_settings_service.dart b/lib/services/app_settings_service.dart index 7b3d5848..88ff0f47 100644 --- a/lib/services/app_settings_service.dart +++ b/lib/services/app_settings_service.dart @@ -235,6 +235,12 @@ class AppSettingsService extends ChangeNotifier { await updateSettings(_settings.copyWith(translationEnabled: value)); } + Future setAutoTranslateIncomingMessages(bool value) async { + await updateSettings( + _settings.copyWith(autoTranslateIncomingMessages: value), + ); + } + Future setTranslationTargetLanguageCode(String? value) async { await updateSettings( _settings.copyWith(translationTargetLanguageCode: value), diff --git a/lib/services/message_retry_service.dart b/lib/services/message_retry_service.dart index 733dfc59..50ec64d9 100644 --- a/lib/services/message_retry_service.dart +++ b/lib/services/message_retry_service.dart @@ -39,7 +39,12 @@ class RetryServiceConfig { final void Function(Message) updateMessage; final Function(Contact)? clearContactPath; final Function(Contact, Uint8List, int)? setContactPath; - final int Function(int pathLength, int messageBytes, {String? contactKey})? + final int Function( + int pathLength, + int messageBytes, { + String? contactKey, + int? deviceTimeoutMs, + })? calculateTimeout; final Uint8List? Function()? getSelfPublicKey; final String Function(Contact, String)? prepareContactOutboundText; @@ -74,6 +79,12 @@ class RetryServiceConfig { class MessageRetryService extends ChangeNotifier { static const int maxAckHistorySize = 100; + + /// Global cap on concurrent in-flight messages across ALL contacts. + /// The firmware's expected_ack_table is a single 8-entry circular buffer + /// shared globally; cap at 6 to leave two slots of headroom. + static const int _maxGlobalInFlight = 6; + int _maxRetries = 5; int get maxRetries => _maxRetries; @@ -170,8 +181,9 @@ class MessageRetryService extends ChangeNotifier { _config?.addMessage(contact.publicKeyHex, message); - // Queue per contact — only one message in-flight at a time to avoid - // overflowing the firmware's 8-entry expected_ack_table. + // Queue per contact — one message in-flight per contact at a time, and + // bounded globally by _maxGlobalInFlight across all contacts so we never + // overflow the firmware's 8-entry global expected_ack_table. final contactKey = contact.publicKeyHex; _sendQueue[contactKey] ??= []; _sendQueue[contactKey]!.add(messageId); @@ -184,6 +196,11 @@ class MessageRetryService extends ChangeNotifier { } void _sendNextForContact(String contactKey) { + // Enforce the global in-flight cap before starting a new send. + // The firmware's expected_ack_table is a single 8-entry circular buffer + // shared across all contacts; exceeding it silently evicts an older slot. + if (_activeMessages.length >= _maxGlobalInFlight) return; + final queue = _sendQueue[contactKey]; if (queue == null) return; @@ -211,7 +228,16 @@ class MessageRetryService extends ChangeNotifier { if (_resolvedMessages.contains(messageId)) return; _resolvedMessages.add(messageId); _activeMessages.remove(messageId); + // Pump this contact's queue first, then any other contacts that are waiting. _sendNextForContact(contactKey); + for (final key in _sendQueue.keys) { + if (key == contactKey) continue; + if (_activeMessages.length >= _maxGlobalInFlight) break; + final queue = _sendQueue[key]; + if (queue != null && queue.isNotEmpty) { + _sendNextForContact(key); + } + } } PathSelection? _selectPathForAttempt(Message message, Contact contact) { @@ -352,6 +378,10 @@ class MessageRetryService extends ChangeNotifier { } bool updateMessageFromSent(int ackHash, int timeoutMs) { + // Firmware sets expected_ack = 0 for CLI/command sends (TXT_TYPE_CLI_DATA). + // No ACK will ever be issued for these, so arming a retry timer is wrong. + if (ackHash == 0) return false; + final config = _config; if (config == null) return false; @@ -404,13 +434,18 @@ class MessageRetryService extends ChangeNotifier { // Calculate timeout: prefer ML prediction, then device-provided, then physics fallback final pathLengthValue = message.pathLength ?? contact.pathLength; + final outboundTextForTimeout = + config.prepareContactOutboundText?.call(contact, message.text) ?? + message.text; + final messageBytesForTimeout = utf8.encode(outboundTextForTimeout).length; int actualTimeout = timeoutMs; if (config.calculateTimeout != null) { actualTimeout = config.calculateTimeout!( pathLengthValue, - message.text.length, + messageBytesForTimeout, contactKey: contact.publicKeyHex, + deviceTimeoutMs: timeoutMs > 0 ? timeoutMs : null, ); } @@ -449,6 +484,11 @@ class MessageRetryService extends ChangeNotifier { }); } + void untrack(String messageId) { + _timeoutTimers[messageId]?.cancel(); + _cleanupMessage(messageId); + } + void _cleanupMessage(String messageId) { _moveAckHashesToHistory(messageId); _ackHashToMessageId.removeWhere( @@ -612,7 +652,6 @@ class MessageRetryService extends ChangeNotifier { for (final expectedHash in expectedHashes) { if (expectedHash == ackHash) { matchedMessageId = messageId; - matchedAttemptIndex = expectedHashes.indexOf(expectedHash); break; } } @@ -664,10 +703,16 @@ class MessageRetryService extends ChangeNotifier { if (config?.onDeliveryObserved != null && tripTimeMs > 0 && message.pathLength != null) { - config!.onDeliveryObserved!( + final outboundTextForObserved = + config!.prepareContactOutboundText?.call(contact, message.text) ?? + message.text; + final messageBytesForObserved = utf8 + .encode(outboundTextForObserved) + .length; + config.onDeliveryObserved!( contact.publicKeyHex, message.pathLength!, - message.text.length, + messageBytesForObserved, tripTimeMs, ); } diff --git a/lib/services/notification_service.dart b/lib/services/notification_service.dart index b367e0e5..b148c95d 100644 --- a/lib/services/notification_service.dart +++ b/lib/services/notification_service.dart @@ -114,6 +114,36 @@ class NotificationService { return _isInitialized; } + // Cached "are we allowed to post notifications" result. Null = not yet + // determined. Avoids calling _notifications.show() when it would only throw + // "You must request notifications permissions first" (every web build, and + // Android 13+ before the user grants the permission). + bool? _canNotify; + + Future _ensureCanNotify() async { + if (!await _ensureInitialized()) return false; + final cached = _canNotify; + if (cached != null) return cached; + + // flutter_local_notifications has no web backend, so show() always throws. + // Skip silently instead of logging an error per incoming message. + if (kIsWeb) return _canNotify = false; + + // On Android 13+ notifications require an explicit grant; reflect the real + // OS state so we don't spam failed show() calls when denied. + final androidPlugin = _notifications + .resolvePlatformSpecificImplementation< + AndroidFlutterLocalNotificationsPlugin + >(); + if (androidPlugin != null) { + final enabled = await androidPlugin.areNotificationsEnabled(); + return _canNotify = enabled ?? false; + } + + // iOS/macOS request permission during initialize(); desktop has no gate. + return _canNotify = true; + } + Future requestPermissions() async { if (!_isInitialized) { await initialize(); @@ -126,7 +156,8 @@ class NotificationService { >(); if (androidPlugin != null) { final granted = await androidPlugin.requestNotificationsPermission(); - return granted ?? false; + _canNotify = granted ?? false; + return _canNotify!; } // iOS permissions are requested during initialization @@ -140,7 +171,8 @@ class NotificationService { badge: true, sound: true, ); - return granted ?? false; + _canNotify = granted ?? false; + return _canNotify!; } return true; @@ -165,7 +197,7 @@ class NotificationService { String? contactId, int? badgeCount, }) async { - if (!await _ensureInitialized()) return; + if (!await _ensureCanNotify()) return; final androidDetails = AndroidNotificationDetails( 'messages', @@ -215,7 +247,7 @@ class NotificationService { required String contactType, String? contactId, }) async { - if (!await _ensureInitialized()) return; + if (!await _ensureCanNotify()) return; const androidDetails = AndroidNotificationDetails( 'adverts', @@ -248,7 +280,7 @@ class NotificationService { await _notifications.show( id: contactId != null ? 'advert:$contactId'.hashCode - : DateTime.now().millisecondsSinceEpoch, + : DateTime.now().millisecondsSinceEpoch & 0x7FFFFFFF, title: _l10n.notification_newTypeDiscovered(contactType), body: contactName, notificationDetails: notificationDetails, @@ -265,7 +297,7 @@ class NotificationService { int? channelIndex, int? badgeCount, }) async { - if (!await _ensureInitialized()) return; + if (!await _ensureCanNotify()) return; final androidDetails = AndroidNotificationDetails( 'channel_messages', @@ -304,7 +336,9 @@ class NotificationService { try { await _notifications.show( - id: channelIndex?.hashCode ?? DateTime.now().millisecondsSinceEpoch, + id: + channelIndex?.hashCode ?? + DateTime.now().millisecondsSinceEpoch & 0x7FFFFFFF, title: channelName, body: body, notificationDetails: notificationDetails, @@ -543,7 +577,7 @@ class NotificationService { } Future _showBatchSummary(List<_PendingNotification> batch) async { - if (!await _ensureInitialized()) return; + if (!await _ensureCanNotify()) return; // Group by type final messages = batch diff --git a/lib/services/path_history_service.dart b/lib/services/path_history_service.dart index fc81c565..7a61e3f6 100644 --- a/lib/services/path_history_service.dart +++ b/lib/services/path_history_service.dart @@ -134,10 +134,12 @@ class PathHistoryService extends ChangeNotifier { newWeight = (currentWeight + successIncrement).clamp(0.0, maxWeight); } else { newWeight = currentWeight - failureDecrement; - if (newWeight <= 0) { + if (newWeight <= 0 && failureCount >= 3) { removePathRecord(contactPubKeyHex, selection.pathBytes); return; } + // Keep the record with a small floor weight until we have enough evidence + newWeight = newWeight.clamp(0.1, maxWeight); } _addPathRecord( diff --git a/lib/services/timeout_prediction_service.dart b/lib/services/timeout_prediction_service.dart index d92ca643..f007e51c 100644 --- a/lib/services/timeout_prediction_service.dart +++ b/lib/services/timeout_prediction_service.dart @@ -63,12 +63,15 @@ class TimeoutPredictionService extends ChangeNotifier { required int tripTimeMs, int secondsSinceLastRx = 0, }) { + final isFlood = pathLength < 0; final observation = DeliveryObservation( contactKey: contactKey, - pathLength: pathLength, + // Clamp to 0 for flood so the hop-count slope is learned from direct paths + // only; isFlood carries the flood signal as a separate feature. + pathLength: isFlood ? 0 : pathLength, messageBytes: messageBytes, secondsSinceLastRx: secondsSinceLastRx, - isFlood: pathLength < 0, + isFlood: isFlood, deliveryMs: tripTimeMs, timestamp: DateTime.now(), ); @@ -76,11 +79,12 @@ class TimeoutPredictionService extends ChangeNotifier { _observations.add(observation); if (_observations.length > maxObservations) { _observations.removeAt(0); + _rebuildContactStats(); + } else { + _contactStats.putIfAbsent(contactKey, () => _ContactStats()); + _contactStats[contactKey]!.add(tripTimeMs.toDouble()); } - _contactStats.putIfAbsent(contactKey, () => _ContactStats()); - _contactStats[contactKey]!.add(tripTimeMs.toDouble()); - _observationsSinceLastTrain++; if (_observationsSinceLastTrain >= _retrainInterval && _observations.length >= minObservations) { @@ -108,11 +112,14 @@ class TimeoutPredictionService extends ChangeNotifier { try { if (_activeFeatures.isEmpty) return null; + final flood = pathLength < 0; final allFeatures = { - 'pathLength': pathLength.toDouble(), + // Clamp to 0 for flood — mirrors recordObservation so training and + // prediction see the same pathLength values; isFlood carries the signal. + 'pathLength': flood ? 0.0 : pathLength.toDouble(), 'messageBytes': messageBytes.toDouble(), 'secSinceRx': secondsSinceLastRx.toDouble(), - 'isFlood': pathLength < 0 ? 1.0 : 0.0, + 'isFlood': flood ? 1.0 : 0.0, }; final row = _activeFeatures.map((f) => allFeatures[f]!).toList(); @@ -164,7 +171,9 @@ class TimeoutPredictionService extends ChangeNotifier { // (ml_algo's OLS produces all-zero coefficients for singular matrices) final allNames = ['pathLength', 'messageBytes', 'secSinceRx', 'isFlood']; final allExtractors = [ - (o) => o.pathLength.toDouble(), + // pathLength is already clamped to >=0 in recordObservation, but guard + // here as well for any observations loaded from older persisted data. + (o) => o.pathLength < 0 ? 0.0 : o.pathLength.toDouble(), (o) => o.messageBytes.toDouble(), (o) => o.secondsSinceLastRx.toDouble(), (o) => o.isFlood ? 1.0 : 0.0, @@ -215,6 +224,9 @@ class TimeoutPredictionService extends ChangeNotifier { @override void dispose() { + if (_persistTimer?.isActive == true) { + _storage?.saveDeliveryObservations(_observations); + } _persistTimer?.cancel(); super.dispose(); } diff --git a/lib/services/translation_service.dart b/lib/services/translation_service.dart index 294a7848..d01155ab 100644 --- a/lib/services/translation_service.dart +++ b/lib/services/translation_service.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:http/http.dart' as http; import 'package:llamadart/llamadart.dart'; +import 'package:flutter_langdetect/flutter_langdetect.dart'; import '../models/app_settings.dart'; import '../models/translation_support.dart'; @@ -41,8 +42,12 @@ class TranslationService extends ChangeNotifier { TranslationService( this._appSettingsService, { TranslationFileStore? fileStore, - }) : _fileStore = fileStore ?? TranslationFileStore(); + }) : _fileStore = fileStore ?? TranslationFileStore() { + // Initialize langdetect once at service construction. + _langDetectInit = initLangDetect(); + } + bool _disposed = false; bool _isBusy = false; bool _isDownloading = false; bool _cancelDownloadRequested = false; @@ -51,6 +56,7 @@ class TranslationService extends ChangeNotifier { LlamaEngine? _engine; String? _loadedModelPath; String? _failedModelPath; + Future? _langDetectInit; int _downloadedBytes = 0; int? _downloadTotalBytes; String? _downloadFileName; @@ -84,7 +90,22 @@ class TranslationService extends ChangeNotifier { 'en'; } - bool shouldTranslateIncoming({ + bool shouldAutoTranslateIncoming({ + required String text, + required bool isCli, + required bool isOutgoing, + }) { + if (!_settings.autoTranslateIncomingMessages) { + return false; + } + return canTranslateIncoming( + text: text, + isCli: isCli, + isOutgoing: isOutgoing, + ); + } + + bool canTranslateIncoming({ required String text, required bool isCli, required bool isOutgoing, @@ -195,7 +216,7 @@ class TranslationService extends ChangeNotifier { } _downloadTotalBytes = totalSize; - notifyListeners(); + _notify(); DownloadedModelFile downloaded; if (supportsRange && @@ -248,7 +269,7 @@ class TranslationService extends ChangeNotifier { throw StateError('Model download failed: HTTP ${response.statusCode}'); } _downloadTotalBytes ??= response.contentLength; - notifyListeners(); + _notify(); final trackedStream = _trackDownloadProgress(response.stream); return await _fileStore.writeModelBytes( fileName: fileName, @@ -293,7 +314,7 @@ class TranslationService extends ChangeNotifier { throw const TranslationDownloadCancelled(); } _downloadFileName = 'Merging chunks...'; - notifyListeners(); + _notify(); combineReached = true; return await _fileStore.combineChunks( fileName: fileName, @@ -341,7 +362,7 @@ class TranslationService extends ChangeNotifier { } _cancelDownloadRequested = true; _lastError = 'Download stopped.'; - notifyListeners(); + _notify(); } Future removeModel(TranslationModelRecord model) async { @@ -368,7 +389,9 @@ class TranslationService extends ChangeNotifier { if (targetLanguageCode == null || !_isPlainTextEligible(text)) { return null; } - final detectedLanguageCode = await detectLanguage(text); + final detectedLanguageCode = await detectLanguage( + _stripReplyInfoForDetection(text), + ); if (detectedLanguageCode != null && detectedLanguageCode == targetLanguageCode) { return const TranslationResult( @@ -409,7 +432,9 @@ class TranslationService extends ChangeNotifier { if (targetLanguageCode == null || !_isPlainTextEligible(text)) { return null; } - final detectedLanguageCode = await detectLanguage(text); + final detectedLanguageCode = await detectLanguage( + _stripReplyInfoForDetection(text), + ); if (detectedLanguageCode != null && detectedLanguageCode == targetLanguageCode) { return const TranslationResult( @@ -436,7 +461,26 @@ class TranslationService extends ChangeNotifier { } Future detectLanguage(String text) async { - return _heuristicLanguageCode(text); + try { + // Ensure the detector is initialized (constructor starts init). + await (_langDetectInit ??= initLangDetect()); + final code = detect(text); + if (code.isEmpty) return null; + return code; + } catch (error) { + _lastError = error.toString(); + appLogger.warn('Language detection failed: $error'); + _notify(); + return null; + } + } + + String _stripReplyInfoForDetection(String text) { + final match = RegExp( + r'@\[([^\]]+)\]\s+(.+)$', + dotAll: true, + ).firstMatch(text); + return match?.group(2) ?? text; } Future _translateText({ @@ -495,7 +539,7 @@ class TranslationService extends ChangeNotifier { } catch (error) { _lastError = error.toString(); appLogger.warn('Translation request failed: $error'); - notifyListeners(); + _notify(); return null; } } @@ -518,72 +562,6 @@ class TranslationService extends ChangeNotifier { trimmed.startsWith('r:')); } - String? _heuristicLanguageCode(String text) { - final trimmed = text.trim(); - if (trimmed.isEmpty) { - return null; - } - - if (RegExp(r'[ぁ-んァ-ン]').hasMatch(text)) { - return 'ja'; - } - if (RegExp(r'[가-힣]').hasMatch(text)) { - return 'ko'; - } - if (RegExp(r'[\u4e00-\u9fff]').hasMatch(text)) { - return 'zh'; - } - - final lower = trimmed.toLowerCase(); - final patterns = { - 'uk': r'\b(привіт|дякую|будь|ласка|як|де|не|так|це|є|най|ще|може|для)\b', - 'ru': - r'\b(что|это|как|не|да|нет|он|она|они|быть|есть|для|сегодня|если|уже|может)\b', - 'bg': r'\b(ще|няма|благодаря|моля|това|какво|тук|ние|вие|не|със|за)\b', - 'de': - r'\b(der|die|das|und|ist|nicht|ein|eine|ich|für|mit|auf|zu|auch|als|an|im|am|es|dem|den|sich|von)\b', - 'en': - r'\b(the|and|is|you|for|with|from|not|that|this|have|be|are|was|were|but|can|will|your|what|when|how|they)\b', - 'es': - r'\b(el|la|los|las|es|que|de|en|con|por|para|no|un|una|se|como|su|al|del|está)\b', - 'fr': - r'\b(le|la|les|un|une|et|est|que|qui|pour|dans|pas|avec|sur|ne|vous|il|elle|des|ce|cette|je|tu|nous|vous)\b', - 'it': - r'\b(il|la|lo|un|una|che|di|da|in|per|con|non|si|mi|ti|noi|voi|lui|lei)\b', - 'pt': - r'\b(os|as|que|de|do|da|em|para|com|por|não|uma|um|se|você|também)\b', - 'nl': - r'\b(de|het|een|en|is|niet|dat|wat|je|ik|op|aan|voor|met|als|nog|zijn)\b', - 'sv': - r'\b(och|är|det|att|som|en|på|inte|har|var|men|du|jag|vi|ni|den|detta)\b', - 'pl': - r'\b(na|się|nie|jest|to|że|do|od|dla|czy|tak|ale|ma|jak|on|ona|my)\b', - 'sk': r'\b(je|na|so|že|do|od|za|si|to|ten|tá|tí|ako|má|nie|som|sa)\b', - 'sl': r'\b(in|je|na|se|da|za|od|ne|to|ta|so|kako|bo|sem|si)\b', - 'hu': - r'\b(az|és|nem|van|volt|hogy|mit|mire|ki|mi|ez|azért|is|de|ha|te|ő|mi|itt)\b', - }; - - final scores = {}; - for (final entry in patterns.entries) { - scores[entry.key] = RegExp( - entry.value, - caseSensitive: false, - ).allMatches(lower).length; - } - - final sorted = scores.entries.toList() - ..sort((a, b) => b.value.compareTo(a.value)); - if (sorted.isEmpty || sorted.first.value == 0) { - return null; - } - if (sorted.length > 1 && sorted.first.value == sorted[1].value) { - return null; - } - - return sorted.first.key; - } - String _languageLabel(String code) { for (final option in supportedTranslationLanguages) { if (option.code == code) { @@ -654,6 +632,10 @@ class TranslationService extends ChangeNotifier { final completer = Completer(); _setBusy(true); _queue = _queue.then((_) async { + if (_disposed) { + completer.completeError(StateError('TranslationService disposed.')); + return; + } try { completer.complete(await action()); } catch (error, stackTrace) { @@ -671,17 +653,24 @@ class TranslationService extends ChangeNotifier { throw const TranslationDownloadCancelled(); } _downloadedBytes += chunk.length; - notifyListeners(); + _notify(); yield chunk; } } + void _notify() { + if (_disposed) { + return; + } + notifyListeners(); + } + void _setBusy(bool value) { if (_isBusy == value) { return; } _isBusy = value; - notifyListeners(); + _notify(); } void _setDownloading(bool value) { @@ -692,11 +681,12 @@ class TranslationService extends ChangeNotifier { _downloadTotalBytes = null; _downloadFileName = null; } - notifyListeners(); + _notify(); } @override void dispose() { + _disposed = true; final engine = _engine; _engine = null; _loadedModelPath = null; diff --git a/lib/services/usb_serial_service_native.dart b/lib/services/usb_serial_service_native.dart index 9c8af85e..1976de94 100644 --- a/lib/services/usb_serial_service_native.dart +++ b/lib/services/usb_serial_service_native.dart @@ -33,12 +33,14 @@ class UsbSerialService { String? _connectedPortLabel; FlSerial? _serial; AppDebugLogService? _debugLogService; + Object? _lastError; UsbSerialStatus get status => _status; String? get activePortKey => _connectedPortKey; String? get activePortDisplayLabel => _connectedPortLabel ?? _connectedPortKey; Stream get frameStream => _frameController.stream; + Object? get lastError => _lastError; bool get _useAndroidUsbHost => !kIsWeb && defaultTargetPlatform == TargetPlatform.android; bool get _useDesktopFlSerial => @@ -434,6 +436,7 @@ class UsbSerialService { } void _addFrameError(Object error, [StackTrace? stackTrace]) { + _lastError = error; if (_frameController.isClosed) { return; } diff --git a/lib/services/usb_serial_service_web.dart b/lib/services/usb_serial_service_web.dart index 5261308d..2429187a 100644 --- a/lib/services/usb_serial_service_web.dart +++ b/lib/services/usb_serial_service_web.dart @@ -15,6 +15,18 @@ class UsbSerialService { static const Map _knownUsbNames = { '2886:1667': 'Seeed Wio Tracker L1', }; + + /// USB-to-UART bridge chips whose hardware auto-reset circuit requires DTR + /// to be held asserted after open (otherwise the MCU resets). Native-USB-CDC + /// boards (nRF52840/Adafruit 0x239A, Espressif native 0x303A, Seeed 0x2886) + /// tie DTR to the bootloader/reset line, so asserting it re-enumerates and + /// drops the device ("The device has been lost"); they must be left alone. + static const Set _uartBridgeVendorIds = { + 0x10C4, // Silicon Labs CP210x + 0x1A86, // QinHeng CH340 / CH9102 + 0x0403, // FTDI + 0x067B, // Prolific PL2303 + }; static final Map _deviceNamesByPortKey = {}; static final Map _baseLabelsByPortKey = {}; static final Map _authorizedPortsByKey = @@ -34,12 +46,14 @@ class UsbSerialService { String _requestPortLabel = 'Choose USB Device'; String _fallbackDeviceName = 'Web Serial Device'; AppDebugLogService? _debugLogService; + Object? _lastError; UsbSerialStatus get status => _status; String? get activePortKey => _connectedPortKey; String? get activePortDisplayLabel => _connectedPortName ?? _connectedPortKey; Stream get frameStream => _frameController.stream; bool get isConnected => _status == UsbSerialStatus.connected; + Object? get lastError => _lastError; JSObject get _navigator => JSObject.fromInteropObject(web.window.navigator); bool get _isSupported => _navigator.has('serial'); @@ -74,6 +88,7 @@ class UsbSerialService { } _status = UsbSerialStatus.connecting; + _lastError = null; _frameDecoder.reset(); try { @@ -282,16 +297,30 @@ class UsbSerialService { ..['flowControl'] = 'none'.toJS; await port.callMethod>('open'.toJS, options).toDart; - // Prevent ESP32 USB-CDC reset: hold DTR=true, RTS=false after open. - try { - final signals = JSObject() - ..['dataTerminalReady'] = true.toJS - ..['requestToSend'] = false.toJS; - await port - .callMethod>('setSignals'.toJS, signals) - .toDart; - } catch (_) { - // setSignals may not be supported on all browsers/devices. + // Only UART-bridge chips (CP210x/CH340/FTDI/PL2303) need DTR held high to + // avoid the auto-reset circuit firing on open. Native-USB-CDC boards + // (e.g. nRF52840/Adafruit) tie DTR to the reset line — toggling it there + // re-enumerates the device and Web Serial reports "The device has been + // lost". Leave their signals untouched. + final vendorId = _portInfo(port)?.usbVendorId; + final isUartBridge = + vendorId != null && _uartBridgeVendorIds.contains(vendorId); + _debugLogService?.info( + 'Open: vendorId=${vendorId == null ? 'unknown' : '0x${vendorId.toRadixString(16)}'} ' + 'uartBridge=$isUartBridge (DTR ${isUartBridge ? 'asserted' : 'left default'})', + tag: 'USB Serial', + ); + if (isUartBridge) { + try { + final signals = JSObject() + ..['dataTerminalReady'] = true.toJS + ..['requestToSend'] = false.toJS; + await port + .callMethod>('setSignals'.toJS, signals) + .toDart; + } catch (_) { + // setSignals may not be supported on all browsers/devices. + } } } @@ -384,13 +413,21 @@ class UsbSerialService { } catch (error, stackTrace) { _debugLogService?.error('_pumpReads error: $error', tag: 'USB Serial'); if (_status == UsbSerialStatus.connected) { + // The transport is dead — reflect that in status immediately so a + // concurrent connect handshake fails fast instead of waiting for a + // SELF_INFO that can never arrive. + _status = UsbSerialStatus.disconnected; + _lastError = error; _addFrameError(error, stackTrace); } } finally { _debugLogService?.info('_pumpReads: ended', tag: 'USB Serial'); _releaseLock(reader); if (_status == UsbSerialStatus.connected && identical(reader, _reader)) { - _addFrameError(StateError('USB serial connection closed')); + _status = UsbSerialStatus.disconnected; + final closedError = StateError('USB serial connection closed'); + _lastError = closedError; + _addFrameError(closedError); } } } diff --git a/lib/theme/mesh_theme.dart b/lib/theme/mesh_theme.dart index 7c35d57c..fcb15b1b 100644 --- a/lib/theme/mesh_theme.dart +++ b/lib/theme/mesh_theme.dart @@ -1,70 +1,113 @@ +import 'package:flutter/cupertino.dart' show CupertinoPageTransitionsBuilder; import 'package:flutter/material.dart'; -/// MeshCore redesign palette — warm field-journal dark theme with -/// phosphor-green signal accents. Mirrors values from the redesign spec. +/// MeshCore palette — high-contrast slate surfaces with sky-blue accents. class MeshPalette { MeshPalette._(); - // Surfaces (warm near-black, olive undertone) - static const bg = Color(0xFF0F1412); - static const bg1 = Color(0xFF161C19); - static const bg2 = Color(0xFF1D2521); - static const bg3 = Color(0xFF28322D); - static const bg4 = Color(0xFF34403A); + // Surfaces shared with the map overlays and navigation. + static const bg = Color(0xFF0B1220); + static const bg1 = Color(0xFF0F172A); + static const bg2 = Color(0xFF162033); + static const bg3 = Color(0xFF1E293B); + static const bg4 = Color(0xFF334155); // Lines - static const line = Color(0xFF232C28); - static const line2 = Color(0xFF34403A); - static const line3 = Color(0xFF48564F); + static const line = Color(0xFF1E293B); + static const line2 = Color(0xFF334155); + static const line3 = Color(0xFF475569); // Ink - static const ink = Color(0xFFEFF3E8); - static const ink2 = Color(0xFFBAC4B5); - static const ink3 = Color(0xFF7C8B82); - static const ink4 = Color(0xFF55635B); + static const ink = Color(0xFFF8FAFC); + static const ink2 = Color(0xFFCBD5E1); + static const ink3 = Color(0xFF94A3B8); + static const ink4 = Color(0xFF64748B); - // Signal (phosphor) - static const signal = Color(0xFF7BEFA8); - static const signalDim = Color(0xFF4DC580); - static const signalBg = Color(0x177BEFA8); // ~9% alpha - static const signalLine = Color(0x427BEFA8); // ~26% - static const signalGlow = Color(0x597BEFA8); // ~35% + // Signal-quality green (used only for SNR coloring, not UI chrome) + static const signal = Color(0xFF22C55E); + static const signalDim = Color(0xFF16A34A); - // Warn (ember) - static const warn = Color(0xFFFFA552); - static const warnDim = Color(0xFFC27E3C); - static const warnBg = Color(0x1CFFA552); - static const warnLine = Color(0x4DFFA552); + // Warn + static const warn = Color(0xFFF59E0B); + static const warnDim = Color(0xFFD97706); + static const warnBg = Color(0x1FF59E0B); + static const warnLine = Color(0x66F59E0B); - // Alert (coral) - static const alert = Color(0xFFFF6A5C); - static const alertBg = Color(0x1CFF6A5C); - static const alertLine = Color(0x52FF6A5C); + // Alert + static const alert = Color(0xFFEF4444); + static const alertBg = Color(0x1FEF4444); + static const alertLine = Color(0x66EF4444); - // Blue (dusk sky) - static const blue = Color(0xFF7FCBF5); - static const blueBg = Color(0x1C7FCBF5); - static const blueLine = Color(0x477FCBF5); + // Blue — primary map/app accent + static const blue = Color(0xFF0EA5E9); + static const blueDim = Color(0xFF0284C7); + static const blueBg = Color(0x290EA5E9); + static const blueLine = Color(0x800EA5E9); // Magenta static const magenta = Color(0xFFDE7FDB); static const magentaBg = Color(0x1CDE7FDB); static const magentaLine = Color(0x47DE7FDB); - // Me bubble (mossy) - static const me = Color(0xFF1E3527); - static const meBorder = Color(0xFF2D5039); - static const meInk = Color(0xFFDEF0DC); + // Me bubble (dusk blue) + static const me = Color(0xFF0C4A6E); + static const meBorder = Color(0xFF0369A1); + static const meInk = Color(0xFFF0F9FF); // ── Light variant (used when user explicitly picks light theme) - static const lightBg = Color(0xFFF5F3EC); - static const lightBg1 = Color(0xFFECE9DF); - static const lightBg2 = Color(0xFFE2DED2); - static const lightLine = Color(0xFFCAC5B4); - static const lightInk = Color(0xFF0F1410); - static const lightInk2 = Color(0xFF3D463E); - static const lightInk3 = Color(0xFF6A756D); - static const lightSignal = Color(0xFF1A7A44); + static const lightBg = Color(0xFFF4F6F8); + static const lightBg1 = Color(0xFFEAEEF2); + static const lightBg2 = Color(0xFFDFE5EA); + static const lightLine = Color(0xFFC3CCD4); + static const lightInk = Color(0xFF10161B); + static const lightInk2 = Color(0xFF3C4853); + static const lightInk3 = Color(0xFF69767F); + static const lightBlue = Color(0xFF2F6EA8); +} + +/// High-contrast semantic colors for UI rendered over variable map tiles. +class MapPalette { + MapPalette._(); + + static const online = Color(0xFF22C55E); + static const offline = Color(0xFF6B7280); + static const stale = Color(0xFFF59E0B); + static const repeater = Color(0xFF2563EB); + static const router = Color(0xFF7C3AED); + static const batteryLow = Color(0xFFEF4444); + static const cluster = Color(0xFFF97316); + static const selected = Color(0xFF0EA5E9); + static const sensor = Color(0xFF0F766E); + static const shared = Color(0xFF0369A1); + + static const panelLight = Color(0xF0FFFFFF); + static const panelDark = Color(0xF50B1220); + static const textPrimary = Color(0xFFF8FAFC); + static const textSecondary = Color(0xFFCBD5E1); + static const textMuted = Color(0xFF94A3B8); + static const border = Color(0x5264758B); + static const markerOutline = Colors.white; + static const markerShadow = Color(0xB3000000); +} + +/// High-contrast colors for line-of-sight maps and elevation profiles. +class LosPalette { + LosPalette._(); + + static const terrain = Color(0xFFA3E635); + static const beam = Color(0xFF38BDF8); + static const horizon = Color(0xFFFBBF24); + static const blocked = Color(0xFFEF4444); + static const marginal = Color(0xFFF59E0B); + static const clear = Color(0xFF22C55E); + static const selected = Color(0xFF0EA5E9); + static const chartBackground = Color(0xFF0B1220); + static const panelDark = Color(0xF00F172A); + static const panelLight = Color(0xF5FFFFFF); + static const text = Color(0xFFF8FAFC); + static const textMuted = Color(0xFFCBD5E1); + static const border = Color(0x5264758B); + static const shadow = Color(0x99000000); } /// Named font stacks — Flutter falls back to system fonts when the named @@ -75,6 +118,7 @@ class MeshFonts { static const sans = 'Inter'; static const mono = 'JetBrains Mono'; static const display = 'Instrument Serif'; + static const emoji = 'Noto Color Emoji'; static const List sansFallback = [ 'system-ui', @@ -96,6 +140,11 @@ class MeshFonts { 'Times New Roman', 'serif', ]; + static const List emojiFallback = [ + 'Apple Color Emoji', + 'Segoe UI Emoji', + 'Noto Emoji', + ]; } /// Radii used consistently across the app. @@ -115,18 +164,22 @@ class MeshTheme { static ThemeData dark() { const scheme = ColorScheme.dark( - primary: MeshPalette.signal, - onPrimary: Color(0xFF0A1810), - primaryContainer: MeshPalette.signalBg, - onPrimaryContainer: MeshPalette.signal, - secondary: MeshPalette.blue, - onSecondary: Color(0xFF0A1520), - tertiary: MeshPalette.magenta, - onTertiary: Color(0xFF201020), + primary: MeshPalette.blue, + onPrimary: Colors.white, + primaryContainer: Color(0xFF075985), + onPrimaryContainer: Colors.white, + secondary: MeshPalette.magenta, + onSecondary: Colors.white, + secondaryContainer: Color(0xFF331A33), + onSecondaryContainer: Colors.white, + tertiary: MeshPalette.warn, + onTertiary: Color(0xFF0B1220), + tertiaryContainer: Color(0xFF78350F), + onTertiaryContainer: Colors.white, error: MeshPalette.alert, - onError: Color(0xFF1A0A08), - errorContainer: MeshPalette.alertBg, - onErrorContainer: MeshPalette.alert, + onError: Colors.white, + errorContainer: Color(0xFF7F1D1D), + onErrorContainer: Colors.white, surface: MeshPalette.bg, onSurface: MeshPalette.ink, surfaceContainerLowest: MeshPalette.bg, @@ -141,33 +194,39 @@ class MeshTheme { scrim: Colors.black54, inverseSurface: MeshPalette.ink, onInverseSurface: MeshPalette.bg, - inversePrimary: MeshPalette.signalDim, + inversePrimary: MeshPalette.blueDim, ); return _build(scheme, Brightness.dark); } static ThemeData light() { const scheme = ColorScheme.light( - primary: MeshPalette.lightSignal, + primary: MeshPalette.lightBlue, onPrimary: Colors.white, - primaryContainer: Color(0xFFD4E8D8), - onPrimaryContainer: MeshPalette.lightSignal, - secondary: Color(0xFF2F6EA8), + primaryContainer: Color(0xFFD3E4F5), + onPrimaryContainer: Color(0xFF12354F), + secondary: Color(0xFF8C4A8A), onSecondary: Colors.white, - tertiary: Color(0xFF8C4A8A), + secondaryContainer: Color(0xFFEFD6EE), + onSecondaryContainer: Color(0xFF3D1A3C), + tertiary: Color(0xFF9A5B16), onTertiary: Colors.white, + tertiaryContainer: Color(0xFFF8E3C9), + onTertiaryContainer: Color(0xFF4A2A05), error: Color(0xFFB53D2F), onError: Colors.white, + errorContainer: Color(0xFFF6D9D4), + onErrorContainer: Color(0xFF5C1A12), surface: MeshPalette.lightBg, onSurface: MeshPalette.lightInk, surfaceContainerLowest: MeshPalette.lightBg, surfaceContainerLow: MeshPalette.lightBg1, surfaceContainer: MeshPalette.lightBg1, surfaceContainerHigh: MeshPalette.lightBg2, - surfaceContainerHighest: Color(0xFFD5D0C0), + surfaceContainerHighest: Color(0xFFD2DAE1), onSurfaceVariant: MeshPalette.lightInk2, outline: MeshPalette.lightLine, - outlineVariant: Color(0xFFDBD6C6), + outlineVariant: Color(0xFFD8DEE5), ); return _build(scheme, Brightness.light); } @@ -327,9 +386,9 @@ class MeshTheme { padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6), ), navigationBarTheme: NavigationBarThemeData( - backgroundColor: scheme.surfaceContainerLow, + backgroundColor: scheme.surface, surfaceTintColor: Colors.transparent, - indicatorColor: scheme.primary.withValues(alpha: 0.14), + indicatorColor: scheme.primary, indicatorShape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(MeshRadii.md), ), @@ -341,13 +400,13 @@ class MeshTheme { fontSize: 10, fontWeight: selected ? FontWeight.w700 : FontWeight.w500, letterSpacing: 0.1, - color: selected ? scheme.primary : scheme.onSurfaceVariant, + color: selected ? scheme.onPrimary : scheme.onSurfaceVariant, ); }), iconTheme: WidgetStateProperty.resolveWith((states) { final selected = states.contains(WidgetState.selected); return IconThemeData( - color: selected ? scheme.primary : scheme.onSurfaceVariant, + color: selected ? scheme.onPrimary : scheme.onSurfaceVariant, size: 22, ); }), @@ -386,6 +445,106 @@ class MeshTheme { ), iconTheme: IconThemeData(color: scheme.onSurfaceVariant, size: 22), splashFactory: InkSparkle.splashFactory, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: FadeForwardsPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + TargetPlatform.linux: FadeForwardsPageTransitionsBuilder(), + TargetPlatform.macOS: FadeForwardsPageTransitionsBuilder(), + TargetPlatform.windows: FadeForwardsPageTransitionsBuilder(), + }, + ), + segmentedButtonTheme: SegmentedButtonThemeData( + style: SegmentedButton.styleFrom( + selectedBackgroundColor: scheme.primary.withValues(alpha: 0.16), + selectedForegroundColor: scheme.primary, + side: BorderSide(color: scheme.outlineVariant), + textStyle: const TextStyle( + fontFamily: MeshFonts.sans, + fontFamilyFallback: MeshFonts.sansFallback, + fontSize: 13, + fontWeight: FontWeight.w600, + ), + ), + ), + switchTheme: SwitchThemeData( + thumbColor: WidgetStateProperty.resolveWith( + (states) => states.contains(WidgetState.selected) + ? scheme.onPrimary + : scheme.onSurfaceVariant, + ), + trackColor: WidgetStateProperty.resolveWith( + (states) => states.contains(WidgetState.selected) + ? scheme.primary + : scheme.surfaceContainerHighest, + ), + trackOutlineColor: WidgetStateProperty.resolveWith( + (states) => states.contains(WidgetState.selected) + ? Colors.transparent + : scheme.outline, + ), + ), + sliderTheme: SliderThemeData( + activeTrackColor: scheme.primary, + inactiveTrackColor: scheme.surfaceContainerHighest, + thumbColor: scheme.primary, + overlayColor: scheme.primary.withValues(alpha: 0.12), + valueIndicatorColor: scheme.surfaceContainerHighest, + valueIndicatorTextStyle: TextStyle( + fontFamily: MeshFonts.mono, + fontFamilyFallback: MeshFonts.monoFallback, + color: scheme.onSurface, + fontSize: 12, + ), + trackHeight: 3, + ), + tabBarTheme: TabBarThemeData( + labelColor: scheme.primary, + unselectedLabelColor: scheme.onSurfaceVariant, + indicatorColor: scheme.primary, + dividerColor: scheme.outlineVariant, + labelStyle: const TextStyle( + fontFamily: MeshFonts.sans, + fontFamilyFallback: MeshFonts.sansFallback, + fontSize: 13.5, + fontWeight: FontWeight.w700, + ), + unselectedLabelStyle: const TextStyle( + fontFamily: MeshFonts.sans, + fontFamilyFallback: MeshFonts.sansFallback, + fontSize: 13.5, + fontWeight: FontWeight.w500, + ), + ), + progressIndicatorTheme: ProgressIndicatorThemeData( + color: scheme.primary, + linearTrackColor: scheme.surfaceContainerHigh, + circularTrackColor: Colors.transparent, + ), + tooltipTheme: TooltipThemeData( + decoration: BoxDecoration( + color: scheme.surfaceContainerHighest, + borderRadius: BorderRadius.circular(MeshRadii.sm), + border: Border.all(color: scheme.outline), + ), + textStyle: TextStyle(color: scheme.onSurface, fontSize: 12), + ), + filledButtonTheme: FilledButtonThemeData( + style: FilledButton.styleFrom( + backgroundColor: scheme.primary, + foregroundColor: scheme.onPrimary, + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 14), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(MeshRadii.pill), + ), + textStyle: const TextStyle( + fontFamily: MeshFonts.sans, + fontFamilyFallback: MeshFonts.sansFallback, + fontWeight: FontWeight.w600, + fontSize: 14, + ), + ), + ), ); } @@ -436,6 +595,16 @@ class MeshTheme { ); } + /// Color-emoji style with platform fallbacks and stable vertical metrics. + static TextStyle emoji({double fontSize = 28}) { + return TextStyle( + fontFamily: MeshFonts.emoji, + fontFamilyFallback: MeshFonts.emojiFallback, + fontSize: fontSize, + height: 1, + ); + } + /// Color-code an SNR value for consistency across the app. static Color snrColor(num? snr, {required bool blocked}) { if (blocked) return MeshPalette.alert; diff --git a/lib/widgets/battery_indicator.dart b/lib/widgets/battery_indicator.dart index ccea59dd..9a74d7d5 100644 --- a/lib/widgets/battery_indicator.dart +++ b/lib/widgets/battery_indicator.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import '../connector/meshcore_connector.dart'; +import '../theme/mesh_theme.dart'; class BatteryUi { final IconData icon; @@ -10,19 +11,19 @@ class BatteryUi { BatteryUi batteryUiForPercent(int? percent) { if (percent == null) { - return const BatteryUi(Icons.battery_unknown, Colors.grey); + return const BatteryUi(Icons.battery_unknown, null); } final p = percent.clamp(0, 100); return switch (p) { - <= 5 => const BatteryUi(Icons.battery_alert, Colors.redAccent), - <= 15 => const BatteryUi(Icons.battery_0_bar, Colors.redAccent), - <= 30 => const BatteryUi(Icons.battery_1_bar, Colors.orange), - <= 45 => const BatteryUi(Icons.battery_2_bar, Colors.amber), - <= 60 => const BatteryUi(Icons.battery_3_bar, Colors.lightGreen), - <= 80 => const BatteryUi(Icons.battery_5_bar, Colors.green), - _ => const BatteryUi(Icons.battery_full, Colors.green), + <= 5 => const BatteryUi(Icons.battery_alert, MeshPalette.alert), + <= 15 => const BatteryUi(Icons.battery_0_bar, MeshPalette.alert), + <= 30 => const BatteryUi(Icons.battery_1_bar, MeshPalette.warn), + <= 45 => const BatteryUi(Icons.battery_2_bar, MeshPalette.warn), + <= 60 => const BatteryUi(Icons.battery_3_bar, null), + <= 80 => const BatteryUi(Icons.battery_5_bar, null), + _ => const BatteryUi(Icons.battery_full, MeshPalette.signal), }; } @@ -76,9 +77,9 @@ class _BatteryIndicatorState extends State { Flexible( child: Text( displayText, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w500, + style: MeshTheme.mono( + fontSize: 11, + fontWeight: FontWeight.w600, color: batteryUi.color, ), maxLines: 1, diff --git a/lib/widgets/byte_count_input.dart b/lib/widgets/byte_count_input.dart index ca432522..91f638b8 100644 --- a/lib/widgets/byte_count_input.dart +++ b/lib/widgets/byte_count_input.dart @@ -86,7 +86,7 @@ class ByteCountedTextField extends StatelessWidget { final counterColor = ratio > errorThreshold ? Theme.of(context).colorScheme.error : ratio > warningThreshold - ? Colors.orange + ? Theme.of(context).colorScheme.tertiary : Theme.of(context).colorScheme.onSurfaceVariant; return Column( @@ -118,8 +118,9 @@ class ByteCountedTextField extends StatelessWidget { textInputAction: textInputAction, onSubmitted: onSubmitted, ), - if (showCounter) - Padding( + Opacity( + opacity: showCounter ? 1 : 0, + child: Padding( padding: const EdgeInsets.only(top: 4, right: 4), child: Align( alignment: Alignment.centerRight, @@ -129,6 +130,7 @@ class ByteCountedTextField extends StatelessWidget { ), ), ), + ), ], ); }, diff --git a/lib/widgets/device_tile.dart b/lib/widgets/device_tile.dart index 3f30b38e..3763b78a 100644 --- a/lib/widgets/device_tile.dart +++ b/lib/widgets/device_tile.dart @@ -1,14 +1,27 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; + import '../l10n/l10n.dart'; +import '../theme/mesh_theme.dart'; +import 'mesh_ui.dart'; import 'signal_ui.dart'; -/// A reusable tile widget for displaying a MeshCore device in a list +/// A MeshCard-based row for displaying a scanned BLE device. +/// Shows an AvatarCircle (router icon, deterministic hue from device name), +/// device name, mono MAC address, mono RSSI dBm, and SignalBars on the right. +/// While connecting, shows a small progress ring instead of signal bars. class DeviceTile extends StatelessWidget { final ScanResult scanResult; - final VoidCallback onTap; + final VoidCallback? onTap; + final bool isConnecting; - const DeviceTile({super.key, required this.scanResult, required this.onTap}); + const DeviceTile({ + super.key, + required this.scanResult, + required this.onTap, + this.isConnecting = false, + }); @override Widget build(BuildContext context) { @@ -17,23 +30,12 @@ class DeviceTile extends StatelessWidget { final name = device.platformName.isNotEmpty ? device.platformName : scanResult.advertisementData.advName; + final displayName = name.isNotEmpty + ? name + : context.l10n.common_unknownDevice; + final mac = device.remoteId.toString(); + final scheme = Theme.of(context).colorScheme; - return ListTile( - leading: _buildSignalIcon(rssi), - title: Text( - name.isNotEmpty ? name : context.l10n.common_unknownDevice, - style: const TextStyle(fontWeight: FontWeight.w500), - ), - subtitle: Text(device.remoteId.toString()), - trailing: ElevatedButton( - onPressed: onTap, - child: Text(context.l10n.common_connect), - ), - onTap: onTap, - ); - } - - Widget _buildSignalIcon(int rssi) { final tier = rssi >= -60 ? 0 : rssi >= -70 @@ -45,15 +47,70 @@ class DeviceTile extends StatelessWidget { : 4; final signalUi = signalUiForStrengthTier(tier); - return Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon(signalUi.icon, color: signalUi.color), - Text( - '$rssi dBm', - style: TextStyle(fontSize: 10, color: signalUi.color), - ), - ], + return MeshCard( + onTap: onTap == null + ? null + : () { + HapticFeedback.selectionClick(); + onTap!(); + }, + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12), + child: Row( + children: [ + AvatarCircle(name: displayName, size: 42, icon: Icons.router), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + displayName, + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + color: scheme.onSurface, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + const SizedBox(height: 3), + Text( + mac, + style: MeshTheme.mono( + fontSize: 11, + color: scheme.onSurfaceVariant, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ], + ), + ), + const SizedBox(width: 12), + if (isConnecting) + SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator( + strokeWidth: 2, + color: scheme.primary, + ), + ) + else + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Icon(signalUi.icon, size: 16, color: signalUi.color), + const SizedBox(height: 3), + Text( + '$rssi dBm', + style: MeshTheme.mono(fontSize: 10, color: signalUi.color), + ), + ], + ), + ], + ), ); } } diff --git a/lib/widgets/elements_ui.dart b/lib/widgets/elements_ui.dart index 0c462499..a4995c73 100644 --- a/lib/widgets/elements_ui.dart +++ b/lib/widgets/elements_ui.dart @@ -29,31 +29,65 @@ class FeatureToggleRow extends StatefulWidget { class _FeatureToggleRow extends State { @override Widget build(BuildContext context) { - return Row( - children: [ - Expanded( - child: SwitchListTile( - title: Text(widget.title), - subtitle: Text(widget.subtitle), - value: widget.value, - onChanged: widget.onChanged, - contentPadding: EdgeInsets.zero, + final scheme = Theme.of(context).colorScheme; + final textTheme = Theme.of(context).textTheme; + + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.title, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 2), + Text( + widget.subtitle, + style: textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ], + ), ), - ), - if (widget.hasRefreshing) - IconButton( - icon: widget.isRefreshing - ? const SizedBox( - width: 18, - height: 18, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.refresh, size: 20), - onPressed: widget.isRefreshing ? null : widget.onRefresh, - tooltip: widget.refreshTooltip, - visualDensity: VisualDensity.compact, + const SizedBox(width: 8), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Switch(value: widget.value, onChanged: widget.onChanged), + if (widget.hasRefreshing) ...[ + const SizedBox(width: 4), + widget.isRefreshing + ? SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator( + strokeWidth: 1.8, + color: scheme.primary, + ), + ) + : IconButton( + icon: const Icon(Icons.refresh, size: 18), + onPressed: widget.onRefresh, + tooltip: widget.refreshTooltip, + visualDensity: VisualDensity.compact, + padding: EdgeInsets.zero, + constraints: const BoxConstraints( + minWidth: 32, + minHeight: 32, + ), + ), + ], + ], ), - ], + ], + ), ); } } diff --git a/lib/widgets/emoji_picker.dart b/lib/widgets/emoji_picker.dart index 87fd1c9c..3a8fdf79 100644 --- a/lib/widgets/emoji_picker.dart +++ b/lib/widgets/emoji_picker.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import '../l10n/app_localizations.dart'; import '../l10n/l10n.dart'; +import '../theme/mesh_theme.dart'; class EmojiPicker extends StatelessWidget { final Function(String) onEmojiSelected; @@ -257,7 +258,11 @@ class EmojiPicker extends StatelessWidget { ), child: Text( emoji, - style: const TextStyle(fontSize: 28), + style: MeshTheme.emoji(), + textHeightBehavior: const TextHeightBehavior( + applyHeightToFirstAscent: false, + applyHeightToLastDescent: false, + ), ), ), ), @@ -298,7 +303,12 @@ class EmojiPicker extends StatelessWidget { child: Center( child: Text( emojis[index], - style: const TextStyle(fontSize: 28), + style: MeshTheme.emoji(), + textHeightBehavior: + const TextHeightBehavior( + applyHeightToFirstAscent: false, + applyHeightToLastDescent: false, + ), ), ), ), diff --git a/lib/widgets/empty_state.dart b/lib/widgets/empty_state.dart index 172c9a4e..2f0c9847 100644 --- a/lib/widgets/empty_state.dart +++ b/lib/widgets/empty_state.dart @@ -1,7 +1,9 @@ import 'package:flutter/material.dart'; /// A centered empty state display with icon, title, and optional subtitle/action. -class EmptyState extends StatelessWidget { +/// Features a tinted icon circle, fade+slide entrance animation, and clear +/// typography hierarchy using the MeshCore design system. +class EmptyState extends StatefulWidget { final IconData icon; final String title; final String? subtitle; @@ -15,25 +17,97 @@ class EmptyState extends StatelessWidget { this.action, }); + @override + State createState() => _EmptyStateState(); +} + +class _EmptyStateState extends State + with SingleTickerProviderStateMixin { + late final AnimationController _controller = AnimationController( + vsync: this, + duration: const Duration(milliseconds: 420), + ); + late final CurvedAnimation _curve = CurvedAnimation( + parent: _controller, + curve: Curves.easeOutCubic, + ); + + @override + void initState() { + super.initState(); + _controller.forward(); + } + + @override + void dispose() { + _curve.dispose(); + _controller.dispose(); + super.dispose(); + } + @override Widget build(BuildContext context) { - return Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon(icon, size: 64, color: Colors.grey[400]), - const SizedBox(height: 16), - Text(title, style: TextStyle(fontSize: 16, color: Colors.grey[600])), - if (subtitle != null) ...[ - const SizedBox(height: 8), - Text( - subtitle!, - style: TextStyle(fontSize: 14, color: Colors.grey[500]), - textAlign: TextAlign.center, + final scheme = Theme.of(context).colorScheme; + return FadeTransition( + opacity: _curve, + child: SlideTransition( + position: Tween( + begin: const Offset(0, 0.06), + end: Offset.zero, + ).animate(_curve), + child: Center( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 40), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + width: 80, + height: 80, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: scheme.primary.withValues(alpha: 0.08), + border: Border.all( + color: scheme.primary.withValues(alpha: 0.18), + width: 1.5, + ), + ), + child: Icon( + widget.icon, + size: 36, + color: scheme.onSurfaceVariant, + ), + ), + const SizedBox(height: 20), + Text( + widget.title, + style: Theme.of(context).textTheme.titleMedium?.copyWith( + fontWeight: FontWeight.w600, + color: scheme.onSurface, + letterSpacing: -0.1, + ), + textAlign: TextAlign.center, + ), + if (widget.subtitle != null) ...[ + const SizedBox(height: 8), + Text( + widget.subtitle!, + style: TextStyle( + fontSize: 13.5, + color: scheme.onSurfaceVariant, + height: 1.45, + ), + textAlign: TextAlign.center, + ), + ], + if (widget.action != null) ...[ + const SizedBox(height: 28), + widget.action!, + ], + ], ), - ], - if (action != null) ...[const SizedBox(height: 24), action!], - ], + ), + ), ), ); } diff --git a/lib/widgets/gif_picker.dart b/lib/widgets/gif_picker.dart index 9c569512..90b6261b 100644 --- a/lib/widgets/gif_picker.dart +++ b/lib/widgets/gif_picker.dart @@ -180,7 +180,10 @@ class _GifPickerState extends State { const SizedBox(height: 8), Text( context.l10n.gifPicker_poweredBy, - style: TextStyle(fontSize: 11, color: Colors.grey[600]), + style: TextStyle( + fontSize: 11, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), ], ), @@ -197,11 +200,18 @@ class _GifPickerState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon(Icons.error_outline, size: 64, color: Colors.grey[400]), + Icon( + Icons.error_outline, + size: 64, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), const SizedBox(height: 16), Text( _error!, - style: TextStyle(fontSize: 16, color: Colors.grey[600]), + style: TextStyle( + fontSize: 16, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), const SizedBox(height: 16), ElevatedButton.icon( @@ -219,11 +229,18 @@ class _GifPickerState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon(Icons.search_off, size: 64, color: Colors.grey[400]), + Icon( + Icons.search_off, + size: 64, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), const SizedBox(height: 16), Text( context.l10n.gifPicker_noGifsFound, - style: TextStyle(fontSize: 16, color: Colors.grey[600]), + style: TextStyle( + fontSize: 16, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), ], ), diff --git a/lib/widgets/jump_to_bottom_button.dart b/lib/widgets/jump_to_bottom_button.dart index 3f6d96e2..5ce25542 100644 --- a/lib/widgets/jump_to_bottom_button.dart +++ b/lib/widgets/jump_to_bottom_button.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; + import '../helpers/chat_scroll_controller.dart'; +import '../theme/mesh_theme.dart'; class JumpToBottomButton extends StatelessWidget { final ChatScrollController scrollController; @@ -8,6 +10,7 @@ class JumpToBottomButton extends StatelessWidget { @override Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; return ValueListenableBuilder( valueListenable: scrollController.showJumpToBottom, builder: (context, show, _) { @@ -15,9 +18,33 @@ class JumpToBottomButton extends StatelessWidget { return Positioned( right: 16, bottom: 16, - child: FloatingActionButton.small( - onPressed: scrollController.jumpToBottom, - child: const Icon(Icons.keyboard_arrow_down), + child: Material( + color: Colors.transparent, + child: InkWell( + onTap: scrollController.jumpToBottom, + borderRadius: BorderRadius.circular(MeshRadii.pill), + child: Container( + width: 40, + height: 40, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: scheme.surfaceContainerHigh.withValues(alpha: 0.92), + border: Border.all(color: scheme.outlineVariant, width: 1), + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.18), + blurRadius: 8, + offset: const Offset(0, 2), + ), + ], + ), + child: Icon( + Icons.keyboard_arrow_down, + size: 22, + color: scheme.primary, + ), + ), + ), ), ); }, diff --git a/lib/widgets/mesh_ui.dart b/lib/widgets/mesh_ui.dart new file mode 100644 index 00000000..797af7a7 --- /dev/null +++ b/lib/widgets/mesh_ui.dart @@ -0,0 +1,637 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +import '../theme/mesh_theme.dart'; + +/// MeshCore shared design kit. +/// +/// Building blocks used across all screens so the app reads as one product: +/// [SectionHeader], [MeshCard], [StatusChip], [StatTile], [AvatarCircle], +/// [SignalBars], [RouteChip], [PulseDot], [BottomSheetHeader] + +/// [showMeshSheet], [ErrorRetryCard], and [ListEntrance]. + +/// Small-caps mono section label, optionally with a trailing widget. +class SectionHeader extends StatelessWidget { + final String label; + final Widget? trailing; + final EdgeInsetsGeometry padding; + + const SectionHeader( + this.label, { + super.key, + this.trailing, + this.padding = const EdgeInsets.fromLTRB(16, 20, 16, 8), + }); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + return Padding( + padding: padding, + child: Row( + children: [ + Expanded( + child: Text( + label.toUpperCase(), + style: MeshTheme.accentLabel(color: scheme.onSurfaceVariant), + overflow: TextOverflow.ellipsis, + ), + ), + ?trailing, + ], + ), + ); + } +} + +/// Bordered surface card with press feedback. The standard container for +/// grouped content and tappable list entries. +class MeshCard extends StatelessWidget { + final Widget child; + final VoidCallback? onTap; + final VoidCallback? onLongPress; + final EdgeInsetsGeometry padding; + final EdgeInsetsGeometry margin; + final Color? color; + final Color? borderColor; + final double radius; + + const MeshCard({ + super.key, + required this.child, + this.onTap, + this.onLongPress, + this.padding = const EdgeInsets.all(14), + this.margin = const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + this.color, + this.borderColor, + this.radius = MeshRadii.md, + }); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + final shape = RoundedRectangleBorder( + borderRadius: BorderRadius.circular(radius), + side: BorderSide(color: borderColor ?? scheme.outlineVariant), + ); + return Padding( + padding: margin, + child: Material( + color: color ?? scheme.surfaceContainerLow, + shape: shape, + clipBehavior: Clip.antiAlias, + child: InkWell( + onTap: onTap, + onLongPress: onLongPress == null + ? null + : () { + HapticFeedback.selectionClick(); + onLongPress!(); + }, + child: Padding(padding: padding, child: child), + ), + ), + ); + } +} + +/// Tinted pill chip for statuses: a dot or icon plus a short label. +class StatusChip extends StatelessWidget { + final String label; + final Color color; + final IconData? icon; + final bool pulse; + final double fontSize; + + const StatusChip({ + super.key, + required this.label, + required this.color, + this.icon, + this.pulse = false, + this.fontSize = 11.5, + }); + + @override + Widget build(BuildContext context) { + return Container( + padding: const EdgeInsets.symmetric(horizontal: 9, vertical: 4), + decoration: BoxDecoration( + color: color.withValues(alpha: 0.12), + borderRadius: BorderRadius.circular(MeshRadii.pill), + border: Border.all(color: color.withValues(alpha: 0.3)), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + if (icon != null) + Icon(icon, size: fontSize + 2, color: color) + else + PulseDot(color: color, size: 7, animate: pulse), + const SizedBox(width: 5), + Flexible( + child: Text( + label, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: MeshTheme.mono( + fontSize: fontSize, + fontWeight: FontWeight.w600, + color: color, + ), + ), + ), + ], + ), + ); + } +} + +/// Compact metric tile: icon, mono value (+ optional unit), small label. +class StatTile extends StatelessWidget { + final IconData icon; + final String label; + final String value; + final String? unit; + final Color? color; + final VoidCallback? onTap; + + const StatTile({ + super.key, + required this.icon, + required this.label, + required this.value, + this.unit, + this.color, + this.onTap, + }); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + final accent = color ?? scheme.primary; + return MeshCard( + onTap: onTap, + margin: EdgeInsets.zero, + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + children: [ + Icon(icon, size: 14, color: accent), + const SizedBox(width: 6), + Expanded( + child: Text( + label.toUpperCase(), + style: MeshTheme.accentLabel( + color: scheme.onSurfaceVariant, + fontSize: 9, + ), + overflow: TextOverflow.ellipsis, + ), + ), + ], + ), + const SizedBox(height: 6), + Text.rich( + TextSpan( + text: value, + style: MeshTheme.mono( + fontSize: 17, + fontWeight: FontWeight.w600, + color: scheme.onSurface, + ), + children: [ + if (unit != null) + TextSpan( + text: ' $unit', + style: MeshTheme.mono( + fontSize: 11, + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ], + ), + ); + } +} + +/// Initials avatar with a deterministic per-name hue, or a fixed [color] +/// for node-type coloring. Optional [icon] replaces initials. +class AvatarCircle extends StatelessWidget { + final String name; + final double size; + final Color? color; + final IconData? icon; + + const AvatarCircle({ + super.key, + required this.name, + this.size = 40, + this.color, + this.icon, + }); + + static const _hues = [ + MeshPalette.blue, + MeshPalette.magenta, + MeshPalette.signal, + MeshPalette.warn, + Color(0xFF8FA8F0), + Color(0xFF6FD9CE), + ]; + + Color _colorFor(String s) { + var h = 0; + for (final c in s.codeUnits) { + h = (h * 31 + c) & 0x7fffffff; + } + return _hues[h % _hues.length]; + } + + @override + Widget build(BuildContext context) { + final accent = color ?? _colorFor(name); + final initials = _initials(name); + return Container( + width: size, + height: size, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: accent.withValues(alpha: 0.14), + border: Border.all(color: accent.withValues(alpha: 0.4)), + ), + alignment: Alignment.center, + child: icon != null + ? Icon(icon, size: size * 0.5, color: accent) + : Text( + initials, + style: MeshTheme.mono( + fontSize: size * 0.36, + fontWeight: FontWeight.w700, + color: accent, + ), + ), + ); + } + + static String _initials(String name) { + final words = name + .trim() + .split(RegExp(r'\s+')) + .where((w) => w.isNotEmpty) + .toList(); + if (words.isEmpty) return '?'; + if (words.length == 1) { + return words.first.characters.take(2).toString().toUpperCase(); + } + return (words.first.characters.take(1).toString() + + words[1].characters.take(1).toString()) + .toUpperCase(); + } +} + +/// Four-bar signal strength indicator driven by an SNR value (dB), colored +/// with the shared [MeshTheme.snrColor] ramp. +class SignalBars extends StatelessWidget { + final double? snr; + final double height; + + const SignalBars({super.key, required this.snr, this.height = 14}); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + final color = MeshTheme.snrColor(snr, blocked: false); + final active = snr == null + ? 0 + : snr! > 0 + ? 4 + : snr! > -5 + ? 3 + : snr! > -12 + ? 2 + : 1; + return Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, + children: List.generate(4, (i) { + final on = i < active; + return Container( + width: 3, + height: height * (0.4 + i * 0.2), + margin: const EdgeInsets.only(right: 2), + decoration: BoxDecoration( + color: on ? color : scheme.outlineVariant, + borderRadius: BorderRadius.circular(1), + ), + ); + }), + ); + } +} + +/// Chip describing how a message was routed: direct (with hop count) vs flood. +class RouteChip extends StatelessWidget { + final bool isDirect; + final int? hops; + + const RouteChip({super.key, required this.isDirect, this.hops}); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + final label = isDirect + ? (hops == null || hops == 0 + ? 'DIRECT' + : '$hops HOP${hops == 1 ? '' : 'S'}') + : 'FLOOD'; + return Container( + padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), + decoration: BoxDecoration( + color: scheme.surfaceContainerHigh, + borderRadius: BorderRadius.circular(MeshRadii.xs), + border: Border.all(color: scheme.outlineVariant), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + isDirect ? Icons.trending_flat : Icons.podcasts, + size: 11, + color: scheme.onSurfaceVariant, + ), + const SizedBox(width: 3), + Text( + label, + style: MeshTheme.accentLabel( + color: scheme.onSurfaceVariant, + fontSize: 8.5, + ), + ), + ], + ), + ); + } +} + +/// Small status dot, optionally with a soft breathing animation. +class PulseDot extends StatefulWidget { + final Color color; + final double size; + final bool animate; + + const PulseDot({ + super.key, + required this.color, + this.size = 8, + this.animate = false, + }); + + @override + State createState() => _PulseDotState(); +} + +class _PulseDotState extends State + with SingleTickerProviderStateMixin { + // Created eagerly: a lazy `late final` initializer would run on first + // access — which can be dispose(), where ticker creation throws. + late final AnimationController _controller; + + @override + void initState() { + super.initState(); + _controller = AnimationController( + vsync: this, + duration: const Duration(milliseconds: 1400), + ); + if (widget.animate) _controller.repeat(reverse: true); + } + + @override + void didUpdateWidget(PulseDot old) { + super.didUpdateWidget(old); + if (widget.animate && !_controller.isAnimating) { + _controller.repeat(reverse: true); + } else if (!widget.animate && _controller.isAnimating) { + _controller.stop(); + _controller.value = 0; + } + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return FadeTransition( + opacity: widget.animate + ? Tween(begin: 0.35, end: 1.0).animate( + CurvedAnimation(parent: _controller, curve: Curves.easeInOut), + ) + : const AlwaysStoppedAnimation(1.0), + child: Container( + width: widget.size, + height: widget.size, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: widget.color, + boxShadow: [ + BoxShadow( + color: widget.color.withValues(alpha: 0.45), + blurRadius: widget.size * 0.7, + ), + ], + ), + ), + ); + } +} + +/// Standard modal sheet header: drag handle, title, optional subtitle and +/// trailing action, and a close button. +class BottomSheetHeader extends StatelessWidget { + final String title; + final String? subtitle; + final Widget? trailing; + + const BottomSheetHeader({ + super.key, + required this.title, + this.subtitle, + this.trailing, + }); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + return Padding( + padding: const EdgeInsets.fromLTRB(20, 8, 8, 4), + child: Column( + children: [ + Container( + width: 36, + height: 4, + margin: const EdgeInsets.only(bottom: 10), + decoration: BoxDecoration( + color: scheme.outline, + borderRadius: BorderRadius.circular(2), + ), + ), + Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: Theme.of(context).textTheme.titleMedium?.copyWith( + fontWeight: FontWeight.w700, + letterSpacing: -0.2, + ), + ), + if (subtitle != null) + Text( + subtitle!, + style: Theme.of(context).textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + ?trailing, + IconButton( + icon: const Icon(Icons.close, size: 20), + onPressed: () => Navigator.of(context).maybePop(), + ), + ], + ), + ], + ), + ); + } +} + +/// Shows a modal bottom sheet with the app-standard shape, scroll behavior +/// and safe-area handling. Pair the content with [BottomSheetHeader]. +Future showMeshSheet( + BuildContext context, { + required WidgetBuilder builder, + bool isScrollControlled = true, +}) { + return showModalBottomSheet( + context: context, + isScrollControlled: isScrollControlled, + useSafeArea: true, + showDragHandle: false, + builder: (context) => Padding( + padding: EdgeInsets.only(bottom: MediaQuery.viewInsetsOf(context).bottom), + child: builder(context), + ), + ); +} + +/// Inline error surface with an optional retry action. +class ErrorRetryCard extends StatelessWidget { + final String message; + final VoidCallback? onRetry; + final String? retryLabel; + + const ErrorRetryCard({ + super.key, + required this.message, + this.onRetry, + this.retryLabel, + }); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + return MeshCard( + color: scheme.error.withValues(alpha: 0.08), + borderColor: scheme.error.withValues(alpha: 0.35), + child: Row( + children: [ + Icon(Icons.error_outline, color: scheme.error, size: 20), + const SizedBox(width: 10), + Expanded( + child: Text( + message, + style: TextStyle(color: scheme.error, fontSize: 13), + ), + ), + if (onRetry != null) + TextButton(onPressed: onRetry, child: Text(retryLabel ?? 'Retry')), + ], + ), + ); + } +} + +/// Staggered fade + slide entrance for list items. Wrap each item and pass +/// its [index]; animation only plays once per widget lifecycle. +class ListEntrance extends StatefulWidget { + final int index; + final Widget child; + + const ListEntrance({super.key, required this.index, required this.child}); + + @override + State createState() => _ListEntranceState(); +} + +class _ListEntranceState extends State + with SingleTickerProviderStateMixin { + // Created eagerly: a lazy `late final` initializer would run on first + // access — which can be dispose(), where ticker creation throws. + late final AnimationController _controller; + late final CurvedAnimation _curve; + + @override + void initState() { + super.initState(); + _controller = AnimationController( + vsync: this, + duration: const Duration(milliseconds: 280), + ); + _curve = CurvedAnimation(parent: _controller, curve: Curves.easeOutCubic); + final delay = Duration(milliseconds: 24 * widget.index.clamp(0, 12)); + Future.delayed(delay, () { + if (mounted) _controller.forward(); + }); + } + + @override + void dispose() { + _curve.dispose(); + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return FadeTransition( + opacity: _curve, + child: SlideTransition( + position: Tween( + begin: const Offset(0, 0.04), + end: Offset.zero, + ).animate(_curve), + child: widget.child, + ), + ); + } +} diff --git a/lib/widgets/message_status_icon.dart b/lib/widgets/message_status_icon.dart index 0689f0b5..c1971c15 100644 --- a/lib/widgets/message_status_icon.dart +++ b/lib/widgets/message_status_icon.dart @@ -1,36 +1,159 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -class MessageStatusIcon extends StatelessWidget { +import '../l10n/l10n.dart'; +import '../theme/mesh_theme.dart'; + +class MessageStatusIcon extends StatefulWidget { final bool isAcked; final bool isFailed; + final bool isPending; + final bool isRepeated; final double size; + /// Base tint for the sent/sending state. On a colored (outgoing) bubble a + /// plain grey tick is nearly invisible, so callers can pass the bubble's own + /// meta/text color for contrast. Falls back to [ColorScheme.onSurfaceVariant]. + final Color? onColor; + const MessageStatusIcon({ super.key, required this.isAcked, this.isFailed = false, + this.isPending = false, + this.isRepeated = false, this.size = 14, + this.onColor, + }); + + @override + State createState() => _MessageStatusIconState(); +} + +class _MessageStatusIconState extends State + with SingleTickerProviderStateMixin { + late final AnimationController _controller; + + @override + void initState() { + super.initState(); + _controller = AnimationController( + vsync: this, + duration: const Duration(milliseconds: 1200), + ); + if (widget.isPending) _controller.repeat(); + } + + @override + void didUpdateWidget(MessageStatusIcon oldWidget) { + super.didUpdateWidget(oldWidget); + if (widget.isPending && !_controller.isAnimating) { + _controller.repeat(); + } else if (!widget.isPending && _controller.isAnimating) { + _controller + ..stop() + ..reset(); + } + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + final colorScheme = Theme.of(context).colorScheme; + final double size = widget.size; + final Color baseColor = widget.onColor ?? colorScheme.onSurfaceVariant; + + if (widget.isFailed) { + return Semantics( + label: l10n.messageStatus_failed, + child: Icon(Icons.cancel, size: size, color: colorScheme.error), + ); + } + + if (widget.isPending) { + return Semantics( + label: l10n.messageStatus_pending, + child: _SendingDots( + controller: _controller, + color: baseColor, + size: size, + ), + ); + } + + final bool delivered = widget.isAcked || widget.isRepeated; + final String label = widget.isRepeated + ? l10n.messageStatus_repeated + : widget.isAcked + ? l10n.messageStatus_delivered + : l10n.messageStatus_sent; + // Use palette colors: tertiary (warn/amber) for acked/repeated, base for sent. + final Color color = delivered + ? MeshPalette.signal.withValues(alpha: 0.9) + : baseColor; + + return Semantics( + label: label, + child: delivered + ? SvgPicture.asset( + 'assets/icons/done_all.svg', + width: size, + height: size, + colorFilter: ColorFilter.mode(color, BlendMode.srcIn), + ) + : Icon(Icons.done, size: size, color: color), + ); + } +} + +/// Three dots that pulse left-to-right while a message is in flight. +class _SendingDots extends StatelessWidget { + final AnimationController controller; + final Color color; + final double size; + + const _SendingDots({ + required this.controller, + required this.color, + required this.size, }); @override Widget build(BuildContext context) { - if (isFailed) { - return Icon(Icons.cancel, size: size, color: Colors.red); - } - - final Color color; - if (isAcked) { - color = Colors.green; - } else { - color = Colors.grey; - } - - return SvgPicture.asset( - 'assets/icons/done_all.svg', - width: size, + final double dot = (size * 0.24).clamp(2.0, 4.0); + return SizedBox( height: size, - colorFilter: ColorFilter.mode(color, BlendMode.srcIn), + child: AnimatedBuilder( + animation: controller, + builder: (context, _) { + return Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: List.generate(3, (i) { + final double phase = (controller.value - i * 0.18) % 1.0; + final double t = phase < 0.5 ? phase * 2 : (1 - phase) * 2; + final double opacity = 0.25 + 0.75 * t.clamp(0.0, 1.0); + return Padding( + padding: EdgeInsets.symmetric(horizontal: dot * 0.28), + child: Container( + width: dot, + height: dot, + decoration: BoxDecoration( + color: color.withValues(alpha: opacity), + shape: BoxShape.circle, + ), + ), + ); + }), + ); + }, + ), ); } } diff --git a/lib/widgets/path_editor_sheet.dart b/lib/widgets/path_editor_sheet.dart new file mode 100644 index 00000000..ee6ba006 --- /dev/null +++ b/lib/widgets/path_editor_sheet.dart @@ -0,0 +1,376 @@ +import 'dart:typed_data'; + +import 'package:flutter/material.dart'; + +import '../connector/meshcore_protocol.dart'; +import '../helpers/path_helper.dart'; +import '../l10n/contact_localization.dart'; +import '../l10n/l10n.dart'; +import '../models/contact.dart'; + +class PathEditorSheet extends StatefulWidget { + final List availableContacts; + final List initialPath; + + const PathEditorSheet({ + super.key, + required this.availableContacts, + this.initialPath = const [], + }); + + static Future show( + BuildContext context, { + required List availableContacts, + List initialPath = const [], + }) { + return showModalBottomSheet( + context: context, + isScrollControlled: true, + useSafeArea: true, + builder: (context) => Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom, + ), + child: FractionallySizedBox( + heightFactor: 0.9, + child: PathEditorSheet( + availableContacts: availableContacts, + initialPath: initialPath, + ), + ), + ), + ); + } + + @override + State createState() => _PathEditorSheetState(); +} + +class _Hop { + final int id; + final int byte; + + const _Hop(this.id, this.byte); +} + +class _PathEditorSheetState extends State { + static const int _maxHops = 64; + + final List<_Hop> _hops = []; + final _hexController = TextEditingController(); + String? _hexError; + bool _syncingHex = false; + String _search = ''; + int _nextHopId = 0; + + @override + void initState() { + super.initState(); + for (final byte in widget.initialPath) { + _hops.add(_Hop(_nextHopId++, byte)); + } + _syncHexFromHops(); + } + + @override + void dispose() { + _hexController.dispose(); + super.dispose(); + } + + List get _repeaters { + final query = _search.trim().toLowerCase(); + return widget.availableContacts + .where((c) => c.type == advTypeRepeater || c.type == advTypeRoom) + .where((c) => c.publicKey.isNotEmpty) + .where((c) => query.isEmpty || c.name.toLowerCase().contains(query)) + .toList() + ..sort((a, b) => a.name.toLowerCase().compareTo(b.name.toLowerCase())); + } + + void _syncHexFromHops() { + _syncingHex = true; + _hexController.text = PathHelper.formatPathHex( + _hops.map((h) => h.byte).toList(), + ); + _syncingHex = false; + _hexError = null; + } + + void _onHexChanged(String text) { + if (_syncingHex) return; + final l10n = context.l10n; + final tokens = text + .split(RegExp(r'[,\s]+')) + .where((t) => t.isNotEmpty) + .toList(); + final invalid = tokens + .where((t) => t.length != 2 || int.tryParse(t, radix: 16) == null) + .toList(); + setState(() { + if (invalid.isNotEmpty) { + _hexError = l10n.pathEditor_invalidTokens(invalid.join(', ')); + return; + } + if (tokens.length > _maxHops) { + _hexError = l10n.pathEditor_tooManyHops; + return; + } + _hexError = null; + _hops + ..clear() + ..addAll( + tokens.map((t) => _Hop(_nextHopId++, int.parse(t, radix: 16))), + ); + }); + } + + void _addHop(Contact contact) { + if (_hops.length >= _maxHops) return; + setState(() { + _hops.add(_Hop(_nextHopId++, contact.publicKey.first)); + _syncHexFromHops(); + }); + } + + void _removeHop(int index) { + setState(() { + _hops.removeAt(index); + _syncHexFromHops(); + }); + } + + void _reorderHop(int oldIndex, int newIndex) { + setState(() { + final hop = _hops.removeAt(oldIndex); + _hops.insert(newIndex, hop); + _syncHexFromHops(); + }); + } + + void _save() { + Navigator.pop( + context, + Uint8List.fromList(_hops.map((h) => h.byte).toList()), + ); + } + + Widget _hopTile(BuildContext context, int index) { + final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; + final hop = _hops[index]; + final hex = PathHelper.hopHex(hop.byte); + final name = PathHelper.hopName(hop.byte, widget.availableContacts); + + return ListTile( + key: ValueKey(hop.id), + contentPadding: EdgeInsets.zero, + leading: CircleAvatar( + radius: 14, + backgroundColor: scheme.primaryContainer, + child: Text( + '${index + 1}', + style: TextStyle(fontSize: 12, color: scheme.onPrimaryContainer), + ), + ), + title: Text( + name ?? l10n.pathEditor_unknownHop, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + subtitle: Text(hex), + trailing: Row( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + icon: const Icon(Icons.remove_circle_outline), + tooltip: l10n.pathEditor_removeHop, + constraints: const BoxConstraints(minWidth: 44, minHeight: 44), + onPressed: () => _removeHop(index), + ), + ReorderableDragStartListener( + index: index, + child: const Padding( + padding: EdgeInsets.symmetric(horizontal: 10, vertical: 12), + child: Icon(Icons.drag_handle), + ), + ), + ], + ), + ); + } + + Widget _repeaterTile(BuildContext context, Contact contact) { + final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; + final isRepeater = contact.type == advTypeRepeater; + final full = _hops.length >= _maxHops; + + return ListTile( + contentPadding: EdgeInsets.zero, + enabled: !full, + leading: CircleAvatar( + radius: 16, + backgroundColor: isRepeater + ? scheme.primaryContainer + : scheme.secondaryContainer, + child: Icon( + isRepeater ? Icons.router : Icons.meeting_room, + size: 16, + color: isRepeater + ? scheme.onPrimaryContainer + : scheme.onSecondaryContainer, + ), + ), + title: Text(contact.name, maxLines: 1, overflow: TextOverflow.ellipsis), + subtitle: Text( + '${contact.typeLabel(l10n)} • ${PathHelper.hopHex(contact.publicKey.first)}', + ), + trailing: const Icon(Icons.add_circle_outline), + onTap: full ? null : () => _addHop(contact), + ); + } + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + final theme = Theme.of(context); + final scheme = theme.colorScheme; + final repeaters = _repeaters; + + return Column( + children: [ + const SizedBox(height: 8), + Container( + width: 32, + height: 4, + decoration: BoxDecoration( + color: scheme.outlineVariant, + borderRadius: BorderRadius.circular(2), + ), + ), + Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(l10n.pathEditor_title, style: theme.textTheme.titleLarge), + Text( + l10n.pathEditor_hopCounter(_hops.length), + style: theme.textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + Expanded( + child: ListView( + padding: const EdgeInsets.fromLTRB(16, 8, 16, 8), + children: [ + if (_hops.isEmpty) + Padding( + padding: const EdgeInsets.symmetric(vertical: 12), + child: Text( + l10n.pathEditor_noHops, + style: theme.textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ) + else + ReorderableListView.builder( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + buildDefaultDragHandles: false, + itemCount: _hops.length, + onReorderItem: _reorderHop, + itemBuilder: _hopTile, + ), + const Divider(), + const SizedBox(height: 8), + Text(l10n.pathEditor_addHops, style: theme.textTheme.titleSmall), + const SizedBox(height: 8), + TextField( + onChanged: (value) => setState(() => _search = value), + decoration: InputDecoration( + labelText: l10n.pathEditor_searchRepeaters, + prefixIcon: const Icon(Icons.search), + border: const OutlineInputBorder(), + isDense: true, + ), + ), + const SizedBox(height: 4), + if (repeaters.isEmpty) + Padding( + padding: const EdgeInsets.symmetric(vertical: 12), + child: Text( + l10n.path_noRepeatersFound, + style: theme.textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ) + else + ...repeaters.map((c) => _repeaterTile(context, c)), + ExpansionTile( + tilePadding: EdgeInsets.zero, + title: Text( + l10n.pathEditor_advancedHex, + style: theme.textTheme.titleSmall, + ), + children: [ + Padding( + padding: const EdgeInsets.only(bottom: 12), + child: TextField( + controller: _hexController, + onChanged: _onHexChanged, + textCapitalization: TextCapitalization.characters, + decoration: InputDecoration( + labelText: l10n.pathEditor_hexLabel, + helperText: _hexError == null + ? l10n.pathEditor_hexHelper + : null, + errorText: _hexError, + border: const OutlineInputBorder(), + ), + ), + ), + ], + ), + ], + ), + ), + SafeArea( + top: false, + child: Padding( + padding: const EdgeInsets.fromLTRB(16, 8, 16, 16), + child: Row( + children: [ + Expanded( + child: TextButton( + style: TextButton.styleFrom( + minimumSize: const Size.fromHeight(48), + ), + onPressed: () => Navigator.pop(context), + child: Text(l10n.common_cancel), + ), + ), + const SizedBox(width: 12), + Expanded( + child: FilledButton( + style: FilledButton.styleFrom( + minimumSize: const Size.fromHeight(48), + ), + onPressed: _hexError != null ? null : _save, + child: Text(l10n.pathEditor_usePath), + ), + ), + ], + ), + ), + ), + ], + ); + } +} diff --git a/lib/widgets/path_management_dialog.dart b/lib/widgets/path_management_dialog.dart deleted file mode 100644 index a2122f46..00000000 --- a/lib/widgets/path_management_dialog.dart +++ /dev/null @@ -1,510 +0,0 @@ -import 'dart:typed_data'; - -import 'package:flutter/material.dart'; -import 'package:meshcore_open/models/path_history.dart'; -import 'package:meshcore_open/screens/path_trace_map.dart'; -import 'package:meshcore_open/widgets/elements_ui.dart'; -import 'package:provider/provider.dart'; - -import '../connector/meshcore_connector.dart'; -import '../l10n/l10n.dart'; -import '../models/contact.dart'; -import '../l10n/contact_localization.dart'; -import '../helpers/path_helper.dart'; -import '../services/path_history_service.dart'; -import '../helpers/snack_bar_builder.dart'; -import 'path_selection_dialog.dart'; - -class PathManagementDialog { - static Future show(BuildContext context, {required Contact contact}) { - return showDialog( - context: context, - builder: (context) => _PathManagementDialog(contact: contact), - ); - } -} - -class _PathManagementDialog extends StatefulWidget { - final Contact contact; - - const _PathManagementDialog({required this.contact}); - - @override - State<_PathManagementDialog> createState() => _PathManagementDialogState(); -} - -class _PathManagementDialogState extends State<_PathManagementDialog> { - bool _showAllPaths = false; - - int _resolveContactIndex = -1; - - Contact _resolveContact(MeshCoreConnector connector) { - if (_resolveContactIndex >= 0 && - _resolveContactIndex < connector.contacts.length && - connector.contacts[_resolveContactIndex].publicKeyHex == - widget.contact.publicKeyHex) { - return connector.contacts[_resolveContactIndex]; - } - _resolveContactIndex = connector.contacts.indexWhere( - (c) => c.publicKeyHex == widget.contact.publicKeyHex, - ); - if (_resolveContactIndex == -1) { - return widget.contact; - } - return connector.contacts[_resolveContactIndex]; - } - - String _formatRelativeTime(BuildContext context, DateTime? time) { - if (time == null) return '—'; - final l10n = context.l10n; - final diff = DateTime.now().difference(time); - if (diff.inSeconds < 60) return l10n.time_justNow; - if (diff.inMinutes < 60) return l10n.time_minutesAgo(diff.inMinutes); - if (diff.inHours < 24) return l10n.time_hoursAgo(diff.inHours); - return l10n.time_daysAgo(diff.inDays); - } - - void _showFullPathDialog(BuildContext context, List pathBytes) { - final l10n = context.l10n; - if (pathBytes.isEmpty) { - showDismissibleSnackBar( - context, - content: Text(l10n.chat_pathDetailsNotAvailable), - duration: const Duration(seconds: 2), - ); - return; - } - - final connector = context.read(); - final allContacts = connector.allContacts; - - final formattedPath = PathHelper.formatPathHex(pathBytes); - final resolvedNames = PathHelper.resolvePathNames(pathBytes, allContacts); - - showDialog( - context: context, - builder: (context) => AlertDialog( - title: Text(l10n.chat_fullPath), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SelectableText(formattedPath), - const SizedBox(height: 8), - SelectableText( - resolvedNames, - style: TextStyle( - fontSize: 13, - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - ), - ], - ), - actions: [ - TextButton( - onPressed: () => Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PathTraceMapScreen( - title: context.l10n.contacts_repeaterPathTrace, - path: Uint8List.fromList(pathBytes), - flipPathAround: true, - targetContact: widget.contact, - pathHashByteWidth: connector.pathHashByteWidth, - ), - ), - ), - child: Text(context.l10n.contacts_pathTrace), - ), - TextButton( - onPressed: () => Navigator.pop(context), - child: Text(l10n.common_close), - ), - ], - ), - ); - } - - Future _setCustomPath( - BuildContext context, - MeshCoreConnector connector, - Contact currentContact, - ) async { - final l10n = context.l10n; - if (currentContact.pathLength > 0 && - currentContact.path.isEmpty && - connector.isConnected) { - connector.getContacts(); - } - - final pathForInput = currentContact.pathFormattedIdList( - connector.pathHashByteWidth, - ); - final availableContacts = connector.allContacts - .where((c) => c.publicKeyHex != currentContact.publicKeyHex) - .toList(); - - final result = await PathSelectionDialog.show( - context, - availableContacts: availableContacts, - initialPath: pathForInput.isEmpty ? null : pathForInput, - currentPathLabel: currentContact.pathLabel(l10n), - onRefresh: connector.isConnected ? connector.getContacts : null, - ); - - if (result != null && context.mounted) { - await connector.setPathOverride( - currentContact, - pathLen: result.length, - pathBytes: result, - ); - - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text(l10n.chat_hopsCount(result.length)), - duration: const Duration(seconds: 2), - ); - } - } - - @override - Widget build(BuildContext context) { - final l10n = context.l10n; - return Consumer2( - builder: (context, connector, pathService, _) { - final currentContact = _resolveContact(connector); - final paths = pathService.getRecentPaths(currentContact.publicKeyHex); - - final repeatersList = List.of(connector.directRepeaters) - ..sort((a, b) => b.ranking.compareTo(a.ranking)); - - if (repeatersList.isEmpty) { - _showAllPaths = true; - } - - final directRepeater = repeatersList.isEmpty - ? null - : repeatersList.first; - final secondDirectRepeater = repeatersList.length < 2 - ? null - : repeatersList.elementAt(1); - final thirdDirectRepeater = repeatersList.length < 3 - ? null - : repeatersList.elementAt(2); - - List>> pathsWithRepeaters = - paths.map((path) { - final isDirectRepeater = - directRepeater != null && - path.pathBytes.isNotEmpty && - directRepeater.pubkeyFirstByte == path.pathBytes.first; - final isSecondDirectRepeater = - secondDirectRepeater != null && - path.pathBytes.isNotEmpty && - secondDirectRepeater.pubkeyFirstByte == path.pathBytes.first; - final isThirdDirectRepeater = - thirdDirectRepeater != null && - path.pathBytes.isNotEmpty && - thirdDirectRepeater.pubkeyFirstByte == path.pathBytes.first; - - int ranking = -1; - Color color = Colors.grey; - if (isDirectRepeater) { - color = Colors.green; - ranking = 3; - } else if (isSecondDirectRepeater) { - color = Colors.yellow; - ranking = 2; - } else if (isThirdDirectRepeater) { - color = Colors.red; - ranking = 1; - } else if (path.wasFloodDiscovery) { - color = Colors.blue; - ranking = 0; - } - - return MapEntry(ranking, MapEntry(color, path)); - }).toList(); - - pathsWithRepeaters.sort((a, b) => b.key.compareTo(a.key)); - - return AlertDialog( - title: Text(l10n.chat_pathManagement), - content: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - l10n.path_currentPath(currentContact.pathLabel(l10n)), - style: const TextStyle(fontSize: 12, color: Colors.grey), - ), - const SizedBox(height: 12), - if (paths.isNotEmpty) ...[ - if (repeatersList.isNotEmpty) - FeatureToggleRow( - title: l10n.chat_ShowAllPaths, - subtitle: "", - value: _showAllPaths, - onChanged: (val) { - setState(() { - _showAllPaths = val; - }); - }, - ), - Text( - l10n.chat_recentAckPaths, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 12, - ), - ), - if (pathsWithRepeaters.length >= 100) ...[ - const SizedBox(height: 8), - Container( - width: double.infinity, - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - decoration: BoxDecoration( - color: Colors.amberAccent, - borderRadius: BorderRadius.circular(8), - ), - child: Text( - l10n.chat_pathHistoryFull, - style: const TextStyle(fontSize: 12), - ), - ), - ], - const SizedBox(height: 8), - ...pathsWithRepeaters.map((entry) { - final path = entry.value.value; - final color = entry.value.key; - - if (!_showAllPaths && entry.key < 1) { - return const SizedBox.shrink(); - } else { - return Card( - margin: const EdgeInsets.symmetric(vertical: 4), - child: ListTile( - dense: true, - leading: CircleAvatar( - radius: 16, - backgroundColor: color, - child: Text( - path.routeWeight.toStringAsFixed(1), - style: const TextStyle(fontSize: 10), - ), - ), - title: Text( - l10n.chat_hopsCount(path.hopCount), - style: const TextStyle(fontSize: 14), - ), - isThreeLine: true, - subtitle: Text( - '${(path.tripTimeMs / 1000).toStringAsFixed(2)}s • ${_formatRelativeTime(context, path.timestamp)}\n${path.successCount} ${l10n.chat_successes} • ${l10n.chat_score}: ${path.routeWeight.toStringAsFixed(1)}', - style: const TextStyle(fontSize: 11), - ), - trailing: Row( - mainAxisSize: MainAxisSize.min, - children: [ - IconButton( - icon: const Icon(Icons.close, size: 16), - tooltip: l10n.chat_removePath, - onPressed: () async { - await pathService.removePathRecord( - currentContact.publicKeyHex, - path.pathBytes, - ); - }, - ), - path.wasFloodDiscovery - ? const Icon( - Icons.waves, - size: 16, - color: Colors.grey, - ) - : const Icon( - Icons.route, - size: 16, - color: Colors.grey, - ), - ], - ), - onLongPress: () => - _showFullPathDialog(context, path.pathBytes), - onTap: () async { - if (path.pathBytes.isEmpty) { - showDismissibleSnackBar( - context, - content: Text( - l10n.chat_pathDetailsNotAvailable, - ), - duration: const Duration(seconds: 2), - ); - return; - } - - final pathBytes = Uint8List.fromList( - path.pathBytes, - ); - final pathLength = path.pathBytes.length; - - await connector.setPathOverride( - currentContact, - pathLen: pathLength, - pathBytes: pathBytes, - ); - - if (!context.mounted) return; - Navigator.pop(context); - showDismissibleSnackBar( - context, - content: Text( - l10n.path_usingHopsPath(path.hopCount), - ), - duration: const Duration(seconds: 2), - ); - }, - ), - ); - } - }), - const Divider(), - ] else ...[ - Text(l10n.chat_noPathHistoryYet), - const Divider(), - ], - // Flood delivery stats - Builder( - builder: (context) { - final floodStats = pathService.getFloodStats( - currentContact.publicKeyHex, - ); - if (floodStats == null || - (floodStats.successCount == 0 && - floodStats.failureCount == 0)) { - return const SizedBox.shrink(); - } - return Card( - margin: const EdgeInsets.symmetric(vertical: 4), - child: ListTile( - dense: true, - leading: const CircleAvatar( - radius: 16, - backgroundColor: Colors.blue, - child: Icon(Icons.waves, size: 16), - ), - title: const Text( - 'Flood Mode', - style: TextStyle(fontSize: 14), - ), - subtitle: Text( - '${floodStats.successCount} ${l10n.chat_successes} / ${floodStats.failureCount} failures' - '${floodStats.lastTripTimeMs > 0 ? ' • ${(floodStats.lastTripTimeMs / 1000).toStringAsFixed(2)}s' : ''}' - '${floodStats.lastUsed != null ? ' • ${_formatRelativeTime(context, floodStats.lastUsed!)}' : ''}', - style: const TextStyle(fontSize: 11), - ), - ), - ); - }, - ), - const SizedBox(height: 8), - Text( - l10n.chat_pathActions, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 12, - ), - ), - const SizedBox(height: 8), - ListTile( - dense: true, - leading: const CircleAvatar( - radius: 16, - backgroundColor: Colors.purple, - child: Icon(Icons.edit_road, size: 16), - ), - title: Text( - l10n.chat_setCustomPath, - style: const TextStyle(fontSize: 14), - ), - subtitle: Text( - l10n.chat_setCustomPathSubtitle, - style: const TextStyle(fontSize: 11), - ), - onTap: () async { - await _setCustomPath(context, connector, currentContact); - }, - ), - ListTile( - dense: true, - leading: const CircleAvatar( - radius: 16, - backgroundColor: Colors.orange, - child: Icon(Icons.clear_all, size: 16), - ), - title: Text( - l10n.chat_clearPath, - style: const TextStyle(fontSize: 14), - ), - subtitle: Text( - l10n.chat_clearPathSubtitle, - style: const TextStyle(fontSize: 11), - ), - onTap: () async { - await connector.clearContactPath(currentContact); - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text(l10n.chat_pathCleared), - duration: const Duration(seconds: 2), - ); - Navigator.pop(context); - }, - ), - ListTile( - dense: true, - leading: const CircleAvatar( - radius: 16, - backgroundColor: Colors.blue, - child: Icon(Icons.waves, size: 16), - ), - title: Text( - l10n.chat_forceFloodMode, - style: const TextStyle(fontSize: 14), - ), - subtitle: Text( - l10n.chat_floodModeSubtitle, - style: const TextStyle(fontSize: 11), - ), - onTap: () async { - await connector.setPathOverride( - currentContact, - pathLen: -1, - ); - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text(l10n.chat_floodModeEnabled), - duration: const Duration(seconds: 2), - ); - Navigator.pop(context); - }, - ), - ], - ), - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(context), - child: Text(l10n.common_close), - ), - ], - ); - }, - ); - } -} diff --git a/lib/widgets/path_map_ui.dart b/lib/widgets/path_map_ui.dart new file mode 100644 index 00000000..333301e0 --- /dev/null +++ b/lib/widgets/path_map_ui.dart @@ -0,0 +1,661 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_map/flutter_map.dart'; +import 'package:latlong2/latlong.dart'; + +import '../l10n/l10n.dart'; +import '../models/display_path.dart'; +import '../models/path_playback.dart'; +import '../theme/mesh_theme.dart'; + +/// Shared UI for the path map screens (live path trace and received-message +/// path map): packet-flow animation overlays, single/combined view toggle, +/// playback controls, and the multi-path summary/legend. + +enum PathViewMode { single, combined } + +const Color kPrimaryPathColor = Colors.blueAccent; +const List kAlternatePathColors = [ + Color(0xFF8B5CF6), // purple + MeshPalette.signal, // green + MeshPalette.warn, // amber + MeshPalette.magenta, +]; + +double getPathDistanceMeters(List points) { + if (points.length <= 1) return 0.0; + + double distanceMeters = 0.0; + final distanceCalculator = Distance(); + + for (int i = 0; i < points.length - 1; i++) { + distanceMeters += distanceCalculator(points[i], points[i + 1]); + } + + return distanceMeters; +} + +String formatDistance(double distanceMeters, {required bool isImperial}) { + if (isImperial) { + return '(${(distanceMeters / 1609.34).toStringAsFixed(2)} mi)'; + } + return '(${(distanceMeters / 1000).toStringAsFixed(2)} km)'; +} + +String formatLastObserved(BuildContext context, DateTime timestamp) { + final l10n = context.l10n; + final diff = DateTime.now().difference(timestamp); + if (diff.isNegative || diff.inMinutes < 5) return l10n.contacts_lastSeenNow; + if (diff.inMinutes < 60) return l10n.contacts_lastSeenMinsAgo(diff.inMinutes); + if (diff.inHours < 24) { + return diff.inHours == 1 + ? l10n.contacts_lastSeenHourAgo + : l10n.contacts_lastSeenHoursAgo(diff.inHours); + } + return diff.inDays == 1 + ? l10n.contacts_lastSeenDayAgo + : l10n.contacts_lastSeenDaysAgo(diff.inDays); +} + +/// Polylines for the visible paths: shared-segment halos (combined view), +/// dashed runs for estimated segments, dimming for unfocused paths and for +/// the selected path while its packet animation is running. +List buildMultiPathPolylines({ + required List visible, + required DisplayPath? selected, + required bool combined, + required bool animating, +}) { + final lines = []; + + if (combined && visible.length > 1) { + final counts = {}; + for (final path in visible) { + for (var i = 0; i < path.points.length - 1; i++) { + counts.update( + _segmentKey(path.points[i], path.points[i + 1]), + (v) => v + 1, + ifAbsent: () => 1, + ); + } + } + final drawn = {}; + for (final path in visible) { + for (var i = 0; i < path.points.length - 1; i++) { + final key = _segmentKey(path.points[i], path.points[i + 1]); + if ((counts[key] ?? 0) < 2 || !drawn.add(key)) continue; + lines.add( + Polyline( + points: [path.points[i], path.points[i + 1]], + strokeWidth: 11, + color: Colors.white.withValues(alpha: 0.22), + ), + ); + } + } + } + + void addPath(DisplayPath path, {required bool isSelected}) { + final dimmedByFocus = combined && !isSelected; + final alpha = dimmedByFocus ? 0.38 : (isSelected && animating ? 0.30 : 1.0); + final width = isSelected ? 5.0 : 3.0; + var i = 0; + while (i < path.segmentEstimated.length) { + final dashed = path.segmentEstimated[i]; + var j = i; + while (j < path.segmentEstimated.length && + path.segmentEstimated[j] == dashed) { + j++; + } + lines.add( + Polyline( + points: path.points.sublist(i, j + 1), + strokeWidth: width, + color: path.color.withValues(alpha: alpha), + pattern: dashed + ? StrokePattern.dashed(segments: const [10, 7]) + : const StrokePattern.solid(), + ), + ); + i = j; + } + } + + for (final path in visible) { + if (path.id != selected?.id) addPath(path, isSelected: false); + } + if (selected != null && visible.any((p) => p.id == selected.id)) { + addPath(selected, isSelected: true); + } + + return lines; +} + +String _segmentKey(LatLng a, LatLng b) { + final ka = + '${a.latitude.toStringAsFixed(6)},${a.longitude.toStringAsFixed(6)}'; + final kb = + '${b.latitude.toStringAsFixed(6)},${b.longitude.toStringAsFixed(6)}'; + return ka.compareTo(kb) <= 0 ? '$ka|$kb' : '$kb|$ka'; +} + +/// Bright traversed portion plus the glow on the active segment. +List buildPacketTrailPolylines( + PathPlaybackController playback, + Color color, +) { + if (!playback.started || !playback.hasPath) return const []; + final seg = playback.currentSegment; + final traversed = [ + ...playback.points.take(seg + 1), + playback.position, + ]; + return [ + Polyline( + points: [playback.points[seg], playback.position], + strokeWidth: 8, + color: Colors.white.withValues(alpha: 0.45), + ), + Polyline(points: traversed, strokeWidth: 5, color: color), + ]; +} + +/// The moving packet dot and the pulse ring at the hop it just reached. +List buildPacketMarkers(PathPlaybackController playback, Color color) { + if (!playback.started || !playback.hasPath) return const []; + final markers = []; + + final dwell = playback.dwellProgress; + if (dwell != null) { + final reached = playback.points[playback.reachedPointIndex]; + markers.add( + Marker( + point: reached, + width: 56, + height: 56, + child: IgnorePointer( + child: Center( + child: Container( + width: 24 + 28 * dwell, + height: 24 + 28 * dwell, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all( + color: color.withValues(alpha: 1.0 - dwell), + width: 3, + ), + ), + ), + ), + ), + ), + ); + } + + markers.add( + Marker( + point: playback.position, + width: 24, + height: 24, + child: IgnorePointer( + child: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: color, + border: Border.all(color: Colors.white, width: 2), + boxShadow: [ + BoxShadow( + color: color.withValues(alpha: 0.7), + blurRadius: 12, + spreadRadius: 2, + ), + ], + ), + ), + ), + ), + ); + + return markers; +} + +/// Bottom sheet listing the paths that pass through a shared node. +void showSharedNodeSheet( + BuildContext context, { + required String title, + required List paths, + required ValueChanged onSelect, +}) { + final l10n = context.l10n; + showModalBottomSheet( + context: context, + builder: (sheetContext) => SafeArea( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(16, 16, 16, 4), + child: Text( + title, + style: MeshTheme.mono( + fontSize: 14, + fontWeight: FontWeight.w700, + color: MeshPalette.ink, + ), + ), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Text( + l10n.pathMap_sharedNodeCount(paths.length), + style: TextStyle(fontSize: 12, color: MeshPalette.ink3), + ), + ), + const SizedBox(height: 8), + for (final path in paths) + ListTile( + dense: true, + leading: _colorDot(path.color), + title: Text( + path.label, + style: MeshTheme.mono(fontSize: 13, color: MeshPalette.ink), + ), + trailing: Text( + l10n.pathMap_hopCount(path.totalTransmissions), + style: MeshTheme.mono(fontSize: 11, color: MeshPalette.ink3), + ), + onTap: () { + Navigator.pop(sheetContext); + onSelect(path); + }, + ), + const SizedBox(height: 8), + ], + ), + ), + ); +} + +Widget _colorDot(Color color) => Container( + width: 10, + height: 10, + decoration: BoxDecoration(color: color, shape: BoxShape.circle), +); + +/// Floating Single/Combined toggle for the top of a path map Stack. +class PathViewModeToggle extends StatelessWidget { + final PathViewMode mode; + final ValueChanged onChanged; + + const PathViewModeToggle({ + super.key, + required this.mode, + required this.onChanged, + }); + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + return Positioned( + top: 12, + left: 0, + right: 0, + child: Center( + child: DecoratedBox( + decoration: BoxDecoration( + color: MeshPalette.bg1.withValues(alpha: 0.92), + borderRadius: BorderRadius.circular(MeshRadii.pill), + ), + child: SegmentedButton( + style: const ButtonStyle( + visualDensity: VisualDensity(horizontal: -3, vertical: -3), + ), + showSelectedIcon: false, + segments: [ + ButtonSegment( + value: PathViewMode.single, + label: Text(l10n.pathMap_viewSingle), + ), + ButtonSegment( + value: PathViewMode.combined, + label: Text(l10n.pathMap_viewCombined), + ), + ], + selected: {mode}, + onSelectionChanged: (selection) => onChanged(selection.first), + ), + ), + ), + ); + } +} + +/// Compact playback control row: animation toggle, step/play/replay buttons, +/// follow-packet lock, speed chip, and the live "Hop x of y · from → to" +/// label. +class PathAnimationControls extends StatelessWidget { + final PathPlaybackController playback; + final DisplayPath? selected; + final bool animationEnabled; + final VoidCallback onToggleAnimation; + final bool followEnabled; + final VoidCallback onToggleFollow; + + const PathAnimationControls({ + super.key, + required this.playback, + required this.selected, + required this.animationEnabled, + required this.onToggleAnimation, + required this.followEnabled, + required this.onToggleFollow, + }); + + @override + Widget build(BuildContext context) { + return AnimatedBuilder( + animation: playback, + builder: (context, _) { + final l10n = context.l10n; + final enabled = animationEnabled && playback.hasPath; + final path = selected; + String? hopLabel; + if (animationEnabled && + playback.started && + playback.hasPath && + path != null) { + final seg = playback.currentSegment; + final row = seg < path.rowForSegment.length + ? path.rowForSegment[seg] + : 0; + final from = path.pointLabels[seg]; + final to = path.pointLabels[seg + 1]; + hopLabel = + '${l10n.pathMap_hopOf(row + 1, path.totalTransmissions)} · $from → $to'; + } + + Widget controlButton({ + required IconData icon, + required String tooltip, + VoidCallback? onPressed, + Color? color, + }) => IconButton( + icon: Icon(icon, size: 20, color: color), + tooltip: tooltip, + onPressed: onPressed, + visualDensity: VisualDensity.compact, + padding: EdgeInsets.zero, + constraints: const BoxConstraints(minWidth: 34, minHeight: 34), + ); + + return Padding( + padding: const EdgeInsets.fromLTRB(4, 0, 12, 2), + child: Row( + children: [ + controlButton( + icon: Icons.animation, + tooltip: animationEnabled + ? l10n.pathMap_animationOff + : l10n.pathMap_animationOn, + color: animationEnabled ? MeshPalette.blue : MeshPalette.ink4, + onPressed: onToggleAnimation, + ), + controlButton( + icon: Icons.skip_previous, + tooltip: l10n.pathMap_stepBack, + onPressed: enabled && playback.started + ? playback.stepBack + : null, + ), + controlButton( + icon: playback.playing ? Icons.pause : Icons.play_arrow, + tooltip: playback.playing + ? l10n.pathMap_pause + : l10n.pathMap_play, + onPressed: enabled ? playback.togglePlay : null, + ), + controlButton( + icon: Icons.skip_next, + tooltip: l10n.pathMap_stepForward, + onPressed: enabled ? playback.stepForward : null, + ), + controlButton( + icon: Icons.replay, + tooltip: l10n.pathMap_replay, + onPressed: enabled ? playback.replay : null, + ), + controlButton( + icon: followEnabled ? Icons.lock : Icons.lock_open, + tooltip: followEnabled + ? l10n.pathMap_unfollowPacket + : l10n.pathMap_followPacket, + color: followEnabled ? MeshPalette.blue : null, + onPressed: enabled ? onToggleFollow : null, + ), + TextButton( + onPressed: enabled ? playback.cycleSpeed : null, + style: TextButton.styleFrom( + visualDensity: VisualDensity.compact, + padding: const EdgeInsets.symmetric(horizontal: 6), + minimumSize: const Size(36, 30), + ), + child: Text( + playback.speed == 0.5 ? '0.5×' : '${playback.speed.toInt()}×', + style: MeshTheme.mono(fontSize: 12), + ), + ), + Expanded( + child: Text( + hopLabel ?? '', + maxLines: 1, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.right, + style: MeshTheme.mono( + fontSize: 10.5, + color: MeshPalette.ink2, + ), + ), + ), + ], + ), + ); + }, + ); + } +} + +/// Marker/line style legend swatches. +class PathMiniLegend extends StatelessWidget { + final bool combined; + final bool showInferred; + + const PathMiniLegend({ + super.key, + required this.combined, + this.showInferred = true, + }); + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + Widget item(Widget swatch, String text) => Row( + mainAxisSize: MainAxisSize.min, + children: [ + swatch, + const SizedBox(width: 4), + Text(text, style: TextStyle(fontSize: 11, color: MeshPalette.ink3)), + ], + ); + Widget dashSample() => Row( + mainAxisSize: MainAxisSize.min, + children: [ + for (var i = 0; i < 3; i++) + Container( + width: 5, + height: 3, + margin: const EdgeInsets.only(right: 2), + color: MeshPalette.ink3, + ), + ], + ); + return Wrap( + spacing: 12, + runSpacing: 2, + children: [ + item(_colorDot(MeshPalette.signal), l10n.pathTrace_legendGpsConfirmed), + if (showInferred) + item(_colorDot(MeshPalette.warn), l10n.pathTrace_legendInferred), + if (combined) ...[ + item( + Container( + width: 14, + height: 6, + decoration: BoxDecoration( + color: Colors.white.withValues(alpha: 0.35), + borderRadius: BorderRadius.circular(3), + ), + ), + l10n.pathMap_legendShared, + ), + item(dashSample(), l10n.pathMap_legendEstimated), + ], + ], + ); + } +} + +/// "Observed paths: N" header plus one selectable row per path with hop +/// count, distance, GPS-confirmed count, last-observed time, and an eye +/// toggle for visibility. +class PathSummaryList extends StatelessWidget { + final List paths; + final String selectedId; + final Set hiddenIds; + final bool isImperial; + final ValueChanged onSelect; + final ValueChanged onToggleVisibility; + final VoidCallback onShowAll; + + const PathSummaryList({ + super.key, + required this.paths, + required this.selectedId, + required this.hiddenIds, + required this.isImperial, + required this.onSelect, + required this.onToggleVisibility, + required this.onShowAll, + }); + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(12, 2, 12, 0), + child: Row( + children: [ + Text( + l10n.pathMap_observedPaths(paths.length), + style: MeshTheme.accentLabel(color: MeshPalette.ink3), + ), + const Spacer(), + if (hiddenIds.isNotEmpty) + TextButton( + onPressed: onShowAll, + style: TextButton.styleFrom( + visualDensity: VisualDensity.compact, + padding: const EdgeInsets.symmetric(horizontal: 8), + minimumSize: const Size(0, 26), + ), + child: Text( + l10n.pathMap_showAllPaths, + style: const TextStyle(fontSize: 11), + ), + ), + ], + ), + ), + for (final path in paths) _buildRow(context, path), + const SizedBox(height: 4), + ], + ); + } + + Widget _buildRow(BuildContext context, DisplayPath path) { + final l10n = context.l10n; + final isSelected = path.id == selectedId; + final hidden = hiddenIds.contains(path.id); + final timestamp = path.record?.timestamp; + final parts = [ + '${l10n.pathMap_hopCount(path.totalTransmissions)} ${formatDistance(path.distanceMeters, isImperial: isImperial)}', + l10n.pathMap_gpsCount(path.gpsConfirmedHops, path.hopBytes.length), + if (timestamp != null) formatLastObserved(context, timestamp), + ]; + + return InkWell( + onTap: () => onSelect(path), + child: Container( + margin: const EdgeInsets.symmetric(horizontal: 8, vertical: 1), + padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), + decoration: BoxDecoration( + color: isSelected ? MeshPalette.bg3 : Colors.transparent, + borderRadius: BorderRadius.circular(MeshRadii.sm), + ), + child: Row( + children: [ + Opacity( + opacity: hidden ? 0.45 : 1, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + _colorDot(path.color), + const SizedBox(width: 8), + Text( + path.label, + style: MeshTheme.mono( + fontSize: 12, + fontWeight: isSelected + ? FontWeight.w700 + : FontWeight.w500, + color: MeshPalette.ink, + ), + ), + ], + ), + ), + const SizedBox(width: 8), + Expanded( + child: Opacity( + opacity: hidden ? 0.45 : 1, + child: Text( + parts.join(' · '), + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: MeshTheme.mono( + fontSize: 10.5, + color: MeshPalette.ink3, + ), + ), + ), + ), + IconButton( + icon: Icon( + hidden ? Icons.visibility_off : Icons.visibility, + size: 16, + color: hidden ? MeshPalette.ink4 : MeshPalette.ink3, + ), + tooltip: hidden ? l10n.pathMap_showPath : l10n.pathMap_hidePath, + visualDensity: VisualDensity.compact, + padding: EdgeInsets.zero, + constraints: const BoxConstraints(minWidth: 30, minHeight: 30), + onPressed: () => onToggleVisibility(path), + ), + ], + ), + ), + ); + } +} diff --git a/lib/widgets/path_selection_dialog.dart b/lib/widgets/path_selection_dialog.dart deleted file mode 100644 index 44ae58f9..00000000 --- a/lib/widgets/path_selection_dialog.dart +++ /dev/null @@ -1,346 +0,0 @@ -import 'dart:typed_data'; -import 'package:flutter/material.dart'; -import 'package:meshcore_open/connector/meshcore_protocol.dart'; -import '../l10n/l10n.dart'; -import '../models/contact.dart'; -import '../l10n/contact_localization.dart'; -import '../helpers/snack_bar_builder.dart'; - -class PathSelectionDialog extends StatefulWidget { - final List availableContacts; - final String title; - final String? initialPath; - final String? currentPathLabel; - final VoidCallback? onRefresh; - - const PathSelectionDialog({ - super.key, - required this.availableContacts, - required this.title, - this.initialPath, - this.currentPathLabel, - this.onRefresh, - }); - - @override - State createState() => _PathSelectionDialogState(); - - static Future show( - BuildContext context, { - required List availableContacts, - String? title, - String? initialPath, - String? currentPathLabel, - VoidCallback? onRefresh, - }) { - return showDialog( - context: context, - builder: (context) => PathSelectionDialog( - availableContacts: availableContacts, - title: title ?? context.l10n.path_enterCustomPath, - initialPath: initialPath, - currentPathLabel: currentPathLabel, - onRefresh: onRefresh, - ), - ); - } -} - -class _PathSelectionDialogState extends State { - late TextEditingController _controller; - final List _selectedContacts = []; - List _validContacts = []; - - @override - void initState() { - super.initState(); - _controller = TextEditingController(text: widget.initialPath ?? ''); - _filterValidContacts(); - } - - @override - void didUpdateWidget(PathSelectionDialog oldWidget) { - super.didUpdateWidget(oldWidget); - if (widget.availableContacts != oldWidget.availableContacts) { - _filterValidContacts(); - } - } - - void _filterValidContacts() { - _validContacts = widget.availableContacts - .where((c) => c.type == advTypeRepeater || c.type == advTypeRoom) - .toList(); - } - - void _updateTextFromContacts() { - final pathParts = _selectedContacts - .map((contact) { - if (contact.publicKeyHex.length >= 2) { - return contact.publicKeyHex.substring(0, 2); - } - return ''; - }) - .where((s) => s.isNotEmpty) - .toList(); - - _controller.text = pathParts.join(','); - } - - void _toggleContact(Contact contact) { - setState(() { - if (_selectedContacts.contains(contact)) { - _selectedContacts.remove(contact); - } else { - _selectedContacts.add(contact); - } - _updateTextFromContacts(); - }); - } - - void _clearSelection() { - setState(() { - _selectedContacts.clear(); - _controller.clear(); - }); - } - - Future _validateAndSubmit() async { - final l10n = context.l10n; - final path = _controller.text.trim().toUpperCase(); - if (path.isEmpty) { - if (mounted) Navigator.pop(context); - return; - } - - // Parse comma-separated hex prefixes - final pathIds = path - .split(',') - .map((s) => s.trim()) - .where((s) => s.isNotEmpty) - .toList(); - final pathBytesList = []; - final invalidPrefixes = []; - - for (final id in pathIds) { - if (id.length < 2) { - invalidPrefixes.add(id); - continue; - } - - final prefix = id.substring(0, 2); - try { - final byte = int.parse(prefix, radix: 16); - pathBytesList.add(byte); - } catch (e) { - invalidPrefixes.add(id); - } - } - - if (!mounted) return; - - // Show error for invalid prefixes - if (invalidPrefixes.isNotEmpty) { - showDismissibleSnackBar( - context, - content: Text(l10n.path_invalidHexPrefixes(invalidPrefixes.join(", "))), - duration: const Duration(seconds: 3), - backgroundColor: Colors.red, - ); - return; - } - - // Check max path length (64 hops) - if (pathBytesList.length > 64) { - showDismissibleSnackBar( - context, - content: Text(l10n.path_tooLong), - duration: const Duration(seconds: 3), - backgroundColor: Colors.red, - ); - return; - } - - if (pathBytesList.isNotEmpty && mounted) { - Navigator.pop(context, Uint8List.fromList(pathBytesList)); - } - } - - @override - void dispose() { - _controller.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - final l10n = context.l10n; - return AlertDialog( - title: Text(widget.title), - content: SingleChildScrollView( - child: SizedBox( - width: double.maxFinite, - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (widget.currentPathLabel != null) ...[ - Row( - children: [ - Text( - l10n.path_currentPathLabel, - style: const TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - ), - ), - const Spacer(), - if (widget.onRefresh != null) - TextButton.icon( - onPressed: widget.onRefresh, - icon: const Icon(Icons.refresh, size: 16), - label: Text(l10n.common_reload), - ), - ], - ), - Text( - widget.currentPathLabel!, - style: const TextStyle(fontSize: 11, color: Colors.grey), - ), - const SizedBox(height: 16), - ], - Text( - l10n.path_hexPrefixInstructions, - style: const TextStyle(fontSize: 12, color: Colors.grey), - ), - const SizedBox(height: 8), - Text( - l10n.path_hexPrefixExample, - style: const TextStyle(fontSize: 11, color: Colors.grey), - ), - const SizedBox(height: 16), - TextField( - controller: _controller, - decoration: InputDecoration( - labelText: l10n.path_labelHexPrefixes, - hintText: l10n.path_hexPrefixExample, - border: const OutlineInputBorder(), - helperText: l10n.path_helperMaxHops, - ), - textCapitalization: TextCapitalization.characters, - maxLength: 191, // 64 hops * 2 chars + 63 commas - ), - const SizedBox(height: 16), - const Divider(), - const SizedBox(height: 8), - Row( - children: [ - Text( - l10n.path_selectFromContacts, - style: const TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - ), - ), - const Spacer(), - if (_selectedContacts.isNotEmpty) - TextButton( - onPressed: _clearSelection, - child: Text(l10n.common_clear), - ), - ], - ), - const SizedBox(height: 8), - if (_validContacts.isEmpty) ...[ - Center( - child: Padding( - padding: const EdgeInsets.all(16.0), - child: Column( - children: [ - const Icon( - Icons.info_outline, - size: 48, - color: Colors.grey, - ), - const SizedBox(height: 16), - Text( - l10n.path_noRepeatersFound, - style: const TextStyle(fontSize: 14), - textAlign: TextAlign.center, - ), - const SizedBox(height: 8), - Text( - l10n.path_customPathsRequire, - style: const TextStyle( - fontSize: 12, - color: Colors.grey, - ), - textAlign: TextAlign.center, - ), - ], - ), - ), - ), - ] else ...[ - ConstrainedBox( - constraints: const BoxConstraints(maxHeight: 200), - child: ListView.builder( - shrinkWrap: true, - itemCount: _validContacts.length, - itemBuilder: (context, index) { - final contact = _validContacts[index]; - final isSelected = _selectedContacts.contains(contact); - - return ListTile( - dense: true, - leading: CircleAvatar( - radius: 16, - backgroundColor: isSelected - ? Colors.green - : (contact.type == 2 - ? Colors.blue - : Colors.purple), - child: Icon( - contact.type == 2 - ? Icons.router - : Icons.meeting_room, - size: 16, - color: Colors.white, - ), - ), - title: Text( - contact.name, - style: const TextStyle(fontSize: 14), - ), - subtitle: Text( - '${contact.typeLabel(l10n)} • ${contact.publicKeyHex.substring(0, 2)}', - style: const TextStyle(fontSize: 10), - ), - trailing: isSelected - ? const Icon( - Icons.check_circle, - color: Colors.green, - ) - : const Icon(Icons.add_circle_outline), - onTap: () => _toggleContact(contact), - ); - }, - ), - ), - ], - ], - ), - ), - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(context), - child: Text(l10n.common_cancel), - ), - TextButton( - onPressed: _validateAndSubmit, - child: Text(l10n.path_setPath), - ), - ], - ); - } -} diff --git a/lib/widgets/quick_switch_bar.dart b/lib/widgets/quick_switch_bar.dart index 40dcb59a..90b90b40 100644 --- a/lib/widgets/quick_switch_bar.dart +++ b/lib/widgets/quick_switch_bar.dart @@ -2,12 +2,14 @@ import 'dart:ui'; import 'package:flutter/material.dart'; import '../l10n/l10n.dart'; +import '../theme/mesh_theme.dart'; class QuickSwitchBar extends StatelessWidget { final int selectedIndex; final ValueChanged onDestinationSelected; final int contactsUnreadCount; final int channelsUnreadCount; + final bool highContrast; const QuickSwitchBar({ super.key, @@ -15,6 +17,7 @@ class QuickSwitchBar extends StatelessWidget { required this.onDestinationSelected, this.contactsUnreadCount = 0, this.channelsUnreadCount = 0, + this.highContrast = false, }); @override @@ -22,6 +25,14 @@ class QuickSwitchBar extends StatelessWidget { final theme = Theme.of(context); final colorScheme = theme.colorScheme; final labelStyle = theme.textTheme.labelMedium ?? const TextStyle(); + final background = highContrast ? MapPalette.panelDark : Colors.transparent; + final selectedColor = highContrast + ? MapPalette.textPrimary + : colorScheme.onPrimary; + final unselectedColor = highContrast + ? MapPalette.textSecondary + : colorScheme.onSurfaceVariant; + final indicator = highContrast ? MapPalette.selected : colorScheme.primary; return SizedBox( width: double.infinity, @@ -31,9 +42,11 @@ class QuickSwitchBar extends StatelessWidget { filter: ImageFilter.blur(sigmaX: 14, sigmaY: 14), child: DecoratedBox( decoration: BoxDecoration( - color: Colors.transparent, + color: background, border: Border.all( - color: colorScheme.outlineVariant.withValues(alpha: 0.4), + color: highContrast + ? MapPalette.border + : colorScheme.outlineVariant.withValues(alpha: 0.4), ), ), child: NavigationBarTheme( @@ -41,22 +54,18 @@ class QuickSwitchBar extends StatelessWidget { backgroundColor: Colors.transparent, surfaceTintColor: Colors.transparent, shadowColor: Colors.transparent, - indicatorColor: colorScheme.primaryContainer, + indicatorColor: indicator, labelTextStyle: WidgetStateProperty.resolveWith((states) { final isSelected = states.contains(WidgetState.selected); return labelStyle.copyWith( fontWeight: isSelected ? FontWeight.w700 : FontWeight.w500, - color: isSelected - ? colorScheme.onPrimaryContainer - : colorScheme.onSurfaceVariant, + color: isSelected ? selectedColor : unselectedColor, ); }), iconTheme: WidgetStateProperty.resolveWith((states) { final isSelected = states.contains(WidgetState.selected); return IconThemeData( - color: isSelected - ? colorScheme.onPrimaryContainer - : colorScheme.onSurfaceVariant, + color: isSelected ? selectedColor : unselectedColor, ); }), ), @@ -67,10 +76,12 @@ class QuickSwitchBar extends StatelessWidget { destinations: [ NavigationDestination( icon: _buildIconWithBadge( + context, const Icon(Icons.people_outline), contactsUnreadCount, ), selectedIcon: _buildIconWithBadge( + context, const Icon(Icons.people), contactsUnreadCount, ), @@ -78,10 +89,12 @@ class QuickSwitchBar extends StatelessWidget { ), NavigationDestination( icon: _buildIconWithBadge( + context, const Icon(Icons.tag), channelsUnreadCount, ), selectedIcon: _buildIconWithBadge( + context, const Icon(Icons.tag), channelsUnreadCount, ), @@ -101,26 +114,9 @@ class QuickSwitchBar extends StatelessWidget { ); } - Widget _buildIconWithBadge(Icon icon, int count) { + Widget _buildIconWithBadge(BuildContext context, Icon icon, int count) { if (count <= 0) return icon; - - return Stack( - clipBehavior: Clip.none, - children: [ - icon, - Positioned( - right: -2, - top: -2, - child: Container( - width: 8, - height: 8, - decoration: const BoxDecoration( - color: Colors.redAccent, - shape: BoxShape.circle, - ), - ), - ), - ], - ); + final label = count > 99 ? '99+' : '$count'; + return Badge(label: Text(label), child: icon); } } diff --git a/lib/widgets/radio_stats_entry.dart b/lib/widgets/radio_stats_entry.dart index eda0848a..aab7c4de 100644 --- a/lib/widgets/radio_stats_entry.dart +++ b/lib/widgets/radio_stats_entry.dart @@ -7,6 +7,9 @@ import 'package:meshcore_open/l10n/l10n.dart'; import 'package:meshcore_open/screens/companion_radio_stats_screen.dart'; import 'package:provider/provider.dart'; +import '../theme/mesh_theme.dart'; +import 'mesh_ui.dart'; + void pushCompanionRadioStatsScreen(BuildContext context) { Navigator.push( context, @@ -59,11 +62,15 @@ class _RadioStatsIconButtonState extends State { active: connector.radioStatsAirActivityPulse, ); if (widget.compact) { - return GestureDetector( - onTap: () => pushCompanionRadioStatsScreen(context), - child: Padding( - padding: const EdgeInsets.only(left: 4), - child: dot, + return Semantics( + label: context.l10n.radioStats_tooltip, + button: true, + child: GestureDetector( + onTap: () => pushCompanionRadioStatsScreen(context), + child: Padding( + padding: const EdgeInsets.only(left: 4), + child: dot, + ), ), ); } @@ -136,12 +143,12 @@ class AirActivityDotState extends State { @override Widget build(BuildContext context) { - final scheme = Theme.of(context).colorScheme; final on = widget.active && _blink; - return Icon( - Icons.circle, - size: 12, - color: on ? scheme.primary : scheme.outline, + final scheme = Theme.of(context).colorScheme; + return PulseDot( + color: on ? MeshPalette.blue : scheme.outline, + size: 11, + animate: false, ); } } diff --git a/lib/widgets/repeater_login_dialog.dart b/lib/widgets/repeater_login_dialog.dart index 0973faec..56834455 100644 --- a/lib/widgets/repeater_login_dialog.dart +++ b/lib/widgets/repeater_login_dialog.dart @@ -1,5 +1,4 @@ import 'dart:async'; -import '../utils/platform_info.dart'; import 'package:flutter/material.dart'; import 'package:flutter/foundation.dart'; @@ -10,8 +9,10 @@ import '../l10n/contact_localization.dart'; import '../services/storage_service.dart'; import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/mesh_ui.dart'; import '../utils/app_logger.dart'; -import 'path_management_dialog.dart'; +import 'routing_sheet.dart'; class RepeaterLoginDialog extends StatefulWidget { final Contact repeater; @@ -270,26 +271,40 @@ class _RepeaterLoginDialogState extends State { @override Widget build(BuildContext context) { final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; final connector = context.watch(); final repeater = _resolveRepeater(connector); final isFloodMode = repeater.pathOverride == -1; return AlertDialog( title: Row( children: [ - const Icon(Icons.cell_tower, color: Colors.orange), - const SizedBox(width: 8), + AvatarCircle( + name: repeater.name, + size: 40, + color: MeshPalette.warn, + icon: Icons.cell_tower, + ), + const SizedBox(width: 12), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(l10n.login_repeaterLogin), + Text( + l10n.login_repeaterLogin, + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.w700, + ), + ), Text( repeater.name, style: TextStyle( - fontSize: 14, + fontSize: 13, fontWeight: FontWeight.normal, - color: Colors.grey[600], + color: scheme.onSurfaceVariant, ), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), ], ), @@ -317,19 +332,12 @@ class _RepeaterLoginDialogState extends State { Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Icon( - Icons.error, - size: 18, - color: Theme.of(context).colorScheme.error, - ), + Icon(Icons.error, size: 18, color: scheme.error), const SizedBox(width: 8), Expanded( child: Text( _loginError!, - style: TextStyle( - color: Theme.of(context).colorScheme.error, - fontSize: 13, - ), + style: TextStyle(color: scheme.error, fontSize: 13), ), ), ], @@ -342,7 +350,6 @@ class _RepeaterLoginDialogState extends State { decoration: InputDecoration( labelText: l10n.login_password, hintText: l10n.login_enterPassword, - border: const OutlineInputBorder(), prefixIcon: const Icon(Icons.lock), suffixIcon: IconButton( icon: Icon( @@ -365,9 +372,7 @@ class _RepeaterLoginDialogState extends State { } }, onSubmitted: (_) => _handleLogin(), - autofocus: - !PlatformInfo.isMobile && - _passwordController.text.isEmpty, + autofocus: _passwordController.text.isEmpty, ), const SizedBox(height: 12), CheckboxListTile( @@ -393,9 +398,9 @@ class _RepeaterLoginDialogState extends State { children: [ Text( l10n.login_routing, - style: const TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, + style: MeshTheme.accentLabel( + color: scheme.onSurfaceVariant, + fontSize: 11, ), ), const Spacer(), @@ -423,9 +428,7 @@ class _RepeaterLoginDialogState extends State { Icon( Icons.auto_mode, size: 20, - color: !isFloodMode - ? Theme.of(context).primaryColor - : null, + color: !isFloodMode ? scheme.primary : null, ), const SizedBox(width: 8), Text( @@ -446,9 +449,7 @@ class _RepeaterLoginDialogState extends State { Icon( Icons.waves, size: 20, - color: isFloodMode - ? Theme.of(context).primaryColor - : null, + color: isFloodMode ? scheme.primary : null, ), const SizedBox(width: 8), Text( @@ -469,14 +470,17 @@ class _RepeaterLoginDialogState extends State { const SizedBox(height: 4), Text( repeater.pathLabel(context.l10n), - style: const TextStyle(fontSize: 11, color: Colors.grey), + style: TextStyle( + fontSize: 11, + color: scheme.onSurfaceVariant, + ), ), const SizedBox(height: 8), Align( alignment: Alignment.centerLeft, child: TextButton.icon( onPressed: () => - PathManagementDialog.show(context, contact: repeater), + ContactRoutingSheet.show(context, contact: repeater), icon: const Icon(Icons.timeline, size: 18), label: Text(l10n.login_managePaths), ), @@ -497,12 +501,12 @@ class _RepeaterLoginDialogState extends State { child: Row( mainAxisSize: MainAxisSize.min, children: [ - const SizedBox( + SizedBox( width: 16, height: 16, child: CircularProgressIndicator( strokeWidth: 2, - color: Colors.white, + color: scheme.onPrimary, ), ), const SizedBox(width: 12), diff --git a/lib/widgets/room_login_dialog.dart b/lib/widgets/room_login_dialog.dart index 2641c023..a5e2555b 100644 --- a/lib/widgets/room_login_dialog.dart +++ b/lib/widgets/room_login_dialog.dart @@ -10,9 +10,11 @@ import '../l10n/contact_localization.dart'; import '../services/storage_service.dart'; import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/mesh_ui.dart'; import '../utils/app_logger.dart'; import '../helpers/snack_bar_builder.dart'; -import 'path_management_dialog.dart'; +import 'routing_sheet.dart'; class RoomLoginDialog extends StatefulWidget { final Contact room; @@ -181,7 +183,7 @@ class _RoomLoginDialogState extends State { showDismissibleSnackBar( context, content: Text(context.l10n.login_failed(e.toString())), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); } } @@ -226,26 +228,40 @@ class _RoomLoginDialogState extends State { @override Widget build(BuildContext context) { final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; final connector = context.watch(); final repeater = _resolveRepeater(connector); final isFloodMode = repeater.pathOverride == -1; return AlertDialog( title: Row( children: [ - const Icon(Icons.group, color: Colors.purple), - const SizedBox(width: 8), + AvatarCircle( + name: repeater.name, + size: 40, + color: MeshPalette.magenta, + icon: Icons.group, + ), + const SizedBox(width: 12), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(l10n.login_roomLogin), + Text( + l10n.login_roomLogin, + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.w700, + ), + ), Text( repeater.name, style: TextStyle( - fontSize: 14, + fontSize: 13, fontWeight: FontWeight.normal, - color: Colors.grey[600], + color: scheme.onSurfaceVariant, ), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), ], ), @@ -275,7 +291,6 @@ class _RoomLoginDialogState extends State { decoration: InputDecoration( labelText: l10n.login_password, hintText: l10n.login_enterPassword, - border: const OutlineInputBorder(), prefixIcon: const Icon(Icons.lock), suffixIcon: IconButton( icon: Icon( @@ -319,9 +334,9 @@ class _RoomLoginDialogState extends State { children: [ Text( l10n.login_routing, - style: const TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, + style: MeshTheme.accentLabel( + color: scheme.onSurfaceVariant, + fontSize: 11, ), ), const Spacer(), @@ -349,9 +364,7 @@ class _RoomLoginDialogState extends State { Icon( Icons.auto_mode, size: 20, - color: !isFloodMode - ? Theme.of(context).primaryColor - : null, + color: !isFloodMode ? scheme.primary : null, ), const SizedBox(width: 8), Text( @@ -372,9 +385,7 @@ class _RoomLoginDialogState extends State { Icon( Icons.waves, size: 20, - color: isFloodMode - ? Theme.of(context).primaryColor - : null, + color: isFloodMode ? scheme.primary : null, ), const SizedBox(width: 8), Text( @@ -395,14 +406,17 @@ class _RoomLoginDialogState extends State { const SizedBox(height: 4), Text( repeater.pathLabel(context.l10n), - style: const TextStyle(fontSize: 11, color: Colors.grey), + style: TextStyle( + fontSize: 11, + color: scheme.onSurfaceVariant, + ), ), const SizedBox(height: 8), Align( alignment: Alignment.centerLeft, child: TextButton.icon( onPressed: () => - PathManagementDialog.show(context, contact: repeater), + ContactRoutingSheet.show(context, contact: repeater), icon: const Icon(Icons.timeline, size: 18), label: Text(l10n.login_managePaths), ), @@ -423,12 +437,12 @@ class _RoomLoginDialogState extends State { child: Row( mainAxisSize: MainAxisSize.min, children: [ - const SizedBox( + SizedBox( width: 16, height: 16, child: CircularProgressIndicator( strokeWidth: 2, - color: Colors.white, + color: scheme.onPrimary, ), ), const SizedBox(width: 12), diff --git a/lib/widgets/routing_sheet.dart b/lib/widgets/routing_sheet.dart new file mode 100644 index 00000000..4c1a26f6 --- /dev/null +++ b/lib/widgets/routing_sheet.dart @@ -0,0 +1,723 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../connector/meshcore_connector.dart'; +import '../helpers/path_helper.dart'; +import '../l10n/l10n.dart'; +import '../models/contact.dart'; +import '../models/path_history.dart'; +import '../screens/path_trace_map.dart'; +import '../services/path_history_service.dart'; +import 'path_editor_sheet.dart'; + +enum _RoutingMode { auto, flood, manual } + +enum _PathQuality { strong, good, fair, proven, flood, untested } + +class ContactRoutingSheet { + static Future show(BuildContext context, {required Contact contact}) { + return showModalBottomSheet( + context: context, + isScrollControlled: true, + useSafeArea: true, + builder: (context) => DraggableScrollableSheet( + expand: false, + initialChildSize: 0.75, + minChildSize: 0.4, + maxChildSize: 0.95, + builder: (context, scrollController) => _RoutingSheetBody( + contact: contact, + scrollController: scrollController, + ), + ), + ); + } +} + +class _RoutingSheetBody extends StatefulWidget { + final Contact contact; + final ScrollController scrollController; + + const _RoutingSheetBody({ + required this.contact, + required this.scrollController, + }); + + @override + State<_RoutingSheetBody> createState() => _RoutingSheetBodyState(); +} + +class _RoutingSheetBodyState extends State<_RoutingSheetBody> { + int _resolveContactIndex = -1; + String? _syncStatus; + + Contact _resolveContact(MeshCoreConnector connector) { + if (_resolveContactIndex >= 0 && + _resolveContactIndex < connector.contacts.length && + connector.contacts[_resolveContactIndex].publicKeyHex == + widget.contact.publicKeyHex) { + return connector.contacts[_resolveContactIndex]; + } + _resolveContactIndex = connector.contacts.indexWhere( + (c) => c.publicKeyHex == widget.contact.publicKeyHex, + ); + if (_resolveContactIndex == -1) { + return widget.contact; + } + return connector.contacts[_resolveContactIndex]; + } + + _RoutingMode _modeOf(Contact contact) { + final override = contact.pathOverride; + if (override == null) return _RoutingMode.auto; + return override < 0 ? _RoutingMode.flood : _RoutingMode.manual; + } + + Future _selectMode( + MeshCoreConnector connector, + Contact contact, + _RoutingMode mode, + ) async { + switch (mode) { + case _RoutingMode.auto: + setState(() => _syncStatus = null); + await connector.setPathOverride(contact, pathLen: null); + case _RoutingMode.flood: + setState(() => _syncStatus = null); + await connector.setPathOverride(contact, pathLen: -1); + case _RoutingMode.manual: + await _editManualPath(connector, contact); + } + } + + Future _editManualPath( + MeshCoreConnector connector, + Contact contact, + ) async { + final override = contact.pathOverride; + final initial = override != null && override > 0 + ? (contact.pathOverrideBytes ?? Uint8List(0)) + : (contact.pathLength > 0 ? contact.path : Uint8List(0)); + final available = connector.allContacts + .where((c) => c.publicKeyHex != contact.publicKeyHex) + .toList(); + final result = await PathEditorSheet.show( + context, + availableContacts: available, + initialPath: initial, + ); + if (result == null || !mounted) return; + await connector.setPathOverride( + contact, + pathLen: result.length, + pathBytes: result, + ); + await _verifyPath(connector, contact, result); + } + + Future _applyHistoryPath( + MeshCoreConnector connector, + Contact contact, + PathRecord record, + ) async { + final bytes = Uint8List.fromList(record.pathBytes); + await connector.setPathOverride( + contact, + pathLen: bytes.length, + pathBytes: bytes, + ); + await _verifyPath(connector, contact, bytes); + } + + Future _verifyPath( + MeshCoreConnector connector, + Contact contact, + Uint8List bytes, + ) async { + if (!mounted) return; + if (!connector.isConnected) { + setState(() => _syncStatus = context.l10n.chat_pathSavedLocally); + return; + } + setState(() => _syncStatus = null); + final verified = await connector.verifyContactPathOnDevice(contact, bytes); + if (!mounted) return; + setState( + () => _syncStatus = verified + ? context.l10n.chat_pathDeviceConfirmed + : context.l10n.chat_pathDeviceNotConfirmed, + ); + } + + Future _forgetPath(MeshCoreConnector connector, Contact contact) async { + await connector.clearContactPath(contact); + if (!mounted) return; + setState(() => _syncStatus = context.l10n.chat_pathCleared); + } + + _PathQuality _qualityOf(PathRecord record, List ranked) { + if (record.pathBytes.isNotEmpty) { + final first = record.pathBytes.first; + for (var i = 0; i < ranked.length && i < 3; i++) { + if (ranked[i].pubkeyFirstByte == first) { + return switch (i) { + 0 => _PathQuality.strong, + 1 => _PathQuality.good, + _ => _PathQuality.fair, + }; + } + } + } + if (record.successCount > 0) return _PathQuality.proven; + if (record.wasFloodDiscovery) return _PathQuality.flood; + return _PathQuality.untested; + } + + String _qualityLabel(BuildContext context, _PathQuality quality) { + final l10n = context.l10n; + return switch (quality) { + _PathQuality.strong => l10n.routing_qualityStrong, + _PathQuality.good => l10n.routing_qualityGood, + _PathQuality.fair => l10n.routing_qualityFair, + _PathQuality.proven => l10n.routing_qualityWorked, + _PathQuality.flood => l10n.routing_qualityFlood, + _PathQuality.untested => l10n.routing_qualityUntested, + }; + } + + IconData _qualityIcon(_PathQuality quality) { + return switch (quality) { + _PathQuality.strong => Icons.signal_cellular_alt, + _PathQuality.good => Icons.signal_cellular_alt_2_bar, + _PathQuality.fair => Icons.signal_cellular_alt_1_bar, + _PathQuality.proven => Icons.check_circle_outline, + _PathQuality.flood => Icons.waves, + _PathQuality.untested => Icons.route, + }; + } + + String _relativeTime(BuildContext context, DateTime time) { + final l10n = context.l10n; + final diff = DateTime.now().difference(time); + if (diff.inSeconds < 60) return l10n.time_justNow; + if (diff.inMinutes < 60) return l10n.time_minutesAgo(diff.inMinutes); + if (diff.inHours < 24) return l10n.time_hoursAgo(diff.inHours); + return l10n.time_daysAgo(diff.inDays); + } + + String _modeHint(BuildContext context, _RoutingMode mode) { + final l10n = context.l10n; + return switch (mode) { + _RoutingMode.auto => l10n.routing_modeAutoHint, + _RoutingMode.flood => l10n.routing_modeFloodHint, + _RoutingMode.manual => l10n.routing_modeManualHint, + }; + } + + String _routeText( + BuildContext context, + MeshCoreConnector connector, + Contact contact, + _RoutingMode mode, + ) { + final l10n = context.l10n; + switch (mode) { + case _RoutingMode.flood: + return l10n.routing_floodBroadcast; + case _RoutingMode.manual: + final bytes = contact.pathOverrideBytes ?? Uint8List(0); + if (bytes.isEmpty) return l10n.routing_directNoHops; + return PathHelper.resolvePathNames(bytes, connector.allContacts); + case _RoutingMode.auto: + if (contact.pathLength < 0) return l10n.routing_noPathYet; + if (contact.pathLength == 0) return l10n.routing_directNoHops; + if (contact.path.isEmpty) { + return l10n.chat_hopsCount(contact.pathLength); + } + return PathHelper.resolvePathNames(contact.path, connector.allContacts); + } + } + + Uint8List _displayBytes(Contact contact, _RoutingMode mode) { + return switch (mode) { + _RoutingMode.flood => Uint8List(0), + _RoutingMode.manual => contact.pathOverrideBytes ?? Uint8List(0), + _RoutingMode.auto => contact.path, + }; + } + + void _openPathTrace( + BuildContext context, + MeshCoreConnector connector, + Contact contact, + List pathBytes, + ) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PathTraceMapScreen( + title: context.l10n.contacts_repeaterPathTrace, + path: Uint8List.fromList(pathBytes), + flipPathAround: true, + targetContact: contact, + pathHashByteWidth: connector.pathHashByteWidth, + ), + ), + ); + } + + void _showPathDetail( + BuildContext context, + MeshCoreConnector connector, + Contact contact, + List pathBytes, + ) { + final l10n = context.l10n; + final formattedPath = PathHelper.formatPathHex(pathBytes); + final resolvedNames = PathHelper.resolvePathNames( + pathBytes, + connector.allContacts, + ); + + showDialog( + context: context, + builder: (dialogContext) => AlertDialog( + title: Text(l10n.chat_fullPath), + content: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SelectableText(formattedPath), + const SizedBox(height: 8), + SelectableText( + resolvedNames, + style: TextStyle( + fontSize: 13, + color: Theme.of(dialogContext).colorScheme.onSurfaceVariant, + ), + ), + ], + ), + actions: [ + TextButton( + onPressed: () => + _openPathTrace(dialogContext, connector, contact, pathBytes), + child: Text(l10n.contacts_pathTrace), + ), + TextButton( + onPressed: () => Navigator.pop(dialogContext), + child: Text(l10n.common_close), + ), + ], + ), + ); + } + + Widget _currentRouteCard( + BuildContext context, + MeshCoreConnector connector, + Contact contact, + _RoutingMode mode, + ({ + int successCount, + int failureCount, + int lastTripTimeMs, + DateTime? lastUsed, + })? + floodStats, + ) { + final l10n = context.l10n; + final theme = Theme.of(context); + final scheme = theme.colorScheme; + final displayBytes = _displayBytes(contact, mode); + + return Card( + margin: EdgeInsets.zero, + child: Padding( + padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Icon( + mode == _RoutingMode.flood ? Icons.waves : Icons.route, + size: 18, + color: scheme.primary, + ), + const SizedBox(width: 8), + Text( + l10n.routing_currentRoute, + style: theme.textTheme.titleSmall, + ), + ], + ), + const SizedBox(height: 8), + Text( + _routeText(context, connector, contact, mode), + style: theme.textTheme.bodyMedium, + ), + if (mode == _RoutingMode.flood && + floodStats != null && + (floodStats.successCount > 0 || floodStats.failureCount > 0)) + Padding( + padding: const EdgeInsets.only(top: 4), + child: Text( + _floodStatsLine(context, floodStats), + style: theme.textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ), + if (_syncStatus != null) + Padding( + padding: const EdgeInsets.only(top: 4), + child: Text( + _syncStatus!, + style: theme.textTheme.bodySmall?.copyWith( + color: scheme.tertiary, + ), + ), + ), + Wrap( + spacing: 8, + children: [ + if (displayBytes.isNotEmpty) + TextButton.icon( + icon: const Icon(Icons.map_outlined, size: 18), + label: Text(l10n.contacts_pathTrace), + onPressed: () => _openPathTrace( + context, + connector, + contact, + displayBytes, + ), + ), + if (mode == _RoutingMode.manual) + TextButton.icon( + icon: const Icon(Icons.edit, size: 18), + label: Text(l10n.routing_editPath), + onPressed: () => _editManualPath(connector, contact), + ), + if (mode == _RoutingMode.auto && contact.pathLength >= 0) + TextButton.icon( + icon: const Icon(Icons.restart_alt, size: 18), + label: Text(l10n.routing_forgetPath), + onPressed: () => _forgetPath(connector, contact), + ), + ], + ), + ], + ), + ), + ); + } + + String _floodStatsLine( + BuildContext context, + ({ + int successCount, + int failureCount, + int lastTripTimeMs, + DateTime? lastUsed, + }) + stats, + ) { + final l10n = context.l10n; + final parts = [ + l10n.routing_deliveryCounts(stats.successCount, stats.failureCount), + if (stats.lastTripTimeMs > 0) + '${(stats.lastTripTimeMs / 1000).toStringAsFixed(1)}s', + if (stats.lastUsed != null) + l10n.routing_lastWorked(_relativeTime(context, stats.lastUsed!)), + ]; + return parts.join(' • '); + } + + Widget _floodTile( + BuildContext context, + MeshCoreConnector connector, + Contact contact, + _RoutingMode mode, + ({ + int successCount, + int failureCount, + int lastTripTimeMs, + DateTime? lastUsed, + }) + stats, + ) { + final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; + + return Card( + margin: const EdgeInsets.symmetric(vertical: 4), + child: ListTile( + leading: CircleAvatar( + radius: 18, + backgroundColor: scheme.surfaceContainerHighest, + child: Icon(Icons.waves, size: 18, color: scheme.onSurfaceVariant), + ), + title: Text(l10n.routing_floodDelivery), + subtitle: Text( + _floodStatsLine(context, stats), + style: const TextStyle(fontSize: 11), + ), + trailing: mode == _RoutingMode.flood + ? Icon( + Icons.check_circle, + color: scheme.primary, + semanticLabel: l10n.routing_inUse, + ) + : null, + onTap: mode == _RoutingMode.flood + ? null + : () => _selectMode(connector, contact, _RoutingMode.flood), + ), + ); + } + + Widget _pathRecordTile( + BuildContext context, + MeshCoreConnector connector, + Contact contact, + _RoutingMode mode, + PathHistoryService pathService, + PathRecord record, + _PathQuality quality, + ) { + final l10n = context.l10n; + final theme = Theme.of(context); + final scheme = theme.colorScheme; + + final (Color bg, Color fg) = switch (quality) { + _PathQuality.strong => ( + scheme.primaryContainer, + scheme.onPrimaryContainer, + ), + _PathQuality.good => ( + scheme.secondaryContainer, + scheme.onSecondaryContainer, + ), + _PathQuality.fair => ( + scheme.tertiaryContainer, + scheme.onTertiaryContainer, + ), + _PathQuality.proven => ( + scheme.primaryContainer, + scheme.onPrimaryContainer, + ), + _ => (scheme.surfaceContainerHighest, scheme.onSurfaceVariant), + }; + + final hasBytes = record.pathBytes.isNotEmpty; + final inUse = + hasBytes && + ((mode == _RoutingMode.manual && + listEquals(record.pathBytes, contact.pathOverrideBytes)) || + (mode == _RoutingMode.auto && + listEquals(record.pathBytes, contact.path))); + + final title = hasBytes + ? PathHelper.resolvePathNames(record.pathBytes, connector.allContacts) + : l10n.chat_hopsCount(record.hopCount); + + final line1 = + '${l10n.chat_hopsCount(record.hopCount)} • ${_qualityLabel(context, quality)}'; + final line2Parts = [ + record.timestamp != null + ? l10n.routing_lastWorked(_relativeTime(context, record.timestamp!)) + : l10n.routing_neverWorked, + if (record.tripTimeMs > 0) + '${(record.tripTimeMs / 1000).toStringAsFixed(1)}s', + l10n.routing_deliveryCounts(record.successCount, record.failureCount), + ]; + + return Card( + margin: const EdgeInsets.symmetric(vertical: 4), + child: ListTile( + enabled: hasBytes, + leading: CircleAvatar( + radius: 18, + backgroundColor: bg, + child: Icon( + _qualityIcon(quality), + size: 18, + color: fg, + semanticLabel: _qualityLabel(context, quality), + ), + ), + title: Text(title, maxLines: 1, overflow: TextOverflow.ellipsis), + subtitle: Text( + '$line1\n${line2Parts.join(' • ')}', + style: const TextStyle(fontSize: 11), + ), + isThreeLine: true, + trailing: Row( + mainAxisSize: MainAxisSize.min, + children: [ + if (inUse) + Tooltip( + message: l10n.routing_inUse, + child: Icon( + Icons.check_circle, + color: scheme.primary, + semanticLabel: l10n.routing_inUse, + ), + ), + IconButton( + icon: const Icon(Icons.delete_outline, size: 20), + tooltip: l10n.chat_removePath, + constraints: const BoxConstraints(minWidth: 44, minHeight: 44), + onPressed: () => pathService.removePathRecord( + contact.publicKeyHex, + record.pathBytes, + ), + ), + ], + ), + onTap: hasBytes && !inUse + ? () => _applyHistoryPath(connector, contact, record) + : null, + onLongPress: hasBytes + ? () => + _showPathDetail(context, connector, contact, record.pathBytes) + : null, + ), + ); + } + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + final theme = Theme.of(context); + final scheme = theme.colorScheme; + + return Consumer2( + builder: (context, connector, pathService, _) { + final contact = _resolveContact(connector); + final mode = _modeOf(contact); + final floodStats = pathService.getFloodStats(contact.publicKeyHex); + final hasFloodStats = + floodStats != null && + (floodStats.successCount > 0 || floodStats.failureCount > 0); + + final rankedRepeaters = List.of(connector.directRepeaters) + ..sort((a, b) => b.ranking.compareTo(a.ranking)); + final entries = + pathService + .getRecentPaths(contact.publicKeyHex) + .map( + (r) => (quality: _qualityOf(r, rankedRepeaters), record: r), + ) + .toList() + ..sort((a, b) { + final byQuality = a.quality.index.compareTo(b.quality.index); + if (byQuality != 0) return byQuality; + final aTime = + a.record.timestamp ?? + DateTime.fromMillisecondsSinceEpoch(0); + final bTime = + b.record.timestamp ?? + DateTime.fromMillisecondsSinceEpoch(0); + return bTime.compareTo(aTime); + }); + + return ListView( + controller: widget.scrollController, + padding: const EdgeInsets.fromLTRB(16, 8, 16, 24), + children: [ + Center( + child: Container( + width: 32, + height: 4, + decoration: BoxDecoration( + color: scheme.outlineVariant, + borderRadius: BorderRadius.circular(2), + ), + ), + ), + const SizedBox(height: 12), + Text(l10n.routing_title, style: theme.textTheme.titleLarge), + Text( + contact.name, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: theme.textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + const SizedBox(height: 16), + SegmentedButton<_RoutingMode>( + style: const ButtonStyle( + minimumSize: WidgetStatePropertyAll(Size.fromHeight(44)), + ), + segments: [ + ButtonSegment( + value: _RoutingMode.auto, + icon: const Icon(Icons.auto_mode), + label: Text(l10n.routing_modeAuto), + ), + ButtonSegment( + value: _RoutingMode.flood, + icon: const Icon(Icons.waves), + label: Text(l10n.routing_modeFlood), + ), + ButtonSegment( + value: _RoutingMode.manual, + icon: const Icon(Icons.edit_road), + label: Text(l10n.routing_modeManual), + ), + ], + selected: {mode}, + onSelectionChanged: (selection) => + _selectMode(connector, contact, selection.first), + ), + const SizedBox(height: 8), + Text( + _modeHint(context, mode), + style: theme.textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + const SizedBox(height: 16), + _currentRouteCard(context, connector, contact, mode, floodStats), + const SizedBox(height: 16), + Text(l10n.routing_knownPaths, style: theme.textTheme.titleSmall), + Text( + l10n.routing_knownPathsHint, + style: theme.textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + const SizedBox(height: 8), + if (hasFloodStats) + _floodTile(context, connector, contact, mode, floodStats), + if (entries.isEmpty && !hasFloodStats) + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Text( + l10n.chat_noPathHistoryYet, + style: theme.textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ), + ...entries.map( + (entry) => _pathRecordTile( + context, + connector, + contact, + mode, + pathService, + entry.record, + entry.quality, + ), + ), + ], + ); + }, + ); + } +} diff --git a/lib/widgets/signal_ui.dart b/lib/widgets/signal_ui.dart index e0e05111..0edcb9af 100644 --- a/lib/widgets/signal_ui.dart +++ b/lib/widgets/signal_ui.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import '../theme/mesh_theme.dart'; class SignalUi { final IconData icon; @@ -12,27 +13,27 @@ SignalUi signalUiForStrengthTier(int tier) { case 0: return const SignalUi( icon: Icons.signal_cellular_4_bar, - color: Colors.green, + color: MeshPalette.signal, ); case 1: return const SignalUi( icon: Icons.signal_cellular_alt, - color: Colors.lightGreen, + color: MeshPalette.signalDim, ); case 2: return const SignalUi( icon: Icons.signal_cellular_alt_2_bar, - color: Colors.amber, + color: MeshPalette.warn, ); case 3: return const SignalUi( icon: Icons.signal_cellular_alt_1_bar, - color: Colors.orange, + color: MeshPalette.warnDim, ); default: return const SignalUi( icon: Icons.signal_cellular_alt_1_bar, - color: Colors.red, + color: MeshPalette.alert, ); } } diff --git a/lib/widgets/snr_indicator.dart b/lib/widgets/snr_indicator.dart index 99f20539..f57776de 100644 --- a/lib/widgets/snr_indicator.dart +++ b/lib/widgets/snr_indicator.dart @@ -5,6 +5,8 @@ import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; import '../l10n/l10n.dart'; import '../models/contact.dart'; +import '../theme/mesh_theme.dart'; +import 'mesh_ui.dart'; import 'signal_ui.dart'; Contact? _getRepeaterPrefixMatchNearLocation( @@ -166,7 +168,7 @@ class _SNRIndicatorState extends State { style: TextStyle( fontSize: 12, fontWeight: FontWeight.w500, - color: Colors.grey, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), maxLines: 1, overflow: TextOverflow.ellipsis, @@ -218,10 +220,6 @@ class _SNRIndicatorState extends State { separatorBuilder: (_, _) => const Divider(height: 1), itemBuilder: (context, index) { final repeater = directBestRepeaters[index]; - final snrUi = snrUiFromSNR( - repeater.snr, - widget.connector.currentSf, - ); final allContacts = widget.connector.allContacts; final selfLat = widget.connector.selfLatitude; @@ -242,22 +240,47 @@ class _SNRIndicatorState extends State { ); final name = contact?.name; + final hex = repeater.pubkeyFirstByte + .toRadixString(16) + .padLeft(2, '0'); + final snrColor = MeshTheme.snrColor( + repeater.snr, + blocked: false, + ); - return Column( - children: [ - ListTile( - leading: Icon(snrUi.icon, color: snrUi.color), - title: Text( - name ?? - repeater.pubkeyFirstByte - .toRadixString(16) - .padLeft(2, '0'), + return Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 10, + ), + child: Row( + children: [ + AvatarCircle( + name: name ?? hex, + size: 36, + color: snrColor, ), - subtitle: Text( - 'SNR: ${repeater.snr.toStringAsFixed(1)} dB\n${l10n.snrIndicator_lastSeen}: ${_formatLastUpdated(repeater.lastUpdated)}', + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + name ?? hex, + style: Theme.of(context).textTheme.bodyMedium, + ), + Text( + '${repeater.snr.toStringAsFixed(1)} dB • ${_formatLastUpdated(repeater.lastUpdated)}', + style: MeshTheme.mono( + fontSize: 11, + color: snrColor, + ), + ), + ], + ), ), - ), - ], + ], + ), ); }, ), diff --git a/lib/widgets/sync_progress_overlay.dart b/lib/widgets/sync_progress_overlay.dart new file mode 100644 index 00000000..4aef90ea --- /dev/null +++ b/lib/widgets/sync_progress_overlay.dart @@ -0,0 +1,60 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../connector/meshcore_connector.dart'; + +class SyncProgressAppBarBottom extends StatelessWidget + implements PreferredSizeWidget { + static const double height = 3; + + const SyncProgressAppBarBottom({super.key}); + + @override + Size get preferredSize => const Size.fromHeight(height); + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (context, connector, _) { + final state = _SyncProgressState.fromConnector(connector); + if (state == null) return const SizedBox(height: height); + + return SizedBox( + height: height, + child: LinearProgressIndicator( + value: state.value, + minHeight: height, + color: state.color, + backgroundColor: state.color.withValues(alpha: 0.18), + ), + ); + }, + ); + } +} + +class _SyncProgressState { + final double? value; + final Color color; + + const _SyncProgressState({required this.value, required this.color}); + + static _SyncProgressState? fromConnector(MeshCoreConnector connector) { + if (connector.isLoadingContacts) { + return _SyncProgressState( + value: connector.contactSyncProgress, + color: Colors.red, + ); + } + if (connector.isSyncingChannels) { + return _SyncProgressState( + value: connector.channelSyncProgress / 100, + color: Colors.blue, + ); + } + if (connector.isShowingQueuedMessageSyncProgress) { + return const _SyncProgressState(value: null, color: Colors.green); + } + return null; + } +} diff --git a/lib/widgets/telemetry_location_map.dart b/lib/widgets/telemetry_location_map.dart new file mode 100644 index 00000000..f8983c04 --- /dev/null +++ b/lib/widgets/telemetry_location_map.dart @@ -0,0 +1,423 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_map/flutter_map.dart'; +import 'package:latlong2/latlong.dart'; +import 'package:provider/provider.dart'; + +import '../connector/meshcore_connector.dart'; +import '../connector/meshcore_protocol.dart'; +import '../l10n/l10n.dart'; +import '../models/app_settings.dart'; +import '../models/contact.dart'; +import '../services/app_settings_service.dart'; +import '../services/map_tile_cache_service.dart'; +import 'themed_map_tile_layer.dart'; + +class TelemetryLocationMap extends StatefulWidget { + final double latitude; + final double longitude; + final String label; + final int contactType; + final String contactPublicKeyHex; + + const TelemetryLocationMap({ + super.key, + required this.latitude, + required this.longitude, + required this.label, + required this.contactType, + required this.contactPublicKeyHex, + }); + + @override + State createState() => _TelemetryLocationMapState(); +} + +class _TelemetryLocationMapState extends State { + static const double _initialZoom = 14.0; + static const double _minZoom = 2.0; + static const double _maxZoom = 18.0; + + final MapController _mapController = MapController(); + + LatLng get _position => LatLng(widget.latitude, widget.longitude); + + @override + void dispose() { + _mapController.dispose(); + super.dispose(); + } + + @override + void didUpdateWidget(covariant TelemetryLocationMap oldWidget) { + super.didUpdateWidget(oldWidget); + if (oldWidget.latitude == widget.latitude && + oldWidget.longitude == widget.longitude) { + return; + } + + WidgetsBinding.instance.addPostFrameCallback((_) { + if (mounted) { + _mapController.move(_position, _initialZoom); + } + }); + } + + @override + Widget build(BuildContext context) { + final connector = context.watch(); + final settingsService = context.watch(); + final settings = settingsService.settings; + final tileCache = context.read(); + final contacts = _filteredContacts(connector, settings); + final isDesktop = _isDesktopPlatform(defaultTargetPlatform); + + return Padding( + padding: const EdgeInsets.only(top: 8, bottom: 4), + child: ClipRRect( + borderRadius: BorderRadius.circular(8), + child: LayoutBuilder( + builder: (context, constraints) { + final maxHeight = MediaQuery.sizeOf(context).height * 0.75; + final squareHeight = constraints.maxWidth.isFinite + ? constraints.maxWidth + : maxHeight; + // Prefer square sizing by width, but cap only the height so the map + // remains usable on wide screens without growing past the viewport. + final mapHeight = squareHeight > maxHeight + ? maxHeight + : squareHeight; + + return SizedBox( + width: double.infinity, + height: mapHeight, + child: Stack( + children: [ + FlutterMap( + mapController: _mapController, + options: MapOptions( + initialCenter: _position, + initialZoom: _initialZoom, + minZoom: _minZoom, + maxZoom: _maxZoom, + interactionOptions: InteractionOptions( + flags: ~InteractiveFlag.rotate, + scrollWheelVelocity: isDesktop ? 0.012 : 0.005, + cursorKeyboardRotationOptions: + CursorKeyboardRotationOptions.disabled(), + keyboardOptions: isDesktop + ? const KeyboardOptions( + enableArrowKeysPanning: true, + enableWASDPanning: true, + enableRFZooming: true, + ) + : const KeyboardOptions.disabled(), + ), + ), + children: [ + ThemedMapTileLayer(tileCache: tileCache), + MarkerLayer( + markers: [ + ...contacts.map(_buildContactMarker), + _buildTelemetryMarker(), + _buildLabelMarker(_position, widget.label), + ], + ), + ], + ), + Positioned( + top: 8, + right: 8, + child: _MapButton( + icon: Icons.filter_list, + tooltip: context.l10n.map_filterNodes, + onPressed: () => + _showFilterDialog(context, settingsService), + ), + ), + Positioned( + left: 8, + top: 8, + child: Column( + children: [ + _MapButton( + icon: Icons.add, + tooltip: context.l10n.map_zoomIn, + onPressed: () => _zoomBy(1), + ), + const SizedBox(height: 6), + _MapButton( + icon: Icons.remove, + tooltip: context.l10n.map_zoomOut, + onPressed: () => _zoomBy(-1), + ), + const SizedBox(height: 6), + _MapButton( + icon: Icons.my_location, + tooltip: context.l10n.map_centerMap, + onPressed: () => + _mapController.move(_position, _initialZoom), + ), + ], + ), + ), + ], + ), + ); + }, + ), + ), + ); + } + + List _filteredContacts( + MeshCoreConnector connector, + AppSettings settings, + ) { + final contacts = settings.mapShowDiscoveryContacts + ? connector.allContacts + : connector.allContacts.where((contact) => contact.isActive).toList(); + + return contacts.where((contact) { + if (!contact.hasLocation) return false; + if (contact.publicKeyHex == widget.contactPublicKeyHex) return false; + if (contact.type == advTypeChat) return settings.mapShowChatNodes; + if (contact.type == advTypeRepeater) return settings.mapShowRepeaters; + return settings.mapShowOtherNodes; + }).toList(); + } + + Marker _buildTelemetryMarker() { + return Marker( + point: _position, + width: 44, + height: 44, + child: IgnorePointer( + child: _MarkerBubble( + color: Colors.red, + icon: _getNodeIcon(widget.contactType), + size: 24, + ), + ), + ); + } + + Marker _buildContactMarker(Contact contact) { + return Marker( + point: LatLng(contact.latitude!, contact.longitude!), + width: 34, + height: 34, + child: IgnorePointer( + child: _MarkerBubble( + color: _getNodeColor(contact.type), + icon: _getNodeIcon(contact.type), + size: 18, + ), + ), + ); + } + + Marker _buildLabelMarker(LatLng point, String label) { + return Marker( + point: point, + width: 140, + height: 24, + alignment: Alignment.topCenter, + child: IgnorePointer( + child: Transform.translate( + offset: const Offset(0, -24), + child: FittedBox( + fit: BoxFit.contain, + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), + decoration: BoxDecoration( + color: Colors.black54, + borderRadius: BorderRadius.circular(8), + ), + alignment: Alignment.center, + child: Text( + label, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: const TextStyle( + color: Colors.white, + fontSize: 11, + fontWeight: FontWeight.w500, + ), + ), + ), + ), + ), + ), + ); + } + + void _zoomBy(double delta) { + final camera = _mapController.camera; + final nextZoom = (camera.zoom + delta).clamp(_minZoom, _maxZoom).toDouble(); + _mapController.move(camera.center, nextZoom); + } + + bool _isDesktopPlatform(TargetPlatform platform) { + return platform == TargetPlatform.linux || + platform == TargetPlatform.windows || + platform == TargetPlatform.macOS; + } + + Color _getNodeColor(int type) { + switch (type) { + case advTypeChat: + return Colors.blue; + case advTypeRepeater: + return Colors.green; + case advTypeRoom: + return Colors.purple; + case advTypeSensor: + return Colors.orange; + default: + return Colors.grey; + } + } + + IconData _getNodeIcon(int type) { + switch (type) { + case advTypeChat: + return Icons.person; + case advTypeRepeater: + return Icons.router; + case advTypeRoom: + return Icons.meeting_room; + case advTypeSensor: + return Icons.sensors; + default: + return Icons.device_unknown; + } + } + + void _showFilterDialog( + BuildContext context, + AppSettingsService settingsService, + ) { + showDialog( + context: context, + builder: (dialogContext) => AlertDialog( + title: Text(context.l10n.map_filterNodes), + content: SingleChildScrollView( + child: Consumer( + builder: (consumerContext, service, child) { + final settings = service.settings; + // Reuse the global map filters so the telemetry preview and the + // main map stay consistent without another settings model. + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + CheckboxListTile( + title: Text(context.l10n.map_chatNodes), + value: settings.mapShowChatNodes, + onChanged: (value) { + service.setMapShowChatNodes(value ?? true); + }, + contentPadding: EdgeInsets.zero, + ), + CheckboxListTile( + title: Text(context.l10n.map_repeaters), + value: settings.mapShowRepeaters, + onChanged: (value) { + service.setMapShowRepeaters(value ?? true); + }, + contentPadding: EdgeInsets.zero, + ), + CheckboxListTile( + title: Text(context.l10n.map_otherNodes), + value: settings.mapShowOtherNodes, + onChanged: (value) { + service.setMapShowOtherNodes(value ?? true); + }, + contentPadding: EdgeInsets.zero, + ), + CheckboxListTile( + title: Text(context.l10n.map_showDiscoveryContacts), + value: settings.mapShowDiscoveryContacts, + onChanged: (value) { + service.setMapShowDiscoveryContacts(value ?? true); + }, + contentPadding: EdgeInsets.zero, + ), + ], + ); + }, + ), + ), + actions: [ + TextButton( + onPressed: () => Navigator.pop(dialogContext), + child: Text(context.l10n.common_close), + ), + ], + ), + ); + } +} + +class _MarkerBubble extends StatelessWidget { + final Color color; + final IconData icon; + final double size; + + const _MarkerBubble({ + required this.color, + required this.icon, + required this.size, + }); + + @override + Widget build(BuildContext context) { + return Container( + padding: const EdgeInsets.all(4), + decoration: BoxDecoration( + color: color, + shape: BoxShape.circle, + border: Border.all(color: Colors.white, width: 2), + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.3), + blurRadius: 4, + offset: const Offset(0, 2), + ), + ], + ), + alignment: Alignment.center, + child: Icon(icon, color: Colors.white, size: size), + ); + } +} + +class _MapButton extends StatelessWidget { + final IconData icon; + final String tooltip; + final VoidCallback onPressed; + + const _MapButton({ + required this.icon, + required this.tooltip, + required this.onPressed, + }); + + @override + Widget build(BuildContext context) { + return Material( + color: Theme.of(context).colorScheme.surface, + elevation: 3, + borderRadius: BorderRadius.circular(8), + clipBehavior: Clip.antiAlias, + child: IconButton( + icon: Icon(icon), + tooltip: tooltip, + onPressed: onPressed, + constraints: const BoxConstraints.tightFor(width: 40, height: 40), + padding: EdgeInsets.zero, + iconSize: 20, + ), + ); + } +} diff --git a/lib/widgets/themed_map_tile_layer.dart b/lib/widgets/themed_map_tile_layer.dart new file mode 100644 index 00000000..c6d2eaad --- /dev/null +++ b/lib/widgets/themed_map_tile_layer.dart @@ -0,0 +1,60 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_map/flutter_map.dart'; + +import '../services/map_tile_cache_service.dart'; + +/// Shared cached map tiles with an automatic dark-mode treatment. +/// +/// The dark style transforms the existing OpenStreetMap raster tiles, so light +/// and dark maps share the same offline cache and network requests. +class ThemedMapTileLayer extends StatelessWidget { + final MapTileCacheService tileCache; + final double opacity; + + const ThemedMapTileLayer({ + super.key, + required this.tileCache, + this.opacity = 1, + }); + + static const ColorFilter _darkMapFilter = ColorFilter.matrix([ + -0.0850, + -0.2861, + -0.0289, + 0, + 120, + -0.0957, + -0.3218, + -0.0325, + 0, + 140, + -0.1169, + -0.3934, + -0.0397, + 0, + 170, + 0, + 0, + 0, + 1, + 0, + ]); + + @override + Widget build(BuildContext context) { + Widget layer = TileLayer( + urlTemplate: kMapTileUrlTemplate, + tileProvider: tileCache.tileProvider, + userAgentPackageName: MapTileCacheService.userAgentPackageName, + maxZoom: 19, + ); + + if (Theme.of(context).brightness == Brightness.dark) { + layer = ColorFiltered(colorFilter: _darkMapFilter, child: layer); + } + if (opacity < 1) { + layer = Opacity(opacity: opacity, child: layer); + } + return layer; + } +} diff --git a/lib/widgets/unread_badge.dart b/lib/widgets/unread_badge.dart index 424cb6f5..1cf5c1d6 100644 --- a/lib/widgets/unread_badge.dart +++ b/lib/widgets/unread_badge.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; +import '../theme/mesh_theme.dart'; + class UnreadBadge extends StatelessWidget { final int count; @@ -9,17 +11,18 @@ class UnreadBadge extends StatelessWidget { Widget build(BuildContext context) { final display = count > 9999 ? '9999+' : count.toString(); return Container( - padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), + padding: const EdgeInsets.symmetric(horizontal: 7, vertical: 2), decoration: BoxDecoration( - color: Colors.redAccent, - borderRadius: BorderRadius.circular(10), + color: MeshPalette.blue.withValues(alpha: 0.18), + borderRadius: BorderRadius.circular(MeshRadii.pill), + border: Border.all(color: MeshPalette.blue.withValues(alpha: 0.45)), ), child: Text( display, - style: const TextStyle( - color: Colors.white, + style: MeshTheme.mono( fontSize: 11, - fontWeight: FontWeight.w600, + fontWeight: FontWeight.w700, + color: MeshPalette.blue, ), ), ); diff --git a/lib/widgets/unread_divider.dart b/lib/widgets/unread_divider.dart index f9ebd1d0..4de05b32 100644 --- a/lib/widgets/unread_divider.dart +++ b/lib/widgets/unread_divider.dart @@ -1,30 +1,43 @@ import 'package:flutter/material.dart'; import '../l10n/l10n.dart'; +import '../theme/mesh_theme.dart'; class UnreadDivider extends StatelessWidget { const UnreadDivider({super.key}); @override Widget build(BuildContext context) { - final color = Theme.of(context).colorScheme.primary; + final scheme = Theme.of(context).colorScheme; + final color = scheme.primary; return Padding( - padding: const EdgeInsets.symmetric(vertical: 8), + padding: const EdgeInsets.symmetric(vertical: 10), child: Row( children: [ - Expanded(child: Divider(color: color)), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 8), + Expanded( + child: Container(height: 1, color: color.withValues(alpha: 0.25)), + ), + const SizedBox(width: 10), + Container( + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4), + decoration: BoxDecoration( + color: color.withValues(alpha: 0.12), + borderRadius: BorderRadius.circular(MeshRadii.pill), + border: Border.all(color: color.withValues(alpha: 0.35)), + ), child: Text( context.l10n.chat_newMessages, - style: TextStyle( + style: MeshTheme.mono( + fontSize: 10.5, + fontWeight: FontWeight.w600, color: color, - fontSize: 12, - fontWeight: FontWeight.w500, ), ), ), - Expanded(child: Divider(color: color)), + const SizedBox(width: 10), + Expanded( + child: Container(height: 1, color: color.withValues(alpha: 0.25)), + ), ], ), ); diff --git a/macos/Podfile.lock b/macos/Podfile.lock index 481f1bcc..0f1561a5 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -1,73 +1,21 @@ PODS: - flserial (0.0.1): - FlutterMacOS - - flutter_blue_plus_darwin (0.0.2): - - Flutter - - FlutterMacOS - - flutter_local_notifications (0.0.1): - - FlutterMacOS - FlutterMacOS (1.0.0) - - mobile_scanner (7.0.0): - - Flutter - - FlutterMacOS - - package_info_plus (0.0.1): - - FlutterMacOS - - share_plus (0.0.1): - - FlutterMacOS - - shared_preferences_foundation (0.0.1): - - Flutter - - FlutterMacOS - - sqflite_darwin (0.0.4): - - Flutter - - FlutterMacOS - - url_launcher_macos (0.0.1): - - FlutterMacOS DEPENDENCIES: - flserial (from `Flutter/ephemeral/.symlinks/plugins/flserial/macos`) - - flutter_blue_plus_darwin (from `Flutter/ephemeral/.symlinks/plugins/flutter_blue_plus_darwin/darwin`) - - flutter_local_notifications (from `Flutter/ephemeral/.symlinks/plugins/flutter_local_notifications/macos`) - FlutterMacOS (from `Flutter/ephemeral`) - - mobile_scanner (from `Flutter/ephemeral/.symlinks/plugins/mobile_scanner/darwin`) - - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) - - share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`) - - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`) - - sqflite_darwin (from `Flutter/ephemeral/.symlinks/plugins/sqflite_darwin/darwin`) - - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) EXTERNAL SOURCES: flserial: :path: Flutter/ephemeral/.symlinks/plugins/flserial/macos - flutter_blue_plus_darwin: - :path: Flutter/ephemeral/.symlinks/plugins/flutter_blue_plus_darwin/darwin - flutter_local_notifications: - :path: Flutter/ephemeral/.symlinks/plugins/flutter_local_notifications/macos FlutterMacOS: :path: Flutter/ephemeral - mobile_scanner: - :path: Flutter/ephemeral/.symlinks/plugins/mobile_scanner/darwin - package_info_plus: - :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos - share_plus: - :path: Flutter/ephemeral/.symlinks/plugins/share_plus/macos - shared_preferences_foundation: - :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin - sqflite_darwin: - :path: Flutter/ephemeral/.symlinks/plugins/sqflite_darwin/darwin - url_launcher_macos: - :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos SPEC CHECKSUMS: flserial: 3c161e076dfc73458ec5803e7a9a9d2bb85fadf6 - flutter_blue_plus_darwin: 20a08bfeaa0f7804d524858d3d8744bcc1b6dbc3 - flutter_local_notifications: 4bf37a31afde695b56091b4ae3e4d9c7a7e6cda0 FlutterMacOS: d0db08ddef1a9af05a5ec4b724367152bb0500b1 - mobile_scanner: 9157936403f5a0644ca3779a38ff8404c5434a93 - package_info_plus: f0052d280d17aa382b932f399edf32507174e870 - share_plus: 510bf0af1a42cd602274b4629920c9649c52f4cc - shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb - sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0 - url_launcher_macos: f87a979182d112f911de6820aefddaf56ee9fbfd PODFILE CHECKSUM: 54d867c82ac51cbd61b565781b9fada492027009 diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index defe6932..10f8906b 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -29,6 +29,7 @@ 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; 99C5B380294D2DE19A818101 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B665683D805EE21638F484F2 /* Pods_RunnerTests.framework */; }; D7DDCBD47F2955423D77927D /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F985DDB6BE5BEB6B545DE9A /* Pods_Runner.framework */; }; + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -88,6 +89,7 @@ BEFF4DDC60AFB628205F8E82 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; D99E941424F19B7B9AA1B968 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; EA5A89F8C49904B995EFAA24 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -103,6 +105,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, D7DDCBD47F2955423D77927D /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -164,6 +167,7 @@ 33CEB47122A05771004F2AC0 /* Flutter */ = { isa = PBXGroup; children = ( + 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */, 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, @@ -231,6 +235,9 @@ productType = "com.apple.product-type.bundle.unit-test"; }; 33CC10EC2044A3C60003C045 /* Runner */ = { + packageProductDependencies = ( + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */, + ); isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( @@ -256,6 +263,9 @@ /* Begin PBXProject section */ 33CC10E52044A3C60003C045 /* Project object */ = { + packageReferences = ( + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */, + ); isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = YES; @@ -796,6 +806,18 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ +/* Begin XCLocalSwiftPackageReference section */ + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; + }; +/* End XCLocalSwiftPackageReference section */ +/* Begin XCSwiftPackageProductDependency section */ + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = { + isa = XCSwiftPackageProductDependency; + productName = FlutterGeneratedPluginSwiftPackage; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 33CC10E52044A3C60003C045 /* Project object */; } diff --git a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index fd43b250..e082e324 100644 --- a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -5,6 +5,24 @@ + + + + + + + + + + =0.6.8 <0.7.0' + llamadart: ^0.8.0 + flutter_langdetect: ^0.0.1 hooks: user_defines: diff --git a/scripts/security/contact_import_clipboard_pocs.py b/scripts/security/contact_import_clipboard_pocs.py new file mode 100644 index 00000000..dcf7ced9 --- /dev/null +++ b/scripts/security/contact_import_clipboard_pocs.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 +"""Generate local PoCs for MeshCore clipboard contact import validation gaps. + +The output is a meshcore:// URI suitable for manual testing in a local/dev app +session. It does not connect to BLE/USB/TCP devices or transmit anything. +""" + +from __future__ import annotations + +import argparse +import sys + + +SCHEME = "meshcore://" + + +def uri_from_bytes(payload: bytes) -> str: + return SCHEME + payload.hex() + + +def oversized_payload(size: int) -> bytes: + if size < 1: + raise ValueError("size must be positive") + return b"A" * size + + +def short_malformed_payload() -> bytes: + return b"\x00" + + +def non_advert_like_payload() -> bytes: + # 98 bytes matches the UI's minimum exported-contact length check, but the + # content is intentionally not a valid signed advert/contact packet. + payload = bytearray(98) + payload[0:4] = b"POC!" + payload[36] = 0xFF + payload[-4:] = b"END!" + return bytes(payload) + + +def main() -> int: + parser = argparse.ArgumentParser( + description="Generate meshcore:// clipboard import PoC payloads." + ) + parser.add_argument( + "case", + choices=("short", "non-advert", "oversized"), + help="PoC case to generate.", + ) + parser.add_argument( + "--size", + type=int, + default=4096, + help="Byte length for the oversized case. Default: 4096.", + ) + args = parser.parse_args() + + if args.case == "short": + payload = short_malformed_payload() + elif args.case == "non-advert": + payload = non_advert_like_payload() + else: + payload = oversized_payload(args.size) + + sys.stdout.write(uri_from_bytes(payload)) + sys.stdout.write("\n") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/test/helpers/path_hop_resolver_test.dart b/test/helpers/path_hop_resolver_test.dart new file mode 100644 index 00000000..8e903bc6 --- /dev/null +++ b/test/helpers/path_hop_resolver_test.dart @@ -0,0 +1,94 @@ +import 'dart:typed_data'; + +import 'package:flutter_test/flutter_test.dart'; +import 'package:latlong2/latlong.dart'; +import 'package:meshcore_open/connector/meshcore_protocol.dart'; +import 'package:meshcore_open/helpers/path_hop_resolver.dart'; +import 'package:meshcore_open/models/contact.dart'; + +Contact _contact({ + required int prefix, + required String name, + required double latitude, + required double longitude, + DateTime? lastSeen, +}) { + return Contact( + publicKey: Uint8List(32)..first = prefix, + name: name, + type: advTypeRepeater, + pathLength: 0, + path: Uint8List(0), + latitude: latitude, + longitude: longitude, + lastSeen: lastSeen ?? DateTime.utc(2026), + ); +} + +void main() { + test('received paths resolve hash conflicts from the receiver backward', () { + final nearReceiver = _contact( + prefix: 0xAA, + name: 'Near receiver', + latitude: 0, + longitude: 0.1, + ); + final nearPreviousHop = _contact( + prefix: 0xBB, + name: 'Near previous hop', + latitude: 0, + longitude: 1.1, + ); + final wrongConflict = _contact( + prefix: 0xBB, + name: 'Near receiver but wrong', + latitude: 0, + longitude: 0.2, + ); + final previousHop = _contact( + prefix: 0xCC, + name: 'Previous hop', + latitude: 0, + longitude: 1, + ); + + final resolved = PathHopResolver.resolve( + pathBytes: const [0xBB, 0xCC, 0xAA], + contacts: [nearReceiver, nearPreviousHop, wrongConflict, previousHop], + endpoint: const LatLng(0, 0), + resolveFromEnd: true, + ); + + expect(resolved.map((contact) => contact?.name), [ + 'Near previous hop', + 'Previous hop', + 'Near receiver', + ]); + }); + + test('falls back to the most recently seen conflict without locations', () { + final older = Contact( + publicKey: Uint8List(32)..first = 0xAA, + name: 'Older', + type: advTypeRepeater, + pathLength: 0, + path: Uint8List(0), + lastSeen: DateTime.utc(2025), + ); + final newer = Contact( + publicKey: Uint8List(32)..first = 0xAA, + name: 'Newer', + type: advTypeRepeater, + pathLength: 0, + path: Uint8List(0), + lastSeen: DateTime.utc(2026), + ); + + final resolved = PathHopResolver.resolve( + pathBytes: const [0xAA], + contacts: [older, newer], + ); + + expect(resolved.single?.name, 'Newer'); + }); +} diff --git a/test/screens/tcp_flow_test.dart b/test/screens/tcp_flow_test.dart index 1d8174c8..d48ae33d 100644 --- a/test/screens/tcp_flow_test.dart +++ b/test/screens/tcp_flow_test.dart @@ -123,11 +123,13 @@ void main() { ); await tester.pumpAndSettle(); - await tester.tap(find.widgetWithText(FloatingActionButton, 'TCP')); + final scannerContext = tester.element(find.byType(ScannerScreen)); + final scannerL10n = AppLocalizations.of(scannerContext); + await tester.tap(find.byTooltip(scannerL10n.connectionChoiceTcpLabel)); await tester.pumpAndSettle(); expect(find.byType(TcpScreen), findsOneWidget); - await tester.tap(find.widgetWithText(FloatingActionButton, 'Bluetooth')); + await tester.tap(find.widgetWithText(OutlinedButton, 'Bluetooth')); await tester.pumpAndSettle(); expect(find.byType(TcpScreen), findsNothing); diff --git a/test/screens/usb_flow_test.dart b/test/screens/usb_flow_test.dart index 16e5a951..4c6b8bd2 100644 --- a/test/screens/usb_flow_test.dart +++ b/test/screens/usb_flow_test.dart @@ -157,10 +157,12 @@ void main() { ); await tester.pumpAndSettle(); + final context = tester.element(find.byType(ScannerScreen)); + final l10n = AppLocalizations.of(context); if (PlatformInfo.supportsUsbSerial) { - expect(find.widgetWithText(FloatingActionButton, 'USB'), findsOneWidget); + expect(find.byTooltip(l10n.connectionChoiceUsbLabel), findsOneWidget); } else { - expect(find.widgetWithText(FloatingActionButton, 'USB'), findsNothing); + expect(find.byTooltip(l10n.connectionChoiceUsbLabel), findsNothing); } // ScannerScreen.dispose() schedules disconnect work that debounces notify. @@ -186,13 +188,13 @@ void main() { final context = tester.element(find.byType(ScannerScreen)); final l10n = AppLocalizations.of(context); - expect(find.text(l10n.scanner_scan), findsOneWidget); + expect(find.text(l10n.scanner_scan), findsWidgets); if (PlatformInfo.supportsUsbSerial) { - expect(find.text(l10n.connectionChoiceUsbLabel), findsOneWidget); + expect(find.byTooltip(l10n.connectionChoiceUsbLabel), findsOneWidget); } if (!PlatformInfo.isWeb) { - expect(find.text(l10n.connectionChoiceTcpLabel), findsOneWidget); + expect(find.byTooltip(l10n.connectionChoiceTcpLabel), findsOneWidget); } await tester.pumpWidget(const SizedBox.shrink()); diff --git a/untranslated.json b/untranslated.json index 9e26dfee..9e0501e8 100644 --- a/untranslated.json +++ b/untranslated.json @@ -1 +1,715 @@ -{} \ No newline at end of file +{ + "bg": [ + "scanner_bluetoothWebUnsupported", + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "de": [ + "scanner_bluetoothWebUnsupported", + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "es": [ + "scanner_bluetoothWebUnsupported", + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "fr": [ + "scanner_bluetoothWebUnsupported", + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "hu": [ + "scanner_bluetoothWebUnsupported", + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "it": [ + "scanner_bluetoothWebUnsupported", + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "ja": [ + "scanner_bluetoothWebUnsupported", + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "ko": [ + "scanner_bluetoothWebUnsupported", + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "nl": [ + "scanner_bluetoothWebUnsupported", + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "pl": [ + "scanner_bluetoothWebUnsupported", + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "pt": [ + "scanner_bluetoothWebUnsupported", + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "ru": [ + "scanner_bluetoothWebUnsupported", + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "sk": [ + "scanner_bluetoothWebUnsupported", + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "sl": [ + "scanner_bluetoothWebUnsupported", + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "sv": [ + "scanner_bluetoothWebUnsupported", + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "uk": [ + "scanner_bluetoothWebUnsupported", + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "zh": [ + "scanner_bluetoothWebUnsupported", + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ] +}