This is a Kotlin Multiplatform (KMP) food journal mobile app that allows the user to also get suggestions on how to make their foods healthier...
- BackGround
- Requirements
- Project Structure
- Procedure
- Screenshot
- Demo
- Tools, Technologies, & Libraries
- Snapbite was developed for the KotlinConf' 2024 Contest...
- The mobile app is written purely in Kotlin with a little bit of Swift to cater for the iOS-specific functionalities...
- These are the requirements for setting up the project:
- The project requires a laptop with the minimum/recommended specifications set by Google for running Android Studio...
- This is the IDE used to run the project...
- Depending on the time of installation, the IDE may prompt you to update the project's Android Gradle Plugin (AGP) version...
- To run the app, an Emulator provided by Android Studio or a physical device (USB/Wireless Debugging) is required...
- Snapbite is divided into the following modules:
- It contains MainActivity.kt which is used to run the Android app as well as setting up the Notification handling for Firebase Cloud Messaging (FCM)...
- This is the main module of the app that contains shared logic which is used by both the Android and iOS variants...
- It is subdivided into the following modules:
- It contains the Android-specific logic of the app...
- It houses the features of the app which have been categorised using packages in a Clean Architecture format...
- It comprises of the Unit Tests written for the About, Settings, and Food features using MockK and Robolectric...
- It contains the iOS-specific logic of the app...
- It provides the assets of the app such as images and the font (Caveat) using Moko Resources...
- This module utilises XCode to run and manage the iOS variant of the app...
- To set up the project, please follow this procedure:
- To clone the project from GitHub, open Android Studio and choose "Clone from Version Control"...
- When presented with the Dialog, copy and paste the following URL in the box requesting for the repository's URL: https://github.com/emmanuelmuturia/Snapbite
- Once the project is open in Android Studio, upgrade it to the latest AGP version if prompted and follow the steps presented using the AGP Assistant...
- If you do not have an Emulator and would like to use it for running the app, then simply go to "Device Manager" on the right-hand panel of Android Studio and click the "+" icon to add a new Virtual Device. Choose your preferred device and configurations, including the System Image if you have none installed...
- If you would like to use a Physical Device instead, here are the two options you should use to connect it to Android Studio:
- Ensure that your device has "USB Debugging" enabled by first enabling Developer Options (Check your device's website for the steps you need to take for this) and navigating to the "Developer Options" section and toggling "USB Debugging" on...
- Connect your device to the laptop using a USB cable and select "Transfer Files"...
- That's it!
- To use Wireless Debugging instead, follow the above procedure but enable "Wireless Debugging" instead of "USB Debugging"...
- Once that is done, navigate to "Device Manager" and click the WiFi icon...
- You will be presented with a QR Code. On the "Developer Options" under "Wireless Debugging", choose "Pair using QR Code" and scan the QR code that has been presented to you in Android Studio. Alternatively, select the "Pair using Pairing Code" and do the same on your device still under "Wireless Debugging". Wait for Android Studio to scan and discover your device...
- That's it!
Screenshot | Description |
---|---|
Uploading a food item... | |
Displaying the saved food item... | |
Healthier suggestions for the food item... |
Snapbite.Demo.mp4
- This project has been developed and supported by the following Tools, Technologies, and Libraries:
- The project's User Interface (UI) has been built using Jetpack Compose which is Google's Kotlin-first UI toolkit...
- Snapbite has been built to support both Android and iOS platforms through Jetbrain's multiplatform technology: Kotlin Multiplatform (KMP)...
- To allow for the sharing of ViewModels and assets, Moko MVVM and Moko Resources have been respectively implemented...
- Navigation between screens was made easy by Voyager, which is a library that supports KMP projects...
- The project's core functionalities are based on Firebase products such as Firebase Authentication (SignIn with Google), Firebase Cloud Firestore (Database), and Firebase Cloud Messaging (Push Notifications)...
- Snapbite has utilised Google's Gemini Pro AI Model to provide recommendations on making the user's food healthier using the Gemini API...
- The project has utilised SQLDelight to provide an offline-first experience to the user through local storage...
- MockK has been used to mock various dependencies that were required during the Unit Tests in an efficient and Kotlin-first manner...
- To simulate an Android environment, Robolectric was used and it allowed for the dependencies to work together, just like they would in a real-world Android environment...