fossasia / susi_android

SUSI.AI Android App https://play.google.com/apps/testing/ai.susi
Apache License 2.0
2.42k stars 1.11k forks source link

SUSI.AI Android App

Dev CircleCI Master CircleCI Codacy Badge Preview the app Gitter Mailing List Twitter Follow

The main feature of the app is to provide a conversational interface to provide intelligent answers using the loklak/AskSusi infrastructure. The app also offers login functionalities to connect to other services and store personal data. Additionally, the application uses data provided by the user's phone to improve Susi answers. Geolocation information, for example, helps to offer better answers related to questions about "things nearby".

Roadmap

Planned features & enhancements are:

Communication

Please join our mailing list to discuss questions regarding the project: https://groups.google.com/forum/#!forum/susiai

Our chat channel is on gitter here: https://gitter.im/fossasia/susi_android

Screenshots

Development

A native Android app using both Java and Kotlin for writing code. The answers for user queries comes from SUSI Server which further uses skills defined in SUSI Skill Data.

Android App Development Set up

Please find info about the set up of the Android app in your development environment here.

Libraries used and their documentation

Project Conventions

There are certain conventions we follow in the project, we recommend that you become familiar with these so that the development process is uniform for everyone:

MVP

The project follows Model-View-Presenter design pattern and requires schematic interfaces for each component to be written first as contracts and then implemented.
All the interactions are done using interfaces only. This means any model, view or presenter will only be referenced by its interface. We do so it is easy to mock and test them and there is no discrepancy in the callable methods of the concrete class and the interface.
We realize that MVP is opinionated and there is no strict boundary between the responsibility of each component, but we recommend following this style:

Use of Kotlin

Around 50% of the App is written in Kotlin. Kotlin is a very similar language to Java but with much more advantages than Java. It is easy to adapt and learn. So, you need not worry if you don't have prior experience with it. Follow these docs for syntax reference. The latest Android Canary Version has in built support for Kotlin but if you don't have the Canary version, you can add Kotlin Plugin in your Android Studio. Follow this link to see how to do that.

Project Structure

Generally, projects are created using package by layer approach where packages are names by layers like ui, activity, fragment, etc but it quickly becomes unscalable in large projects where a large number of unrelated classes are crammed in one layer and it becomes difficult to navigate through them.
Instead, we follow package by feature, which at the cost of flatness of our project, provides us packages of isolated functioning related classes which are likely to be a complete self-sufficient component of the application. Each package contains all related classes of view, presenter, their implementations like Activities and Fragments.
A notable exception to this is the helper module and data classes like Models and Repositories as they are used in a cross component way.
Note: The interface contract for Presenter and View is present in contract package in each module

Separation of concerns

Lastly, each class should only perform one task, do it well, and be unit tested for it. For example, if a presenter is doing more than it should, i.e., parsing dates or implementing search logic, better move it in its own class. There can be exceptions to this practice, but if the functionality can be generalised and reused, it should most definitely be transferred in its own class and unit tested.

Contributions Best Practices

For first time Contributor

First time contributors can read CONTRIBUTING.md file for help regarding creating issues and sending pull requests.

Branch Policy

We have the following branches

Code practices

Please help us follow the best practice to make it easy for the reviewer as well as the contributor. We want to focus on the code quality more than on managing pull request ethics.

For Developers: Adding Fabric API KEY

  1. Go to AndroidManifest.xml Replace the fabric_api_key with the Real Fabric API Key by adding :

    <meta-data android:name="io.fabric.ApiKey" android:value="fabric_api_key" />
  2. Open the app/fabric.properties: Replace the fabric_api_key with your actual Fabric API Secret.

  3. Open MainApplication.java, a) After adding the API KEYS and API Secret uncomment the line :

        Fabric.with(this, new Crashlytics())

    b) Add imports :

        import com.crashlytics.android.Crashlytics;
        import io.fabric.sdk.android.Fabric;
  4. Uncomment the line in the app/gradle:

    apply plugin: 'io.fabric'

    For Developers: Updating the URL of the smart speaker

  5. Go to build.gradle file and the URL of the smart speaker local server under the name of SPEAKER_BASE_URL as a buildConfigField can be updated there under the buildtypes section in both the release and debug blocks :

    buildConfigField "String", "SPEAKER_BASE_URL", '"http://10.0.0.1:5000"' 
    

For Developers: Adding the YouTube API key

Go to AndroidManifest.xml and replace the ${YOUTUBE_API_KEY} with the real youtube API Key by adding :

<meta-data
android:name="com.google.android.youtube.API_KEY"
android:value="${YOUTUBE_API_KEY}" />

For Testers: Testing the App

If you are a tester and want to test the app, you have two ways to do that:

  1. Installing APK on your device: You can get debug APK as well as Release APK in apk branch of the repository. After each PR merge, both the APKs are automatically updated. So, just download the APK you want and install it on your device. The APKs will always be the latest one.
  2. Testing on appetize.io: If you don't want to download the APKs, you can simply go on this link and use the App on an online simulator. You will always find the latest version of App on that link because it is updated after each PR merge.

License

This project is currently licensed under the Apache License Version 2.0. A copy of LICENSE.md should be present along with the source code. To obtain the software under a different license, please contact FOSSASIA.