Skip to content
/ my-monzo Public

🎮 - Playground Android™ with Monzo public API

License

Notifications You must be signed in to change notification settings

gm4s/my-monzo

Repository files navigation

MyMonzo for Android™

Kotlin Java Min SDK

Modular Architecture 🔧

Never heard about modular architecture? click here

For each new features please create its own component

@NewFeatureScope
@Component(
        dependencies = [CoreComponent::class],
        modules = [NewFeatureModule::class]
)
interface NewFeatureComponent {

    fun environment(): NewFeatureEnvironment

}

Its own environment

data class NewFeatureEnvironment @Inject constructor(
       // Add properties needed. Ex: api, analytics, scheduler, etc.
)

And its own module

@Module
class NewFeatureModule {

    @Provides
    @NewFeatureScope
    fun provideNewFeatureEnvironment(): NewFeatureEnvironment {
        return NewFeatureEnvironment()
    }

}

Design Pattern ⚡

MVVM facilitates a separation of development of the graphical user interface from development of the business logic or back-end logic (the data model). The view model of MVVM is a value converter, meaning the view model is responsible for exposing (converting) the data objects from the model in such a way that objects are easily managed and presented. In this respect, the view model is more model than view, and handles most if not all of the view's display logic. The view model may implement a mediator pattern, organizing access to the back-end logic around the set of use cases supported by the view.

For each new ViewModel's please follow this implementation:

class NewFeatureViewModel(
        environment: NewFeatureEnvironment
): ActivityViewModel() {

    class Factory(
            private val _environment: NewFeatureEnvironment
    ) : ViewModelProvider.Factory {
        override fun <T : ViewModel?> create(modelClass: Class<T>): T {
            return NewFeatureViewModel(_environment) as T
        }
    }

}

To bind the ViewModel to the activity:

private val viewModelFactory by lazy {
    NewFeatureViewModel.Factory(component.environment(), scopeProvider)
}

private val viewModel by lazy {
    ViewModelProviders.of(this, viewModelFactory).get(NewFeatureViewModel::class.java)
}

Gradle 🐘

Test a unique class

./gradlew :${MODULE}:testReleaseUnitTest --tests ${CLASS REFERENCE} --info

Test all

./gradlew :${MODULE}:testReleaseUnitTest

Lint

./gradlew :${MODULE}:lintRelease

Git 💾

Branch naming convention

$ git branch -b [developer-initial]/[issue-tag-number]_[issue-name]

Formatting commit messages

$ git commit -am "[... your message ...]"

All commit message line will be cropped at 100 characters

Formatting pull request

Please follow the template PULL_REQUEST_TEMPLATE when you create a new pull request.

Android Version Support 📱

Android fragmentation analytics --> Platform Versions

  • Min API 21 --> Lolipop : 5.0.x
  • Max API 28 --> Oreo : 8.1.x

Android Code Style Convention 🍉

Cookbooks 📚

Contributors 🍪

Guillaume Mas