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

refactor

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