From 5f1e125cff3c70e23b8be0a0fa02e11d3a78f168 Mon Sep 17 00:00:00 2001 From: aitorarana Date: Tue, 17 Feb 2026 12:11:50 +0100 Subject: [PATCH] Added map data and device selection --- .../hub_remote_datasource_impl.dart | 50 +- .../latest_positions_response_model.dart | 96 ++- ...test_positions_response_model.freezed.dart | 678 +++++++++++++++++- .../latest_positions_response_model.g.dart | 80 ++- .../hub/domain/entities/address_entity.dart | 14 + .../entities/address_entity.freezed.dart | 283 ++++++++ .../hub/domain/entities/network_entity.dart | 12 + .../entities/network_entity.freezed.dart | 277 +++++++ .../hub/domain/entities/position_entity.dart | 44 +- .../entities/position_entity.freezed.dart | 352 +++++++++ .../hub/lib/src/features/hub/hub_builder.dart | 2 +- .../features/hub/presentation/hub_screen.dart | 209 ++++-- .../presentation/state/hub_view_model.dart | 48 +- .../presentation/state/hub_view_state.dart | 4 +- .../state/hub_view_state.freezed.dart | 78 +- packages/design_system/fonts/SFIcons.ttf | Bin 29300 -> 28912 bytes packages/design_system/fonts/config.json | 28 +- .../lib/src/dropdowns/dropdown.dart | 4 +- .../design_system/lib/src/icons/sf_icons.dart | 2 +- packages/sf_localizations/assets/l10n/en.json | 2 +- packages/sf_localizations/assets/l10n/es.json | 2 +- 21 files changed, 2073 insertions(+), 192 deletions(-) create mode 100644 modules/legacy/modules/hub/lib/src/features/hub/domain/entities/address_entity.dart create mode 100644 modules/legacy/modules/hub/lib/src/features/hub/domain/entities/address_entity.freezed.dart create mode 100644 modules/legacy/modules/hub/lib/src/features/hub/domain/entities/network_entity.dart create mode 100644 modules/legacy/modules/hub/lib/src/features/hub/domain/entities/network_entity.freezed.dart create mode 100644 modules/legacy/modules/hub/lib/src/features/hub/domain/entities/position_entity.freezed.dart diff --git a/modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart b/modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart index 78fb2279..6eca5a50 100644 --- a/modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart +++ b/modules/legacy/modules/hub/lib/src/core/data/datasource/hub_remote_datasource_impl.dart @@ -1,13 +1,11 @@ import 'dart:convert'; import 'package:dio/dio.dart'; -import 'package:flutter/material.dart'; import 'package:hub/src/core/data/datasource/hub_remote_datasource.dart'; import 'package:hub/src/core/data/models/get_devices_response_model.dart'; import 'package:hub/src/core/data/models/latest_positions_response_model.dart'; import 'package:hub/src/features/hub/domain/entities/device_entity.dart'; import 'package:hub/src/features/hub/domain/entities/position_entity.dart'; -import 'package:hub/src/features/hub/domain/get_latest_positions_use_case.dart'; import 'package:sf_infrastructure/sf_infrastructure.dart'; class HomeRemoteDatasourceImpl implements HomeRemoteDatasource { @@ -62,17 +60,53 @@ class HomeRemoteDatasourceImpl implements HomeRemoteDatasource { LatestPositionsItemResponseModel( latitude: 43.327116830678186, longitude: -3.083269100434551, - address: 'Aparcamiento', - positionDate: DateTime.now(), + address: LatestPositionsAddressResponseModel( + street: 'street', + city: 'city', + province: 'province', + state: 'state', + country: 'country', + ), + positionDate: DateTime.now().millisecondsSinceEpoch, frequentPlace: false, - frequentPlaceName: ''), + frequentPlaceName: '', + id: '1', + deviceIdentificator: deviceId, + hpe: 0, + ncell: 65, + type: 0, + createdAt: DateTime.now().millisecondsSinceEpoch, + positionDateOriginal: null, + message: '', + networks: [LatestPositionsNetworkResponseModel(SSID: 'SSID', BSSID: 'BSSID', signal: 'signal')], + ignore: false, + suspect: false + ), LatestPositionsItemResponseModel( latitude: 43.32729043118528, longitude: -3.08320596406992, - address: 'Izekoren etxea', - positionDate: DateTime.now(), + address: LatestPositionsAddressResponseModel( + street: 'street', + city: 'city', + province: 'province', + state: 'state', + country: 'country', + ), + positionDate: DateTime.now().millisecondsSinceEpoch, frequentPlace: true, - frequentPlaceName: 'La cafetería'), + frequentPlaceName: 'La cafetería', + id: '2', + deviceIdentificator: deviceId, + hpe: 0, + ncell: 65, + type: 0, + createdAt: DateTime.now().millisecondsSinceEpoch, + positionDateOriginal: null, + message: '', + networks: [], + ignore: false, + suspect: false + ), ]);*/ return model.toEntity(); } on DioException catch (error) { diff --git a/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.dart b/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.dart index e9aeaf19..b3fac765 100644 --- a/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.dart +++ b/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.dart @@ -1,4 +1,6 @@ import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:hub/src/features/hub/domain/entities/address_entity.dart'; +import 'package:hub/src/features/hub/domain/entities/network_entity.dart'; import 'package:hub/src/features/hub/domain/entities/position_entity.dart'; part 'latest_positions_response_model.freezed.dart'; @@ -18,27 +20,99 @@ abstract class LatestPositionsResponseModel with _$LatestPositionsResponseModel abstract class LatestPositionsItemResponseModel with _$LatestPositionsItemResponseModel { const factory LatestPositionsItemResponseModel({ + required String id, + required String deviceIdentificator, required double latitude, required double longitude, - required String? address, - required DateTime positionDate, + required int hpe, + int? ncell, + required int type, + int? steps, + LatestPositionsAddressResponseModel? address, + required int createdAt, + required int positionDate, + int? positionDateOriginal, + String? frequentPlaceName, + required String message, + required List networks, + required bool ignore, + required bool suspect, required bool frequentPlace, - required String frequentPlaceName, }) = _LatestPositionsItemResponseModel; factory LatestPositionsItemResponseModel.fromJson(Map json) => - _$LatestPositionsItemResponseModelFromJson(json); + _$LatestPositionsItemResponseModelFromJson(json); } extension LatestPositionsResponseModelMapper on LatestPositionsResponseModel { List toEntity() { - return items.map((LatestPositionsItemResponseModel item) => PositionEntity( - latitude: item.latitude, - longitude: item.longitude, - address: item.address, - positionDate: item.positionDate, - frequentPlace: item.frequentPlace, - frequentPlaceName: item.frequentPlaceName, + return items.map((LatestPositionsItemResponseModel item) => PositionEntity( + id: item.id, + deviceIdentificator: item.deviceIdentificator, + latitude: item.latitude, + longitude: item.longitude, + hpe: item.hpe, + ncell: item.ncell, + type: item.type, + steps: item.steps, + address: item.address?.toEntity(), + createdAt: item.createdAt, + positionDate: item.positionDate, + positionDateOriginal: item.positionDateOriginal, + frequentPlaceName: item.frequentPlaceName, + message: item.message, + networks: item.networks.map((n)=>n.toEntity()).toList(), + ignore: item.ignore, + suspect: item.suspect, + frequentPlace: item.frequentPlace, )).toList(); } } + +@freezed +abstract class LatestPositionsAddressResponseModel with _$LatestPositionsAddressResponseModel { + const factory LatestPositionsAddressResponseModel({ + required String street, + required String city, + required String province, + required String state, + required String country, + }) = _LatestPositionsAddressResponseModel; + + factory LatestPositionsAddressResponseModel.fromJson(Map json) => + _$LatestPositionsAddressResponseModelFromJson(json); +} + +extension LatestPositionsAddressResponseModelMapper on LatestPositionsAddressResponseModel { + AddressEntity toEntity() { + return AddressEntity( + street: street, + city: city, + province: province, + state: state, + country: country, + ); + } +} + +@freezed +abstract class LatestPositionsNetworkResponseModel with _$LatestPositionsNetworkResponseModel { + const factory LatestPositionsNetworkResponseModel({ + required String SSID, + required String BSSID, + required String signal, + }) = _LatestPositionsNetworkResponseModel; + + factory LatestPositionsNetworkResponseModel.fromJson(Map json) => + _$LatestPositionsNetworkResponseModelFromJson(json); +} + +extension LatestPositionsNetworkResponseModelMapper on LatestPositionsNetworkResponseModel { + NetworkEntity toEntity() { + return NetworkEntity( + SSID: SSID, + BSSID: BSSID, + signal: signal, + ); + } +} \ No newline at end of file diff --git a/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.freezed.dart b/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.freezed.dart index 1f149eaa..675f05d5 100644 --- a/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.freezed.dart +++ b/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.freezed.dart @@ -284,7 +284,7 @@ as List, /// @nodoc mixin _$LatestPositionsItemResponseModel { - double get latitude; double get longitude; String? get address; DateTime get positionDate; bool get frequentPlace; String get frequentPlaceName; + String get id; String get deviceIdentificator; double get latitude; double get longitude; int get hpe; int? get ncell; int get type; int? get steps; LatestPositionsAddressResponseModel? get address; int get createdAt; int get positionDate; int? get positionDateOriginal; String? get frequentPlaceName; String get message; List get networks; bool get ignore; bool get suspect; bool get frequentPlace; /// Create a copy of LatestPositionsItemResponseModel /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -297,16 +297,16 @@ $LatestPositionsItemResponseModelCopyWith get @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is LatestPositionsItemResponseModel&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.address, address) || other.address == address)&&(identical(other.positionDate, positionDate) || other.positionDate == positionDate)&&(identical(other.frequentPlace, frequentPlace) || other.frequentPlace == frequentPlace)&&(identical(other.frequentPlaceName, frequentPlaceName) || other.frequentPlaceName == frequentPlaceName)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is LatestPositionsItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.hpe, hpe) || other.hpe == hpe)&&(identical(other.ncell, ncell) || other.ncell == ncell)&&(identical(other.type, type) || other.type == type)&&(identical(other.steps, steps) || other.steps == steps)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.positionDate, positionDate) || other.positionDate == positionDate)&&(identical(other.positionDateOriginal, positionDateOriginal) || other.positionDateOriginal == positionDateOriginal)&&(identical(other.frequentPlaceName, frequentPlaceName) || other.frequentPlaceName == frequentPlaceName)&&(identical(other.message, message) || other.message == message)&&const DeepCollectionEquality().equals(other.networks, networks)&&(identical(other.ignore, ignore) || other.ignore == ignore)&&(identical(other.suspect, suspect) || other.suspect == suspect)&&(identical(other.frequentPlace, frequentPlace) || other.frequentPlace == frequentPlace)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,latitude,longitude,address,positionDate,frequentPlace,frequentPlaceName); +int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,latitude,longitude,hpe,ncell,type,steps,address,createdAt,positionDate,positionDateOriginal,frequentPlaceName,message,const DeepCollectionEquality().hash(networks),ignore,suspect,frequentPlace); @override String toString() { - return 'LatestPositionsItemResponseModel(latitude: $latitude, longitude: $longitude, address: $address, positionDate: $positionDate, frequentPlace: $frequentPlace, frequentPlaceName: $frequentPlaceName)'; + return 'LatestPositionsItemResponseModel(id: $id, deviceIdentificator: $deviceIdentificator, latitude: $latitude, longitude: $longitude, hpe: $hpe, ncell: $ncell, type: $type, steps: $steps, address: $address, createdAt: $createdAt, positionDate: $positionDate, positionDateOriginal: $positionDateOriginal, frequentPlaceName: $frequentPlaceName, message: $message, networks: $networks, ignore: $ignore, suspect: $suspect, frequentPlace: $frequentPlace)'; } @@ -317,11 +317,11 @@ abstract mixin class $LatestPositionsItemResponseModelCopyWith<$Res> { factory $LatestPositionsItemResponseModelCopyWith(LatestPositionsItemResponseModel value, $Res Function(LatestPositionsItemResponseModel) _then) = _$LatestPositionsItemResponseModelCopyWithImpl; @useResult $Res call({ - double latitude, double longitude, String? address, DateTime positionDate, bool frequentPlace, String frequentPlaceName + String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, LatestPositionsAddressResponseModel? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List networks, bool ignore, bool suspect, bool frequentPlace }); - +$LatestPositionsAddressResponseModelCopyWith<$Res>? get address; } /// @nodoc @@ -334,18 +334,42 @@ class _$LatestPositionsItemResponseModelCopyWithImpl<$Res> /// Create a copy of LatestPositionsItemResponseModel /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? latitude = null,Object? longitude = null,Object? address = freezed,Object? positionDate = null,Object? frequentPlace = null,Object? frequentPlaceName = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? deviceIdentificator = null,Object? latitude = null,Object? longitude = null,Object? hpe = null,Object? ncell = freezed,Object? type = null,Object? steps = freezed,Object? address = freezed,Object? createdAt = null,Object? positionDate = null,Object? positionDateOriginal = freezed,Object? frequentPlaceName = freezed,Object? message = null,Object? networks = null,Object? ignore = null,Object? suspect = null,Object? frequentPlace = null,}) { return _then(_self.copyWith( -latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable +as String,latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable as double,longitude: null == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable -as double,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable -as String?,positionDate: null == positionDate ? _self.positionDate : positionDate // ignore: cast_nullable_to_non_nullable -as DateTime,frequentPlace: null == frequentPlace ? _self.frequentPlace : frequentPlace // ignore: cast_nullable_to_non_nullable -as bool,frequentPlaceName: null == frequentPlaceName ? _self.frequentPlaceName : frequentPlaceName // ignore: cast_nullable_to_non_nullable -as String, +as double,hpe: null == hpe ? _self.hpe : hpe // ignore: cast_nullable_to_non_nullable +as int,ncell: freezed == ncell ? _self.ncell : ncell // ignore: cast_nullable_to_non_nullable +as int?,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as int,steps: freezed == steps ? _self.steps : steps // ignore: cast_nullable_to_non_nullable +as int?,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable +as LatestPositionsAddressResponseModel?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as int,positionDate: null == positionDate ? _self.positionDate : positionDate // ignore: cast_nullable_to_non_nullable +as int,positionDateOriginal: freezed == positionDateOriginal ? _self.positionDateOriginal : positionDateOriginal // ignore: cast_nullable_to_non_nullable +as int?,frequentPlaceName: freezed == frequentPlaceName ? _self.frequentPlaceName : frequentPlaceName // ignore: cast_nullable_to_non_nullable +as String?,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable +as String,networks: null == networks ? _self.networks : networks // ignore: cast_nullable_to_non_nullable +as List,ignore: null == ignore ? _self.ignore : ignore // ignore: cast_nullable_to_non_nullable +as bool,suspect: null == suspect ? _self.suspect : suspect // ignore: cast_nullable_to_non_nullable +as bool,frequentPlace: null == frequentPlace ? _self.frequentPlace : frequentPlace // ignore: cast_nullable_to_non_nullable +as bool, )); } +/// Create a copy of LatestPositionsItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$LatestPositionsAddressResponseModelCopyWith<$Res>? get address { + if (_self.address == null) { + return null; + } + return $LatestPositionsAddressResponseModelCopyWith<$Res>(_self.address!, (value) { + return _then(_self.copyWith(address: value)); + }); +} } @@ -427,10 +451,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( double latitude, double longitude, String? address, DateTime positionDate, bool frequentPlace, String frequentPlaceName)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, LatestPositionsAddressResponseModel? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List networks, bool ignore, bool suspect, bool frequentPlace)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _LatestPositionsItemResponseModel() when $default != null: -return $default(_that.latitude,_that.longitude,_that.address,_that.positionDate,_that.frequentPlace,_that.frequentPlaceName);case _: +return $default(_that.id,_that.deviceIdentificator,_that.latitude,_that.longitude,_that.hpe,_that.ncell,_that.type,_that.steps,_that.address,_that.createdAt,_that.positionDate,_that.positionDateOriginal,_that.frequentPlaceName,_that.message,_that.networks,_that.ignore,_that.suspect,_that.frequentPlace);case _: return orElse(); } @@ -448,10 +472,10 @@ return $default(_that.latitude,_that.longitude,_that.address,_that.positionDate, /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( double latitude, double longitude, String? address, DateTime positionDate, bool frequentPlace, String frequentPlaceName) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, LatestPositionsAddressResponseModel? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List networks, bool ignore, bool suspect, bool frequentPlace) $default,) {final _that = this; switch (_that) { case _LatestPositionsItemResponseModel(): -return $default(_that.latitude,_that.longitude,_that.address,_that.positionDate,_that.frequentPlace,_that.frequentPlaceName);case _: +return $default(_that.id,_that.deviceIdentificator,_that.latitude,_that.longitude,_that.hpe,_that.ncell,_that.type,_that.steps,_that.address,_that.createdAt,_that.positionDate,_that.positionDateOriginal,_that.frequentPlaceName,_that.message,_that.networks,_that.ignore,_that.suspect,_that.frequentPlace);case _: throw StateError('Unexpected subclass'); } @@ -468,10 +492,10 @@ return $default(_that.latitude,_that.longitude,_that.address,_that.positionDate, /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( double latitude, double longitude, String? address, DateTime positionDate, bool frequentPlace, String frequentPlaceName)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, LatestPositionsAddressResponseModel? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List networks, bool ignore, bool suspect, bool frequentPlace)? $default,) {final _that = this; switch (_that) { case _LatestPositionsItemResponseModel() when $default != null: -return $default(_that.latitude,_that.longitude,_that.address,_that.positionDate,_that.frequentPlace,_that.frequentPlaceName);case _: +return $default(_that.id,_that.deviceIdentificator,_that.latitude,_that.longitude,_that.hpe,_that.ncell,_that.type,_that.steps,_that.address,_that.createdAt,_that.positionDate,_that.positionDateOriginal,_that.frequentPlaceName,_that.message,_that.networks,_that.ignore,_that.suspect,_that.frequentPlace);case _: return null; } @@ -483,15 +507,33 @@ return $default(_that.latitude,_that.longitude,_that.address,_that.positionDate, @JsonSerializable() class _LatestPositionsItemResponseModel implements LatestPositionsItemResponseModel { - const _LatestPositionsItemResponseModel({required this.latitude, required this.longitude, required this.address, required this.positionDate, required this.frequentPlace, required this.frequentPlaceName}); + const _LatestPositionsItemResponseModel({required this.id, required this.deviceIdentificator, required this.latitude, required this.longitude, required this.hpe, this.ncell, required this.type, this.steps, this.address, required this.createdAt, required this.positionDate, this.positionDateOriginal, this.frequentPlaceName, required this.message, required final List networks, required this.ignore, required this.suspect, required this.frequentPlace}): _networks = networks; factory _LatestPositionsItemResponseModel.fromJson(Map json) => _$LatestPositionsItemResponseModelFromJson(json); +@override final String id; +@override final String deviceIdentificator; @override final double latitude; @override final double longitude; -@override final String? address; -@override final DateTime positionDate; +@override final int hpe; +@override final int? ncell; +@override final int type; +@override final int? steps; +@override final LatestPositionsAddressResponseModel? address; +@override final int createdAt; +@override final int positionDate; +@override final int? positionDateOriginal; +@override final String? frequentPlaceName; +@override final String message; + final List _networks; +@override List get networks { + if (_networks is EqualUnmodifiableListView) return _networks; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_networks); +} + +@override final bool ignore; +@override final bool suspect; @override final bool frequentPlace; -@override final String frequentPlaceName; /// Create a copy of LatestPositionsItemResponseModel /// with the given fields replaced by the non-null parameter values. @@ -506,16 +548,16 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _LatestPositionsItemResponseModel&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.address, address) || other.address == address)&&(identical(other.positionDate, positionDate) || other.positionDate == positionDate)&&(identical(other.frequentPlace, frequentPlace) || other.frequentPlace == frequentPlace)&&(identical(other.frequentPlaceName, frequentPlaceName) || other.frequentPlaceName == frequentPlaceName)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _LatestPositionsItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.hpe, hpe) || other.hpe == hpe)&&(identical(other.ncell, ncell) || other.ncell == ncell)&&(identical(other.type, type) || other.type == type)&&(identical(other.steps, steps) || other.steps == steps)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.positionDate, positionDate) || other.positionDate == positionDate)&&(identical(other.positionDateOriginal, positionDateOriginal) || other.positionDateOriginal == positionDateOriginal)&&(identical(other.frequentPlaceName, frequentPlaceName) || other.frequentPlaceName == frequentPlaceName)&&(identical(other.message, message) || other.message == message)&&const DeepCollectionEquality().equals(other._networks, _networks)&&(identical(other.ignore, ignore) || other.ignore == ignore)&&(identical(other.suspect, suspect) || other.suspect == suspect)&&(identical(other.frequentPlace, frequentPlace) || other.frequentPlace == frequentPlace)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,latitude,longitude,address,positionDate,frequentPlace,frequentPlaceName); +int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,latitude,longitude,hpe,ncell,type,steps,address,createdAt,positionDate,positionDateOriginal,frequentPlaceName,message,const DeepCollectionEquality().hash(_networks),ignore,suspect,frequentPlace); @override String toString() { - return 'LatestPositionsItemResponseModel(latitude: $latitude, longitude: $longitude, address: $address, positionDate: $positionDate, frequentPlace: $frequentPlace, frequentPlaceName: $frequentPlaceName)'; + return 'LatestPositionsItemResponseModel(id: $id, deviceIdentificator: $deviceIdentificator, latitude: $latitude, longitude: $longitude, hpe: $hpe, ncell: $ncell, type: $type, steps: $steps, address: $address, createdAt: $createdAt, positionDate: $positionDate, positionDateOriginal: $positionDateOriginal, frequentPlaceName: $frequentPlaceName, message: $message, networks: $networks, ignore: $ignore, suspect: $suspect, frequentPlace: $frequentPlace)'; } @@ -526,11 +568,11 @@ abstract mixin class _$LatestPositionsItemResponseModelCopyWith<$Res> implements factory _$LatestPositionsItemResponseModelCopyWith(_LatestPositionsItemResponseModel value, $Res Function(_LatestPositionsItemResponseModel) _then) = __$LatestPositionsItemResponseModelCopyWithImpl; @override @useResult $Res call({ - double latitude, double longitude, String? address, DateTime positionDate, bool frequentPlace, String frequentPlaceName + String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, LatestPositionsAddressResponseModel? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List networks, bool ignore, bool suspect, bool frequentPlace }); - +@override $LatestPositionsAddressResponseModelCopyWith<$Res>? get address; } /// @nodoc @@ -543,14 +585,582 @@ class __$LatestPositionsItemResponseModelCopyWithImpl<$Res> /// Create a copy of LatestPositionsItemResponseModel /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? latitude = null,Object? longitude = null,Object? address = freezed,Object? positionDate = null,Object? frequentPlace = null,Object? frequentPlaceName = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? deviceIdentificator = null,Object? latitude = null,Object? longitude = null,Object? hpe = null,Object? ncell = freezed,Object? type = null,Object? steps = freezed,Object? address = freezed,Object? createdAt = null,Object? positionDate = null,Object? positionDateOriginal = freezed,Object? frequentPlaceName = freezed,Object? message = null,Object? networks = null,Object? ignore = null,Object? suspect = null,Object? frequentPlace = null,}) { return _then(_LatestPositionsItemResponseModel( -latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable +as String,latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable as double,longitude: null == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable -as double,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable -as String?,positionDate: null == positionDate ? _self.positionDate : positionDate // ignore: cast_nullable_to_non_nullable -as DateTime,frequentPlace: null == frequentPlace ? _self.frequentPlace : frequentPlace // ignore: cast_nullable_to_non_nullable -as bool,frequentPlaceName: null == frequentPlaceName ? _self.frequentPlaceName : frequentPlaceName // ignore: cast_nullable_to_non_nullable +as double,hpe: null == hpe ? _self.hpe : hpe // ignore: cast_nullable_to_non_nullable +as int,ncell: freezed == ncell ? _self.ncell : ncell // ignore: cast_nullable_to_non_nullable +as int?,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as int,steps: freezed == steps ? _self.steps : steps // ignore: cast_nullable_to_non_nullable +as int?,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable +as LatestPositionsAddressResponseModel?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as int,positionDate: null == positionDate ? _self.positionDate : positionDate // ignore: cast_nullable_to_non_nullable +as int,positionDateOriginal: freezed == positionDateOriginal ? _self.positionDateOriginal : positionDateOriginal // ignore: cast_nullable_to_non_nullable +as int?,frequentPlaceName: freezed == frequentPlaceName ? _self.frequentPlaceName : frequentPlaceName // ignore: cast_nullable_to_non_nullable +as String?,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable +as String,networks: null == networks ? _self._networks : networks // ignore: cast_nullable_to_non_nullable +as List,ignore: null == ignore ? _self.ignore : ignore // ignore: cast_nullable_to_non_nullable +as bool,suspect: null == suspect ? _self.suspect : suspect // ignore: cast_nullable_to_non_nullable +as bool,frequentPlace: null == frequentPlace ? _self.frequentPlace : frequentPlace // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + +/// Create a copy of LatestPositionsItemResponseModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$LatestPositionsAddressResponseModelCopyWith<$Res>? get address { + if (_self.address == null) { + return null; + } + + return $LatestPositionsAddressResponseModelCopyWith<$Res>(_self.address!, (value) { + return _then(_self.copyWith(address: value)); + }); +} +} + + +/// @nodoc +mixin _$LatestPositionsAddressResponseModel { + + String get street; String get city; String get province; String get state; String get country; +/// Create a copy of LatestPositionsAddressResponseModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$LatestPositionsAddressResponseModelCopyWith get copyWith => _$LatestPositionsAddressResponseModelCopyWithImpl(this as LatestPositionsAddressResponseModel, _$identity); + + /// Serializes this LatestPositionsAddressResponseModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is LatestPositionsAddressResponseModel&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,street,city,province,state,country); + +@override +String toString() { + return 'LatestPositionsAddressResponseModel(street: $street, city: $city, province: $province, state: $state, country: $country)'; +} + + +} + +/// @nodoc +abstract mixin class $LatestPositionsAddressResponseModelCopyWith<$Res> { + factory $LatestPositionsAddressResponseModelCopyWith(LatestPositionsAddressResponseModel value, $Res Function(LatestPositionsAddressResponseModel) _then) = _$LatestPositionsAddressResponseModelCopyWithImpl; +@useResult +$Res call({ + String street, String city, String province, String state, String country +}); + + + + +} +/// @nodoc +class _$LatestPositionsAddressResponseModelCopyWithImpl<$Res> + implements $LatestPositionsAddressResponseModelCopyWith<$Res> { + _$LatestPositionsAddressResponseModelCopyWithImpl(this._self, this._then); + + final LatestPositionsAddressResponseModel _self; + final $Res Function(LatestPositionsAddressResponseModel) _then; + +/// Create a copy of LatestPositionsAddressResponseModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? street = null,Object? city = null,Object? province = null,Object? state = null,Object? country = null,}) { + return _then(_self.copyWith( +street: null == street ? _self.street : street // ignore: cast_nullable_to_non_nullable +as String,city: null == city ? _self.city : city // ignore: cast_nullable_to_non_nullable +as String,province: null == province ? _self.province : province // ignore: cast_nullable_to_non_nullable +as String,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable +as String,country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [LatestPositionsAddressResponseModel]. +extension LatestPositionsAddressResponseModelPatterns on LatestPositionsAddressResponseModel { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _LatestPositionsAddressResponseModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _LatestPositionsAddressResponseModel() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _LatestPositionsAddressResponseModel value) $default,){ +final _that = this; +switch (_that) { +case _LatestPositionsAddressResponseModel(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _LatestPositionsAddressResponseModel value)? $default,){ +final _that = this; +switch (_that) { +case _LatestPositionsAddressResponseModel() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String street, String city, String province, String state, String country)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _LatestPositionsAddressResponseModel() when $default != null: +return $default(_that.street,_that.city,_that.province,_that.state,_that.country);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String street, String city, String province, String state, String country) $default,) {final _that = this; +switch (_that) { +case _LatestPositionsAddressResponseModel(): +return $default(_that.street,_that.city,_that.province,_that.state,_that.country);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String street, String city, String province, String state, String country)? $default,) {final _that = this; +switch (_that) { +case _LatestPositionsAddressResponseModel() when $default != null: +return $default(_that.street,_that.city,_that.province,_that.state,_that.country);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _LatestPositionsAddressResponseModel implements LatestPositionsAddressResponseModel { + const _LatestPositionsAddressResponseModel({required this.street, required this.city, required this.province, required this.state, required this.country}); + factory _LatestPositionsAddressResponseModel.fromJson(Map json) => _$LatestPositionsAddressResponseModelFromJson(json); + +@override final String street; +@override final String city; +@override final String province; +@override final String state; +@override final String country; + +/// Create a copy of LatestPositionsAddressResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$LatestPositionsAddressResponseModelCopyWith<_LatestPositionsAddressResponseModel> get copyWith => __$LatestPositionsAddressResponseModelCopyWithImpl<_LatestPositionsAddressResponseModel>(this, _$identity); + +@override +Map toJson() { + return _$LatestPositionsAddressResponseModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _LatestPositionsAddressResponseModel&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,street,city,province,state,country); + +@override +String toString() { + return 'LatestPositionsAddressResponseModel(street: $street, city: $city, province: $province, state: $state, country: $country)'; +} + + +} + +/// @nodoc +abstract mixin class _$LatestPositionsAddressResponseModelCopyWith<$Res> implements $LatestPositionsAddressResponseModelCopyWith<$Res> { + factory _$LatestPositionsAddressResponseModelCopyWith(_LatestPositionsAddressResponseModel value, $Res Function(_LatestPositionsAddressResponseModel) _then) = __$LatestPositionsAddressResponseModelCopyWithImpl; +@override @useResult +$Res call({ + String street, String city, String province, String state, String country +}); + + + + +} +/// @nodoc +class __$LatestPositionsAddressResponseModelCopyWithImpl<$Res> + implements _$LatestPositionsAddressResponseModelCopyWith<$Res> { + __$LatestPositionsAddressResponseModelCopyWithImpl(this._self, this._then); + + final _LatestPositionsAddressResponseModel _self; + final $Res Function(_LatestPositionsAddressResponseModel) _then; + +/// Create a copy of LatestPositionsAddressResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? street = null,Object? city = null,Object? province = null,Object? state = null,Object? country = null,}) { + return _then(_LatestPositionsAddressResponseModel( +street: null == street ? _self.street : street // ignore: cast_nullable_to_non_nullable +as String,city: null == city ? _self.city : city // ignore: cast_nullable_to_non_nullable +as String,province: null == province ? _self.province : province // ignore: cast_nullable_to_non_nullable +as String,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable +as String,country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + + +/// @nodoc +mixin _$LatestPositionsNetworkResponseModel { + + String get SSID; String get BSSID; String get signal; +/// Create a copy of LatestPositionsNetworkResponseModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$LatestPositionsNetworkResponseModelCopyWith get copyWith => _$LatestPositionsNetworkResponseModelCopyWithImpl(this as LatestPositionsNetworkResponseModel, _$identity); + + /// Serializes this LatestPositionsNetworkResponseModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is LatestPositionsNetworkResponseModel&&(identical(other.SSID, SSID) || other.SSID == SSID)&&(identical(other.BSSID, BSSID) || other.BSSID == BSSID)&&(identical(other.signal, signal) || other.signal == signal)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,SSID,BSSID,signal); + +@override +String toString() { + return 'LatestPositionsNetworkResponseModel(SSID: $SSID, BSSID: $BSSID, signal: $signal)'; +} + + +} + +/// @nodoc +abstract mixin class $LatestPositionsNetworkResponseModelCopyWith<$Res> { + factory $LatestPositionsNetworkResponseModelCopyWith(LatestPositionsNetworkResponseModel value, $Res Function(LatestPositionsNetworkResponseModel) _then) = _$LatestPositionsNetworkResponseModelCopyWithImpl; +@useResult +$Res call({ + String SSID, String BSSID, String signal +}); + + + + +} +/// @nodoc +class _$LatestPositionsNetworkResponseModelCopyWithImpl<$Res> + implements $LatestPositionsNetworkResponseModelCopyWith<$Res> { + _$LatestPositionsNetworkResponseModelCopyWithImpl(this._self, this._then); + + final LatestPositionsNetworkResponseModel _self; + final $Res Function(LatestPositionsNetworkResponseModel) _then; + +/// Create a copy of LatestPositionsNetworkResponseModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? SSID = null,Object? BSSID = null,Object? signal = null,}) { + return _then(_self.copyWith( +SSID: null == SSID ? _self.SSID : SSID // ignore: cast_nullable_to_non_nullable +as String,BSSID: null == BSSID ? _self.BSSID : BSSID // ignore: cast_nullable_to_non_nullable +as String,signal: null == signal ? _self.signal : signal // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [LatestPositionsNetworkResponseModel]. +extension LatestPositionsNetworkResponseModelPatterns on LatestPositionsNetworkResponseModel { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _LatestPositionsNetworkResponseModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _LatestPositionsNetworkResponseModel() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _LatestPositionsNetworkResponseModel value) $default,){ +final _that = this; +switch (_that) { +case _LatestPositionsNetworkResponseModel(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _LatestPositionsNetworkResponseModel value)? $default,){ +final _that = this; +switch (_that) { +case _LatestPositionsNetworkResponseModel() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String SSID, String BSSID, String signal)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _LatestPositionsNetworkResponseModel() when $default != null: +return $default(_that.SSID,_that.BSSID,_that.signal);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String SSID, String BSSID, String signal) $default,) {final _that = this; +switch (_that) { +case _LatestPositionsNetworkResponseModel(): +return $default(_that.SSID,_that.BSSID,_that.signal);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String SSID, String BSSID, String signal)? $default,) {final _that = this; +switch (_that) { +case _LatestPositionsNetworkResponseModel() when $default != null: +return $default(_that.SSID,_that.BSSID,_that.signal);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _LatestPositionsNetworkResponseModel implements LatestPositionsNetworkResponseModel { + const _LatestPositionsNetworkResponseModel({required this.SSID, required this.BSSID, required this.signal}); + factory _LatestPositionsNetworkResponseModel.fromJson(Map json) => _$LatestPositionsNetworkResponseModelFromJson(json); + +@override final String SSID; +@override final String BSSID; +@override final String signal; + +/// Create a copy of LatestPositionsNetworkResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$LatestPositionsNetworkResponseModelCopyWith<_LatestPositionsNetworkResponseModel> get copyWith => __$LatestPositionsNetworkResponseModelCopyWithImpl<_LatestPositionsNetworkResponseModel>(this, _$identity); + +@override +Map toJson() { + return _$LatestPositionsNetworkResponseModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _LatestPositionsNetworkResponseModel&&(identical(other.SSID, SSID) || other.SSID == SSID)&&(identical(other.BSSID, BSSID) || other.BSSID == BSSID)&&(identical(other.signal, signal) || other.signal == signal)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,SSID,BSSID,signal); + +@override +String toString() { + return 'LatestPositionsNetworkResponseModel(SSID: $SSID, BSSID: $BSSID, signal: $signal)'; +} + + +} + +/// @nodoc +abstract mixin class _$LatestPositionsNetworkResponseModelCopyWith<$Res> implements $LatestPositionsNetworkResponseModelCopyWith<$Res> { + factory _$LatestPositionsNetworkResponseModelCopyWith(_LatestPositionsNetworkResponseModel value, $Res Function(_LatestPositionsNetworkResponseModel) _then) = __$LatestPositionsNetworkResponseModelCopyWithImpl; +@override @useResult +$Res call({ + String SSID, String BSSID, String signal +}); + + + + +} +/// @nodoc +class __$LatestPositionsNetworkResponseModelCopyWithImpl<$Res> + implements _$LatestPositionsNetworkResponseModelCopyWith<$Res> { + __$LatestPositionsNetworkResponseModelCopyWithImpl(this._self, this._then); + + final _LatestPositionsNetworkResponseModel _self; + final $Res Function(_LatestPositionsNetworkResponseModel) _then; + +/// Create a copy of LatestPositionsNetworkResponseModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? SSID = null,Object? BSSID = null,Object? signal = null,}) { + return _then(_LatestPositionsNetworkResponseModel( +SSID: null == SSID ? _self.SSID : SSID // ignore: cast_nullable_to_non_nullable +as String,BSSID: null == BSSID ? _self.BSSID : BSSID // ignore: cast_nullable_to_non_nullable +as String,signal: null == signal ? _self.signal : signal // ignore: cast_nullable_to_non_nullable as String, )); } diff --git a/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.g.dart b/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.g.dart index 6ac15cc9..9d44f2b0 100644 --- a/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.g.dart +++ b/modules/legacy/modules/hub/lib/src/core/data/models/latest_positions_response_model.g.dart @@ -25,21 +25,91 @@ Map _$LatestPositionsResponseModelToJson( _LatestPositionsItemResponseModel _$LatestPositionsItemResponseModelFromJson( Map json, ) => _LatestPositionsItemResponseModel( + id: json['id'] as String, + deviceIdentificator: json['deviceIdentificator'] as String, latitude: (json['latitude'] as num).toDouble(), longitude: (json['longitude'] as num).toDouble(), - address: json['address'] as String?, - positionDate: DateTime.parse(json['positionDate'] as String), + hpe: (json['hpe'] as num).toInt(), + ncell: (json['ncell'] as num?)?.toInt(), + type: (json['type'] as num).toInt(), + steps: (json['steps'] as num?)?.toInt(), + address: json['address'] == null + ? null + : LatestPositionsAddressResponseModel.fromJson( + json['address'] as Map, + ), + createdAt: (json['createdAt'] as num).toInt(), + positionDate: (json['positionDate'] as num).toInt(), + positionDateOriginal: (json['positionDateOriginal'] as num?)?.toInt(), + frequentPlaceName: json['frequentPlaceName'] as String?, + message: json['message'] as String, + networks: (json['networks'] as List) + .map( + (e) => LatestPositionsNetworkResponseModel.fromJson( + e as Map, + ), + ) + .toList(), + ignore: json['ignore'] as bool, + suspect: json['suspect'] as bool, frequentPlace: json['frequentPlace'] as bool, - frequentPlaceName: json['frequentPlaceName'] as String, ); Map _$LatestPositionsItemResponseModelToJson( _LatestPositionsItemResponseModel instance, ) => { + 'id': instance.id, + 'deviceIdentificator': instance.deviceIdentificator, 'latitude': instance.latitude, 'longitude': instance.longitude, + 'hpe': instance.hpe, + 'ncell': instance.ncell, + 'type': instance.type, + 'steps': instance.steps, 'address': instance.address, - 'positionDate': instance.positionDate.toIso8601String(), - 'frequentPlace': instance.frequentPlace, + 'createdAt': instance.createdAt, + 'positionDate': instance.positionDate, + 'positionDateOriginal': instance.positionDateOriginal, 'frequentPlaceName': instance.frequentPlaceName, + 'message': instance.message, + 'networks': instance.networks, + 'ignore': instance.ignore, + 'suspect': instance.suspect, + 'frequentPlace': instance.frequentPlace, +}; + +_LatestPositionsAddressResponseModel +_$LatestPositionsAddressResponseModelFromJson(Map json) => + _LatestPositionsAddressResponseModel( + street: json['street'] as String, + city: json['city'] as String, + province: json['province'] as String, + state: json['state'] as String, + country: json['country'] as String, + ); + +Map _$LatestPositionsAddressResponseModelToJson( + _LatestPositionsAddressResponseModel instance, +) => { + 'street': instance.street, + 'city': instance.city, + 'province': instance.province, + 'state': instance.state, + 'country': instance.country, +}; + +_LatestPositionsNetworkResponseModel +_$LatestPositionsNetworkResponseModelFromJson(Map json) => + _LatestPositionsNetworkResponseModel( + SSID: json['SSID'] as String, + BSSID: json['BSSID'] as String, + signal: json['signal'] as String, + ); + +Map _$LatestPositionsNetworkResponseModelToJson( + _LatestPositionsNetworkResponseModel instance, +) => { + 'SSID': instance.SSID, + 'BSSID': instance.BSSID, + 'signal': instance.signal, }; diff --git a/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/address_entity.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/address_entity.dart new file mode 100644 index 00000000..ba61989a --- /dev/null +++ b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/address_entity.dart @@ -0,0 +1,14 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'address_entity.freezed.dart'; + +@freezed +abstract class AddressEntity with _$AddressEntity { + const factory AddressEntity({ + required String? street, + required String? city, + required String? province, + required String? state, + required String? country, + }) = _AddressEntity; +} diff --git a/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/address_entity.freezed.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/address_entity.freezed.dart new file mode 100644 index 00000000..e2f3ec5e --- /dev/null +++ b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/address_entity.freezed.dart @@ -0,0 +1,283 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'address_entity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$AddressEntity { + + String? get street; String? get city; String? get province; String? get state; String? get country; +/// Create a copy of AddressEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$AddressEntityCopyWith get copyWith => _$AddressEntityCopyWithImpl(this as AddressEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is AddressEntity&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country)); +} + + +@override +int get hashCode => Object.hash(runtimeType,street,city,province,state,country); + +@override +String toString() { + return 'AddressEntity(street: $street, city: $city, province: $province, state: $state, country: $country)'; +} + + +} + +/// @nodoc +abstract mixin class $AddressEntityCopyWith<$Res> { + factory $AddressEntityCopyWith(AddressEntity value, $Res Function(AddressEntity) _then) = _$AddressEntityCopyWithImpl; +@useResult +$Res call({ + String? street, String? city, String? province, String? state, String? country +}); + + + + +} +/// @nodoc +class _$AddressEntityCopyWithImpl<$Res> + implements $AddressEntityCopyWith<$Res> { + _$AddressEntityCopyWithImpl(this._self, this._then); + + final AddressEntity _self; + final $Res Function(AddressEntity) _then; + +/// Create a copy of AddressEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? street = freezed,Object? city = freezed,Object? province = freezed,Object? state = freezed,Object? country = freezed,}) { + return _then(_self.copyWith( +street: freezed == street ? _self.street : street // ignore: cast_nullable_to_non_nullable +as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable +as String?,province: freezed == province ? _self.province : province // ignore: cast_nullable_to_non_nullable +as String?,state: freezed == state ? _self.state : state // ignore: cast_nullable_to_non_nullable +as String?,country: freezed == country ? _self.country : country // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + +} + + +/// Adds pattern-matching-related methods to [AddressEntity]. +extension AddressEntityPatterns on AddressEntity { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _AddressEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _AddressEntity() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _AddressEntity value) $default,){ +final _that = this; +switch (_that) { +case _AddressEntity(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _AddressEntity value)? $default,){ +final _that = this; +switch (_that) { +case _AddressEntity() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String? street, String? city, String? province, String? state, String? country)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _AddressEntity() when $default != null: +return $default(_that.street,_that.city,_that.province,_that.state,_that.country);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String? street, String? city, String? province, String? state, String? country) $default,) {final _that = this; +switch (_that) { +case _AddressEntity(): +return $default(_that.street,_that.city,_that.province,_that.state,_that.country);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String? street, String? city, String? province, String? state, String? country)? $default,) {final _that = this; +switch (_that) { +case _AddressEntity() when $default != null: +return $default(_that.street,_that.city,_that.province,_that.state,_that.country);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _AddressEntity implements AddressEntity { + const _AddressEntity({required this.street, required this.city, required this.province, required this.state, required this.country}); + + +@override final String? street; +@override final String? city; +@override final String? province; +@override final String? state; +@override final String? country; + +/// Create a copy of AddressEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$AddressEntityCopyWith<_AddressEntity> get copyWith => __$AddressEntityCopyWithImpl<_AddressEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _AddressEntity&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country)); +} + + +@override +int get hashCode => Object.hash(runtimeType,street,city,province,state,country); + +@override +String toString() { + return 'AddressEntity(street: $street, city: $city, province: $province, state: $state, country: $country)'; +} + + +} + +/// @nodoc +abstract mixin class _$AddressEntityCopyWith<$Res> implements $AddressEntityCopyWith<$Res> { + factory _$AddressEntityCopyWith(_AddressEntity value, $Res Function(_AddressEntity) _then) = __$AddressEntityCopyWithImpl; +@override @useResult +$Res call({ + String? street, String? city, String? province, String? state, String? country +}); + + + + +} +/// @nodoc +class __$AddressEntityCopyWithImpl<$Res> + implements _$AddressEntityCopyWith<$Res> { + __$AddressEntityCopyWithImpl(this._self, this._then); + + final _AddressEntity _self; + final $Res Function(_AddressEntity) _then; + +/// Create a copy of AddressEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? street = freezed,Object? city = freezed,Object? province = freezed,Object? state = freezed,Object? country = freezed,}) { + return _then(_AddressEntity( +street: freezed == street ? _self.street : street // ignore: cast_nullable_to_non_nullable +as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable +as String?,province: freezed == province ? _self.province : province // ignore: cast_nullable_to_non_nullable +as String?,state: freezed == state ? _self.state : state // ignore: cast_nullable_to_non_nullable +as String?,country: freezed == country ? _self.country : country // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/network_entity.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/network_entity.dart new file mode 100644 index 00000000..0280d704 --- /dev/null +++ b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/network_entity.dart @@ -0,0 +1,12 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'network_entity.freezed.dart'; + +@freezed +abstract class NetworkEntity with _$NetworkEntity { + const factory NetworkEntity({ + required String SSID, + required String BSSID, + required String signal, + }) = _NetworkEntity; +} diff --git a/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/network_entity.freezed.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/network_entity.freezed.dart new file mode 100644 index 00000000..eb795e0a --- /dev/null +++ b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/network_entity.freezed.dart @@ -0,0 +1,277 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'network_entity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$NetworkEntity { + + String get SSID; String get BSSID; String get signal; +/// Create a copy of NetworkEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$NetworkEntityCopyWith get copyWith => _$NetworkEntityCopyWithImpl(this as NetworkEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is NetworkEntity&&(identical(other.SSID, SSID) || other.SSID == SSID)&&(identical(other.BSSID, BSSID) || other.BSSID == BSSID)&&(identical(other.signal, signal) || other.signal == signal)); +} + + +@override +int get hashCode => Object.hash(runtimeType,SSID,BSSID,signal); + +@override +String toString() { + return 'NetworkEntity(SSID: $SSID, BSSID: $BSSID, signal: $signal)'; +} + + +} + +/// @nodoc +abstract mixin class $NetworkEntityCopyWith<$Res> { + factory $NetworkEntityCopyWith(NetworkEntity value, $Res Function(NetworkEntity) _then) = _$NetworkEntityCopyWithImpl; +@useResult +$Res call({ + String SSID, String BSSID, String signal +}); + + + + +} +/// @nodoc +class _$NetworkEntityCopyWithImpl<$Res> + implements $NetworkEntityCopyWith<$Res> { + _$NetworkEntityCopyWithImpl(this._self, this._then); + + final NetworkEntity _self; + final $Res Function(NetworkEntity) _then; + +/// Create a copy of NetworkEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? SSID = null,Object? BSSID = null,Object? signal = null,}) { + return _then(_self.copyWith( +SSID: null == SSID ? _self.SSID : SSID // ignore: cast_nullable_to_non_nullable +as String,BSSID: null == BSSID ? _self.BSSID : BSSID // ignore: cast_nullable_to_non_nullable +as String,signal: null == signal ? _self.signal : signal // ignore: cast_nullable_to_non_nullable +as String, + )); +} + +} + + +/// Adds pattern-matching-related methods to [NetworkEntity]. +extension NetworkEntityPatterns on NetworkEntity { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _NetworkEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _NetworkEntity() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _NetworkEntity value) $default,){ +final _that = this; +switch (_that) { +case _NetworkEntity(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _NetworkEntity value)? $default,){ +final _that = this; +switch (_that) { +case _NetworkEntity() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String SSID, String BSSID, String signal)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _NetworkEntity() when $default != null: +return $default(_that.SSID,_that.BSSID,_that.signal);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String SSID, String BSSID, String signal) $default,) {final _that = this; +switch (_that) { +case _NetworkEntity(): +return $default(_that.SSID,_that.BSSID,_that.signal);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String SSID, String BSSID, String signal)? $default,) {final _that = this; +switch (_that) { +case _NetworkEntity() when $default != null: +return $default(_that.SSID,_that.BSSID,_that.signal);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _NetworkEntity implements NetworkEntity { + const _NetworkEntity({required this.SSID, required this.BSSID, required this.signal}); + + +@override final String SSID; +@override final String BSSID; +@override final String signal; + +/// Create a copy of NetworkEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$NetworkEntityCopyWith<_NetworkEntity> get copyWith => __$NetworkEntityCopyWithImpl<_NetworkEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _NetworkEntity&&(identical(other.SSID, SSID) || other.SSID == SSID)&&(identical(other.BSSID, BSSID) || other.BSSID == BSSID)&&(identical(other.signal, signal) || other.signal == signal)); +} + + +@override +int get hashCode => Object.hash(runtimeType,SSID,BSSID,signal); + +@override +String toString() { + return 'NetworkEntity(SSID: $SSID, BSSID: $BSSID, signal: $signal)'; +} + + +} + +/// @nodoc +abstract mixin class _$NetworkEntityCopyWith<$Res> implements $NetworkEntityCopyWith<$Res> { + factory _$NetworkEntityCopyWith(_NetworkEntity value, $Res Function(_NetworkEntity) _then) = __$NetworkEntityCopyWithImpl; +@override @useResult +$Res call({ + String SSID, String BSSID, String signal +}); + + + + +} +/// @nodoc +class __$NetworkEntityCopyWithImpl<$Res> + implements _$NetworkEntityCopyWith<$Res> { + __$NetworkEntityCopyWithImpl(this._self, this._then); + + final _NetworkEntity _self; + final $Res Function(_NetworkEntity) _then; + +/// Create a copy of NetworkEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? SSID = null,Object? BSSID = null,Object? signal = null,}) { + return _then(_NetworkEntity( +SSID: null == SSID ? _self.SSID : SSID // ignore: cast_nullable_to_non_nullable +as String,BSSID: null == BSSID ? _self.BSSID : BSSID // ignore: cast_nullable_to_non_nullable +as String,signal: null == signal ? _self.signal : signal // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/position_entity.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/position_entity.dart index 00750377..ffdab2a2 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/position_entity.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/position_entity.dart @@ -1,17 +1,29 @@ -class PositionEntity { - final double latitude; - final double longitude; - final String? address; - final bool frequentPlace; - final String frequentPlaceName; - final DateTime positionDate; +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:hub/src/features/hub/domain/entities/address_entity.dart'; +import 'package:hub/src/features/hub/domain/entities/network_entity.dart'; - const PositionEntity({ - required this.latitude, - required this.longitude, - required this.address, - required this.positionDate, - required this.frequentPlace, - required this.frequentPlaceName, - }); -} \ No newline at end of file +part 'position_entity.freezed.dart'; + +@freezed +abstract class PositionEntity with _$PositionEntity { + const factory PositionEntity({ + required String id, + required String deviceIdentificator, + required double latitude, + required double longitude, + required int hpe, + int? ncell, + required int type, + int? steps, + AddressEntity? address, + required int createdAt, + required int positionDate, + int? positionDateOriginal, + String? frequentPlaceName, + required String message, + required List networks, + required bool ignore, + required bool suspect, + required bool frequentPlace, + }) = _PositionEntity; +} diff --git a/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/position_entity.freezed.dart b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/position_entity.freezed.dart new file mode 100644 index 00000000..098dc68d --- /dev/null +++ b/modules/legacy/modules/hub/lib/src/features/hub/domain/entities/position_entity.freezed.dart @@ -0,0 +1,352 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'position_entity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$PositionEntity { + + String get id; String get deviceIdentificator; double get latitude; double get longitude; int get hpe; int? get ncell; int get type; int? get steps; AddressEntity? get address; int get createdAt; int get positionDate; int? get positionDateOriginal; String? get frequentPlaceName; String get message; List get networks; bool get ignore; bool get suspect; bool get frequentPlace; +/// Create a copy of PositionEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$PositionEntityCopyWith get copyWith => _$PositionEntityCopyWithImpl(this as PositionEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is PositionEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.hpe, hpe) || other.hpe == hpe)&&(identical(other.ncell, ncell) || other.ncell == ncell)&&(identical(other.type, type) || other.type == type)&&(identical(other.steps, steps) || other.steps == steps)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.positionDate, positionDate) || other.positionDate == positionDate)&&(identical(other.positionDateOriginal, positionDateOriginal) || other.positionDateOriginal == positionDateOriginal)&&(identical(other.frequentPlaceName, frequentPlaceName) || other.frequentPlaceName == frequentPlaceName)&&(identical(other.message, message) || other.message == message)&&const DeepCollectionEquality().equals(other.networks, networks)&&(identical(other.ignore, ignore) || other.ignore == ignore)&&(identical(other.suspect, suspect) || other.suspect == suspect)&&(identical(other.frequentPlace, frequentPlace) || other.frequentPlace == frequentPlace)); +} + + +@override +int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,latitude,longitude,hpe,ncell,type,steps,address,createdAt,positionDate,positionDateOriginal,frequentPlaceName,message,const DeepCollectionEquality().hash(networks),ignore,suspect,frequentPlace); + +@override +String toString() { + return 'PositionEntity(id: $id, deviceIdentificator: $deviceIdentificator, latitude: $latitude, longitude: $longitude, hpe: $hpe, ncell: $ncell, type: $type, steps: $steps, address: $address, createdAt: $createdAt, positionDate: $positionDate, positionDateOriginal: $positionDateOriginal, frequentPlaceName: $frequentPlaceName, message: $message, networks: $networks, ignore: $ignore, suspect: $suspect, frequentPlace: $frequentPlace)'; +} + + +} + +/// @nodoc +abstract mixin class $PositionEntityCopyWith<$Res> { + factory $PositionEntityCopyWith(PositionEntity value, $Res Function(PositionEntity) _then) = _$PositionEntityCopyWithImpl; +@useResult +$Res call({ + String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, AddressEntity? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List networks, bool ignore, bool suspect, bool frequentPlace +}); + + +$AddressEntityCopyWith<$Res>? get address; + +} +/// @nodoc +class _$PositionEntityCopyWithImpl<$Res> + implements $PositionEntityCopyWith<$Res> { + _$PositionEntityCopyWithImpl(this._self, this._then); + + final PositionEntity _self; + final $Res Function(PositionEntity) _then; + +/// Create a copy of PositionEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? deviceIdentificator = null,Object? latitude = null,Object? longitude = null,Object? hpe = null,Object? ncell = freezed,Object? type = null,Object? steps = freezed,Object? address = freezed,Object? createdAt = null,Object? positionDate = null,Object? positionDateOriginal = freezed,Object? frequentPlaceName = freezed,Object? message = null,Object? networks = null,Object? ignore = null,Object? suspect = null,Object? frequentPlace = null,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable +as String,latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable +as double,longitude: null == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable +as double,hpe: null == hpe ? _self.hpe : hpe // ignore: cast_nullable_to_non_nullable +as int,ncell: freezed == ncell ? _self.ncell : ncell // ignore: cast_nullable_to_non_nullable +as int?,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as int,steps: freezed == steps ? _self.steps : steps // ignore: cast_nullable_to_non_nullable +as int?,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable +as AddressEntity?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as int,positionDate: null == positionDate ? _self.positionDate : positionDate // ignore: cast_nullable_to_non_nullable +as int,positionDateOriginal: freezed == positionDateOriginal ? _self.positionDateOriginal : positionDateOriginal // ignore: cast_nullable_to_non_nullable +as int?,frequentPlaceName: freezed == frequentPlaceName ? _self.frequentPlaceName : frequentPlaceName // ignore: cast_nullable_to_non_nullable +as String?,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable +as String,networks: null == networks ? _self.networks : networks // ignore: cast_nullable_to_non_nullable +as List,ignore: null == ignore ? _self.ignore : ignore // ignore: cast_nullable_to_non_nullable +as bool,suspect: null == suspect ? _self.suspect : suspect // ignore: cast_nullable_to_non_nullable +as bool,frequentPlace: null == frequentPlace ? _self.frequentPlace : frequentPlace // ignore: cast_nullable_to_non_nullable +as bool, + )); +} +/// Create a copy of PositionEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$AddressEntityCopyWith<$Res>? get address { + if (_self.address == null) { + return null; + } + + return $AddressEntityCopyWith<$Res>(_self.address!, (value) { + return _then(_self.copyWith(address: value)); + }); +} +} + + +/// Adds pattern-matching-related methods to [PositionEntity]. +extension PositionEntityPatterns on PositionEntity { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _PositionEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _PositionEntity() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _PositionEntity value) $default,){ +final _that = this; +switch (_that) { +case _PositionEntity(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _PositionEntity value)? $default,){ +final _that = this; +switch (_that) { +case _PositionEntity() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, AddressEntity? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List networks, bool ignore, bool suspect, bool frequentPlace)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _PositionEntity() when $default != null: +return $default(_that.id,_that.deviceIdentificator,_that.latitude,_that.longitude,_that.hpe,_that.ncell,_that.type,_that.steps,_that.address,_that.createdAt,_that.positionDate,_that.positionDateOriginal,_that.frequentPlaceName,_that.message,_that.networks,_that.ignore,_that.suspect,_that.frequentPlace);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, AddressEntity? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List networks, bool ignore, bool suspect, bool frequentPlace) $default,) {final _that = this; +switch (_that) { +case _PositionEntity(): +return $default(_that.id,_that.deviceIdentificator,_that.latitude,_that.longitude,_that.hpe,_that.ncell,_that.type,_that.steps,_that.address,_that.createdAt,_that.positionDate,_that.positionDateOriginal,_that.frequentPlaceName,_that.message,_that.networks,_that.ignore,_that.suspect,_that.frequentPlace);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, AddressEntity? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List networks, bool ignore, bool suspect, bool frequentPlace)? $default,) {final _that = this; +switch (_that) { +case _PositionEntity() when $default != null: +return $default(_that.id,_that.deviceIdentificator,_that.latitude,_that.longitude,_that.hpe,_that.ncell,_that.type,_that.steps,_that.address,_that.createdAt,_that.positionDate,_that.positionDateOriginal,_that.frequentPlaceName,_that.message,_that.networks,_that.ignore,_that.suspect,_that.frequentPlace);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _PositionEntity implements PositionEntity { + const _PositionEntity({required this.id, required this.deviceIdentificator, required this.latitude, required this.longitude, required this.hpe, this.ncell, required this.type, this.steps, this.address, required this.createdAt, required this.positionDate, this.positionDateOriginal, this.frequentPlaceName, required this.message, required final List networks, required this.ignore, required this.suspect, required this.frequentPlace}): _networks = networks; + + +@override final String id; +@override final String deviceIdentificator; +@override final double latitude; +@override final double longitude; +@override final int hpe; +@override final int? ncell; +@override final int type; +@override final int? steps; +@override final AddressEntity? address; +@override final int createdAt; +@override final int positionDate; +@override final int? positionDateOriginal; +@override final String? frequentPlaceName; +@override final String message; + final List _networks; +@override List get networks { + if (_networks is EqualUnmodifiableListView) return _networks; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_networks); +} + +@override final bool ignore; +@override final bool suspect; +@override final bool frequentPlace; + +/// Create a copy of PositionEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$PositionEntityCopyWith<_PositionEntity> get copyWith => __$PositionEntityCopyWithImpl<_PositionEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _PositionEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.hpe, hpe) || other.hpe == hpe)&&(identical(other.ncell, ncell) || other.ncell == ncell)&&(identical(other.type, type) || other.type == type)&&(identical(other.steps, steps) || other.steps == steps)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.positionDate, positionDate) || other.positionDate == positionDate)&&(identical(other.positionDateOriginal, positionDateOriginal) || other.positionDateOriginal == positionDateOriginal)&&(identical(other.frequentPlaceName, frequentPlaceName) || other.frequentPlaceName == frequentPlaceName)&&(identical(other.message, message) || other.message == message)&&const DeepCollectionEquality().equals(other._networks, _networks)&&(identical(other.ignore, ignore) || other.ignore == ignore)&&(identical(other.suspect, suspect) || other.suspect == suspect)&&(identical(other.frequentPlace, frequentPlace) || other.frequentPlace == frequentPlace)); +} + + +@override +int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,latitude,longitude,hpe,ncell,type,steps,address,createdAt,positionDate,positionDateOriginal,frequentPlaceName,message,const DeepCollectionEquality().hash(_networks),ignore,suspect,frequentPlace); + +@override +String toString() { + return 'PositionEntity(id: $id, deviceIdentificator: $deviceIdentificator, latitude: $latitude, longitude: $longitude, hpe: $hpe, ncell: $ncell, type: $type, steps: $steps, address: $address, createdAt: $createdAt, positionDate: $positionDate, positionDateOriginal: $positionDateOriginal, frequentPlaceName: $frequentPlaceName, message: $message, networks: $networks, ignore: $ignore, suspect: $suspect, frequentPlace: $frequentPlace)'; +} + + +} + +/// @nodoc +abstract mixin class _$PositionEntityCopyWith<$Res> implements $PositionEntityCopyWith<$Res> { + factory _$PositionEntityCopyWith(_PositionEntity value, $Res Function(_PositionEntity) _then) = __$PositionEntityCopyWithImpl; +@override @useResult +$Res call({ + String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, AddressEntity? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List networks, bool ignore, bool suspect, bool frequentPlace +}); + + +@override $AddressEntityCopyWith<$Res>? get address; + +} +/// @nodoc +class __$PositionEntityCopyWithImpl<$Res> + implements _$PositionEntityCopyWith<$Res> { + __$PositionEntityCopyWithImpl(this._self, this._then); + + final _PositionEntity _self; + final $Res Function(_PositionEntity) _then; + +/// Create a copy of PositionEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? deviceIdentificator = null,Object? latitude = null,Object? longitude = null,Object? hpe = null,Object? ncell = freezed,Object? type = null,Object? steps = freezed,Object? address = freezed,Object? createdAt = null,Object? positionDate = null,Object? positionDateOriginal = freezed,Object? frequentPlaceName = freezed,Object? message = null,Object? networks = null,Object? ignore = null,Object? suspect = null,Object? frequentPlace = null,}) { + return _then(_PositionEntity( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable +as String,latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable +as double,longitude: null == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable +as double,hpe: null == hpe ? _self.hpe : hpe // ignore: cast_nullable_to_non_nullable +as int,ncell: freezed == ncell ? _self.ncell : ncell // ignore: cast_nullable_to_non_nullable +as int?,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as int,steps: freezed == steps ? _self.steps : steps // ignore: cast_nullable_to_non_nullable +as int?,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable +as AddressEntity?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as int,positionDate: null == positionDate ? _self.positionDate : positionDate // ignore: cast_nullable_to_non_nullable +as int,positionDateOriginal: freezed == positionDateOriginal ? _self.positionDateOriginal : positionDateOriginal // ignore: cast_nullable_to_non_nullable +as int?,frequentPlaceName: freezed == frequentPlaceName ? _self.frequentPlaceName : frequentPlaceName // ignore: cast_nullable_to_non_nullable +as String?,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable +as String,networks: null == networks ? _self._networks : networks // ignore: cast_nullable_to_non_nullable +as List,ignore: null == ignore ? _self.ignore : ignore // ignore: cast_nullable_to_non_nullable +as bool,suspect: null == suspect ? _self.suspect : suspect // ignore: cast_nullable_to_non_nullable +as bool,frequentPlace: null == frequentPlace ? _self.frequentPlace : frequentPlace // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + +/// Create a copy of PositionEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$AddressEntityCopyWith<$Res>? get address { + if (_self.address == null) { + return null; + } + + return $AddressEntityCopyWith<$Res>(_self.address!, (value) { + return _then(_self.copyWith(address: value)); + }); +} +} + +// dart format on diff --git a/modules/legacy/modules/hub/lib/src/features/hub/hub_builder.dart b/modules/legacy/modules/hub/lib/src/features/hub/hub_builder.dart index 51504488..9f154583 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/hub_builder.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/hub_builder.dart @@ -12,7 +12,7 @@ class HubBuilder { return MaterialPage( key: state.pageKey, - child: HubScreen(navigationContract: navigationContract), + child: HubScreen(navigationContract: navigationContract, routerState: state), ); } } diff --git a/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart index f0b8db18..9efd7f0c 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/presentation/hub_screen.dart @@ -1,4 +1,5 @@ import 'package:flutter_svg/svg.dart'; +import 'package:go_router/go_router.dart'; import 'package:hub/src/features/hub/presentation/state/hub_view_model.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; @@ -11,8 +12,13 @@ import 'package:utils/utils.dart'; class HubScreen extends ConsumerWidget { final NavigationContract navigationContract; + final GoRouterState routerState; - const HubScreen({super.key, required this.navigationContract}); + const HubScreen({ + super.key, + required this.navigationContract, + required this.routerState + }); @override Widget build(BuildContext context, WidgetRef ref) { @@ -24,8 +30,8 @@ class HubScreen extends ConsumerWidget { return Scaffold( backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), body: SafeArea( - child: Container( - padding: EdgeInsets.symmetric(horizontal: 14), + child: Container( + padding: EdgeInsets.symmetric(horizontal: 14), child: Column( children: [ SizedBox(height: SizeUtils.getByScreen(small: 8, big: 4)), @@ -33,10 +39,28 @@ class HubScreen extends ConsumerWidget { children: [ SizedBox( height: SizeUtils.getByScreen(small: 36, big: 36), - child: Align( - alignment: Alignment.centerLeft, - child: Image.asset('assets/images/ui/iso_sf.png', - height: SizeUtils.getByScreen(small: 18, big: 18)), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Image.asset('assets/images/ui/iso_sf.png', + height: SizeUtils.getByScreen(small: 18, big: 18)), + SizedBox(width: SizeUtils.getByScreen(small: 8, big: 4)), + SizedBox( + width: SizeUtils.getByScreen(small: 104, big: 100), + height: 32, + child: CustomDropdown( + items: viewState.devices.map((device)=> + Text(device.carrierName) + ).toList(), + values: viewState.devices, + value: viewState.selectedDevice, + onChanged: (device){viewModel.setSelectedDevice(device);}, + height: 32, + color: Colors.transparent, + padding: EdgeInsets.zero, + ), + ), + ] ) ), Center( @@ -51,29 +75,29 @@ class HubScreen extends ConsumerWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppSectionButton( - onPressed: (){navigationContract.pushTo(AppRoutes.customerService);}, - icon: SFIcons.customerService, - text: I18n.customerService), + onPressed: (){navigationContract.pushTo(AppRoutes.customerService);}, + icon: SFIcons.customerService, + text: I18n.customerService), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), AppSectionButton( - onPressed: (){navigationContract.pushTo(AppRoutes.dashboardHome);}, - icon: SFIcons.payments, - text: I18n.sfPay), + onPressed: (){navigationContract.pushTo(AppRoutes.dashboardHome);}, + icon: SFIcons.payments, + text: I18n.sfPay), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), AppSectionButton( - onPressed: (){navigationContract.pushTo(AppRoutes.dashboardFunctions);}, - icon: SFIcons.functions, - text: I18n.functions), + onPressed: (){navigationContract.pushTo(AppRoutes.dashboardFunctions);}, + icon: SFIcons.functions, + text: I18n.functions), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), AppSectionButton( - onPressed: (){navigationContract.pushTo(AppRoutes.accountSettings);}, - icon: Icons.manage_accounts_outlined, - text: I18n.accountSettings), + onPressed: (){navigationContract.pushTo(AppRoutes.accountSettings);}, + icon: Icons.manage_accounts_outlined, + text: I18n.accountSettings), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), AppSectionButton( - onPressed: (){}, - icon: Icons.settings_outlined, - text: I18n.deviceSettings), + onPressed: (){}, + icon: Icons.settings_outlined, + text: I18n.deviceSettings), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 22)), Text(context.translate(I18n.watchesOnMap), @@ -86,32 +110,7 @@ class HubScreen extends ConsumerWidget { SizedBox(height: SizeUtils.getByScreen(small: 4, big: 8)), SizedBox( height: SizeUtils.getByScreen(small: 200, big: 300), - child: FlutterMap( - mapController: viewModel.mapController, - options: MapOptions( - initialCenter: LatLng(45.32833189648895, -3.0830872665435085), // Center the map over London, UK - initialZoom: 15, - keepAlive: true, - ), - children: [ - TileLayer( - urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', - userAgentPackageName: 'com.savefamily.sf_platform', - ), - MarkerLayer(markers: viewState.positions.map((position)=> - Marker( - point: LatLng(position.latitude, position.longitude), - width: 200, - height: 145, - child: Align( - alignment: Alignment.topCenter, - child: SvgPicture.asset('assets/images/ui/location.svg', - height: 80)), - rotate: true, - ) - ).toList()) - ], - ) + child: Minimap(), ), SizedBox(height: SizeUtils.getByScreen(small: 14, big: 13)), ], @@ -181,4 +180,118 @@ class AppSectionButton extends ConsumerWidget { ); } +} + +class Minimap extends ConsumerWidget { + + IconData batteryToIcon(int battery) { + if (battery < 15) return Icons.battery_0_bar; + if (battery < 30) return Icons.battery_1_bar; + if (battery < 45) return Icons.battery_2_bar; + if (battery < 60) return Icons.battery_3_bar; + if (battery < 75) return Icons.battery_4_bar; + if (battery < 90) return Icons.battery_5_bar; + return Icons.battery_6_bar; + } + + @override + Widget build(BuildContext context, WidgetRef ref) { + final theme = ref.watch(themePortProvider); + + final viewState = ref.watch(hubViewModelProvider); + final viewModel = ref.read(hubViewModelProvider.notifier); + + final battery = viewState.selectedPosition?.ncell ?? 0; + final IconData batteryIcon = batteryToIcon(battery); + + final positionDate = DateTime.fromMillisecondsSinceEpoch(viewState.selectedPosition?.positionDate ?? 0); + + return FlutterMap( + mapController: viewModel.mapController, + options: MapOptions( + initialCenter: LatLng(45.32833189648895, -3.0830872665435085), + initialZoom: 15, + keepAlive: true, + ), + children: [ + TileLayer( + urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', + userAgentPackageName: 'com.savefamily.sf_platform', + ), + MarkerLayer(markers: [if (viewState.selectedPosition != null) + Marker( + point: LatLng(viewState.selectedPosition!.latitude, viewState.selectedPosition!.longitude), + width: 200, + height: 145, + child: Align( + alignment: Alignment.topCenter, + child: SvgPicture.asset('assets/images/ui/location.svg', + height: 80) + ), + rotate: true, + ) + ]), + if (viewState.selectedPosition != null) + Align( + alignment: Alignment.bottomCenter, + child: Container( + height: SizeUtils.getByScreen(small: 60, big: 58), + width: SizeUtils.getByScreen(small: 300, big: 298), + margin: EdgeInsets.only(bottom: SizeUtils.getByScreen(small: 20, big: 16)), + decoration: BoxDecoration( + color: theme.getColorFor(ThemeCode.backgroundPrimary), + borderRadius: BorderRadius.all(Radius.circular(SizeUtils.getByScreen(small: 9, big: 8))) + ), + child: Row( + children: [ + Icon(SFIcons.location, + size: SizeUtils.getByScreen(small: 40, big: 38), + color: Color(0xFF588EA5), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + width: SizeUtils.getByScreen(small: 250, big: 248), + child: Text('${viewState.selectedPosition!.address?.street}, ' + '${viewState.selectedPosition!.address?.province}, ' + '${viewState.selectedPosition!.address?.country}', + overflow: TextOverflow.ellipsis, + ) + ), + Row( + children: [ + Text('${positionDate.month.toString().padLeft(2, '0')}-' + '${positionDate.day.toString().padLeft(2, '0')} ' + '${positionDate.hour.toString().padLeft(2, '0')}:' + '${positionDate.minute.toString().padLeft(2, '0')}:' + '${positionDate.second.toString().padLeft(2, '0')}', + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 12, big: 11) + ), + ), + if (viewState.selectedPosition!.networks.isNotEmpty) + Text(' | ${viewState.selectedPosition!.networks.first.signal}', + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 12, big: 11) + ), + ), + Icon(batteryIcon), + Text('${viewState.selectedPosition!.ncell ?? 0}%', + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 12, big: 11) + ), + ) + ], + ) + ], + ) + ], + ), + ), + ) + ], + ); + } } \ No newline at end of file diff --git a/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_model.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_model.dart index c87c507a..2473a0f7 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_model.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_model.dart @@ -2,18 +2,14 @@ import 'dart:async'; import 'package:flutter_map/flutter_map.dart'; import 'package:hub/src/features/hub/domain/entities/device_entity.dart'; -import 'package:hub/src/features/hub/domain/entities/get_devices_request_entity.dart'; import 'package:hub/src/features/hub/domain/entities/position_entity.dart'; import 'package:hub/src/features/hub/domain/get_devices_use_case.dart'; import 'package:hub/src/features/hub/domain/get_latest_positions_use_case.dart'; import 'package:hub/src/features/hub/presentation/providers/get_devices_use_case_provider.dart'; import 'package:hub/src/features/hub/presentation/providers/get_latest_positions_use_case_provider.dart'; import 'package:hub/src/features/hub/presentation/state/hub_view_state.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:latlong2/latlong.dart'; -import 'package:sf_localizations/sf_localizations.dart'; -import 'package:uuid/uuid.dart'; final hubViewModelProvider = NotifierProvider.autoDispose( @@ -36,11 +32,14 @@ class HubViewModel extends Notifier { _getDevicesUseCase.getDevices( userId: '' ).then((List res){ - state = state.copyWith(devices: res); + state = state.copyWith( + devices: res, + selectedDevice: res.first + ); return Future.wait(res.map((device) => - _getLatestPositionsUseCase.getLatestPositions( - deviceId: device.identificator - ) + _getLatestPositionsUseCase.getLatestPositions( + deviceId: device.identificator + ) )); }).then( (List> res) { @@ -55,31 +54,28 @@ class HubViewModel extends Notifier { void setPositions(List> positions) { final devicePositions = positions.map((List devicePositions)=>devicePositions[0]).toList(); + final selectedPosition = devicePositions.where((p)=> + p.deviceIdentificator == state.selectedDevice!.identificator).firstOrNull; state = state.copyWith( positions: devicePositions, + selectedPosition: selectedPosition, ); - mapController.move(LatLng( - devicePositions.fold(0.0, (double x, PositionEntity position)=>x+position.latitude)/positions.length, - devicePositions.fold(0.0, (double x, PositionEntity position)=>x+position.longitude)/positions.length, - ), 15); + if (selectedPosition != null) { + mapController.move(LatLng( + selectedPosition.latitude, + selectedPosition.longitude, + ), 15); + } } - GetDevicesRequestEntity _toDevicesRequest() { - final userId = ''; - if (userId == null) throw Exception('userId is required'); - - return GetDevicesRequestEntity(userId: userId); - } - - /*void _startLoadingForSignUp() { + void setSelectedDevice(DeviceEntity device) { + final selectedPosition = state.positions.where((p)=> + p.deviceIdentificator == device.identificator).firstOrNull; state = state.copyWith( - isLoading: true, - errorMessage: '', - twoFASecret: null, - showSecretCode: false, - showAccountCreated: false, + selectedDevice: device, + selectedPosition: selectedPosition, ); - }*/ + } void disposeControllers(){ mapController.dispose(); diff --git a/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart index a1c6dbde..d19035f7 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.dart @@ -8,6 +8,8 @@ part 'hub_view_state.freezed.dart'; abstract class HubViewState with _$HubViewState { const factory HubViewState({ @Default([]) List devices, - @Default([]) List positions + DeviceEntity? selectedDevice, + @Default([]) List positions, + PositionEntity? selectedPosition }) = _HubViewState; } diff --git a/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.freezed.dart b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.freezed.dart index 0388aa6b..92221d5c 100644 --- a/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.freezed.dart +++ b/modules/legacy/modules/hub/lib/src/features/hub/presentation/state/hub_view_state.freezed.dart @@ -14,7 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$HubViewState { - List get devices; List get positions; + List get devices; DeviceEntity? get selectedDevice; List get positions; PositionEntity? get selectedPosition; /// Create a copy of HubViewState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -25,16 +25,16 @@ $HubViewStateCopyWith get copyWith => _$HubViewStateCopyWithImpl Object.hash(runtimeType,const DeepCollectionEquality().hash(devices),const DeepCollectionEquality().hash(positions)); +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(devices),selectedDevice,const DeepCollectionEquality().hash(positions),selectedPosition); @override String toString() { - return 'HubViewState(devices: $devices, positions: $positions)'; + return 'HubViewState(devices: $devices, selectedDevice: $selectedDevice, positions: $positions, selectedPosition: $selectedPosition)'; } @@ -45,11 +45,11 @@ abstract mixin class $HubViewStateCopyWith<$Res> { factory $HubViewStateCopyWith(HubViewState value, $Res Function(HubViewState) _then) = _$HubViewStateCopyWithImpl; @useResult $Res call({ - List devices, List positions + List devices, DeviceEntity? selectedDevice, List positions, PositionEntity? selectedPosition }); - +$PositionEntityCopyWith<$Res>? get selectedPosition; } /// @nodoc @@ -62,14 +62,28 @@ class _$HubViewStateCopyWithImpl<$Res> /// Create a copy of HubViewState /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? devices = null,Object? positions = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? devices = null,Object? selectedDevice = freezed,Object? positions = null,Object? selectedPosition = freezed,}) { return _then(_self.copyWith( devices: null == devices ? _self.devices : devices // ignore: cast_nullable_to_non_nullable -as List,positions: null == positions ? _self.positions : positions // ignore: cast_nullable_to_non_nullable -as List, +as List,selectedDevice: freezed == selectedDevice ? _self.selectedDevice : selectedDevice // ignore: cast_nullable_to_non_nullable +as DeviceEntity?,positions: null == positions ? _self.positions : positions // ignore: cast_nullable_to_non_nullable +as List,selectedPosition: freezed == selectedPosition ? _self.selectedPosition : selectedPosition // ignore: cast_nullable_to_non_nullable +as PositionEntity?, )); } +/// Create a copy of HubViewState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$PositionEntityCopyWith<$Res>? get selectedPosition { + if (_self.selectedPosition == null) { + return null; + } + return $PositionEntityCopyWith<$Res>(_self.selectedPosition!, (value) { + return _then(_self.copyWith(selectedPosition: value)); + }); +} } @@ -151,10 +165,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( List devices, List positions)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( List devices, DeviceEntity? selectedDevice, List positions, PositionEntity? selectedPosition)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _HubViewState() when $default != null: -return $default(_that.devices,_that.positions);case _: +return $default(_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition);case _: return orElse(); } @@ -172,10 +186,10 @@ return $default(_that.devices,_that.positions);case _: /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( List devices, List positions) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( List devices, DeviceEntity? selectedDevice, List positions, PositionEntity? selectedPosition) $default,) {final _that = this; switch (_that) { case _HubViewState(): -return $default(_that.devices,_that.positions);case _: +return $default(_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition);case _: throw StateError('Unexpected subclass'); } @@ -192,10 +206,10 @@ return $default(_that.devices,_that.positions);case _: /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( List devices, List positions)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( List devices, DeviceEntity? selectedDevice, List positions, PositionEntity? selectedPosition)? $default,) {final _that = this; switch (_that) { case _HubViewState() when $default != null: -return $default(_that.devices,_that.positions);case _: +return $default(_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition);case _: return null; } @@ -207,7 +221,7 @@ return $default(_that.devices,_that.positions);case _: class _HubViewState implements HubViewState { - const _HubViewState({final List devices = const [], final List positions = const []}): _devices = devices,_positions = positions; + const _HubViewState({final List devices = const [], this.selectedDevice, final List positions = const [], this.selectedPosition}): _devices = devices,_positions = positions; final List _devices; @@ -217,6 +231,7 @@ class _HubViewState implements HubViewState { return EqualUnmodifiableListView(_devices); } +@override final DeviceEntity? selectedDevice; final List _positions; @override@JsonKey() List get positions { if (_positions is EqualUnmodifiableListView) return _positions; @@ -224,6 +239,7 @@ class _HubViewState implements HubViewState { return EqualUnmodifiableListView(_positions); } +@override final PositionEntity? selectedPosition; /// Create a copy of HubViewState /// with the given fields replaced by the non-null parameter values. @@ -235,16 +251,16 @@ _$HubViewStateCopyWith<_HubViewState> get copyWith => __$HubViewStateCopyWithImp @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _HubViewState&&const DeepCollectionEquality().equals(other._devices, _devices)&&const DeepCollectionEquality().equals(other._positions, _positions)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _HubViewState&&const DeepCollectionEquality().equals(other._devices, _devices)&&(identical(other.selectedDevice, selectedDevice) || other.selectedDevice == selectedDevice)&&const DeepCollectionEquality().equals(other._positions, _positions)&&(identical(other.selectedPosition, selectedPosition) || other.selectedPosition == selectedPosition)); } @override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_devices),const DeepCollectionEquality().hash(_positions)); +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_devices),selectedDevice,const DeepCollectionEquality().hash(_positions),selectedPosition); @override String toString() { - return 'HubViewState(devices: $devices, positions: $positions)'; + return 'HubViewState(devices: $devices, selectedDevice: $selectedDevice, positions: $positions, selectedPosition: $selectedPosition)'; } @@ -255,11 +271,11 @@ abstract mixin class _$HubViewStateCopyWith<$Res> implements $HubViewStateCopyWi factory _$HubViewStateCopyWith(_HubViewState value, $Res Function(_HubViewState) _then) = __$HubViewStateCopyWithImpl; @override @useResult $Res call({ - List devices, List positions + List devices, DeviceEntity? selectedDevice, List positions, PositionEntity? selectedPosition }); - +@override $PositionEntityCopyWith<$Res>? get selectedPosition; } /// @nodoc @@ -272,15 +288,29 @@ class __$HubViewStateCopyWithImpl<$Res> /// Create a copy of HubViewState /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? devices = null,Object? positions = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? devices = null,Object? selectedDevice = freezed,Object? positions = null,Object? selectedPosition = freezed,}) { return _then(_HubViewState( devices: null == devices ? _self._devices : devices // ignore: cast_nullable_to_non_nullable -as List,positions: null == positions ? _self._positions : positions // ignore: cast_nullable_to_non_nullable -as List, +as List,selectedDevice: freezed == selectedDevice ? _self.selectedDevice : selectedDevice // ignore: cast_nullable_to_non_nullable +as DeviceEntity?,positions: null == positions ? _self._positions : positions // ignore: cast_nullable_to_non_nullable +as List,selectedPosition: freezed == selectedPosition ? _self.selectedPosition : selectedPosition // ignore: cast_nullable_to_non_nullable +as PositionEntity?, )); } +/// Create a copy of HubViewState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$PositionEntityCopyWith<$Res>? get selectedPosition { + if (_self.selectedPosition == null) { + return null; + } + return $PositionEntityCopyWith<$Res>(_self.selectedPosition!, (value) { + return _then(_self.copyWith(selectedPosition: value)); + }); +} } // dart format on diff --git a/packages/design_system/fonts/SFIcons.ttf b/packages/design_system/fonts/SFIcons.ttf index ef3076f16e34e88849f8e40dddacc78198cfe69d..10d00529428ceb5b715e226686e17c525b21092e 100644 GIT binary patch delta 570 zcmXxfOGs2v9LMqB^<1Y$ZN{eYu^99=f{z^M_Q27iK%9K#BOf#3BqHjRR}mb|1R)sH z@wsZaGK5PPG5fo*+_eff#X!5Df`n5m7vm~n`rDuWhY#PgIE(Yo{!~tXD6el-MZcW^ zq6M%mPtUD9Q#0r9fdT^>BbL9;~+lNZ1&y2Eg>Y?^_Vr7@4}iMl71 z8O@`uYUkHeUe%kf`cMosIB+cfA<*;?uK1|vmVfQEu-MYgKPOfZcTg=&A0-c z{y&OY^YiqGv&`*K{7OxAQ=lnu=XR-S8DYmqSA|wCgw0;)C@$5^&6(k%Vo#B++C@2cZLyRT}f|SV1P>e*ADxx5X zM!d%0&J|(h=DHxVVL^-w5;qc~8!=IHWg{j?bcF{-6Sp#x?|hRvCnsl;+4#t9e&QY+ zbgz8)1_%{^bfvd{>|$ncEDA7$fb+AVp3ZLX)pgTMOOBYU2DfG=T;@vv_|4&=k?^(b zUI#F+IkVtPPI))@w8MDh2ciXy3h-HNF8OO!m)~_PcL~LZle^iEtylCNrE8hqvK2#=U%&T$|B7mMx|TrF%nlEotPr< z0iB_Yry-=ED91X?rDBwg7O&&|v38SCWh|6@wmQ+^c9ffvW27Wwe4JU