From fc1b2bc7d9b8b975e9889b0b16b68c5dc738ace5 Mon Sep 17 00:00:00 2001 From: Paul Nagle Date: Sat, 30 Dec 2023 21:17:15 +0000 Subject: [PATCH 1/2] Enable location on google map --- src/app/pages/map-search/map-search.page.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/pages/map-search/map-search.page.ts b/src/app/pages/map-search/map-search.page.ts index 6916e6b0..d359928d 100644 --- a/src/app/pages/map-search/map-search.page.ts +++ b/src/app/pages/map-search/map-search.page.ts @@ -127,6 +127,7 @@ export class MapSearchPage implements OnInit { await GoogleMap.create(mapArgs).then(map => { this.map = map; + this.map.enableCurrentLocation(true) this.map.setOnCameraIdleListener((event) => { if (this.performSearch === false) { From 98af7e78101e6312f47d84f302d9e0599a3098ff Mon Sep 17 00:00:00 2001 From: Paul Nagle Date: Sun, 31 Dec 2023 10:08:53 +0000 Subject: [PATCH 2/2] Map edge cases --- src/app/pages/map-search/map-search.page.ts | 19 +++++++------ src/app/services/loading.service.ts | 30 +-------------------- 2 files changed, 12 insertions(+), 37 deletions(-) diff --git a/src/app/pages/map-search/map-search.page.ts b/src/app/pages/map-search/map-search.page.ts index d359928d..4aeb118d 100644 --- a/src/app/pages/map-search/map-search.page.ts +++ b/src/app/pages/map-search/map-search.page.ts @@ -150,6 +150,7 @@ export class MapSearchPage implements OnInit { if (this.currentMarkerIDs.length > 0) { this.map.removeMarkers(this.currentMarkerIDs).then(result => { + this.currentMarkerIDs = [] this.map.disableClustering().then(clusteringDisabled => { this.getMeetings(event); }); @@ -164,14 +165,18 @@ export class MapSearchPage implements OnInit { this.openMeetingModal(event.title) }) }); // create map - - } getMeetings(event: CameraIdleCallbackData) { this.currentMarkerList = [] this.meetingListService.getRadiusMeetings(event.bounds.center.lat, event.bounds.center.lng, this.mapRadius).then(meetingList => { + + // Empty result set edge case + if (meetingList.data =='{}') { + meetingList.data = [] + } + meetingList.data = meetingList.data.filter((meeting: { latitude: any }) => meeting.latitude = parseFloat(meeting.latitude)); meetingList.data = meetingList.data.filter((meeting: { longitude: any }) => meeting.longitude = parseFloat(meeting.longitude)); this.currentMeetings = meetingList.data @@ -228,9 +233,7 @@ export class MapSearchPage implements OnInit { lat:this.currentMeetings[i+1]['latitude'], lng:this.currentMeetings[i+1]['longitude'] })); - - console.log("Pushing RED marker") - console.log(this.data) + this.currentMarkerList.push(this.data); } } @@ -239,6 +242,7 @@ export class MapSearchPage implements OnInit { }); } + addMarkers() { if (this.currentMarkerList.length > 0) { this.map.addMarkers(this.currentMarkerList).then(markerIDs => { @@ -252,6 +256,7 @@ export class MapSearchPage implements OnInit { } } + meetingsAreCoLocated(i: LatLng, j: LatLng) { let areColocated = false; if (((Math.round(i.lat * 1000) / 1000) !== (Math.round(j.lat * 1000) / 1000)) || @@ -265,7 +270,6 @@ export class MapSearchPage implements OnInit { pushStandaloneMeetingMarker(meeting: any) { - console.log("pushStandaloneMeetingMarker") let markerLatLng: LatLng = {lat: Number(meeting['latitude']), lng: Number(meeting['longitude'])} this.data = { coordinate: markerLatLng, @@ -276,8 +280,6 @@ export class MapSearchPage implements OnInit { y: 100, } }; - console.log("Standalone meeting marker data") - console.log(this.data) this.currentMarkerList.push(this.data); } @@ -343,6 +345,7 @@ export class MapSearchPage implements OnInit { } } + openMeetingModal(meetingIDs: any) { console.log(meetingIDs) this.meetingListService.getMeetingsByIDs(meetingIDs).then((response) => { diff --git a/src/app/services/loading.service.ts b/src/app/services/loading.service.ts index b1224ff9..4c54116b 100644 --- a/src/app/services/loading.service.ts +++ b/src/app/services/loading.service.ts @@ -14,6 +14,7 @@ export class LoadingService { this.isLoading = true; return await this.loadingController.create({ spinner: 'circles', + backdropDismiss: true, message: text }).then(a => { a.present().then(() => { @@ -29,32 +30,3 @@ export class LoadingService { return await this.loadingController.dismiss(); } } - - -// import { Injectable } from '@angular/core'; -// import { LoadingController } from '@ionic/angular'; - -// @Injectable({ -// providedIn: 'root' -// }) -// export class LoadingService { - -// isLoading = false; - -// constructor(public loadingController: LoadingController) { } - -// async present(text: string) { -// this.isLoading = true; -// const loading = await this.loadingController.create({ -// spinner: 'circles', -// message: text -// }); - -// loading.present(); -// } - -// async dismiss() { -// this.isLoading = false; -// return await this.loadingController.dismiss(); -// } -// } \ No newline at end of file