diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ccd0ca..e374b1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,41 @@ +## 1.2.0-alpha + +### Breaking changes + +This release introduces some breaking changes. All stuff listed below is also mentioned in the [Migration guide](https://github.com/mkoslacz/Moviper/blob/master/MIGRATION_GUIDE.md). +* Simplified Moviper internals to ease the troubleshooting and debugging. +* Rename some methods to make them more self-explaining. +* Removed Wipe (View-Interactor-Presenter-Entity) and Perv (Presenter-Entity-Routing-View) components as they did not add much value to the project but still needed the maintenance. +* Removed deprecated methods. + +### General + +* Introduced even more samples, now with VIPER testing showcases inside. + +### Enhancements + +* Added support for `ViewHolder`s. Now they can represent a View in a VIPER architecture. See `sample-recyclerview`. + +### Internal + +* Routing activity attaching moved from constructor to the routing lifecycle. +* Simplified a VIPER components lifecycle. +* Simplified a presenter architecture. +* Simplified a routing architecture. +* Bumped dependencies versions: + - RxJava to 1.2.3 + - buildtools to 25.0.2 + - support libs to 25.1.0 + + +### Credits + +Many thanks to guys that helped me in Moviper development implementing my ideas. +* [Tomasz Najda](https://github.com/tomasznajda) - simplifying Moviper architecture, +* [Bartosz Wilk](https://github.com/bartoszwilk) - Moviper templates, +* [Jakub Jodelka](https://github.com/jakubjodelka) - Moviper samples, VIPER ViewHolders. + + ## 1.1.0-alpha ### General diff --git a/MIGRATION_GUIDE.md b/MIGRATION_GUIDE.md new file mode 100644 index 0000000..ab3fb55 --- /dev/null +++ b/MIGRATION_GUIDE.md @@ -0,0 +1,67 @@ +## Classes + +| **1.1.0-alpha** | **1.2.0-alpha** | +|---------------------------------|---------------------------| +| MvpActivity | ViperActivity | +| MvpLceActivity | ViperLceActivity | +| MvpLceViewStateActivity | ViperLceViewStateActivity | +| MvpViewStateActivity | ViperViewStateActivity | +| MvpFragment | ViperFragment | +| MvpLceFragment | ViperLceFragment | +| MvpLceViewStateFragment | ViperLceViewStateFragment | +| MvpViewStateFragment | ViperViewStateFragment | +| PervActivityBasePresenter | removed | +| PervActivityBaseRxPresenter | removed | +| PervFragmentBasePresenter | removed | +| PervFragmentBaseRxPresenter | removed | +| WipeBasePresenter | removed | +| WipeBaseRxPresenter | removed | +| ViperActivityBasePresenter | BasePresenter | +| ViperActivityBaseRxPresenter | BaseRxPresenter | +| ViperFragmentBasePresenter | BasePresenter | +| ViperFragmentBaseRxPresenter | BaseRxPresenter | +| ActivityBaseRouting | BaseRouting | +| ActivityBaseRxRouting | BaseRxRouting | +| ActivityBaseViewHelperRouting | BaseViewHelperRouting | +| ActivityBaseViewHelperRxRouting | BaseViewHelperRxRouting | +| FragmentBaseRouting | BaseRouting | +| FragmentBaseRxRouting | BaseRxRouting | +| FragmentBaseViewHelperRouting | BaseViewHelperRouting | +| FragmentBaseViewHelperRxRouting | BaseViewHelperRxRouting | + +## Interfaces + +|** 1.1.0-alpha** | **1.2.0-alpha** | +|------------------------------------|-----------------------------| +| MoviperInteractor | ViperInteractor | +| MoviperRxInteractor | ViperRxInteractor | +| MoviperPresenter | ViperPresenter | +| MoviperActivityPresenterForRouting | ViperPresenterForRouting | +| MoviperFragmentPresenterForRouting | ViperPresenterForRouting | +| MoviperPresenterForRouting | ViperPresenterForRouting | +| MoviperPresenterForInteractor | ViperPresenterForInteractor | +| MoviperRouting | ViperRouting | +| MoviperRxRouting | ViperRxRouting | +| MoviperViewHelperRouting | ViperViewHelperRouting | +| MoviperViewHelperRxRouting | ViperViewHelperRxRouting | +| MoviperViewHelper | ViperViewHelper | + +## Methods + +| **1.1.0-alpha** | **1.2.0-alpha** | +|-----------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------| +| MoviperActivityPresenterForRouting#createRouting(Activity activity) MoviperFragmentPresenterForRouting#createRouting(Fragment fragment) | ViperPresenterForRouting#createRouting() | +| MoviperPresenterForRouting#isRoutingAttached() | removed | +| MoviperPresenterForInteractor#isInteractorAttached() | removed | +| MoviperRouting#attachPresenter(PresenterType presenter) | ViperRouting#attach(ActivityHolder activity, PresenterType presenter) ViperRxRouting#attach(ActivityHolder activity) | +| MoviperRouting#detachPresenter() MoviperRxRouting#onPresenterDetach() | CommonViperRouting#detach(boolean retainInstance) | +| Interactor#attachPresenter() | ViperInteractor#attach(PresenterType presenter) ViperRxInteractor#attach() | +| Interactor#detachPresenter() Interactor#onPresenterDetach() | CommonViperInteractor#detach(boolean retainInstance) | | 1.2.0-alpha | +|-----------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------| +| MoviperActivityPresenterForRouting#createRouting(Activity activity) MoviperFragmentPresenterForRouting#createRouting(Fragment fragment) | ViperPresenterForRouting#createRouting() | +| MoviperPresenterForRouting#isRoutingAttached() | removed | +| MoviperPresenterForInteractor#isInteractorAttached() | removed | +| MoviperRouting#attachPresenter(PresenterType presenter) | ViperRouting#attach(ActivityHolder activity, PresenterType presenter) ViperRxRouting#attach(ActivityHolder activity) | +| MoviperRouting#detachPresenter() MoviperRxRouting#onPresenterDetach() | CommonViperRouting#detach(boolean retainInstance) | +| Interactor#attachPresenter() | ViperInteractor#attach(PresenterType presenter) ViperRxInteractor#attach() | +| Interactor#detachPresenter() Interactor#onPresenterDetach() | CommonViperInteractor#detach(boolean retainInstance) | \ No newline at end of file diff --git a/README.md b/README.md index cfa7edb..ea41a4c 100644 --- a/README.md +++ b/README.md @@ -12,16 +12,20 @@ To avoid manually creating all VIPER class files and managing their dependencies ### Great! But I'm used to go with Mosby. What about all of its goodies? -You are able to use all of the Mosby's MVP Views with Moviper. MvpFragment, MvpLceActivity, ViewStateFragment etc. are fully compatibile with Moviper presenters. +Moviper has all of the Mosby's MVP Views mapped to fit VIPER requirements. Just simply replace `Mvp` with `Viper` and let the Android Studio do the autoimport for you. + +For example `MvpFragment` maps to `ViperFragment`. ## Dependency ```groovy dependencies { - compile 'com.mateuszkoslacz.moviper:moviper:1.1.0-alpha' + compile 'com.mateuszkoslacz.moviper:moviper:1.2.0-alpha' } ``` +If you are upgrading Moviper you should probably check out the [Changelog](https://github.com/mkoslacz/Moviper/blob/master/CHANGELOG.md) and/or the [Migration guide](https://github.com/mkoslacz/Moviper/blob/master/MIGRATION_GUIDE.md). + ## Getting started First of all, check out the samples. After that, just create a VIPER files set using [Moviper Template Generator](https://github.com/mkoslacz/MoviperTemplateGenerator), fill up the contract, generate missing methods using Android Studio autofix @@ -67,9 +71,22 @@ Moviper.getInstance().getPresenterInstance(SomePresenter.class, "someName") .subscribe(somePresenter -> somePresenter.someMethod(false)); // exactly one or zero Presenters with given name and class goes here ``` +### VIPER ViewHolders + +For complex RecyclerView list elements and/or multiple views on RecyclerViewlist you can design your app in the way that treats every list element as a separate VIPER View with its own contract. +Generating such ViewHolders is supported in the [Moviper Template Generator](https://github.com/mkoslacz/MoviperTemplateGenerator). +For the sample usage check out the `sample-recyclerview`. + ## Examples -For the basic usage just check out the `rxsample` (or `sample`, if you aren't familiar with [RxJava](https://github.com/ReactiveX/RxJava)) module in this repo. For the IPC usage check out the `ipcsample` module. +For the basic usage just check out the `sample-rx` (or `sample`, if you aren't familiar with [RxJava](https://github.com/ReactiveX/RxJava)) module in this repo. Most of samples include showcases of test scenarios for given Moviper usecases. + +More advanced usage: +- Inter-Presenter-Communication — `sample-ipc`, +- VIPER ViewHolders - `sample-recyclerview`, +- Repository Design Pattern usage in Interactors and tests - `sample-rx-rdp` +- ViewState usage - `sample-rx-viewstate` +- Activity/Fragment retaining presenter - `sample-rx-presenter` ## Credits diff --git a/TODO.md b/TODO.md index 0c8b1cb..6d9f4cc 100644 --- a/TODO.md +++ b/TODO.md @@ -1,16 +1,5 @@ #Viper-framework TODOs: - - add sample showcasing Moviper inter-presenter communications - - add helper methods to BasePresenters, Interactors etc: ifViewIsAttachedDo( () -> {actions}); - - learn & implement Dagger2 Viper injection (to use in example and maybe to remove passing - activity through presenter to let it be android-free. another (no-dagger) option is to pass - newly created routing to presenter constructor) - - add lifecycle driven version of contract - - learn & implement Viper testing using Dagger & Mocks - - add better docs for Viper framework (Mvp, Perv, Wipe, Viper use cases etc) - create super rx versions of base classes - - create reasonable samples of lib usage (basic, rx, tests with dagger) - - create non-ViewHelper versions of Perv and Viper - - extract Viper framework to separate library - create Android Studio plugin for creating appropriate classes and interfaces set - choosing root viper dir - choosing view name