Observable < ChatResult > synchroniseConversation ( String conversationId ) { return checkState ( ) . flatMap ( client -> client . service ( ) . messaging ( ) . queryMessages ( conversationId , null , 1 ) . map ( result -> { if ( result . isSuccessful ( ) && result . getResult ( ) != null ) { return ( long ) result . getResult ( ) . getLatestEventId ( ) ; } return - 1L ; } ) . flatMap ( result -> persistenceController . getConversation ( conversationId ) . map ( loaded -> compare ( result , loaded ) ) ) . flatMap ( this :: updateLocalConversationList ) . flatMap ( result -> lookForMissingEvents ( client , result ) ) . map ( result -> new ChatResult ( result . isSuccessful , null ) ) ) ; }
Updates single conversation state .