Skip to content

Commit

Permalink
Material3 Disabled, Firebase Setup Doc
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulmominsakib committed Oct 7, 2024
1 parent 4753690 commit fbd9c92
Show file tree
Hide file tree
Showing 5 changed files with 195 additions and 127 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release

private
android/app/upload-keystore.jks
132 changes: 132 additions & 0 deletions FIREBASE_SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Firebase Setup Guide for Face Attendance Project

This guide will walk you through the process of setting up the Firebase database structure for the Face Attendance project on Mac, Windows, and Linux.

## Prerequisites

1. Python 3.7 or higher installed on your system
2. pip (Python package installer)
3. Git (optional, for cloning the repository)
4. A Google account
5. Firebase project created

## Setup Steps

### Step 1: Firebase Console Setup

1. Go to the Firebase Console (https://console.firebase.google.com/)
2. Create a new project or select an existing one
3. Enable Email/Password Authentication:
- In the left sidebar, click on "Authentication"
- Click on the "Sign-in method" tab
- Enable the "Email/Password" sign-in provider
4. Set up Firestore:
- In the left sidebar, click on "Firestore Database"
- Click "Create database"
- Choose "Start in production mode" or "Start in test mode" based on your needs
- Select a location for your database
- Click "Enable"

### Step 2: Clone or Download the Project

If you're using Git:
```
git clone https://github.com/FaceOnLive/Face-Attendance-App-Flutter
cd Face-Attendance-App-Flutter
```

If not using Git, download the project files and navigate to the project directory.

### Step 3: Set Up Python Environment

#### For Homebrew Python users on Mac:

1. Create a virtual environment:
```
python3 -m venv face_attendance_env
```
2. Activate the virtual environment:
```
source face_attendance_env/bin/activate
```

#### For Windows users:

1. Create a virtual environment:
```
python -m venv face_attendance_env
```
2. Activate the virtual environment:
```
face_attendance_env\Scripts\activate
```

#### For Linux users:

1. Create a virtual environment:
```
python3 -m venv face_attendance_env
```
2. Activate the virtual environment:
```
source face_attendance_env/bin/activate
```

### Step 4: Install Required Python Packages

With your virtual environment activated, run:
```
pip install firebase-admin
```

### Step 5: Prepare the Firebase Service Account Key

1. In the Firebase Console, go to Project settings > Service Accounts
2. Click "Generate new private key"
3. Save the JSON file as `serviceAccountKey.json` in the project directory

### Step 6: Run the Setup Script

With your virtual environment still activated:

#### On Mac or Linux:

```
python3 firebase_setup.py
```

#### On Windows:

```
python firebase_setup.py
```

### Step 7: Verify the Setup

1. Go to the Firebase Console
2. Navigate to Firestore Database
3. Check if the collections "Users", "Members", and "Spaces" have been created with sample data

## Troubleshooting

- If you get a "Module not found" error, ensure you've activated the virtual environment and installed the firebase-admin package.
- For Mac/Linux users: If you get a "python3: command not found" error, try using `python` instead of `python3`.
- If you encounter permission issues in Firestore, make sure you've set appropriate security rules in the Firebase Console.

## Security Notes

- Keep your `serviceAccountKey.json` file secure and never commit it to a public repository.
- In production, set up proper Firestore security rules to protect your data.

## Next Steps

After successfully running the setup script, your Firebase Firestore database will be populated with sample data for the Face Attendance project. You can now proceed with connecting your Flutter application to this Firebase backend.

## Cleaning Up

When you're done, deactivate the virtual environment:
```
deactivate
```

For any issues or questions, please refer to the project's documentation or contact the project maintainers.
172 changes: 45 additions & 127 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,143 +1,61 @@
<div align="center">
<a href="https://join.slack.com/t/faceonlive/shared_invite/zt-2drx19c5t-vQsR4TUGPD8oL7i7BXdKZA">Slack</a>
·
<a href="https://www.faceonlive.com/">Website</a>
·
<a href="https://portfolio.faceonlive.com">Portfolio</a>
·
<a href="https://www.huggingface.co/FaceOnLive">Hugging Face</a>
·
<a href="https://getapi.faceonlive.com">Free APIs</a>
·
<a href="https://github.com/FaceOnLive/OpenKYC">OpenKYC</a>
·
<a href="https://github.com/FaceOnLive/Mask-Face-Attendance-App-Flutter">Face Attendance</a>
·
<a href="mailto:contact@faceonlive.com">Contact</a>
</div>
# Face Attendance Project

<h1 align="center">Face Attendance Project</h1>
<p align="center">Flutter Sample App Made with Face Recognition SDK</p>
## Flutter Sample App with Face Recognition SDK

![cover_image](docs/github_cover.png)
![Cover Image](docs/github_cover.png)
![Cover Image](docs/Screenshots.png)

[Video Demo](https://user-images.githubusercontent.com/91896009/164498733-955df7c1-71d6-42e4-8cdc-7e6b7e30e460.mp4)

### Quick Links
[Slack](https://join.slack.com/t/faceonlive/shared_invite/zt-2drx19c5t-vQsR4TUGPD8oL7i7BXdKZA) | [Website](https://www.faceonlive.com/) | [Portfolio](https://portfolio.faceonlive.com) | [Hugging Face](https://www.huggingface.co/FaceOnLive) | [Free APIs](https://getapi.faceonlive.com) | [OpenKYC](https://github.com/FaceOnLive/OpenKYC) | [Face Attendance](https://github.com/FaceOnLive/Mask-Face-Attendance-App-Flutter) | [Contact](mailto:contact@faceonlive.com)

https://user-images.githubusercontent.com/91896009/164498733-955df7c1-71d6-42e4-8cdc-7e6b7e30e460.mp4
## Prerequisites
- Currently supports Android platform (arm64) only
- New AAR Library required for custom package names
- Flutter and Dart extensions recommended for your code editor
- Google Maps API key and Firebase account needed for full functionality

## Setup Instructions
1. Install [Flutter](https://docs.flutter.dev/get-started/install) and [Android Studio](https://developer.android.com/studio)
2. Clone the project: `git clone https://github.com/Turing311/FaceAttendance.git`
3. (Optional) Change package name: `flutter pub run change_app_package_name:main com.new.package.name` (Disclaimer: If you change the package name, you will need a new AAR Library)
4. Update app name in `android/app/src/main/AndroidManifest.xml`
5. Build APK: `flutter build apk --split-per-abi`
6. Create a Firebase project and set up Firestore
7. Run the project: `flutter run` or use your IDE's run button

## Firebase Setup
For detailed instructions on setting up Firebase for this project, including authentication and Firestore configuration, please refer to our [Firebase Setup Guide](FIREBASE_SETUP.md).

## Before we get started
- 👉 For now, Our app does support only Android platform (arm64).

- 👉 You will need a new AAR Library if you are creating this app on your own or changing the package name.

- 🚀 If you are looking the code in a code editor.You can hover over it to see the info of a particular function or classes. 👇
![hovering_over_functions](docs/hovering_over_class_or_functions.png)
- 🙋🏽‍♂️ We are improving the codebase and trying to make it better,but you may see some legacy codes. 🔥


- It would be super awesome 😍 if you install flutter and dart extension on your code editor if available.

- You need to generate your google map api key and firebase account if you are developing this on your own. 🙋🏽‍♂️

- If you face any problem [contact us here](http://faceonlive.com) ✌️


## Getting Started
- Step-0: Make sure you install [flutter] and [androidstudio]

- Step-1: Clone This Project to your local device [With this link](https://github.com/Turing311/FaceAttendance.git)

- Step-2: If you want to change the package name of this app run this command:
<br> *"flutter pub run change_app_package_name:main com.new.package.name"*

**remember you need to generate a new AAR** 👆


- Step-3: For name changing go to android/app/src/main/AndroidManifest.xml and change the parameter in *android:label = "yourappName"*

- Step-4: Run this command to build an apk, if you have changed the package name this command will be able to generate a apk, but it won't work <br> *"flutter build apk --split-per-abi"*

- Step-5: Get a Google Map SDK key from Google API [*if you want geolocatio based verification]
- Follow the below steps [In Order]:<br>
![map_doc_1](docs/android_map_sdk.png)
![map_doc_2](docs/tap_on_credentials.png)<br>
- Tap on Create Credintials, after creating you will see something like this.
![map_doc_3](docs/map_api_key.png)<br>
- Now add the google map api key *"android/app/src/main/AndroidManifest.xml"* in application tag
``` xml
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="your_google_map_api_key _here"/>
```
- Step-6: Open a firebase account, create a project.
- Create an Android App in the console with the package name of the app
<br> *Package Name: com.example.app*
- Download the config file googles-services.json
- Place the file in google-services.json
- On firestore create 3 root collection: "users", "members", "spaces".
- Now on authentication enable **"Email/Password"** login in sign in methods

- Step-7: Now open a emulator or connect a device with your development machine and open the code editor of your choice and You will see a run button on the **main.dart** file if you have installed flutter extension on vscode. if not then go to your project root directory and run **_flutter run_** from the terminal. It will build the apk and install the app on the device or emulator.

- Step-8: After everything has been setted up, copy and paste the code from **firestore.rules** to the Firebase firestore security rules. This file is included with the project.

### How the data is structured:
![data_1](docs/database_visualization/face_attendance_data_1.png)
![data_2](docs/database_visualization/face_attendance_data_2.png)
![data_3](docs/database_visualization/face_attendance_data_3.png)

### Common Errors you can get :
- Error_1: If you see red lines or a lot problems in the debug/problems tab, just run **flutter pub get** in the terminal. This happens because on initial stage your projects doesn't have reference to the cached plugin.
- Error_2: If you see init SDK (number) error (on debugging). just uninstall and reinstall the app. it will fix the issue.
- Error_3: If you see some weird plugin errors run this command in terminal it will reset the plugin cache.
> **flutter clean && flutter pub get**

- if these doesn't help you, you can always contact us with the issue information 😃.
## Common Errors and Solutions
- Red lines: Run `flutter pub get`
- SDK initialization error: Probably changed the package name
-

## Features
- [x] Attendance management with ease
- [x] Get attendance with face verification
- [x] Fast Face Verification
- [x] Use it as Static device to verify multiple person
- [x] Add a member without in need of another app in their phone
- [x] Multiple Space with seperate attendance on each of them
- [x] Attendance filtering
- [x] Holiday Changing
- [x] Dark Mode
- [x] Member Login
- [x] Admin Login
- [x] Admin managment
- [x] Add Member with qr code
- [x] Join Space with qr code
- [ ] Face Login in the app [Coming Soon]
- [ ] Daily log and notification [Can be added with cloud functions]
- [x] Space Range Selection [Admin Side]
- [ ] Geolocation based verification [Coming Soon]
- [ ] More coming soon 🔥 😍
<hr>

🙌 We are excited to see you here, thank you for taking the time to read this..

We are working hard to bring more features stay with us and [follow].

### We have used [flutter] for the UI here and We used our [Super Fast Face SDK] 🔥 to use verification.

You can learn more about our sdk here **[faceonlive.com]**. We always encourage people to contribute on it.

>[Fork] it here 💙 <br>
> [Follow] this repo ❤️
- [x] Easy attendance management with face verification
- [x] Multiple space support with separate attendance tracking
- [x] Admin and member logins
- [x] QR code for adding members and joining spaces
- [x] Dark mode
- [x] Use phone as a static verifier for automatic attendance
- [x] Weekend change option
- [ ] Face login (Coming soon)

If you liked our project you can give a star to let us know. Thank you for your time. Have a great day. ❤️
## Data Structure
![Data Structure 1](docs/database_visualization/face_attendance_data_1.png)
![Data Structure 2](docs/database_visualization/face_attendance_data_2.png)
![Data Structure 3](docs/database_visualization/face_attendance_data_3.png)

## Contributing
We welcome contributions! Fork the repository and submit pull requests to help improve the project.

<!-- REFERENCES -->
[flutter]:https://docs.flutter.dev/get-started/install
[androidstudio]:https://developer.android.com/studio
## Support
If you encounter any issues, please [contact us](http://faceonlive.com).

[follow]: https://github.com/FaceOnLive/Mask-Face-Attendance-App-Flutter/subscription
---

[Fork]: https://github.com/FaceOnLive/Mask-Face-Attendance-App-Flutter/fork
Built with [Flutter](https://docs.flutter.dev/get-started/install) and our [Super Fast Face SDK](https://faceonlive.com) 🚀

[faceonlive.com]:https://faceonlive.com
[Super Fast Face SDK]: https://faceonlive.com
If you find this project helpful, please star the repository and follow us for updates!
15 changes: 15 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}



android {
compileSdk 34
Expand All @@ -50,6 +57,14 @@ android {
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}

buildTypes {
release {
Expand Down
Binary file added docs/Screenshots.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fbd9c92

Please sign in to comment.