Skip to content

Latest commit

 

History

History
115 lines (82 loc) · 6.67 KB

README.md

File metadata and controls

115 lines (82 loc) · 6.67 KB

Dynamics Mobility App Code Setup

Android Studio IDE

Version 3.4.1 of Android Studio IDE was used for developing the Mobility Dynamics App

Project Configurations

  • Gradle Version: 5.1.1
  • Gradle Build Tool Version: 3.4.1
  • Koltin Version: 1.3.31
  • Build Tool Version: 28.0.3
  • Minimum SDK Version: API 21

Android MVVM Base Architecture

This application is build using MVVM architecture having Repository Design Pattern for data source. Following are key highlights of the project.

The application has been built with offline support. It has been designed using Android Architecture components with Realm for offline data caching. The application is built in such a way that whenvever there is a service call, the result will be stored in local database. If internet is not available application will display data from offline storage.

Application Architecture

MVVM

The main advantage of using MVVM, there is no two-way dependency between ViewModel and Model, unlike MVP. Here the viewer can observe the data changes in the ViewModel as we are using LiveData which is lifecycle aware. The ViewModel to view communication is achieved through observer pattern basically observing the state changes of the data in the ViewModel.

Presentation Layer

The View layer is much more flexibile as an indefinite number of Views can bind to a ViewModel. Also, MVVM enforces a clear separation between Views and their master - ViewModel, as the latter holds no reference to Views. The model layer is completely isolated and centralized through the repository pattern.

Model Layer

The model layer is structured on repository pattern so that the ViewModel has no clue on the origins of the data.

The repository handles data interactions and transactions from two main data sources - local and remote which is being handled by NetworkBoundResource and NetworkPaginatedBoundResource for pagination payload data.

There are two main use-cases, online and offline. In both use cases, NetworkBoundResource or NetworkPaginatedBoundResource will always send a call to the server for fetching latest data and cache it in local database and data is displayed to the user. In case of no internet connection, data is always queried from local storage.

Model Layer

Dependency Injection

Dagger2 is used to externalize the creation of dependencies from the classes that use them. Android specific helpers are provided by Dagger-Android and the most significant advantage is that they generate a subcomponent for each Activity through a new code generator.

Dagger

Strong points

  • Decoupling level is high.
  • Data Flow is centralized through Observable.
  • Possess high flexibility to create variants for automated and manual testing.
  • Possess lightweight structure due to MVVM presentation pattern.
  • Is scalable and easy to expand.

Weak points

  • Possess high code base - simpler approaches will certainly lower code size

Different Type Of Environments

There are four build variant configured for the App, As in real application we have many environments due to this I create following build variant to support various environments as a base.

  • Prod Build Variant:

    • This build variant contains both (Debug and Release mode)
    • It contains a separate code base for web service URL.
  • UAT Build Variant:

    • This build variant contains both (Debug and Release mode)
    • It contains a separate code base for web service URL
  • QA Build Variant:

    • This build variant contains both (Debug and Release mode)
    • It contains a separate code base for web service URL.
  • Dev Build Variant:

    • This build variant contains both (Debug and Release mode)
    • It contains a separate code base for web service URL.

Build Variant

How to build ?

As we have four build variant, for generating debug/release build command varies according to product flavors. Open terminal and type the below command to generate debug or release build respectively

  • Prod Build Variant:

    • gradlew assembleProdDebug or ./gradlew assembleProdDebug
    • gradlew assembleProdRelease or ./gradlew assembleProdRelease
  • UAT Build Variant:

    • gradlew assembleUatDebug or ./gradlew assembleUatDebug
    • gradlew assembleUatRelease or ./gradlew assembleUatRelease
  • QA Build Variant:

    • gradlew assembleQaDebug or ./gradlew assembleQaDebug
    • gradlew assembleQaRelease or ./gradlew assembleQaRelease
  • Dev Build Variant:

    • gradlew assembleDevDebug or ./gradlew assembleDevDebug
    • gradlew assembleDevRelease or ./gradlew assembleDevRelease

TODO Improvements Task

  • Move to Navigation component Library after this issues is fixed
  • Improved error screen, currently I am just showing text.
  • Pull to Refresh for Display Items. We can do this once we add Pagination API.
  • Include Proguard rules for code obfuscation.
  • Include Centralize D365 Login