Commit 645a32f3 authored by Leonardo Aramaki's avatar Leonardo Aramaki

Call keep alive only if not succeded and cap room messages fetch count to 50 instead of 100

parent 1a43611e
...@@ -77,7 +77,7 @@ public class RoomPresenter extends BasePresenter<RoomContract.View> ...@@ -77,7 +77,7 @@ public class RoomPresenter extends BasePresenter<RoomContract.View>
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe( .subscribe(
success -> { success -> {
if (success) { if (!success) {
connectivityManagerApi.keepAliveServer(); connectivityManagerApi.keepAliveServer();
} }
}, },
...@@ -89,14 +89,13 @@ public class RoomPresenter extends BasePresenter<RoomContract.View> ...@@ -89,14 +89,13 @@ public class RoomPresenter extends BasePresenter<RoomContract.View>
@Override @Override
public void loadMoreMessages() { public void loadMoreMessages() {
final Disposable subscription = getSingleRoom() final Disposable subscription = getSingleRoom()
.flatMap(messageInteractor::loadMoreMessages) .flatMap(messageInteractor::loadMoreMessages)
.subscribeOn(AndroidSchedulers.from(BackgroundLooper.get())) .subscribeOn(AndroidSchedulers.from(BackgroundLooper.get()))
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe( .subscribe(
success -> { success -> {
if (success) { if (!success) {
connectivityManagerApi.keepAliveServer(); connectivityManagerApi.keepAliveServer();
} }
}, },
......
...@@ -19,7 +19,7 @@ class MessageInteractor(private val messageRepository: MessageRepository, ...@@ -19,7 +19,7 @@ class MessageInteractor(private val messageRepository: MessageRepository,
val roomHistoryState = RoomHistoryState.builder() val roomHistoryState = RoomHistoryState.builder()
.setRoomId(room.roomId) .setRoomId(room.roomId)
.setSyncState(SyncState.NOT_SYNCED) .setSyncState(SyncState.NOT_SYNCED)
.setCount(100) .setCount(50)
.setReset(true) .setReset(true)
.setComplete(false) .setComplete(false)
.setTimestamp(0) .setTimestamp(0)
......
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