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 =
|
val urlForChatting =
|
||||||
ApiUtils.getUrlForChat(chatApiVersion, conversationUser?.baseUrl, roomToken)
|
ApiUtils.getUrlForChat(chatApiVersion, conversationUser?.baseUrl, roomToken)
|
||||||
@ -1614,7 +1614,7 @@ class ChatActivity :
|
|||||||
currentConversation?.type != null &&
|
currentConversation?.type != null &&
|
||||||
currentConversation?.type == ConversationEnums.ConversationType.ROOM_PUBLIC_CALL
|
currentConversation?.type == ConversationEnums.ConversationType.ROOM_PUBLIC_CALL
|
||||||
|
|
||||||
private fun updateRoomTimerHandler() {
|
private fun updateRoomTimerHandler(delay: Long = -1) {
|
||||||
val delayForRecursiveCall = if (shouldShowLobby()) {
|
val delayForRecursiveCall = if (shouldShowLobby()) {
|
||||||
GET_ROOM_INFO_DELAY_LOBBY
|
GET_ROOM_INFO_DELAY_LOBBY
|
||||||
} else {
|
} else {
|
||||||
@ -1628,7 +1628,7 @@ class ChatActivity :
|
|||||||
{
|
{
|
||||||
chatViewModel.getRoom(roomToken)
|
chatViewModel.getRoom(roomToken)
|
||||||
},
|
},
|
||||||
delayForRecursiveCall
|
if (delay > 0) delay else delayForRecursiveCall
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1722,7 +1722,7 @@ class ChatActivity :
|
|||||||
val curMsg = adapter?.items?.getOrNull(index - i)?.item
|
val curMsg = adapter?.items?.getOrNull(index - i)?.item
|
||||||
if (curMsg is ChatMessage) {
|
if (curMsg is ChatMessage) {
|
||||||
if (nextMessage == null && i > 0) {
|
if (nextMessage == null && i > 0) {
|
||||||
nextMessage = curMsg as ChatMessage
|
nextMessage = curMsg
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curMsg.isVoiceMessage) {
|
if (curMsg.isVoiceMessage) {
|
||||||
@ -1733,7 +1733,7 @@ class ChatActivity :
|
|||||||
val filename = curMsg.selectedIndividualHashMap!!["name"]
|
val filename = curMsg.selectedIndividualHashMap!!["name"]
|
||||||
val file = File(context.cacheDir, filename!!)
|
val file = File(context.cacheDir, filename!!)
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
downloadFileToCache(curMsg as ChatMessage, false) {
|
downloadFileToCache(curMsg, false) {
|
||||||
curMsg.isDownloadingVoiceMessage = false
|
curMsg.isDownloadingVoiceMessage = false
|
||||||
curMsg.voiceMessageDuration = try {
|
curMsg.voiceMessageDuration = try {
|
||||||
val retriever = MediaMetadataRetriever()
|
val retriever = MediaMetadataRetriever()
|
||||||
@ -2168,40 +2168,10 @@ class ChatActivity :
|
|||||||
|
|
||||||
private fun checkLobbyState() {
|
private fun checkLobbyState() {
|
||||||
if (currentConversation != null &&
|
if (currentConversation != null &&
|
||||||
ConversationUtils.isLobbyViewApplicable(currentConversation!!, spreedCapabilities)
|
ConversationUtils.isLobbyViewApplicable(currentConversation!!, spreedCapabilities) &&
|
||||||
|
shouldShowLobby()
|
||||||
) {
|
) {
|
||||||
if (shouldShowLobby()) {
|
showLobbyView()
|
||||||
binding.lobby.lobbyView.visibility = View.VISIBLE
|
|
||||||
binding.messagesListView.visibility = View.GONE
|
|
||||||
binding.fragmentContainerActivityChat.visibility = View.GONE
|
|
||||||
binding.progressBar.visibility = View.GONE
|
|
||||||
|
|
||||||
val sb = StringBuilder()
|
|
||||||
sb.append(resources!!.getText(R.string.nc_lobby_waiting))
|
|
||||||
.append("\n\n")
|
|
||||||
|
|
||||||
if (currentConversation?.lobbyTimer != null &&
|
|
||||||
currentConversation?.lobbyTimer !=
|
|
||||||
0L
|
|
||||||
) {
|
|
||||||
val timestampMS = (currentConversation?.lobbyTimer ?: 0) * DateConstants.SECOND_DIVIDER
|
|
||||||
val stringWithStartDate = String.format(
|
|
||||||
resources!!.getString(R.string.nc_lobby_start_date),
|
|
||||||
dateUtils.getLocalDateTimeStringFromTimestamp(timestampMS)
|
|
||||||
)
|
|
||||||
val relativeTime = dateUtils.relativeStartTimeForLobby(timestampMS, resources!!)
|
|
||||||
|
|
||||||
sb.append("$stringWithStartDate - $relativeTime")
|
|
||||||
.append("\n\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
sb.append(currentConversation!!.description)
|
|
||||||
binding.lobby.lobbyTextView.text = sb.toString()
|
|
||||||
} else {
|
|
||||||
binding.lobby.lobbyView.visibility = View.GONE
|
|
||||||
binding.messagesListView.visibility = View.VISIBLE
|
|
||||||
checkShowMessageInputView()
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
binding.lobby.lobbyView.visibility = View.GONE
|
binding.lobby.lobbyView.visibility = View.GONE
|
||||||
binding.messagesListView.visibility = View.VISIBLE
|
binding.messagesListView.visibility = View.VISIBLE
|
||||||
@ -2209,6 +2179,35 @@ class ChatActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun showLobbyView() {
|
||||||
|
binding.lobby.lobbyView.visibility = View.VISIBLE
|
||||||
|
binding.messagesListView.visibility = View.GONE
|
||||||
|
binding.fragmentContainerActivityChat.visibility = View.GONE
|
||||||
|
binding.progressBar.visibility = View.GONE
|
||||||
|
|
||||||
|
val sb = StringBuilder()
|
||||||
|
sb.append(resources!!.getText(R.string.nc_lobby_waiting))
|
||||||
|
.append("\n\n")
|
||||||
|
|
||||||
|
if (currentConversation?.lobbyTimer != null &&
|
||||||
|
currentConversation?.lobbyTimer !=
|
||||||
|
0L
|
||||||
|
) {
|
||||||
|
val timestampMS = (currentConversation?.lobbyTimer ?: 0) * DateConstants.SECOND_DIVIDER
|
||||||
|
val stringWithStartDate = String.format(
|
||||||
|
resources!!.getString(R.string.nc_lobby_start_date),
|
||||||
|
dateUtils.getLocalDateTimeStringFromTimestamp(timestampMS)
|
||||||
|
)
|
||||||
|
val relativeTime = dateUtils.relativeStartTimeForLobby(timestampMS, resources!!)
|
||||||
|
|
||||||
|
sb.append("$stringWithStartDate - $relativeTime")
|
||||||
|
.append("\n\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.append(currentConversation!!.description)
|
||||||
|
binding.lobby.lobbyTextView.text = sb.toString()
|
||||||
|
}
|
||||||
|
|
||||||
private fun onRemoteFileBrowsingResult(intent: Intent?) {
|
private fun onRemoteFileBrowsingResult(intent: Intent?) {
|
||||||
val pathList = intent?.getStringArrayListExtra(RemoteFileBrowserActivity.EXTRA_SELECTED_PATHS)
|
val pathList = intent?.getStringArrayListExtra(RemoteFileBrowserActivity.EXTRA_SELECTED_PATHS)
|
||||||
if (pathList?.size!! >= 1) {
|
if (pathList?.size!! >= 1) {
|
||||||
@ -4028,6 +4027,7 @@ class ChatActivity :
|
|||||||
private const val UNREAD_MESSAGES_MARKER_ID = -1
|
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_NORMAL: Long = 30000
|
||||||
private const val GET_ROOM_INFO_DELAY_LOBBY: Long = 5000
|
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 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_SHARE_FILE_PERMISSION: Int = 221
|
||||||
private const val REQUEST_RECORD_AUDIO_PERMISSION = 222
|
private const val REQUEST_RECORD_AUDIO_PERMISSION = 222
|
||||||
|
@ -69,36 +69,39 @@ class OfflineFirstConversationsRepository @Inject constructor(
|
|||||||
|
|
||||||
override fun getRoom(roomToken: String): Job =
|
override fun getRoom(roomToken: String): Job =
|
||||||
scope.launch {
|
scope.launch {
|
||||||
val id = user.id!!
|
chatNetworkDataSource.getRoom(user, roomToken)
|
||||||
val model = getConversation(id, roomToken)
|
.subscribeOn(Schedulers.io())
|
||||||
if (model != null) {
|
?.observeOn(AndroidSchedulers.mainThread())
|
||||||
_conversationFlow.emit(model)
|
?.subscribe(object : Observer<ConversationModel> {
|
||||||
} else {
|
override fun onSubscribe(p0: Disposable) {
|
||||||
chatNetworkDataSource.getRoom(user, roomToken)
|
// unused atm
|
||||||
.subscribeOn(Schedulers.io())
|
}
|
||||||
?.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
?.subscribe(object : Observer<ConversationModel> {
|
|
||||||
override fun onSubscribe(p0: Disposable) {
|
|
||||||
// unused atm
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onError(e: Throwable) {
|
override fun onError(e: Throwable) {
|
||||||
// unused atm
|
runBlocking {
|
||||||
}
|
// In case network is offline or call fails
|
||||||
|
val id = user.id!!
|
||||||
override fun onComplete() {
|
val model = getConversation(id, roomToken)
|
||||||
// unused atm
|
if (model != null) {
|
||||||
}
|
|
||||||
|
|
||||||
override fun onNext(model: ConversationModel) {
|
|
||||||
runBlocking {
|
|
||||||
_conversationFlow.emit(model)
|
_conversationFlow.emit(model)
|
||||||
val entityList = listOf(model.asEntity())
|
} else {
|
||||||
dao.upsertConversations(entityList)
|
Log.e(TAG, "Conversation model not found on device database")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
}
|
|
||||||
|
override fun onComplete() {
|
||||||
|
// unused atm
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNext(model: ConversationModel) {
|
||||||
|
runBlocking {
|
||||||
|
_conversationFlow.emit(model)
|
||||||
|
val entityList = listOf(model.asEntity())
|
||||||
|
dao.upsertConversations(entityList)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("Detekt.TooGenericExceptionCaught")
|
@Suppress("Detekt.TooGenericExceptionCaught")
|
||||||
|
Loading…
Reference in New Issue
Block a user