mirror of
https://github.com/nextcloud/talk-android
synced 2025-01-18 05:01:28 +00:00
Merge pull request #4567 from nextcloud/issue-4454-fix-msg-input-fragment-join-open-convo
Fixed bug that hides message input upon joining open conversations
This commit is contained in:
commit
f39b1ddc19
@ -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,40 +2168,10 @@ class ChatActivity :
|
||||
|
||||
private fun checkLobbyState() {
|
||||
if (currentConversation != null &&
|
||||
ConversationUtils.isLobbyViewApplicable(currentConversation!!, spreedCapabilities)
|
||||
ConversationUtils.isLobbyViewApplicable(currentConversation!!, spreedCapabilities) &&
|
||||
shouldShowLobby()
|
||||
) {
|
||||
if (shouldShowLobby()) {
|
||||
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()
|
||||
}
|
||||
showLobbyView()
|
||||
} else {
|
||||
binding.lobby.lobbyView.visibility = View.GONE
|
||||
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?) {
|
||||
val pathList = intent?.getStringArrayListExtra(RemoteFileBrowserActivity.EXTRA_SELECTED_PATHS)
|
||||
if (pathList?.size!! >= 1) {
|
||||
@ -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,36 +69,39 @@ 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())
|
||||
?.subscribe(object : Observer<ConversationModel> {
|
||||
override fun onSubscribe(p0: Disposable) {
|
||||
// unused atm
|
||||
}
|
||||
chatNetworkDataSource.getRoom(user, roomToken)
|
||||
.subscribeOn(Schedulers.io())
|
||||
?.observeOn(AndroidSchedulers.mainThread())
|
||||
?.subscribe(object : Observer<ConversationModel> {
|
||||
override fun onSubscribe(p0: Disposable) {
|
||||
// unused atm
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
// unused atm
|
||||
}
|
||||
|
||||
override fun onComplete() {
|
||||
// unused atm
|
||||
}
|
||||
|
||||
override fun onNext(model: ConversationModel) {
|
||||
runBlocking {
|
||||
override fun onError(e: Throwable) {
|
||||
runBlocking {
|
||||
// In case network is offline or call fails
|
||||
val id = user.id!!
|
||||
val model = getConversation(id, roomToken)
|
||||
if (model != null) {
|
||||
_conversationFlow.emit(model)
|
||||
val entityList = listOf(model.asEntity())
|
||||
dao.upsertConversations(entityList)
|
||||
} else {
|
||||
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")
|
||||
|
Loading…
Reference in New Issue
Block a user