Skip to content

Commit

Permalink
Merge Hotfix/7.141.1 into 7.142.0 release branch (#3481)
Browse files Browse the repository at this point in the history
<!--
Note: This checklist is a reminder of our shared engineering
expectations. Feel free to change it, although assigning a GitHub
reviewer and the items in bold are required.

⚠️ If you're an external contributor, please file an issue first before
working on a PR, as we can't guarantee that we will accept your changes
if they haven't been discussed ahead of time. Thanks!
-->

Task/Issue URL: https://app.asana.com/0/0/1208593312489483/f
Tech Design URL:
CC:

**Description**:
Merges the hot fix into the latest release branch

<!--
If at any point it isn't actively being worked on/ready for
review/otherwise moving forward strongly consider closing it (or not
opening it in the first place). If you decide not to close it, use Draft
PR while work is still in progress or use `DO NOT MERGE` label to
clarify the PRs state and comment with more information.
-->

**Steps to test this PR**:
1.
2.

<!--
Before submitting a PR, please ensure you have tested the combinations
you expect the reviewer to test, then delete configurations you *know*
do not need explicit testing.

Using a simulator where a physical device is unavailable is acceptable.
-->

**Definition of Done (Internal Only)**:

* [ ] Does this PR satisfy our [Definition of
Done](https://app.asana.com/0/1202500774821704/1207634633537039/f)?

**Copy Testing**:

* [ ] Use of correct apostrophes in new copy, ie `’` rather than `'`

**Orientation Testing**:

* [ ] Portrait
* [ ] Landscape

**Device Testing**:

* [ ] iPhone SE (1st Gen)
* [ ] iPhone 8
* [ ] iPhone X
* [ ] iPhone 14 Pro
* [ ] iPad

**OS Testing**:

* [ ] iOS 15
* [ ] iOS 16
* [ ] iOS 17

**Theme Testing**:

* [ ] Light theme
* [ ] Dark theme

---
###### Internal references:
[Software Engineering
Expectations](https://app.asana.com/0/59792373528535/199064865822552)
[Technical Design
Template](https://app.asana.com/0/59792373528535/184709971311943)

---------

Co-authored-by: Michal Smaga <miasma13@gmail.com>
Co-authored-by: Sam Symons <sam@samsymons.com>
  • Loading branch information
3 people authored Oct 25, 2024
1 parent efdacc0 commit 84bc3af
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion DuckDuckGo/TabViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1325,6 +1325,7 @@ extension TabViewController: WKNavigationDelegate {

let mimeType = MIMEType(from: navigationResponse.response.mimeType, fileExtension: navigationResponse.response.url?.pathExtension)
let urlSchemeType = navigationResponse.response.url.map { SchemeHandler.schemeType(for: $0) } ?? .unknown
let urlNavigationalScheme = navigationResponse.response.url?.scheme.map { URL.NavigationalScheme(rawValue: $0) }

let httpResponse = navigationResponse.response as? HTTPURLResponse
let isSuccessfulResponse = httpResponse?.isSuccessfulResponse ?? false
Expand Down Expand Up @@ -1355,7 +1356,13 @@ extension TabViewController: WKNavigationDelegate {
withAdditionalParameters: [PixelParameters.canAutoPreviewMIMEType: "1"])
} else if shouldTriggerDownloadAction(for: navigationResponse),
let downloadMetadata = AppDependencyProvider.shared.downloadManager.downloadMetaData(for: navigationResponse.response) {
// 3. We know the response should trigger the file download prompt
// 3a. We know it is a download, but allow WebKit handle the "data" scheme natively
if urlNavigationalScheme == .data {
decisionHandler(.download)
return
}

// 3b. We know the response should trigger the file download prompt
self.presentSaveToDownloadsAlert(with: downloadMetadata) {
self.startDownload(with: navigationResponse, decisionHandler: decisionHandler)
} cancelHandler: {
Expand Down

0 comments on commit 84bc3af

Please sign in to comment.