From 084182878f947be7d790c9e354ef4a07b150ea91 Mon Sep 17 00:00:00 2001 From: Paul Nagle Date: Mon, 1 Jan 2024 16:11:58 +0000 Subject: [PATCH 1/2] Throttle calls to aggregator based on map events --- .../meeting-list/meeting-list.component.html | 4 +- .../meeting-list/meeting-list.component.scss | 5 +- src/app/pages/contact/contact.page.html | 2 +- .../do-i-have-the-bmlt.page.html | 2 +- src/app/pages/home/home.page.html | 2 +- src/app/pages/listfull/listfull.page.html | 2 +- .../location-search/location-search.page.html | 2 +- src/app/pages/map-search/map-search.page.html | 2 +- src/app/pages/map-search/map-search.page.ts | 49 ++++++++++--------- src/app/pages/modal/modal.page.html | 2 +- src/app/pages/settings/settings.page.html | 2 +- .../virt-meetings/virt-meetings.page.html | 2 +- .../pages/virt-search/virt-search.page.html | 2 +- 13 files changed, 42 insertions(+), 36 deletions(-) diff --git a/src/app/components/meeting-list/meeting-list.component.html b/src/app/components/meeting-list/meeting-list.component.html index fd724b97..d9cd4f88 100644 --- a/src/app/components/meeting-list/meeting-list.component.html +++ b/src/app/components/meeting-list/meeting-list.component.html @@ -45,9 +45,7 @@

{{'FRIDAY' | translate}} ({{dayCount[5]}})

{{'SATURDAY' | translate}} ({{dayCount[6]}})

Nothing Found.
-
- -
+ diff --git a/src/app/components/meeting-list/meeting-list.component.scss b/src/app/components/meeting-list/meeting-list.component.scss index eb4110ce..b37b14e2 100644 --- a/src/app/components/meeting-list/meeting-list.component.scss +++ b/src/app/components/meeting-list/meeting-list.component.scss @@ -1 +1,4 @@ -.ion-1x { font-size: 15px !important;} \ No newline at end of file +.ion-1x { font-size: 15px !important;} +ion-icon { + float: right; +} \ No newline at end of file diff --git a/src/app/pages/contact/contact.page.html b/src/app/pages/contact/contact.page.html index 08b49fb2..f1538ce9 100644 --- a/src/app/pages/contact/contact.page.html +++ b/src/app/pages/contact/contact.page.html @@ -1,5 +1,5 @@ - + diff --git a/src/app/pages/do-i-have-the-bmlt/do-i-have-the-bmlt.page.html b/src/app/pages/do-i-have-the-bmlt/do-i-have-the-bmlt.page.html index fc93345c..8086101e 100644 --- a/src/app/pages/do-i-have-the-bmlt/do-i-have-the-bmlt.page.html +++ b/src/app/pages/do-i-have-the-bmlt/do-i-have-the-bmlt.page.html @@ -1,5 +1,5 @@ - + diff --git a/src/app/pages/home/home.page.html b/src/app/pages/home/home.page.html index 30031231..d47cd125 100644 --- a/src/app/pages/home/home.page.html +++ b/src/app/pages/home/home.page.html @@ -1,5 +1,5 @@ - + diff --git a/src/app/pages/listfull/listfull.page.html b/src/app/pages/listfull/listfull.page.html index d4d58924..56409b50 100644 --- a/src/app/pages/listfull/listfull.page.html +++ b/src/app/pages/listfull/listfull.page.html @@ -1,5 +1,5 @@ - + diff --git a/src/app/pages/location-search/location-search.page.html b/src/app/pages/location-search/location-search.page.html index da7d98df..9d407a1a 100644 --- a/src/app/pages/location-search/location-search.page.html +++ b/src/app/pages/location-search/location-search.page.html @@ -1,5 +1,5 @@ - + diff --git a/src/app/pages/map-search/map-search.page.html b/src/app/pages/map-search/map-search.page.html index fefd7cac..b49866e3 100644 --- a/src/app/pages/map-search/map-search.page.html +++ b/src/app/pages/map-search/map-search.page.html @@ -1,5 +1,5 @@ - + diff --git a/src/app/pages/map-search/map-search.page.ts b/src/app/pages/map-search/map-search.page.ts index 4aeb118d..7d1b04a2 100644 --- a/src/app/pages/map-search/map-search.page.ts +++ b/src/app/pages/map-search/map-search.page.ts @@ -40,6 +40,8 @@ export class MapSearchPage implements OnInit { meeting!: any; data!: any; + debounceTimestamp: number = 0; + constructor( private translate: TranslateService, private storage: StorageService, @@ -72,7 +74,7 @@ export class MapSearchPage implements OnInit { } }); } else { - this.locatePhone(); + // this.locatePhone(); setTimeout(async () => { await this.createMap(); }, 500); @@ -80,12 +82,15 @@ export class MapSearchPage implements OnInit { }); } else { this.language = 'en'; + setTimeout(async () => { + await this.createMap(); + }, 500); } }); } - locatePhone() { + async locatePhone() { this.translate.get('LOCATING').subscribe(value => { this.presentLoader(value); }); Geolocation.getCurrentPosition().then((resp) => { this.addressLatitude = resp.coords.latitude; @@ -97,10 +102,8 @@ export class MapSearchPage implements OnInit { }).catch((error) => { console.log('Error getting location', error); - this.dismissLoader(); }); - this.dismissLoader(); } @@ -127,7 +130,6 @@ 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) { @@ -163,12 +165,25 @@ export class MapSearchPage implements OnInit { this.map.setOnMarkerClickListener((event) => { this.performSearch = false this.openMeetingModal(event.title) - }) + }); // setOnMarkerClickListener + + this.map.setOnBoundsChangedListener(event => { + }); // setOnBoundsChangedListener + }); // create map } getMeetings(event: CameraIdleCallbackData) { + const timeCheck = Date.now() - this.debounceTimestamp + + if (( timeCheck < 1000 ) && (this.debounceTimestamp != 0)) { + this.dismissLoader() + this.debounceTimestamp = Date.now() + return + } + this.debounceTimestamp = Date.now() + this.currentMarkerList = [] this.meetingListService.getRadiusMeetings(event.bounds.center.lat, event.bounds.center.lng, this.mapRadius).then(meetingList => { @@ -217,22 +232,13 @@ export class MapSearchPage implements OnInit { if (i === (this.currentMeetings.length - 1)) { break } - let currentMeetingLatLng: LatLng = { - lat:this.currentMeetings[i]['latitude'], - lng:this.currentMeetings[i]['longitude'], - } - let nextNextMeetingLatlng: LatLng = { - lat:this.currentMeetings[i + 1]['latitude'], - lng:this.currentMeetings[i + 1]['longitude'], - } + let currentMeetingLatLng: LatLng = {lat:this.currentMeetings[i]['latitude'],lng:this.currentMeetings[i]['longitude']} + let nextNextMeetingLatlng: LatLng = {lat:this.currentMeetings[i + 1]['latitude'],lng:this.currentMeetings[i + 1]['longitude']} - } while (this.meetingsAreCoLocated({ - lat:this.currentMeetings[i]['latitude'], - lng:this.currentMeetings[i]['longitude'] - }, { - lat:this.currentMeetings[i+1]['latitude'], - lng:this.currentMeetings[i+1]['longitude'] - })); + } while (this.meetingsAreCoLocated( + {lat:this.currentMeetings[i]['latitude'],lng:this.currentMeetings[i]['longitude']}, + {lat:this.currentMeetings[i+1]['latitude'],lng:this.currentMeetings[i+1]['longitude']} + )); this.currentMarkerList.push(this.data); } @@ -347,7 +353,6 @@ export class MapSearchPage implements OnInit { openMeetingModal(meetingIDs: any) { - console.log(meetingIDs) this.meetingListService.getMeetingsByIDs(meetingIDs).then((response) => { this.meeting = response.data; this.meeting.filter((i: any) => i.start_time_raw = this.convertTo12Hr(i.start_time)); diff --git a/src/app/pages/modal/modal.page.html b/src/app/pages/modal/modal.page.html index db2fa635..8dfcb0e1 100644 --- a/src/app/pages/modal/modal.page.html +++ b/src/app/pages/modal/modal.page.html @@ -1,5 +1,5 @@ - + {{'MEETING_DETAILS' | translate}} diff --git a/src/app/pages/settings/settings.page.html b/src/app/pages/settings/settings.page.html index c513bac8..eee74b53 100644 --- a/src/app/pages/settings/settings.page.html +++ b/src/app/pages/settings/settings.page.html @@ -1,5 +1,5 @@ - + diff --git a/src/app/pages/virt-meetings/virt-meetings.page.html b/src/app/pages/virt-meetings/virt-meetings.page.html index 99f000e2..f30b1cbb 100644 --- a/src/app/pages/virt-meetings/virt-meetings.page.html +++ b/src/app/pages/virt-meetings/virt-meetings.page.html @@ -1,6 +1,6 @@ - + diff --git a/src/app/pages/virt-search/virt-search.page.html b/src/app/pages/virt-search/virt-search.page.html index 57fda82b..3429c3cc 100644 --- a/src/app/pages/virt-search/virt-search.page.html +++ b/src/app/pages/virt-search/virt-search.page.html @@ -1,6 +1,6 @@ - + From e78982c1a52e9fc3da804430106bc038370ddb38 Mon Sep 17 00:00:00 2001 From: Paul Nagle Date: Mon, 1 Jan 2024 16:13:45 +0000 Subject: [PATCH 2/2] Throttle calls to aggregator based on map events --- src/app/pages/map-search/map-search.page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/pages/map-search/map-search.page.ts b/src/app/pages/map-search/map-search.page.ts index 7d1b04a2..498b7875 100644 --- a/src/app/pages/map-search/map-search.page.ts +++ b/src/app/pages/map-search/map-search.page.ts @@ -74,7 +74,7 @@ export class MapSearchPage implements OnInit { } }); } else { - // this.locatePhone(); + this.locatePhone(); setTimeout(async () => { await this.createMap(); }, 500);