feat(android): attachments can be saved, section 3 item 1 is done
Two questions, and the code was only the second one. WHERE THE FILE LANDS. The private directory is useless - no file manager opens it and it leaves with the uninstall - and direct external storage has been closed since Android 10. Of the three remaining doors, MediaStore -> Downloads is the only one needing neither a permission nor an extra screen: since API 29 an app may write what it inserted itself. The destination picker would need an activity result, which FMX makes painful; sharing would need a FileProvider in the manifest. Below API 29 it would take WRITE_EXTERNAL_STORAGE - one of the ten permissions just removed - so it refuses and says so. WHERE THE CONTENT IS. TVault drops it on purpose: a single attachment took the cache from 13 to 174 Ko. It is re-read from the raw snapshot, which has been in memory ever since saving stopped fetching before publishing. The same data now serves two needs that had nothing to do with each other. Decoding and writing happen off the main thread, under the waiting veil: a few megabytes would freeze the screen, and the veil would not even paint. What leaves the application leaves its protection: the file lands in the clear in Downloads. The confirmation names the place rather than saying "saved". Release configuration compiles too - checked, since that is what section 5 caught out.
This commit is contained in:
@@ -687,6 +687,7 @@ var ICONS = {
|
||||
edit: '<path d="M4 20h4L20 8l-4-4L4 16z"/>',
|
||||
eye: '<path d="M2 12s3.5-6 10-6 10 6 10 6-3.5 6-10 6-10-6-10-6z"/>'
|
||||
+ '<circle cx="12" cy="12" r="3"/>',
|
||||
down: '<path d="M12 4v11M7.5 11l4.5 4.5L16.5 11M5 19.5h14"/>',
|
||||
trash: '<path d="M5 7h14M10 7V4.5h4V7M6.5 7l1 12.5h9L18 7"/>'
|
||||
+ '<path d="M10.5 10.5v6M13.5 10.5v6"/>',
|
||||
dots: '<circle cx="12" cy="5" r="1.4"/><circle cx="12" cy="12" r="1.4"/>'
|
||||
@@ -741,6 +742,11 @@ function renderDetail(d) {
|
||||
+ ico('eye', 'Show') + '</button>' : '')
|
||||
+ '<button class="btn ico-btn" data-copy="row" data-k="' + i + '">'
|
||||
+ ico('copy', 'Copy') + '</button>'
|
||||
// 'a' porte le rang de la piece jointe : sa presence dit qu'il y a
|
||||
// quelque chose a enregistrer, et Delphi seul sait ou.
|
||||
+ (r.a === undefined ? ''
|
||||
: '<button class="btn ico-btn" data-save="' + i + '">'
|
||||
+ ico('down', 'Save to Downloads') + '</button>')
|
||||
+ (r.e ? '<button class="btn ico-btn" data-edit="' + i + '">'
|
||||
+ ico('edit', 'Edit') + '</button>' : '')
|
||||
+ '</div></div>';
|
||||
@@ -767,6 +773,8 @@ document.getElementById('fields').addEventListener('click', function (ev) {
|
||||
send('touch');
|
||||
return;
|
||||
}
|
||||
var save = t.getAttribute('data-save');
|
||||
if (save !== null) { send('savefile?k=' + save); return; }
|
||||
var copy = t.getAttribute('data-copy');
|
||||
if (copy === 'totp') { send('copy?f=totp'); return; }
|
||||
if (copy === 'row') { send('copy?f=row&k=' + t.getAttribute('data-k')); return; }
|
||||
|
||||
Reference in New Issue
Block a user