Support Downloads
I can point you to Odysseus's code for this, but first I want to ask: What UX do you want here?
I might even implement it, but I want to be your design not mine.
@alcinnz I think something close to Firefox/Epiphany would make sense as a start. I haven't decided how I want the empty/no-downloads state to work, whether the button is completely hidden (like Firefox/Epiphany), or whether I want to make it insensitive (more elementary-like).
I think I might also want to explore a toast with an "Open" button on it when the download is complete; I think that's something Firefox Focus on Android does, and I like that it makes it super quick to perform the likely action.
@alcinnz I'm working on a prototype branch now and will push that for the UI direction. :smile:
Hmmm, that (optionally combined with a confirmation dialog like you have external links) should be more straightforward than what I've done in Odysseus. My aversion to popups lead me to fight WebKit a little bit.
You should watch out for application/octet-stream MIMEtypes, that means the client should be guessing the real MIMEtype. Otherwise they can be passed straight to GIO for handling. https://github.com/alcinnz/Odysseus/blob/master/src/Models/Download.vala#L188
And you'll need to instruct WebKit to download pages it can't display, that behavior doesn't come out of the box. https://github.com/alcinnz/Odysseus/blob/master/src/Traits/navigate/autodownload.vala#L27
I'll try implementing this myself.
@alcinnz rather than a dialog, I think I'd prefer a Granite.Widgets.Toast so it's self-contained within the WebView. I am already using a toast for undoing setting a site as a favorite, for example.
I've almost got it working! Though I'm struggling with implementing the "show in folder button", any tips?
@alcinnz that could be dropped to start, but I think Torrential does it here: https://github.com/davidmhewitt/torrential/blob/49ee0d870dc53e45b7638ecd00d6a60378d10b69/src/TorrentManager.vala#L304
When I think of a download feature related to Ephemeral as a private-by-default, always-incognito browser, I ask myself the following questions: How can safe downloads be realized with Ephemeral and how can users be informed about the risks of downloads and at the same time learn how safe ways of dealing with downloads could look like?
That's what the Tor browser does: Files that the browser can display directly, such as PDFs, are displayed inside the browser. For all downloadable files, the following pop-up window appears:

I dislike the idea of a dialog, just to inform a user about something.
How can safe downloads be realized with Ephemeral and how can users be informed about the risks of downloads and at the same time learn how safe ways of dealing with downloads could look like?
Instead, I think it would be better to add this information into the text of new Ephemeral window. I believe Chrome also mentiones downloaded files in it's private windows, so it's not a weird place.
@janxkoci a potential compromise could be copy on the welcome screen plus an in-app toast (like I have for removing a favorite) for confirming downloads. It could be short and sweet, like,
x“example.com” is trying to download “filename.foo”Download
@cassidyjames yeah the thing is I still don't know what is a toast :smiley: How do I see it? I tried adding a page to favs and then removing it, but didn't see anything special...
@janxkoci ah, hit Ctrl+D to remove a favorite; I only throw it on keyboard (in case it was an accidental shortcut press).