Commit bf1b3988 authored by sheteng's avatar sheteng

链接重新链接发消息逻辑

parent 02d6dcc9
......@@ -67,7 +67,6 @@ public class FirstFragment extends Fragment {
CCIMClient.getInstance().registerMessageListener(new OnPushMsgListener() {
@Override
public void pushPrivateMsg(MessageContent msg) {
......
......@@ -47,7 +47,6 @@ public class LoginActivity extends AppCompatActivity {
}
});
loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
......
......@@ -14,7 +14,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Username"
android:text="18"
android:text="19"
android:inputType="textEmailAddress"
android:selectAllOnFocus="true"
app:layout_constraintEnd_toEndOf="parent"
......@@ -27,7 +27,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:hint="UserId"
android:text="18"
android:text="19"
android:imeActionLabel="@string/action_sign_in_short"
android:imeOptions="actionDone"
android:selectAllOnFocus="true"
......
......@@ -10,8 +10,8 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
versionCode 3
versionName "1.0.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
......
......@@ -108,7 +108,7 @@ public class CCIMClient {
@Override
public void onFailed(int errorCode) {
resultCallback.onSocketDisconnection(errorCode);
}
});
}
......
......@@ -85,7 +85,7 @@ public class SocketManager {
@Override
public void onServerDisConnect(int code) {
if (code == ErrorCode.NET_ERROR){
if (code == ErrorCode.NET_ERROR) {
onConnectListener.onSocketDisconnection(code);
} else {
onConnectListener.onSocketReConnection();
......@@ -155,9 +155,7 @@ public class SocketManager {
Common.RequestMessageHeader header = Common.RequestMessageHeader.newBuilder().setVersion(version).setSeq(idPlus).build();
reqBuilder.setHeader(header);
logger.info(reqBuilder.build().toString());
if (socketClient.isActive()) {
socketClient.sendMsg(reqBuilder.build());
}
return idPlus;
}
......
......@@ -115,9 +115,8 @@ public class NettyChatClient implements SocketClient {
return;
}
executor.execute(() -> {
if (channelFuture.channel().isActive()) {
channelFuture.channel().writeAndFlush(msg);
} else {
if (!channelFuture.channel().isActive()) {
connect();
}
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment