Skip to content

Commit

Permalink
dashboard: fixing the white flicker (#1147)
Browse files Browse the repository at this point in the history
<!--
Note: This checklist is a reminder of our shared engineering
expectations.
-->

Please review the release process for BrowserServicesKit
[here](https://app.asana.com/0/1200194497630846/1200837094583426).

**Required**:

Task/Issue URL: https://app.asana.com/0/0/1209097550105014/f
iOS PR:  duckduckgo/iOS#3774
macOS PR: duckduckgo/macos-browser#3705
What kind of version bump will this require?: Major/Minor/Patch

**Optional**:

Tech Design URL:
CC:

**Description**:

<!--
Tagging instructions
If this PR isn't ready to be merged for whatever reason it should be
marked with the `DO NOT MERGE` label (particularly if it's a draft)
If it's pending Product Review/PFR, please add the `Pending Product
Review` label.

If at any point it isn't actively being worked on/ready for
review/otherwise moving forward (besides the above PR/PFR exception)
strongly consider closing it (or not opening it in the first place). If
you decide not to close it, make sure it's labelled to make it clear the
PRs state and comment with more information.
-->

**Steps to test this PR**:
1. It’s in the macOS PR
duckduckgo/macos-browser#3705
1.

<!--
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.
-->

**OS Testing**:

* [ ] iOS 14
* [ ] iOS 15
* [ ] iOS 16
* [ ] macOS 10.15
* [ ] macOS 11
* [ ] macOS 12

---
###### Internal references:
[Software Engineering
Expectations](https://app.asana.com/0/59792373528535/199064865822552)
[Technical Design
Template](https://app.asana.com/0/59792373528535/184709971311943)
  • Loading branch information
shakyShane authored Jan 7, 2025
1 parent e8f94cf commit eea5c7c
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Sources/PrivacyDashboard/PrivacyDashboardController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,24 @@ public protocol PrivacyDashboardControllerDelegate: AnyObject {
@Published public var theme: PrivacyDashboardTheme?
@Published public var allowedPermissions: [AllowedPermission] = []
public var preferredLocale: String?
public var dashboardHtmlName: String {
#if os(iOS)
return "ios"
#else
return "macos"
#endif
}
public lazy var dashboardHtml: String = {
guard let file = Bundle.privacyDashboardResourcesBundle.path(forResource: dashboardHtmlName, ofType: "html", inDirectory: "html") else {
assertionFailure("HTML for the PrivacyDashboard was not found")
return ""
}
guard let html = try? String(contentsOfFile: file) else {
assertionFailure("Should be able to load HTML as a string")
return ""
}
return html
}()

public private(set) weak var privacyInfo: PrivacyInfo?
private let entryPoint: PrivacyDashboardEntryPoint
Expand Down Expand Up @@ -124,7 +142,7 @@ public protocol PrivacyDashboardControllerDelegate: AnyObject {

private func loadStartScreen() {
let url = PrivacyDashboardURLBuilder(configuration: .startScreen(entryPoint: entryPoint, variant: variant)).build()
webView?.loadFileURL(url, allowingReadAccessTo: url.deletingLastPathComponent().deletingLastPathComponent())
webView?.loadHTMLString(dashboardHtml, baseURL: url.deletingLastPathComponent())
}

public func updatePrivacyInfo(_ privacyInfo: PrivacyInfo?) {
Expand Down

0 comments on commit eea5c7c

Please sign in to comment.