Unverified Commit 516f941d authored by Pancor's avatar Pancor Committed by GitHub

add support for muliserver

parent 1a0398f7
......@@ -49,8 +49,7 @@ class ChatRoomPresenter @Inject constructor(private val view: ChatRoomView,
private val roomsRepository: RoomRepository,
private val localRepository: LocalRepository,
factory: ConnectionManagerFactory,
private val mapper: ViewModelMapper,
private val localRepository: LocalRepository) {
private val mapper: ViewModelMapper) {
private val currentServer = serverInteractor.get()!!
private val manager = factory.create(currentServer)
private val client = manager.client
......@@ -563,7 +562,7 @@ class ChatRoomPresenter @Inject constructor(private val view: ChatRoomView,
* @param unfinishedMessage The unfinished message to save.
*/
fun saveUnfinishedMessage(chatRoomId: String, unfinishedMessage: String) {
val key = LocalRepository.UNFINISHED_MSG_KEY + chatRoomId
val key = "${currentServer}_${LocalRepository.UNFINISHED_MSG_KEY}$chatRoomId"
if (unfinishedMessage.isNotBlank()) {
localRepository.save(key, unfinishedMessage)
} else {
......@@ -580,7 +579,7 @@ class ChatRoomPresenter @Inject constructor(private val view: ChatRoomView,
* @return Returns the unfinished message.
*/
fun getUnfinishedMessage(chatRoomId: String): String {
val key = LocalRepository.UNFINISHED_MSG_KEY + chatRoomId
val key = "${currentServer}_${LocalRepository.UNFINISHED_MSG_KEY}$chatRoomId"
return localRepository.get(key) ?: ""
}
}
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