Skip to content

A React Native app meant for training purposes that displays the availabilities of parkings in Ghent.

License

Notifications You must be signed in to change notification settings

ThibaultGobert/ghent-parking

 
 

Repository files navigation

Parking App

Build Status

This React Native app is meant to be used for several workshops. It is a small, but fully functional app, that displays the availabilities of parkings in the center of the city of Ghent.

This app currently supports 2 ways to fetch that data:

  • A static way, via the data/parkings.json file
  • A dynamic way, by using Firebase as a proxy

The data itself is made available by the city of Ghent, licensed under the terms of the Modellicentie Gratis Hergebruik: https://datatank.stad.gent/4/mobiliteit/bezettingparkingsrealtime

Prerequisites

  • node.js 8
  • yarn

Setup

  1. Run yarn install.
  2. Test the app (via the Expo app): yarn start. (Or use a simulator, by running yarn run ios or yarn run android).

Tests

This project uses Jest to perform unit testing. Tests can be executed by issuing yarn test.

ESLint

ESLint is used for static code analysis. Eslint nicely integrates with editors as Atom or Visual Studio Code. Running the linter manually can be done by issuing yarn run lint.

Travis CI setup

Continuous integration, including static code analysis and automated unit testing, can be setup using Travis CI. Simply sign-in with your Github account and enable builds for your forked Github repository.

Firebase setup

The Firebase setup actually uses 2 components:

  • The app will read the database and reflect any changes in real-time.
  • A node.js script (scripts/pushDataToFirebase.js) will publish new data to Firebase every 10s.

In order to use the application with Firebase, please follow these steps:

  1. Create a new Firebase project
  2. Create a new Realtime Database
  3. In the rules tab, specify these rules:
     {
       "rules": {
         ".read": true,
         ".write": "auth != null"
       }
     }
    
    This will make the database readable for anyone that has access to it, but requires users to be authenticated in order to write.
  4. Go to Authentication and add a user with the following credentials:
    • email: [email protected]
    • password: firebase This account will be used by the import script to authenticate itself.
  5. Now go to Project Settings and select the option to add a webapp to Firebase. Copy these settings over to the config/firebase.json file.
  6. Run yarn run firebase. This command will execute the import script (located at scripts/pushDataToFirebase).
  7. If that succeeds, start the app by simply running yarn start

Tip: To test and see real-time updates, stop the script and simply adjust values in the Firebase database.

License

This application is licensed under the term of the MIT license.

About

A React Native app meant for training purposes that displays the availabilities of parkings in Ghent.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%