-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Email sender - why not support attaching files #558
Comments
I generally support the idea of additional binary attachments, as it is the most requested feature as of now. However I think it should be supported by all integrated senders, not only emails. I like the idea of using a file provider. Any thoughts @william-ferguson-au ? |
You don't have a chance to share files reliably without a file provider, so that's a must. It can be reused for all senders as well of course without additional code nor setup... |
@MFlisar can I view your sender/provider-setup somewhere? |
I've currently most functionality in my own classes, but I would add a pull request if this feature would be accepted... Therefore I would have to rewrite it a little bit... I use this functionality already for quite some time in a feedback utility class I've written to send feedback mails with a few files appended... |
The base cache provider is here: https://gist.github.com/MFlisar/fc8689ec47e6adef86d120884a7fa7db It's very simple and basic... Implementation looks like following:
This provider is added to the manifest and from then on it works. The sender then simple creates an email intent and addes content uris of the cached file provider to it and sends the mail... |
As long as it is kept simple and doesn't place requirements on those that don't need attachments, sure. |
My current draft for this is here https://github.com/F43nd1r/acra/tree/file |
I've checked your code a little bit. Is following correct:
For my use case I want following:
I personally just think an empty mail with attachments is much more user friendly, I personally don't want to fill out my feedback in a dialog but want to write it in a mail and therefore, all extra infos (all technical infos, which is not interesting for most people) should not be visible in the mail, it's just distracting... I think, those things could be combined with your implementation by adding an acra field like |
You can provide file uris
The UriProvider is optional, it can be used if you want to provide Uris at runtime instead of compile time. A ContentProvider is also optional, as e.g. file uris are resolved by the android system. Moving the report to an attachment is a different change which can be built upon this one, but it is not an integral part of this. I'll start with that as soon as this is stable. |
Just one comment: file uris may be resolved by the android system, but permissions will be missing, so you must provide a ContentProvider. I.e. sharing a file from your cache directory to gmail will fail, if you share the file uri only... |
Still 2 thoughts:
|
It is able to, but it is only accesible with uri permissions, which aren't granted for any files but the ones configured.
No, good point. |
OK Here's my example of a content provider:
And following:
This one is reusable... |
BuildConfig.APPLICATION_ID cannot be used, as the buildconfig class is unknown. However, context.getPackageName provides the same value. |
OK, that's why I always sub classed my base class I posted on top (didn't remember that). You're right, package name should do it as well |
I now tested this and it works fine. But it's not what I personally want. Could we extend that to support following:
This could be done via a setup flag or similar... |
@MFlisar I think this is not in the scope of the default sender, and should be implemented in a custom sender. However, I've improved the extensibility of the default email sender, so you should be able to reuse most of the code. You'll have to override As for the custom log file, just specify it as attachment instead of as custom log file. |
Thanks, the new sender is really better. One small thing though: imho, it would make sense to have a function to convert a path to a valid
This way I can easily add my log file as attachment via |
Added that in #577 |
Any reason for that?
I've written an
EmailFileIntentSender
that extracts data from custom fields and uses them (currently it extracts the file provider name for the files + file names that should be attached). It would be nice to add some official setup fields for this setup to acra and add this sender to the library.Would you be interested in something like that?
The text was updated successfully, but these errors were encountered: