feat: harden geofence and distance diagnostics
This commit is contained in:
@@ -1,12 +1,35 @@
|
||||
class BuildInfo {
|
||||
static const String date = String.fromEnvironment(
|
||||
static const String _date = String.fromEnvironment(
|
||||
'IGNIS_BUILD_DATE',
|
||||
defaultValue: 'dev',
|
||||
defaultValue: '',
|
||||
);
|
||||
static const String gitSha = String.fromEnvironment(
|
||||
static const String _gitSha = String.fromEnvironment(
|
||||
'IGNIS_GIT_SHA',
|
||||
defaultValue: 'local',
|
||||
defaultValue: '',
|
||||
);
|
||||
|
||||
static String get label => 'build $date - $gitSha';
|
||||
static bool get hasMetadata => _date.isNotEmpty && _gitSha.isNotEmpty;
|
||||
|
||||
static String get shortSha {
|
||||
if (_gitSha.isEmpty) return 'unknown';
|
||||
return _gitSha.length <= 7 ? _gitSha : _gitSha.substring(0, 7);
|
||||
}
|
||||
|
||||
static String get formattedDate {
|
||||
if (_date.isEmpty) return 'unknown date';
|
||||
|
||||
final parsed = DateTime.tryParse(_date);
|
||||
if (parsed == null) return _date;
|
||||
|
||||
final utc = parsed.toUtc();
|
||||
final year = utc.year.toString().padLeft(4, '0');
|
||||
final month = utc.month.toString().padLeft(2, '0');
|
||||
final day = utc.day.toString().padLeft(2, '0');
|
||||
final hour = utc.hour.toString().padLeft(2, '0');
|
||||
final minute = utc.minute.toString().padLeft(2, '0');
|
||||
return '$year-$month-$day $hour:$minute UTC';
|
||||
}
|
||||
|
||||
static String get label =>
|
||||
hasMetadata ? '$formattedDate · $shortSha' : 'build info unavailable';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user