feat: add device authentication, place gates support, and PiP navigation features
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import 'place_gate.dart';
|
||||
|
||||
class PlaceModel {
|
||||
final String id;
|
||||
final String name;
|
||||
@@ -7,6 +9,7 @@ class PlaceModel {
|
||||
final double elevationMeters; // GPS Altitude AMSL in meters (defaults to 0.0)
|
||||
final double? distanceKm;
|
||||
final String? address;
|
||||
final List<PlaceGate> gates;
|
||||
|
||||
PlaceModel({
|
||||
required this.id,
|
||||
@@ -17,8 +20,11 @@ class PlaceModel {
|
||||
this.elevationMeters = 0.0,
|
||||
this.distanceKm,
|
||||
this.address,
|
||||
this.gates = const [],
|
||||
});
|
||||
|
||||
bool get hasGates => gates.isNotEmpty;
|
||||
|
||||
factory PlaceModel.fromJson(Map<String, dynamic> json) {
|
||||
final rawElev = json['elevation_meters'] ?? json['elevation'] ?? json['altitude'] ?? 0.0;
|
||||
double elev = 0.0;
|
||||
@@ -28,6 +34,14 @@ class PlaceModel {
|
||||
elev = double.tryParse(rawElev.toString()) ?? 0.0;
|
||||
}
|
||||
|
||||
final rawGates = json['gates'];
|
||||
List<PlaceGate> parsedGates = [];
|
||||
if (rawGates is List) {
|
||||
parsedGates = rawGates
|
||||
.map((g) => PlaceGate.fromJson(Map<String, dynamic>.from(g)))
|
||||
.toList();
|
||||
}
|
||||
|
||||
return PlaceModel(
|
||||
id: json['id']?.toString() ?? '',
|
||||
name: json['name']?.toString() ?? '',
|
||||
@@ -39,6 +53,7 @@ class PlaceModel {
|
||||
? (json['distanceKm'] as num).toDouble()
|
||||
: null,
|
||||
address: json['address']?.toString() ?? json['neighborhood']?.toString(),
|
||||
gates: parsedGates,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -52,6 +67,7 @@ class PlaceModel {
|
||||
'elevation_meters': elevationMeters,
|
||||
'altitude': elevationMeters,
|
||||
if (address != null) 'address': address,
|
||||
if (gates.isNotEmpty) 'gates': gates.map((g) => g.toJson()).toList(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user