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
add sendMessage()
api for exporting data to saved-messages
#2555
Conversation
To test the changes in this pull request, install this apk: |
I think returning a promise makes sense, so apps could show a progress/busy spinner and hide it again once the export is complete. Also I'm not sure about naming the function |
try { | ||
JSONObject jsonObject = new JSONObject(payload); | ||
byte[] data = Base64.decode(jsonObject.getString("__blobBase64"), Base64.NO_WRAP | Base64.NO_PADDING); | ||
String[] fileName = jsonObject.getString("fileName").split("\\."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks dangerous, maybe use https://docs.oracle.com/javase/6/docs/api/java/lang/String.html#split%28java.lang.String,%20int%29 to split at most in two strings, and probably also check the case where the filename has no dot "." (no extension) at all
To test the changes in this pull request, install this apk: |
closing in favor of #2571 |
sendMessage
takes an object withblob
,fileName
,text
as parameters, currently, the message is always sent to the saved-messages chat, for the future, we consider to allow sending to the webxdc's source chat as well, therefore the broader nameTODO:
at webxdc/webxdc-test#9 there is a test for the
sendMessage
apitargets deltachat/deltachat-core-rust#4350