diff --git a/README.md b/README.md index cb1c8c5..62b5d9d 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Wasp aims : ###Add dependency ```groovy -compile 'com.orhanobut:wasp:1.10' +compile 'com.orhanobut:wasp:1.12' ``` ####Create a service interface @@ -36,7 +36,7 @@ compile 'com.orhanobut:wasp:1.10' public interface GitHubService { @GET("/repos/{user}/{repo}") - void fetchRepo( + void getRepo( @Path("user") String user, @Path("repo") String repo, Callback callback @@ -202,6 +202,42 @@ Use @Field annotation to provide key-value pairs }) ``` +##### Request cancel +Use WaspRequest as return type and take the advantage of features such as cancel. +```java + + @GET("/repos/{user}/{repo}") + WaspRequest getRepo( + @Path("user") String user, + @Path("repo") String repo, + Callback callback + ); + + + WaspRequest request = service.getRepo(); + request.cancel(); +``` + +for multiple request, use the request manager to cancel all request at once +```java +private final RequestManager requestManager = new SimpleRequestManager(); + +public void onRefreshData(){ + WaspRequest request = service.getData(); + requestManager.addRequest(request); +} + +public void onAnotherNetworkCall() { + WaspRequest request = service.getFoo(); + requestManager.addRequest(request); +} + +public void onDestroy(){ + requestManager.cancelAll(); +} + +``` + ##### Request Interceptor You can intercept each request and add some additional information. You can either implement RequestInterceptor interface or use the SimpleInterceptor class. Use SimpleInterceptor if you don't need to implement each feature. diff --git a/gradle.properties b/gradle.properties index a5abaa6..d722e95 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,8 +19,8 @@ # VERSION_NAME=1.7-SNAPSHOT # VERSION_CODE=8 -VERSION_NAME=1.10 -VERSION_CODE=11 +VERSION_NAME=1.11 +VERSION_CODE=12 GROUP=com.orhanobut POM_DESCRIPTION=Android Network Solution