Skip to content

Commit

Permalink
Throttle calls to aggregator based on map events
Browse files Browse the repository at this point in the history
  • Loading branch information
paulnagle committed Jan 1, 2024
1 parent 8ef516d commit 9abf267
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 35 deletions.
4 changes: 1 addition & 3 deletions src/app/components/meeting-list/meeting-list.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ <h3>{{'FRIDAY' | translate}} ({{dayCount[5]}})</h3></div>
<h3>{{'SATURDAY' | translate}} ({{dayCount[6]}})</h3></div>
<div *ngSwitchDefault>Nothing Found.</div>
</div>
<div *ngIf="isExpandAll() === false">
<ion-icon size="large" slot="right" [name]="isDayShown(i) ? 'close-circle' : 'add-circle'"></ion-icon>
</div>
<ion-icon *ngIf="isExpandAll() === false" size="large" slot="end" [name]="isDayShown(i) ? 'close-circle' : 'add-circle'"></ion-icon>

</ion-item-divider>

Expand Down
5 changes: 4 additions & 1 deletion src/app/components/meeting-list/meeting-list.component.scss
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.ion-1x { font-size: 15px !important;}
.ion-1x { font-size: 15px !important;}
ion-icon {
float: right;
}
2 changes: 1 addition & 1 deletion src/app/pages/contact/contact.page.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<ion-header>
<ion-toolbar>
<ion-toolbar color="primary">
<ion-buttons slot="start">
<ion-menu-button></ion-menu-button>
</ion-buttons>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<ion-header>
<ion-toolbar>
<ion-toolbar color="primary">
<ion-buttons slot="start">
<ion-menu-button></ion-menu-button>
</ion-buttons>
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/home/home.page.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<ion-header>
<ion-toolbar>
<ion-toolbar color="primary">
<ion-buttons slot="start">
<ion-menu-button></ion-menu-button>
</ion-buttons>
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/listfull/listfull.page.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<ion-header>
<ion-toolbar>
<ion-toolbar color="primary">
<ion-buttons slot="start">
<ion-menu-button></ion-menu-button>
</ion-buttons>
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/location-search/location-search.page.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<ion-header>
<ion-toolbar>
<ion-toolbar color="primary">
<ion-buttons slot="start">
<ion-menu-button></ion-menu-button>
</ion-buttons>
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/map-search/map-search.page.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<ion-header>
<ion-toolbar>
<ion-toolbar color="primary">
<ion-buttons slot="start">
<ion-menu-button></ion-menu-button>
</ion-buttons>
Expand Down
47 changes: 26 additions & 21 deletions src/app/pages/map-search/map-search.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export class MapSearchPage implements OnInit {
meeting!: any;
data!: any;

debounceTimestamp: number = 0;

constructor(
private translate: TranslateService,
private storage: StorageService,
Expand Down Expand Up @@ -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;
Expand All @@ -97,10 +102,8 @@ export class MapSearchPage implements OnInit {

}).catch((error) => {
console.log('Error getting location', error);

this.dismissLoader();
});
this.dismissLoader();
}


Expand All @@ -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) {
Expand Down Expand Up @@ -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 => {

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/modal/modal.page.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<ion-header>
<ion-toolbar>
<ion-toolbar color="secondary">
<ion-title>
{{'MEETING_DETAILS' | translate}}
</ion-title>
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/settings/settings.page.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<ion-header>
<ion-toolbar>
<ion-toolbar color="primary">
<ion-buttons slot="start">
<ion-menu-button></ion-menu-button>
</ion-buttons>
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/virt-meetings/virt-meetings.page.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

<ion-header>
<ion-toolbar>
<ion-toolbar color="primary">
<ion-buttons slot="start">
<ion-menu-button></ion-menu-button>
</ion-buttons>
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/virt-search/virt-search.page.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

<ion-header>
<ion-toolbar>
<ion-toolbar color="primary">
<ion-buttons slot="start">
<ion-menu-button></ion-menu-button>
</ion-buttons>
Expand Down

0 comments on commit 9abf267

Please sign in to comment.