Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple files with 3 media attachments #26

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions android/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion android/.idea/.name

This file was deleted.

6 changes: 0 additions & 6 deletions android/.idea/compiler.xml

This file was deleted.

10 changes: 2 additions & 8 deletions android/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 0 additions & 30 deletions android/.idea/jarRepositories.xml

This file was deleted.

10 changes: 10 additions & 0 deletions android/.idea/migrations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions android/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions android/.idea/modules.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,41 @@ object MessageMethods {
Log.d("TwilioInfo", "MessageMethods.getMedia => onSuccess")
channel.getMessageByIndex(messageIndex, object : CallbackListener<Message> {
override fun onSuccess(message: Message) {
Log.d("TwilioInfo", "MessageMethods.getMedia (Messages.getMessageByIndex) => onSuccess")
message.getTemporaryContentUrlsForAttachedMedia(object : CallbackListener<Map<String, String>> {
override fun onSuccess(fileUrls: Map<String, String>) {
Log.d("TwilioInfo", "MessageMethods.getMedia (Message.Media.download) => onSuccess")
result.success(fileUrls[fileUrls.keys.first()] as String)
}
Log.d("TwilioInfo", "MessageMethods.getAllAttachedMedia (Messages.getMessageByIndex) => onSuccess")

override fun onError(errorInfo: ErrorInfo) {
Log.d("TwilioInfo", "MessageMethods.getMedia (Message.Media.download) => onError: $errorInfo")
result.error("${errorInfo.code}", errorInfo.message, errorInfo.status)
}
})
val newmediaList = message.getAttachedMedia()

if (newmediaList != null && newmediaList.isNotEmpty()) {
message.getTemporaryContentUrlsForMedia(newmediaList, object : CallbackListener<Map<String, String>> {
override fun onSuccess(fileUrls: Map<String, String>) {
Log.d("TwilioInfo", "MessageMethods.getAllAttachedMedia => onSuccess")
val mediaSids = fileUrls.values.toList()

Log.d("TwilioInfo", "Media SIDs: $mediaSids")

result.success(mediaSids)
}

override fun onError(errorInfo: ErrorInfo) {
Log.d("TwilioInfo", "MessageMethods.getAllAttachedMedia => onError: $errorInfo")
result.error("${errorInfo.code}", errorInfo.message, errorInfo.status)
}
})
} else {
result.error("ERROR", "No attached media found for the specified message", null)
}
// Log.d("TwilioInfo", "MessageMethods.getMedia (Messages.getMessageByIndex) => onSuccess")
// message.getTemporaryContentUrlsForAttachedMedia(object : CallbackListener<Map<String, String>> {
// override fun onSuccess(fileUrls: Map<String, String>) {
// Log.d("TwilioInfo", "MessageMethods.getMedia (Message.Media.download) => onSuccess")
// result.success(fileUrls[fileUrls.keys.first()] as String)
// }
//
// override fun onError(errorInfo: ErrorInfo) {
// Log.d("TwilioInfo", "MessageMethods.getMedia (Message.Media.download) => onError: $errorInfo")
// result.error("${errorInfo.code}", errorInfo.message, errorInfo.status)
// }
// })
}

override fun onError(errorInfo: ErrorInfo) {
Expand All @@ -168,4 +191,4 @@ object MessageMethods {
}
})
}
}
}
Loading