Skip to content

Commit

Permalink
添加请求提交数据打印
Browse files Browse the repository at this point in the history
  • Loading branch information
sunxudong committed Jun 18, 2020
1 parent ffcdebe commit 986e659
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
9 changes: 6 additions & 3 deletions app/src/main/java/org/sheedon/demo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ protected void onCreate(Bundle savedInstanceState) {
.build();




Call call = client.newCall(request);
Observable observable = client.newObservable(request);
observable.subscribe(new Callback<Response>() {
Expand Down Expand Up @@ -76,6 +74,11 @@ public void onResponse(Response response) {

@Override
public void onCallback(ResponseBody data) {
Log.v("SXD",data.toString());
Log.v("SXD", data.toString());
}

@Override
public void onRequest(String message) {
Log.v("SXD", message);
}
}
4 changes: 2 additions & 2 deletions serial/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
defaultConfig {
minSdkVersion 15
targetSdkVersion 28
versionCode 12
versionName "1.2.8"
versionCode 13
versionName "1.2.9"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
Expand Down
1 change: 1 addition & 0 deletions serial/src/main/java/org/sheedon/serial/RealCall.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ protected void execute() {
}

boolean isSuccess = serialClient.port.sendMessage(data);
serialClient.onRequest(data);

if (!isSuccess) {
client.dispatcher().finishedByLocal(id(), new IllegalStateException("publish is failure"));
Expand Down
7 changes: 7 additions & 0 deletions serial/src/main/java/org/sheedon/serial/SerialClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ public void onCallback(ResponseBody data) {
callback.onCallback(data);
}

@Override
public void onRequest(String message) {
if (callback == null)
return;
callback.onRequest(message);
}

/**
* 获取调度器
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ public interface SerialRealCallback {

void onCallback(ResponseBody data);

void onRequest(String message);

}

0 comments on commit 986e659

Please sign in to comment.