diff --git a/README.md b/README.md index 0734d1c2..f0ecc1d8 100644 --- a/README.md +++ b/README.md @@ -20,10 +20,12 @@ Pluto is distributed through [***mavenCentral***](https://central.sonatype.com/a > Note: add both the `pluto` and the `pluto-no-op` variant to isolate Pluto from release builds. ```groovy +def plutoVersion = "2.1.7" + dependencies { .... - debugImplementation 'com.plutolib:pluto:2.1.6' - releaseImplementation 'com.plutolib:pluto-no-op:2.1.6' + debugImplementation "com.plutolib:pluto:$plutoVersion" + releaseImplementation "com.plutolib:pluto-no-op:$plutoVersion" .... } ``` @@ -47,8 +49,8 @@ Plugin bundle comes with all the basic plugins bundled together as single depend ```groovy dependencies { .... - debugImplementation 'com.plutolib.plugins:bundle-core:2.1.6' - releaseImplementation 'com.plutolib.plugins:bundle-core-no-op:2.1.6' + debugImplementation "com.plutolib.plugins:bundle-core:$plutoVersion" + releaseImplementation "com.plutolib.plugins:bundle-core-no-op:$plutoVersion" .... } ``` diff --git a/pluto-plugins/plugins/datastore/README.md b/pluto-plugins/plugins/datastore/README.md index cd872ca0..8e22d0ce 100644 --- a/pluto-plugins/plugins/datastore/README.md +++ b/pluto-plugins/plugins/datastore/README.md @@ -7,8 +7,8 @@ Pluto Datastore Preferences is distributed through [***mavenCentral***](https:// > Note: add the `no-op` variant to isolate the plugin from release builds. ```groovy dependencies { - debugImplementation 'com.plutolib.plugins:datastore-pref:2.1.6' - releaseImplementation 'com.plutolib.plugins:datastore-pref-no-op:2.1.6' + debugImplementation "com.plutolib.plugins:datastore-pref:$plutoVersion" + releaseImplementation "com.plutolib.plugins:datastore-pref-no-op:$plutoVersion" } ```
diff --git a/pluto-plugins/plugins/exceptions/README.md b/pluto-plugins/plugins/exceptions/README.md index b3e7360d..0ea3999b 100644 --- a/pluto-plugins/plugins/exceptions/README.md +++ b/pluto-plugins/plugins/exceptions/README.md @@ -7,8 +7,8 @@ Pluto Exceptions is distributed through [***mavenCentral***](https://central.son > Note: add the `no-op` variant to isolate the plugin from release builds. ```groovy dependencies { - debugImplementation 'com.plutolib.plugins:exceptions:2.1.6' - releaseImplementation 'com.plutolib.plugins:exceptions-no-op:2.1.6' + debugImplementation "com.plutolib.plugins:exceptions:$plutoVersion" + releaseImplementation "com.plutolib.plugins:exceptions-no-op:$plutoVersion" } ```
diff --git a/pluto-plugins/plugins/layout-inspector/README.md b/pluto-plugins/plugins/layout-inspector/README.md index dbdf7b2b..51246ef5 100644 --- a/pluto-plugins/plugins/layout-inspector/README.md +++ b/pluto-plugins/plugins/layout-inspector/README.md @@ -7,8 +7,8 @@ Pluto Layout Inspector is distributed through [***mavenCentral***](https://centr > Note: add the `no-op` variant to isolate the plugin from release builds. ```groovy dependencies { - debugImplementation 'com.plutolib.plugins:layout-inspector:2.1.6' - releaseImplementation 'com.plutolib.plugins:layout-inspector-no-op:2.1.6' + debugImplementation "com.plutolib.plugins:layout-inspector:$plutoVersion" + releaseImplementation "com.plutolib.plugins:layout-inspector-no-op:$plutoVersion" } ```
diff --git a/pluto-plugins/plugins/logger/README.md b/pluto-plugins/plugins/logger/README.md index f53c2645..d6a5e33c 100644 --- a/pluto-plugins/plugins/logger/README.md +++ b/pluto-plugins/plugins/logger/README.md @@ -7,8 +7,8 @@ Pluto Logger is distributed through [***mavenCentral***](https://central.sonatyp > Note: add the `no-op` variant to isolate the plugin from release builds. ```groovy dependencies { - debugImplementation 'com.plutolib.plugins:logger:2.1.6' - releaseImplementation 'com.plutolib.plugins:logger-no-op:2.1.6' + debugImplementation "com.plutolib.plugins:logger:$plutoVersion" + releaseImplementation "com.plutolib.plugins:logger-no-op:$plutoVersion" } ```
diff --git a/pluto-plugins/plugins/network/README.md b/pluto-plugins/plugins/network/README.md index 4e5764c0..c13210a3 100644 --- a/pluto-plugins/plugins/network/README.md +++ b/pluto-plugins/plugins/network/README.md @@ -7,8 +7,8 @@ Pluto Network is distributed through [***mavenCentral***](https://central.sonaty > Note: add the `no-op` variant to isolate the plugin from release builds. ```groovy dependencies { - debugImplementation 'com.plutolib.plugins:network:2.1.6' - releaseImplementation 'com.plutolib.plugins:network-no-op:2.1.6' + debugImplementation "com.plutolib.plugins:network:$plutoVersion" + releaseImplementation "com.plutolib.plugins:network-no-op:$plutoVersion" } ```
@@ -23,16 +23,66 @@ Pluto.Installer(this) ```
-### Add interceptor +### Add interceptors -To debug HTTP requests/responses, plug the PlutoInterceptor in your OkHttp Client Builder +#### 1. Okhttp Interceptor +Add okhttp-interceptor dependency +```groovy +dependencies { + debugImplementation "com.plutolib.plugins:network-interceptor-okhttp:$plutoVersion" + releaseImplementation "com.plutolib.plugins:network-interceptor-okhttp-no-op:$plutoVersion" +} +``` + +Add interceptor in your OkHttp Client Builder ```kotlin val client = OkHttpClient.Builder() - .addInterceptor(PlutoInterceptor()) - .build() + addPlutoOkhttpInterceptor() + .build() ```
+#### 2. Ktor Interceptor +Add ktor-interceptor dependency +```groovy +dependencies { + debugImplementation "com.plutolib.plugins:network-interceptor-ktor:$plutoVersion" + releaseImplementation "com.plutolib.plugins:network-interceptor-ktor-no-op:$plutoVersion" +} +``` + +Add interceptor in your HttpClient +```kotlin +val client = HttpClient { +... +}.apply { + addPlutoKtorInterceptor() +} +``` +
+ +#### 3. Custom Interceptor +If you wish to use any interceptor, other than Okhttp or Ktor, Pluto provides way to capture network logs. +```kotlin +/* create interceptor */ +val networkInterceptor = NetworkInterceptor.intercept( + NetworkData.Request(....), + NetworkInterceptor.Option() +) + +/** + * wait for the network call to complete +**/ + +/* if error */ +networkInterceptor.onError(exception) + +/* if success */ +networkInterceptor.onResponse( + NetworkData.Response(....) +) +``` + 🎉  You are all done! Now re-build and run your app and open Pluto, you will see the Network plugin installed. @@ -45,13 +95,3 @@ To open Network plugin screen via code, use this Pluto.open(PlutoNetworkPlugin.ID) ```
- -### Log Custom Network traces -PlutoInterceptor works with OkHttp based interceptors, but to allow non-OkHttp based interceptors to track network calls Pluto provides utility to log network calls manually. -```kotlin -PlutoNetwork.logCustomTrace( - request = CustomRequest(), - response = CustomResponse() -) -``` -Once logged successfully, the network call trace will appear in the network call list. diff --git a/pluto-plugins/plugins/rooms-database/README.md b/pluto-plugins/plugins/rooms-database/README.md index 2c470ba3..ad1c5a42 100644 --- a/pluto-plugins/plugins/rooms-database/README.md +++ b/pluto-plugins/plugins/rooms-database/README.md @@ -7,8 +7,8 @@ Pluto Rooms Database is distributed through [***mavenCentral***](https://central > Note: add the `no-op` variant to isolate the plugin from release builds. ```groovy dependencies { - debugImplementation 'com.plutolib.plugins:rooms-db:2.1.6' - releaseImplementation 'com.plutolib.plugins:rooms-db-no-op:2.1.6' + debugImplementation "com.plutolib.plugins:rooms-db:$plutoVersion" + releaseImplementation "com.plutolib.plugins:rooms-db-no-op:$plutoVersion" } ```
diff --git a/pluto-plugins/plugins/shared-preferences/README.md b/pluto-plugins/plugins/shared-preferences/README.md index 5d384e2f..4b7bfe84 100644 --- a/pluto-plugins/plugins/shared-preferences/README.md +++ b/pluto-plugins/plugins/shared-preferences/README.md @@ -7,8 +7,8 @@ Pluto Shared Preferences is distributed through [***mavenCentral***](https://cen > Note: add the `no-op` variant to isolate the plugin from release builds. ```groovy dependencies { - debugImplementation 'com.plutolib.plugins:preferences:2.1.6' - releaseImplementation 'com.plutolib.plugins:preferences-no-op:2.1.6' + debugImplementation "com.plutolib.plugins:preferences:$plutoVersion" + releaseImplementation "com.plutolib.plugins:preferences-no-op:$plutoVersion" } ```