Firebase Function in Code

This section is for the Ionic 4 version of this platform, where Firebase Functions were used to make the apps talk to each other. Ionic 5 version does not use Firebase Functions.

Firebase Functions in Code

In the source code, Firebase functions are located in the User app in the functions folder

There are five Firebase functions in-built currently

  • getDriver - This function is called when User books a ride. This function finds a suitable driver and responds to User app, writes appropriate Data to customer and driver tables. Note, for demo purpose, the functions currently only looks for the driver who is logged in with the demo login (i.e. admin@enappd.com). You can change the logic here.

  • acceptRide - This function is called when Driver accepts an incoming ride request. This function writes appropriate info to customers table and gives back response to Driver app. User app receives a signal that driver has accepted. After this functions completion, driver can not accept new ride, and customer can not book new ride until ride is completed.

  • rejectRide - This function is called when Driver rejects an incoming ride request. This function writes appropriate info to customers table and gives back response to Driver app. User app receives a signal that driver has rejected. After this functions completion, driver can accept new ride, and customer can book new ride.

  • driverNoRespond - This function is called when Driver does not respond to an incoming ride request for a limited amount of time. This function writes appropriate info to customers and drivers table and gives back response to Driver app. User app receives a signal that driver is not responding. After this functions completion, driver can accept new ride, and customer can book new ride.

  • completeRide - This function is called when the Driver completes ride at destination. This function writes appropriate information to customers and drivers table. After this functions completion, driver can accept new ride, and customer can book new ride.

Last updated