Commit 6597044b authored by Yusuke Iwaki's avatar Yusuke Iwaki

refactor

parent bc9a6641
......@@ -103,9 +103,7 @@ public class RocketChatService extends Service implements ConnectivityServiceInt
}
webSocketThreads.put(hostname, null);
return RocketChatWebSocketThread.getStarted(getApplicationContext(), hostname)
.doOnSuccess(thread -> {
webSocketThreads.put(hostname, thread);
});
.doOnSuccess(thread -> webSocketThreads.put(hostname, thread));
});
}
......
......@@ -33,8 +33,6 @@ import chat.rocket.android.service.observer.SessionObserver;
import chat.rocket.android.service.observer.TokenLoginObserver;
import hugo.weaving.DebugLog;
import rx.Single;
import rx.SingleEmitter;
import rx.functions.Action1;
/**
* Thread for handling WebSocket connection.
......@@ -266,13 +264,10 @@ public class RocketChatWebSocketThread extends HandlerThread {
@DebugLog
private Single<Boolean> connect() {
return connectDDPClient()
.flatMap(_val -> Single.fromEmitter(new Action1<SingleEmitter<Boolean>>() {
@Override
public void call(SingleEmitter<Boolean> emitter) {
fetchPublicSettings();
registerListeners();
emitter.onSuccess(true);
}
.flatMap(_val -> Single.fromEmitter(emitter -> {
fetchPublicSettings();
registerListeners();
emitter.onSuccess(true);
}));
}
......
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