From 95a84f0ff95184a38b54777ac01c7d59b98dd374 Mon Sep 17 00:00:00 2001 From: Thibaud Giovannetti Date: Wed, 13 Sep 2017 16:38:37 +0200 Subject: [PATCH] update readme --- CONTRIBUTORS.md | 9 +-------- README.md | 38 ++++++++++++++++++++++++++++++++------ 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 86ab546..a289096 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -5,11 +5,4 @@ In contributing order * Author and maintainer * Most features development - - -* **[Hoang Hiep](https://github.com/hoanghiephui)** - - * Port the library to RxJava2 - - - + \ No newline at end of file diff --git a/README.md b/README.md index 56e11c8..4ebdc11 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,13 @@ ## About -Store2Store simplify the synchronization between storages. +Store2Store simplify the synchronization between Store of datas. For instance, you can easily synchronize a REST API with a local Realm datastore. +**This is the rxJava2 implementation.** + +*If you want to use a rxJava1 version, please use the 1.x.x tags (API is different).* + + ## Installation with gradle ``` @@ -17,21 +22,42 @@ allprojects { ``` # app/build.gradle file -compile 'com.github.playmoweb:store2store:' +compile 'com.github.playmoweb:store2store:3.0.0' ``` ## Create a store or use an existing one -You can create your own store implementing AbstractService : +You can create your own store implementing StoreService : ```java -public class MyStoreService extends AbstractService { - ... +public class MyStore extends StoreService { + public MyStore(Class clazz) { + super(clazz, new MyStoreDao()); + } + + // internal class for the DAO + private class MyStoreDao extends StoreDao { + // implements all methods of the abstract class you can need (some methods needs other to work) + } +} +``` + +## Sync your store to another one + +``` +public class MyConcreteModelStore extends MyStore { + public MyConcreteModelStore(){ + super(MyModel.class); + this.syncWith(new MemoryStore()); // eg: sync with a newly created memoryStore + // you can inject a store with dagger and syncWith() here too :) + } + + // Here you just have to implements the methods you need } ``` -### Existing implementations +## Existing implementations - Realm : https://github.com/playmoweb/store2realm