mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 11:39:42 +01:00
remove comments and unused code
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
b757164c6d
commit
217ff6af74
@ -284,8 +284,6 @@ class ChatActivity :
|
|||||||
private var roomPassword: String = ""
|
private var roomPassword: String = ""
|
||||||
var credentials: String? = null
|
var credentials: String? = null
|
||||||
var currentConversation: ConversationModel? = null
|
var currentConversation: ConversationModel? = null
|
||||||
private var globalLastKnownFutureMessageId = -1
|
|
||||||
private var globalLastKnownPastMessageId = -1
|
|
||||||
var adapter: TalkMessagesListAdapter<ChatMessage>? = null
|
var adapter: TalkMessagesListAdapter<ChatMessage>? = null
|
||||||
var mentionAutocomplete: Autocomplete<*>? = null
|
var mentionAutocomplete: Autocomplete<*>? = null
|
||||||
var layoutManager: LinearLayoutManager? = null
|
var layoutManager: LinearLayoutManager? = null
|
||||||
@ -295,7 +293,6 @@ class ChatActivity :
|
|||||||
var startCallFromRoomSwitch: Boolean = false
|
var startCallFromRoomSwitch: Boolean = false
|
||||||
lateinit var roomId: String
|
lateinit var roomId: String
|
||||||
var voiceOnly: Boolean = true
|
var voiceOnly: Boolean = true
|
||||||
var isFirstMessagesProcessing = true
|
|
||||||
private lateinit var path: String
|
private lateinit var path: String
|
||||||
|
|
||||||
var myFirstMessage: CharSequence? = null
|
var myFirstMessage: CharSequence? = null
|
||||||
@ -594,12 +591,6 @@ class ChatActivity :
|
|||||||
binding.chatToolbar.setOnClickListener { _ -> showConversationInfoScreen() }
|
binding.chatToolbar.setOnClickListener { _ -> showConversationInfoScreen() }
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (adapter == null) {
|
|
||||||
// initAdapter()
|
|
||||||
// binding.messagesListView.setAdapter(adapter)
|
|
||||||
// layoutManager = binding.messagesListView.layoutManager as LinearLayoutManager?
|
|
||||||
// }
|
|
||||||
|
|
||||||
loadAvatarForStatusBar()
|
loadAvatarForStatusBar()
|
||||||
setupSwipeToReply()
|
setupSwipeToReply()
|
||||||
setActionBarTitle()
|
setActionBarTitle()
|
||||||
@ -611,12 +602,6 @@ class ChatActivity :
|
|||||||
withCredentials = credentials!!,
|
withCredentials = credentials!!,
|
||||||
withUrl = urlForChatting,
|
withUrl = urlForChatting,
|
||||||
)
|
)
|
||||||
|
|
||||||
// chatViewModel.initMessagePolling(
|
|
||||||
// withCredentials = credentials!!,
|
|
||||||
// withUrl = urlForChatting,
|
|
||||||
// roomToken = currentConversation!!.token!!
|
|
||||||
// )
|
|
||||||
}
|
}
|
||||||
|
|
||||||
is ChatViewModel.GetCapabilitiesErrorState -> {
|
is ChatViewModel.GetCapabilitiesErrorState -> {
|
||||||
@ -2085,10 +2070,6 @@ class ChatActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun hasGrantedPermissions(grantResults: IntArray): Boolean {
|
|
||||||
return permissionUtil.isFilesPermissionGranted()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
|
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
|
||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||||
if (requestCode == UploadAndShareFilesWorker.REQUEST_PERMISSION) {
|
if (requestCode == UploadAndShareFilesWorker.REQUEST_PERMISSION) {
|
||||||
@ -2452,56 +2433,6 @@ class ChatActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupFieldsForPullChatMessages(
|
|
||||||
lookIntoFuture: Boolean,
|
|
||||||
xChatLastCommonRead: Int?,
|
|
||||||
setReadMarker: Boolean
|
|
||||||
): HashMap<String, Int> {
|
|
||||||
val fieldMap = HashMap<String, Int>()
|
|
||||||
fieldMap["includeLastKnown"] = 0
|
|
||||||
|
|
||||||
if (!lookIntoFuture && isFirstMessagesProcessing) {
|
|
||||||
if (currentConversation != null) {
|
|
||||||
globalLastKnownFutureMessageId = currentConversation!!.lastReadMessage
|
|
||||||
globalLastKnownPastMessageId = currentConversation!!.lastReadMessage
|
|
||||||
fieldMap["includeLastKnown"] = 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val lastKnown = if (lookIntoFuture) {
|
|
||||||
globalLastKnownFutureMessageId
|
|
||||||
} else {
|
|
||||||
globalLastKnownPastMessageId
|
|
||||||
}
|
|
||||||
|
|
||||||
fieldMap["lastKnownMessageId"] = lastKnown
|
|
||||||
xChatLastCommonRead?.let {
|
|
||||||
fieldMap["lastCommonReadId"] = it
|
|
||||||
}
|
|
||||||
|
|
||||||
val timeout = if (lookIntoFuture) {
|
|
||||||
LOOKING_INTO_FUTURE_TIMEOUT
|
|
||||||
} else {
|
|
||||||
0
|
|
||||||
}
|
|
||||||
|
|
||||||
fieldMap["timeout"] = timeout
|
|
||||||
fieldMap["limit"] = MESSAGE_PULL_LIMIT
|
|
||||||
|
|
||||||
if (lookIntoFuture) {
|
|
||||||
fieldMap["lookIntoFuture"] = 1
|
|
||||||
} else {
|
|
||||||
fieldMap["lookIntoFuture"] = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
if (setReadMarker) {
|
|
||||||
fieldMap["setReadMarker"] = 1
|
|
||||||
} else {
|
|
||||||
fieldMap["setReadMarker"] = 0
|
|
||||||
}
|
|
||||||
return fieldMap
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun processExpiredMessages() {
|
private fun processExpiredMessages() {
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
fun deleteExpiredMessages() {
|
fun deleteExpiredMessages() {
|
||||||
@ -2674,29 +2605,6 @@ class ChatActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun processHeaderChatLastGiven(response: Response<*>, isFromTheFuture: Boolean) {
|
|
||||||
val xChatLastGivenHeader: String? = response.headers()["X-Chat-Last-Given"]
|
|
||||||
|
|
||||||
val header = if (response.headers().size > 0 &&
|
|
||||||
xChatLastGivenHeader?.isNotEmpty() == true
|
|
||||||
) {
|
|
||||||
xChatLastGivenHeader.toInt()
|
|
||||||
} else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (header > 0) {
|
|
||||||
if (isFromTheFuture) {
|
|
||||||
globalLastKnownFutureMessageId = header
|
|
||||||
} else {
|
|
||||||
if (globalLastKnownFutureMessageId == -1) {
|
|
||||||
globalLastKnownFutureMessageId = header
|
|
||||||
}
|
|
||||||
globalLastKnownPastMessageId = header
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this method must be called after that the adatper has finished loading ChatMessages items
|
* this method must be called after that the adatper has finished loading ChatMessages items
|
||||||
* it searches by ID the message that was playing,
|
* it searches by ID the message that was playing,
|
||||||
|
Loading…
Reference in New Issue
Block a user