- Water Tracker works with Flutter latest version
- Water Tracker is integrated with firebase services(authentication, firestore, storage, analytics, crashlytics, dynamic links, remote config, cloud messaging)
- App is built with BloC state managment
- Codemagic is used to make production builds
water-tracker-demo.mp4
In main_prod.dart set AppConfig() with such parameters:
dart final configuredApp = AppConfig( appName: , flavorName: 'prod', apiUrl: , child: Application(), );
Follow the same process, but fill the empty fields with the development values dart final configuredApp = AppConfig( appName: 'DEV ', flavorName: 'dev', apiUrl: , child: Application(), );
In order to create a new production release on Android, you have to push to master branch or merge development branch with master.
Push to master branch.
shell
git push origin master
or make pull request to master branch on your remote repository.
GitLab repository and Codemagic have triggers on this events, so the build will start.
1. Clone this repo to your folder:
git clone https://github.com/extrawest/ew_flutter_water_tracker_app.git
2. Change current directory to the cloned folder:
cd ew_flutter_water_tracker_app
3. Get packages
flutter pub get
- In order to get proper Firebase Access Token for Firebase Distribution uploading you need to perform the following command:
shell firebase login:ci
- Login with the needed account (which is added to the Firebase Console of the project)
- Get back to the terminal where you performed the command above and copy the Firebase Access Token
- Set the Access Token as a value of the FIREBASE_TOKEN env var in the Codemagic workflow
Additional info: https://firebase.google.com/docs/cli#cli-ci-systems
In order to ENCODE Firebase configs (GoogleService-Info.plist, google-services.json) in Codemagic with environment variables follow this link: https://blog.codemagic.io/how-to-load-firebase-config-in-codemagic-with-environment-variables/
shell openssl base64 -in GoogleService-Info.plist
shell openssl base64 -in google-services.json
Copy the output encoded text and put it as env var GOOGLE_SERVICE_IOS and GOOGLE_SERVICE_ANDROID respectively
In order to DECODE Firebase configs (GoogleService-Info.plist, google-services.json) from Codemagic environment variables perform these scripts under the Pre-build script section:
shell echo $GOOGLE_SERVICE_IOS | base64 --decode \
$FCI_BUILD_DIR/android/app/google-services.json
echo $GOOGLE_SERVICE_ANDROID | base64 --decode \
$FCI_BUILD_DIR/ios/Runner/GoogleService-Info.plist
Water tracker supports this types of firebase authentication
- Email/password
- Google Authentication
- Facebook Authentication
To add another types of authentication check https://firebase.google.com/docs/auth
Firestore database is used to store all needed information for each user.
- User Data(email, name, daily limit)
- Tracked water (separate document for each day)
- Fcm token
All data is secured using security rules
- Unauthorized access to firebase services are not permitted
- Each user has access only to it's own data based on user UUID provided
Firestore storage is used to store user profile photo
All data is secured using security rules such as in firestore
Firestore storage is used to track such events
- drink_water - event is tracked when user add water
- photo_updated - event is tracked when user update the profile photo
- name_updated - event is tracked when user changes the name
Firestore storage is used to track all fatal and non-fatal crashes.
Water tracker supports receiving notifications in background and terminated states.
Each user is automatically subscribeb on the topic "reminders" in cloud_messaging.
Remote config is used for changing the progress indicator of drunk water during the day. There are two options: 'linear' and 'circular', so it can be changed in firebase console/remote config and users will see the update without new build
Dynamic links gives each user ability to share his daily progress with others. User can just copy the link or share it to other social media with the share_plus package(https://pub.dev/packages/share_plus)
Created by Roman Ovsepian
Extrawest.com, 2022