mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-04-25 22:08:38 +00:00
Added logs & small fixes
This commit is contained in:
parent
6645d579a2
commit
c6b7ed0ef3
4 changed files with 18 additions and 6 deletions
|
|
@ -46,6 +46,9 @@ class FileModel @AnyThread constructor(
|
||||||
mimeType = FileUtils.getMimeType(mime)
|
mimeType = FileUtils.getMimeType(mime)
|
||||||
isImage = mimeType == FileUtils.MimeType.Image
|
isImage = mimeType == FileUtils.MimeType.Image
|
||||||
isVideoPreview = mimeType == FileUtils.MimeType.Video
|
isVideoPreview = mimeType == FileUtils.MimeType.Video
|
||||||
|
Log.d(
|
||||||
|
"$TAG File has already been downloaded, extension is [$extension], MIME is [$mime]"
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
mimeType = FileUtils.MimeType.Unknown
|
mimeType = FileUtils.MimeType.Unknown
|
||||||
isPdf = false
|
isPdf = false
|
||||||
|
|
|
||||||
|
|
@ -166,10 +166,12 @@ class MessageModel @WorkerThread constructor(
|
||||||
override fun onMsgStateChanged(message: ChatMessage, messageState: ChatMessage.State?) {
|
override fun onMsgStateChanged(message: ChatMessage, messageState: ChatMessage.State?) {
|
||||||
statusIcon.postValue(LinphoneUtils.getChatIconResId(chatMessage.state))
|
statusIcon.postValue(LinphoneUtils.getChatIconResId(chatMessage.state))
|
||||||
|
|
||||||
if (messageState == ChatMessage.State.FileTransferDone && !message.isOutgoing) {
|
if (messageState == ChatMessage.State.FileTransferDone) {
|
||||||
Log.i("$TAG File transfer is done")
|
Log.i("$TAG File transfer is done")
|
||||||
downloadingFileModel?.downloadProgress?.postValue(-1)
|
if (!message.isOutgoing) {
|
||||||
downloadingFileModel = null
|
downloadingFileModel?.downloadProgress?.postValue(-1)
|
||||||
|
downloadingFileModel = null
|
||||||
|
}
|
||||||
computeContentsList()
|
computeContentsList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -300,13 +302,16 @@ class MessageModel @WorkerThread constructor(
|
||||||
val contents = chatMessage.contents
|
val contents = chatMessage.contents
|
||||||
for (content in contents) {
|
for (content in contents) {
|
||||||
if (content.isIcalendar) {
|
if (content.isIcalendar) {
|
||||||
|
Log.d("$TAG Found iCal content")
|
||||||
parseConferenceInvite(content)
|
parseConferenceInvite(content)
|
||||||
displayableContentFound = true
|
displayableContentFound = true
|
||||||
} else if (content.isText) {
|
} else if (content.isText) {
|
||||||
|
Log.d("$TAG Found plain text content")
|
||||||
computeTextContent(content)
|
computeTextContent(content)
|
||||||
displayableContentFound = true
|
displayableContentFound = true
|
||||||
} else {
|
} else {
|
||||||
if (content.isFile) {
|
if (content.isFile) {
|
||||||
|
Log.d("$TAG Found file content with type [${content.type}/${content.subtype}]")
|
||||||
filesContentCount += 1
|
filesContentCount += 1
|
||||||
val path = content.filePath ?: ""
|
val path = content.filePath ?: ""
|
||||||
if (path.isNotEmpty()) {
|
if (path.isNotEmpty()) {
|
||||||
|
|
@ -351,11 +356,14 @@ class MessageModel @WorkerThread constructor(
|
||||||
Log.e("$TAG No path found for File Content!")
|
Log.e("$TAG No path found for File Content!")
|
||||||
}
|
}
|
||||||
} else if (content.isFileTransfer) {
|
} else if (content.isFileTransfer) {
|
||||||
|
Log.d(
|
||||||
|
"$TAG Found file content (not downloaded yet) with type [${content.type}/${content.subtype}] and name [${content.name}]"
|
||||||
|
)
|
||||||
filesContentCount += 1
|
filesContentCount += 1
|
||||||
val name = content.name ?: ""
|
val name = content.name ?: ""
|
||||||
if (name.isNotEmpty()) {
|
if (name.isNotEmpty()) {
|
||||||
val fileModel = FileModel(name, content.fileSize.toLong(), true) { model ->
|
val fileModel = FileModel(name, content.fileSize.toLong(), true) { model ->
|
||||||
Log.i("$TAG Starting downloading content for file [${model.fileName}]")
|
Log.d("$TAG Starting downloading content for file [${model.fileName}]")
|
||||||
|
|
||||||
if (content.filePath.orEmpty().isEmpty()) {
|
if (content.filePath.orEmpty().isEmpty()) {
|
||||||
val contentName = content.name
|
val contentName = content.name
|
||||||
|
|
@ -390,6 +398,7 @@ class MessageModel @WorkerThread constructor(
|
||||||
filesList.postValue(filesPath)
|
filesList.postValue(filesPath)
|
||||||
|
|
||||||
if (!displayableContentFound) { // Temporary workaround to prevent empty bubbles
|
if (!displayableContentFound) { // Temporary workaround to prevent empty bubbles
|
||||||
|
Log.w("$TAG No displayable content found, generating text based description")
|
||||||
val describe = LinphoneUtils.getTextDescribingMessage(chatMessage)
|
val describe = LinphoneUtils.getTextDescribingMessage(chatMessage)
|
||||||
val spannable = Spannable.Factory.getInstance().newSpannable(describe)
|
val spannable = Spannable.Factory.getInstance().newSpannable(describe)
|
||||||
text.postValue(spannable)
|
text.postValue(spannable)
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:visibility="@{model.filesList.size() == 1 && model.firstImagePath.length() >= 0 ? View.VISIBLE : View.GONE}"
|
android:visibility="@{model.filesList.size() == 1 && model.firstImagePath.length() >= 0 ? View.VISIBLE : View.GONE}"
|
||||||
coilBubble="@{model.firstImagePath}"/>/>
|
coilBubble="@{model.firstImagePath}"/>
|
||||||
|
|
||||||
<ViewStub
|
<ViewStub
|
||||||
android:id="@+id/meeting_info"
|
android:id="@+id/meeting_info"
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@
|
||||||
app:layout_constraintEnd_toEndOf="parent">
|
app:layout_constraintEnd_toEndOf="parent">
|
||||||
|
|
||||||
<com.google.android.flexbox.FlexboxLayout
|
<com.google.android.flexbox.FlexboxLayout
|
||||||
android:id="@+id/images_grid"
|
android:id="@+id/files_grid"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:onLongClick="@{onLongClickListener}"
|
android:onLongClick="@{onLongClickListener}"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue