Skip to content

Commit 965ad79

Browse files
authored
Update README.md (#278)
1 parent d27a1fd commit 965ad79

File tree

8 files changed

+74
-32
lines changed

8 files changed

+74
-32
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ Pluto is distributed through [***mavenCentral***](https://central.sonatype.com/a
2020

2121
> Note: add both the `pluto` and the `pluto-no-op` variant to isolate Pluto from release builds.
2222
```groovy
23+
def plutoVersion = "2.1.7"
24+
2325
dependencies {
2426
....
25-
debugImplementation 'com.plutolib:pluto:2.1.6'
26-
releaseImplementation 'com.plutolib:pluto-no-op:2.1.6'
27+
debugImplementation "com.plutolib:pluto:$plutoVersion"
28+
releaseImplementation "com.plutolib:pluto-no-op:$plutoVersion"
2729
....
2830
}
2931
```
@@ -47,8 +49,8 @@ Plugin bundle comes with all the basic plugins bundled together as single depend
4749
```groovy
4850
dependencies {
4951
....
50-
debugImplementation 'com.plutolib.plugins:bundle-core:2.1.6'
51-
releaseImplementation 'com.plutolib.plugins:bundle-core-no-op:2.1.6'
52+
debugImplementation "com.plutolib.plugins:bundle-core:$plutoVersion"
53+
releaseImplementation "com.plutolib.plugins:bundle-core-no-op:$plutoVersion"
5254
....
5355
}
5456
```

pluto-plugins/plugins/datastore/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Pluto Datastore Preferences is distributed through [***mavenCentral***](https://
77
> Note: add the `no-op` variant to isolate the plugin from release builds.
88
```groovy
99
dependencies {
10-
debugImplementation 'com.plutolib.plugins:datastore-pref:2.1.6'
11-
releaseImplementation 'com.plutolib.plugins:datastore-pref-no-op:2.1.6'
10+
debugImplementation "com.plutolib.plugins:datastore-pref:$plutoVersion"
11+
releaseImplementation "com.plutolib.plugins:datastore-pref-no-op:$plutoVersion"
1212
}
1313
```
1414
<br>

pluto-plugins/plugins/exceptions/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Pluto Exceptions is distributed through [***mavenCentral***](https://central.son
77
> Note: add the `no-op` variant to isolate the plugin from release builds.
88
```groovy
99
dependencies {
10-
debugImplementation 'com.plutolib.plugins:exceptions:2.1.6'
11-
releaseImplementation 'com.plutolib.plugins:exceptions-no-op:2.1.6'
10+
debugImplementation "com.plutolib.plugins:exceptions:$plutoVersion"
11+
releaseImplementation "com.plutolib.plugins:exceptions-no-op:$plutoVersion"
1212
}
1313
```
1414
<br>

pluto-plugins/plugins/layout-inspector/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Pluto Layout Inspector is distributed through [***mavenCentral***](https://centr
77
> Note: add the `no-op` variant to isolate the plugin from release builds.
88
```groovy
99
dependencies {
10-
debugImplementation 'com.plutolib.plugins:layout-inspector:2.1.6'
11-
releaseImplementation 'com.plutolib.plugins:layout-inspector-no-op:2.1.6'
10+
debugImplementation "com.plutolib.plugins:layout-inspector:$plutoVersion"
11+
releaseImplementation "com.plutolib.plugins:layout-inspector-no-op:$plutoVersion"
1212
}
1313
```
1414
<br>

pluto-plugins/plugins/logger/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Pluto Logger is distributed through [***mavenCentral***](https://central.sonatyp
77
> Note: add the `no-op` variant to isolate the plugin from release builds.
88
```groovy
99
dependencies {
10-
debugImplementation 'com.plutolib.plugins:logger:2.1.6'
11-
releaseImplementation 'com.plutolib.plugins:logger-no-op:2.1.6'
10+
debugImplementation "com.plutolib.plugins:logger:$plutoVersion"
11+
releaseImplementation "com.plutolib.plugins:logger-no-op:$plutoVersion"
1212
}
1313
```
1414
<br>

pluto-plugins/plugins/network/README.md

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Pluto Network is distributed through [***mavenCentral***](https://central.sonaty
77
> Note: add the `no-op` variant to isolate the plugin from release builds.
88
```groovy
99
dependencies {
10-
debugImplementation 'com.plutolib.plugins:network:2.1.6'
11-
releaseImplementation 'com.plutolib.plugins:network-no-op:2.1.6'
10+
debugImplementation "com.plutolib.plugins:network:$plutoVersion"
11+
releaseImplementation "com.plutolib.plugins:network-no-op:$plutoVersion"
1212
}
1313
```
1414
<br>
@@ -23,16 +23,66 @@ Pluto.Installer(this)
2323
```
2424
<br>
2525

26-
### Add interceptor
26+
### Add interceptors
2727

28-
To debug HTTP requests/responses, plug the PlutoInterceptor in your OkHttp Client Builder
28+
#### 1. Okhttp Interceptor
29+
Add okhttp-interceptor dependency
30+
```groovy
31+
dependencies {
32+
debugImplementation "com.plutolib.plugins:network-interceptor-okhttp:$plutoVersion"
33+
releaseImplementation "com.plutolib.plugins:network-interceptor-okhttp-no-op:$plutoVersion"
34+
}
35+
```
36+
37+
Add interceptor in your OkHttp Client Builder
2938
```kotlin
3039
val client = OkHttpClient.Builder()
31-
.addInterceptor(PlutoInterceptor())
32-
.build()
40+
addPlutoOkhttpInterceptor()
41+
.build()
3342
```
3443
<br>
3544

45+
#### 2. Ktor Interceptor
46+
Add ktor-interceptor dependency
47+
```groovy
48+
dependencies {
49+
debugImplementation "com.plutolib.plugins:network-interceptor-ktor:$plutoVersion"
50+
releaseImplementation "com.plutolib.plugins:network-interceptor-ktor-no-op:$plutoVersion"
51+
}
52+
```
53+
54+
Add interceptor in your HttpClient
55+
```kotlin
56+
val client = HttpClient {
57+
...
58+
}.apply {
59+
addPlutoKtorInterceptor()
60+
}
61+
```
62+
<br>
63+
64+
#### 3. Custom Interceptor
65+
If you wish to use any interceptor, other than Okhttp or Ktor, Pluto provides way to capture network logs.
66+
```kotlin
67+
/* create interceptor */
68+
val networkInterceptor = NetworkInterceptor.intercept(
69+
NetworkData.Request(....),
70+
NetworkInterceptor.Option()
71+
)
72+
73+
/**
74+
* wait for the network call to complete
75+
**/
76+
77+
/* if error */
78+
networkInterceptor.onError(exception)
79+
80+
/* if success */
81+
networkInterceptor.onResponse(
82+
NetworkData.Response(....)
83+
)
84+
```
85+
3686
🎉 &nbsp;You are all done!
3787

3888
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
4595
Pluto.open(PlutoNetworkPlugin.ID)
4696
```
4797
<br>
48-
49-
### Log Custom Network traces
50-
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.
51-
```kotlin
52-
PlutoNetwork.logCustomTrace(
53-
request = CustomRequest(),
54-
response = CustomResponse()
55-
)
56-
```
57-
Once logged successfully, the network call trace will appear in the network call list.

pluto-plugins/plugins/rooms-database/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Pluto Rooms Database is distributed through [***mavenCentral***](https://central
77
> Note: add the `no-op` variant to isolate the plugin from release builds.
88
```groovy
99
dependencies {
10-
debugImplementation 'com.plutolib.plugins:rooms-db:2.1.6'
11-
releaseImplementation 'com.plutolib.plugins:rooms-db-no-op:2.1.6'
10+
debugImplementation "com.plutolib.plugins:rooms-db:$plutoVersion"
11+
releaseImplementation "com.plutolib.plugins:rooms-db-no-op:$plutoVersion"
1212
}
1313
```
1414
<br>

pluto-plugins/plugins/shared-preferences/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Pluto Shared Preferences is distributed through [***mavenCentral***](https://cen
77
> Note: add the `no-op` variant to isolate the plugin from release builds.
88
```groovy
99
dependencies {
10-
debugImplementation 'com.plutolib.plugins:preferences:2.1.6'
11-
releaseImplementation 'com.plutolib.plugins:preferences-no-op:2.1.6'
10+
debugImplementation "com.plutolib.plugins:preferences:$plutoVersion"
11+
releaseImplementation "com.plutolib.plugins:preferences-no-op:$plutoVersion"
1212
}
1313
```
1414
<br>

0 commit comments

Comments
 (0)