mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 11:39:42 +01:00
figured it out - was an error with offline conversations not syncing. Chat permissions were updated on server, but not on device.
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com> Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
f0d7ff53c6
commit
19aec5460a
@ -676,7 +676,7 @@ class ChatActivity :
|
||||
}
|
||||
}
|
||||
|
||||
updateRoomTimerHandler()
|
||||
updateRoomTimerHandler(MILLIS_250)
|
||||
|
||||
val urlForChatting =
|
||||
ApiUtils.getUrlForChat(chatApiVersion, conversationUser?.baseUrl, roomToken)
|
||||
@ -1614,7 +1614,7 @@ class ChatActivity :
|
||||
currentConversation?.type != null &&
|
||||
currentConversation?.type == ConversationEnums.ConversationType.ROOM_PUBLIC_CALL
|
||||
|
||||
private fun updateRoomTimerHandler() {
|
||||
private fun updateRoomTimerHandler(delay: Long = -1) {
|
||||
val delayForRecursiveCall = if (shouldShowLobby()) {
|
||||
GET_ROOM_INFO_DELAY_LOBBY
|
||||
} else {
|
||||
@ -1628,7 +1628,7 @@ class ChatActivity :
|
||||
{
|
||||
chatViewModel.getRoom(roomToken)
|
||||
},
|
||||
delayForRecursiveCall
|
||||
if (delay > 0) delay else delayForRecursiveCall
|
||||
)
|
||||
}
|
||||
|
||||
@ -1722,7 +1722,7 @@ class ChatActivity :
|
||||
val curMsg = adapter?.items?.getOrNull(index - i)?.item
|
||||
if (curMsg is ChatMessage) {
|
||||
if (nextMessage == null && i > 0) {
|
||||
nextMessage = curMsg as ChatMessage
|
||||
nextMessage = curMsg
|
||||
}
|
||||
|
||||
if (curMsg.isVoiceMessage) {
|
||||
@ -1733,7 +1733,7 @@ class ChatActivity :
|
||||
val filename = curMsg.selectedIndividualHashMap!!["name"]
|
||||
val file = File(context.cacheDir, filename!!)
|
||||
if (!file.exists()) {
|
||||
downloadFileToCache(curMsg as ChatMessage, false) {
|
||||
downloadFileToCache(curMsg, false) {
|
||||
curMsg.isDownloadingVoiceMessage = false
|
||||
curMsg.voiceMessageDuration = try {
|
||||
val retriever = MediaMetadataRetriever()
|
||||
@ -2168,9 +2168,18 @@ class ChatActivity :
|
||||
|
||||
private fun checkLobbyState() {
|
||||
if (currentConversation != null &&
|
||||
ConversationUtils.isLobbyViewApplicable(currentConversation!!, spreedCapabilities)
|
||||
ConversationUtils.isLobbyViewApplicable(currentConversation!!, spreedCapabilities) &&
|
||||
shouldShowLobby()
|
||||
) {
|
||||
if (shouldShowLobby()) {
|
||||
showLobbyView()
|
||||
} else {
|
||||
binding.lobby.lobbyView.visibility = View.GONE
|
||||
binding.messagesListView.visibility = View.VISIBLE
|
||||
checkShowMessageInputView()
|
||||
}
|
||||
}
|
||||
|
||||
private fun showLobbyView() {
|
||||
binding.lobby.lobbyView.visibility = View.VISIBLE
|
||||
binding.messagesListView.visibility = View.GONE
|
||||
binding.fragmentContainerActivityChat.visibility = View.GONE
|
||||
@ -2197,16 +2206,6 @@ class ChatActivity :
|
||||
|
||||
sb.append(currentConversation!!.description)
|
||||
binding.lobby.lobbyTextView.text = sb.toString()
|
||||
} else {
|
||||
binding.lobby.lobbyView.visibility = View.GONE
|
||||
binding.messagesListView.visibility = View.VISIBLE
|
||||
checkShowMessageInputView()
|
||||
}
|
||||
} else {
|
||||
binding.lobby.lobbyView.visibility = View.GONE
|
||||
binding.messagesListView.visibility = View.VISIBLE
|
||||
checkShowMessageInputView()
|
||||
}
|
||||
}
|
||||
|
||||
private fun onRemoteFileBrowsingResult(intent: Intent?) {
|
||||
@ -4028,6 +4027,7 @@ class ChatActivity :
|
||||
private const val UNREAD_MESSAGES_MARKER_ID = -1
|
||||
private const val GET_ROOM_INFO_DELAY_NORMAL: Long = 30000
|
||||
private const val GET_ROOM_INFO_DELAY_LOBBY: Long = 5000
|
||||
private const val MILLIS_250 = 250L
|
||||
private const val AGE_THRESHOLD_FOR_DELETE_MESSAGE: Int = 21600000 // (6 hours in millis = 6 * 3600 * 1000)
|
||||
private const val REQUEST_SHARE_FILE_PERMISSION: Int = 221
|
||||
private const val REQUEST_RECORD_AUDIO_PERMISSION = 222
|
||||
|
@ -69,11 +69,6 @@ class OfflineFirstConversationsRepository @Inject constructor(
|
||||
|
||||
override fun getRoom(roomToken: String): Job =
|
||||
scope.launch {
|
||||
val id = user.id!!
|
||||
val model = getConversation(id, roomToken)
|
||||
if (model != null) {
|
||||
_conversationFlow.emit(model)
|
||||
} else {
|
||||
chatNetworkDataSource.getRoom(user, roomToken)
|
||||
.subscribeOn(Schedulers.io())
|
||||
?.observeOn(AndroidSchedulers.mainThread())
|
||||
@ -83,7 +78,16 @@ class OfflineFirstConversationsRepository @Inject constructor(
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
// unused atm
|
||||
runBlocking {
|
||||
// In case network is offline or call fails
|
||||
val id = user.id!!
|
||||
val model = getConversation(id, roomToken)
|
||||
if (model != null) {
|
||||
_conversationFlow.emit(model)
|
||||
} else {
|
||||
Log.e(TAG, "Conversation model not found on device database")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onComplete() {
|
||||
@ -99,7 +103,6 @@ class OfflineFirstConversationsRepository @Inject constructor(
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("Detekt.TooGenericExceptionCaught")
|
||||
private suspend fun getRoomsFromServer(): List<ConversationEntity>? {
|
||||
|
Loading…
Reference in New Issue
Block a user