@ -64,6 +64,7 @@ class _MapScreenState extends State<MapScreen> {
bool _hasInitializedMap = false ;
bool _hasInitializedMap = false ;
bool _removedMarkersLoaded = false ;
bool _removedMarkersLoaded = false ;
final List < int > _pathTrace = [ ] ;
final List < int > _pathTrace = [ ] ;
final List < Contact > _pathTraceContacts = [ ] ;
final List < LatLng > _points = [ ] ;
final List < LatLng > _points = [ ] ;
final List < Polyline > _polylines = [ ] ;
final List < Polyline > _polylines = [ ] ;
bool _legendExpanded = false ;
bool _legendExpanded = false ;
@ -488,7 +489,7 @@ class _MapScreenState extends State<MapScreen> {
) ,
) ,
) ,
) ,
) ,
) ,
if ( ! _isBuildingPathTrace )
if ( ! settings. mapShowOverlaps )
. . . _buildGuessedMarker (
. . . _buildGuessedMarker (
guessedLocations ,
guessedLocations ,
showLabels: _showNodeLabels ,
showLabels: _showNodeLabels ,
@ -788,13 +789,22 @@ class _MapScreenState extends State<MapScreen> {
final markers = < Marker > [ ] ;
final markers = < Marker > [ ] ;
for ( final guess in guessed ) {
for ( final guess in guessed ) {
if ( guess . contact . type = = advTypeChat & & _isBuildingPathTrace ) {
continue ;
}
final color = _getNodeColor ( guess . contact . type ) ;
final color = _getNodeColor ( guess . contact . type ) ;
final marker = Marker (
final marker = Marker (
point: guess . position ,
point: guess . position ,
width: 35 ,
width: 35 ,
height: 35 ,
height: 35 ,
child: GestureDetector (
child: GestureDetector (
onTap: ( ) = > _showNodeInfo (
onLongPress: ( ) = > _isBuildingPathTrace
? _showNodeInfo ( context , guess . contact )
: null ,
onTap: ( ) = > _isBuildingPathTrace
? _addToPath ( context , guess . contact , position: guess . position )
: _showNodeInfo (
context ,
context ,
guess . contact ,
guess . contact ,
guessedPosition: guess . position ,
guessedPosition: guess . position ,
@ -870,6 +880,11 @@ class _MapScreenState extends State<MapScreen> {
addContact = true ;
addContact = true ;
}
}
if ( contact . type = = advTypeChat & & _isBuildingPathTrace ) {
addContact = false ;
}
if ( settings . mapShowOverlaps ) {
final hasOverlap = contacts
final hasOverlap = contacts
. where (
. where (
( c ) = >
( c ) = >
@ -886,6 +901,7 @@ class _MapScreenState extends State<MapScreen> {
! _isBuildingPathTrace ) {
! _isBuildingPathTrace ) {
addContact = false ;
addContact = false ;
}
}
}
if ( addContact ) {
if ( addContact ) {
filtered . add ( contact ) ;
filtered . add ( contact ) ;
@ -2121,12 +2137,18 @@ class _MapScreenState extends State<MapScreen> {
}
}
}
}
void _addToPath ( BuildContext context , Contact contact ) {
void _addToPath ( BuildContext context , Contact contact , { LatLng ? position } ) {
setState ( ( ) {
setState ( ( ) {
_pathTrace . add (
_pathTrace . add (
contact . publicKey [ 0 ] ,
contact . publicKey [ 0 ] ,
) ; / / Add first 16 bytes of public key to path trace
) ; / / Add first 16 bytes of public key to path trace
_points . add ( LatLng ( contact . latitude ! , contact . longitude ! ) ) ;
_pathTraceContacts . add (
contact . copyWith (
latitude: position ? . latitude ? ? contact . latitude ,
longitude: position ? . longitude ? ? contact . longitude ,
) ,
) ; / / Add contact to path trace contacts
_points . add ( position ? ? LatLng ( contact . latitude ! , contact . longitude ! ) ) ;
} ) ;
} ) ;
}
}
@ -2134,6 +2156,7 @@ class _MapScreenState extends State<MapScreen> {
setState ( ( ) {
setState ( ( ) {
_isBuildingPathTrace = true ;
_isBuildingPathTrace = true ;
_pathTrace . clear ( ) ;
_pathTrace . clear ( ) ;
_pathTraceContacts . clear ( ) ;
_points . clear ( ) ;
_points . clear ( ) ;
_polylines . clear ( ) ;
_polylines . clear ( ) ;
_points . add ( position ) ;
_points . add ( position ) ;
@ -2142,6 +2165,7 @@ class _MapScreenState extends State<MapScreen> {
void _removePath ( ) {
void _removePath ( ) {
setState ( ( ) {
setState ( ( ) {
_pathTraceContacts . removeLast ( ) ;
_pathTrace . removeLast ( ) ; / / Remove last node from path trace
_pathTrace . removeLast ( ) ; / / Remove last node from path trace
_points . removeLast ( ) ; / / Remove last point from points list
_points . removeLast ( ) ; / / Remove last point from points list
_polylines . clear ( ) ; / / Clear polylines
_polylines . clear ( ) ; / / Clear polylines
@ -2201,6 +2225,7 @@ class _MapScreenState extends State<MapScreen> {
title: l10n . contacts_pathTrace ,
title: l10n . contacts_pathTrace ,
path: Uint8List . fromList ( _pathTrace ) ,
path: Uint8List . fromList ( _pathTrace ) ,
pathHashByteWidth: hashW ,
pathHashByteWidth: hashW ,
pathContacts: _pathTraceContacts ,
) ,
) ,
) ,
) ,
) ;
) ;