fix: Correct neighbor times ref:

This commit is contained in:
Janez T
2026-03-29 11:10:25 +02:00
parent 96aeec1301
commit e09d418084
2 changed files with 22 additions and 14 deletions

View File

@@ -5,22 +5,22 @@
<testcase classname="fastlane.lanes" name="0: default_platform" time="0.000616"> <testcase classname="fastlane.lanes" name="0: default_platform" time="0.000201">
</testcase> </testcase>
<testcase classname="fastlane.lanes" name="1: increment_build_number" time="0.370543"> <testcase classname="fastlane.lanes" name="1: increment_build_number" time="0.700922">
</testcase> </testcase>
<testcase classname="fastlane.lanes" name="2: build_app" time="105.689527"> <testcase classname="fastlane.lanes" name="2: build_app" time="102.603385">
</testcase> </testcase>
<testcase classname="fastlane.lanes" name="3: upload_to_app_store" time="237.850068"> <testcase classname="fastlane.lanes" name="3: upload_to_app_store" time="2538.71069">
</testcase> </testcase>

View File

@@ -1839,16 +1839,24 @@ class _NeighboursSheetState extends State<_NeighboursSheet> {
final parts = trimmed.split(':'); final parts = trimmed.split(':');
if (parts.length >= 3) { if (parts.length >= 3) {
final keyHex = parts[0]; final keyHex = parts[0];
final timestampOrMs = int.tryParse(parts[1]); final timestampOrSeconds = int.tryParse(parts[1]);
final snrRaw = int.tryParse(parts[2]); final snrRaw = int.tryParse(parts[2]);
final isMs = timestampOrMs != null && timestampOrMs < 1e9; final isDurationSeconds =
timestampOrSeconds != null && timestampOrSeconds < 1000000000;
parsed.add( parsed.add(
_Neighbour( _Neighbour(
publicKeyHex: keyHex, publicKeyHex: keyHex,
lastSeenAt: !isMs && timestampOrMs != null lastSeenAt: !isDurationSeconds && timestampOrSeconds != null
? DateTime.fromMillisecondsSinceEpoch(timestampOrMs * 1000) ? timestampOrSeconds >= 1000000000000
? DateTime.fromMillisecondsSinceEpoch(
timestampOrSeconds,
)
: DateTime.fromMillisecondsSinceEpoch(
timestampOrSeconds * 1000,
)
: null, : null,
lastSeenMs: isMs ? timestampOrMs : null, lastSeenSeconds:
isDurationSeconds ? timestampOrSeconds : null,
snrDb: snrRaw != null ? snrRaw / 4.0 : null, snrDb: snrRaw != null ? snrRaw / 4.0 : null,
), ),
); );
@@ -1896,12 +1904,12 @@ class _NeighboursSheetState extends State<_NeighboursSheet> {
.difference(neighbour.lastSeenAt!) .difference(neighbour.lastSeenAt!)
.toLocalizedTimeAgoWithSeconds(context); .toLocalizedTimeAgoWithSeconds(context);
} }
if (neighbour.lastSeenMs != null) { if (neighbour.lastSeenSeconds != null) {
if (neighbour.lastSeenMs! < 1000) { if (neighbour.lastSeenSeconds! < 1) {
return AppLocalizations.of(context)!.justNow; return AppLocalizations.of(context)!.justNow;
} }
return Duration( return Duration(
milliseconds: neighbour.lastSeenMs!, seconds: neighbour.lastSeenSeconds!,
).toLocalizedTimeAgoWithSeconds(context); ).toLocalizedTimeAgoWithSeconds(context);
} }
return AppLocalizations.of(context)!.justNow; return AppLocalizations.of(context)!.justNow;
@@ -2295,13 +2303,13 @@ class _NeighboursSheetState extends State<_NeighboursSheet> {
class _Neighbour { class _Neighbour {
final String publicKeyHex; final String publicKeyHex;
final DateTime? lastSeenAt; final DateTime? lastSeenAt;
final int? lastSeenMs; final int? lastSeenSeconds;
final double? snrDb; final double? snrDb;
const _Neighbour({ const _Neighbour({
required this.publicKeyHex, required this.publicKeyHex,
this.lastSeenAt, this.lastSeenAt,
this.lastSeenMs, this.lastSeenSeconds,
this.snrDb, this.snrDb,
}); });
} }