Skip to content

Latest commit

 

History

History
236 lines (170 loc) · 9.55 KB

README.md

File metadata and controls

236 lines (170 loc) · 9.55 KB

 

app-logo

DOLFIN App

The Flutter-based app for the DOLFIN Project.

About

Babies who are born very early, or who suffer poor blood supply or lack of oxygen to the brain before or around birth, are more likely to have problems with their brain development and child neurological development. This may affect how children think and learn, communicate, play, and interact with the world around them.

DOLFIN aims to answer the research question:

In babies who are born very early or who suffer poor blood supply or lack of oxygen to the brain before or around birth, does giving a nutritional supplement daily for a year improve long-term cognitive development?

Nice to know

The NPEU team have access to the Firebase database using a service account with a private key. This expires around the beginning of June annually. NPEU will give us a new public key and we upload this to the service account through the Google console.

Project Team

PI: Jeremy Parr
RSEs:

Project Structure

  • doflin-flutter: Production repository (left side of the diagram)
  • dolfin-development: This repository. DOLFIN Admin app 'dev' branch, created for NPEU team (right side of the diagram)
  • dolfin-firebase: Includes Firebase Cloud Funcitons, Push Notifications and Database (top left of the diagram)
  • dolfin-firebase: Development Firebase Cloud Funcitons, Push Notifications and Database (top right of the diagram)

Project Diagram

project-diagram

This repository contains both 'DOLFIN App' & 'DOLFIN App Admin'.
The apps are identical with a key exception: Admin app is built with the .env file pointing to the test API, while the DOLFIN App is the production ready version.
The production ready version is not accessible to anyone besides the trial participants. This also excludes both DOLFIN and RSE teams.

Prerequisite Installs

The application uses Flutter, which is written in Dart; both developed and maintained by Google.

  1. Install the following to get started on the project:

    • Flutter Framework (this also installs Dart for you, no need to do it explicitly): Flutter MacOS
      • IMPORTANT NOTES POST INSTALL:
      • Must be downgraded to: Flutter version 3.16.9 channel stable
      • Do NOT run $ dart fix
      • Do NOT adjust pubspec.yaml file! Unless you are keen on predicate logic
    • Xcode available on the Mac App Store
    • Android Studio available from the Jetbrains Toolbox App

    If you have an instalation of Flutter already, and installed this using homebrew, you may not be able to downgrade Flutter. If this is the case, remove your Flutter installation and install only the required version using these instructions for installation and selecting the correct installation from here.

  2. Determine whether you need Ruby (version manager) on a Mac

    Developing on Mac requires you to install additional Ruby versions, which is not interfering with the system built-in one.
    Recommended to check out rbenv. A Ruby version manager. chruby is also a good alternative.

    To determine if you need to install a Ruby Version manager, run:

        $ which ruby
    

    If it returns

        $ /usr/bin/ruby
    

    You need to install a ruby version manager for MacOS to develop iOS apps.

  3. Refer to rbenv repo regarding installation.

  4. Install Android Emulator

    Android requires Java 11. Anything newer will NOT work.

    You want to set up an Android emulator with API 34 or above running Android 14 or above. Do this within Android Studio (Step 1)
    The project is 80:20 split focused in favour of Android, recommended to use Android Studio throughout the development in general.

  5. Install iOS Simulators

    XCode 15 (or newer) will come pre-installed with the relevant up-to-date iOS simulators. No need to do anything else.

Getting Started

Run the following command to confirm you installed everything above correctly:

    $ flutter doctor

If you see the following output, you are good to go:

flutter-doctor

Project Setup to Firebase

  1. Find the .env file on RSE Team OneDrive.
  2. Clone the repository and place the .env file at root level of dolfin-flutter/ directory

You need to configure the application on Android as well as on iOS with Firebase.
If you skip this step, you will have a hard time debugging what is going on with no errors showing.

Android

  1. Download the relevant google-services.json file from Firebase.
    To confirm you have the correct file, you will see uk.ac.ncl.rse.dolfin.admin under package-name.
  2. Copy the file to dolfin-flutter/android/app/ directory

Run the Android App for the first time

  1. Open the Android Simulator manually (as flutter can't do it for you)
  2. Install the flutter packages
        $ flutter pub get 
    
  3. Run the project
        $ flutter run
    
  4. Manually select the Android Simulator
  5. Wait until it builds

iOS

  1. Download the relevant GoogleService-Info.plist file from Firebase
  2. Copy the file to dolfin-flutter/ios/ directory
  3. Open XCode at dolfin-flutter/ios/Runner.xcodeproj
  4. Right-click 'Runner'
  5. Add Files to "Runner"
  6. Select GoogleService-Info.plist
  7. To confirm XCode recognises your file, you need to see it in the XCode file directory

If it doesn't work, follow these steps.

Run the iOS App for the first time

  1. Open the iOS Simulator manually (as flutter can't do it for you)
  2. Install the flutter packages
        $ flutter pub get
    
  3. Install Pods
        $ cd ios 
    
        $ pod install 
    
  4. Run the project
        $ flutter run
    
  5. Manually select the iOS Simulator
  6. Wait until it builds

Building the app

How to build and publish the DOLFIN Admin App:

Android

Prerequisites (each time these have to pre-exist)

  1. In pubspec.yaml increment version: 0.2.7+207 (E.g. to version: 0.2.8+208)
  2. Run flutter run and compile it first to an Android emulator
  3. Put the private_key.pepk and upload-keystore.jks (available from RSE team Onedrive) files under dolfin-flutter-development/android/app/

Building the app

  1. Open Android Studio at dolfin-flutter-development/android/
  2. Mac Menu Bar: Build > Generate Signed App Bundle / APK
  3. Select “Android App Bundle”
  4. Module: android.app Key store path: <your/path>/dolfin-flutter-development/android/app/upload-keystore.jks Key store password: password Key alias: key Key password: password Select “Remember passwords”
  5. Build variants: release
  6. Click “Create”

Publishing the app

  1. Open Google Play Console

  2. “Create new release”

  3. Upload the app-release.aab file

  4. Publish from the Publishing Overview

iOS

Prerequisites (each time these have to pre-exist)

  1. In Info.plist increment

     <key>CFBundleShortVersionString</key>
     <string>2.0.7</string>
     
     and
    
     <key>CFBundleVersion</key>
     <string>207</string>
    
  2. Your Apple ID should be part of the Newcastle University Organisation (Team ID: J3676MPZ85)

Building the App

  1. Open dolfin-flutter-development/
  2. Run flutter build ipa

Publishing the app

  1. Locate the .ipa file under /dolfin-flutter-development/build/ios/ipa
  2. Open Transporter app (https://apps.apple.com/gb/app/transporter/id1450874784?mt=12)
  3. Upload the uk.ac.ncl.rse.dolfin.admin.ipa file
  4. Release it on Testflight

Regenerating the Icons (not needed unless there is an error)

The base icon image is specified in pubspec.yaml and the relevant dependencies should be installed automatically. To regenerate the icons (for Android and iOS), edit the master image file and then use the following commands:

flutter pub get  
flutter pub run flutter_launcher_icons:main

Roadmap

  • Initial Development
  • Minimum viable product
  • Feature-Complete
  • Late 2023 Update by Imre
  • Early 2024 Update by Imre

Acknowledgements

This work was funded by a grant from the UK Research Councils, EPSRC grant ref. EP/L012345/1, “Example project title, please update”.