Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

privacy protection dashboard - #184

Merged
brindy merged 23 commits into
developfrom
feature/privacy_protection_dashboard
Nov 7, 2017
Merged

brindy merged 23 commits into
developfrom
feature/privacy_protection_dashboard

Conversation

@brindy

@brindy brindy commented Nov 5, 2017

Copy link
Copy Markdown
Contributor

Reviewer: Mia
Asana: https://app.asana.com/0/414235014887631/457416080701390
CC:

Description:

Removes old content blocking popover and replaces it with a new privacy protection dashboard.

Note: Zeppelin is not the source of truth yet. Assets used were provided and the site grade in the omnibar as per discussions in Asana.

Steps to test this PR:

Test 1:

  1. Perform a search and tap on the site grade in the omnibar while it's loading
  2. The overview appears and shows the unknown grade with privacy protection on or off as appropriate
  3. When the page finishes loading, the site grade is updated

Test 2:

  1. Go to Evans Cycles and open the privacy protection dashboard
  2. The grade should be a B
  3. Switch privacy protection off
  4. The dashboard shows the "protection off" version of the icons
  5. The message "privacy protection disabled" is shown
  6. The page reloads in the background and the grade updates once finished
  7. The number of trackers text changes from "blocked" to "found"
  8. Switch privacy protection on
  9. The dashboard shows the "protection on" version of the icons
  10. The page reloads in the background, the grade updates once finished and shows "upgraded from D to B"
  11. Add the site to the whitelist and open the dashboard
  12. The "privacy protection paused" message is shown

Test 3:

  1. Go to a page and open the privacy protection dashboard
  2. Tap the site grade and the dashboard closes

Test 4:

  1. Go to a page and open the privacy protection dashboard
  2. Enter a search query and submit
  3. The privacy protection dashboard closes and shows the page loading

Test 5:

  1. Go to a page and open the privacy protection dashboard
  2. Tap the menu icon
  3. The privacy protection dashboard closes and the menu appears

Test 6:

  1. Go to duckduckgo and open the dashboard
  2. The "good privacy practices" text is shown
  3. The "encrypted connection" text is shown

Test 7:

  1. Go to private.brindy.org.uk and open the dashboard
  2. The "unknown privacy practices" text is shown
  3. The "unencrypted connection" text is shown

Test 8:

  1. Go to amazon.com and open the dashboard
  2. The "some privacy practices" message is displayed

Test 9:

  1. Visit a range of sites with various grades
  2. Open privacy protection dashboard and ensure the right grade is displayed
  3. Ensure the number of trackers and major trackers looks correct by comparing with the console
Reviewer Checklist:
  • Ensure the PR solves the problem
  • Review every line of code
  • Ensure the PR does no harm by testing the changes thoroughly
  • Get help if you're uncomfortable with any of the above!
  • Determine if there are any quick wins that improve the implementation
PR DRI Checklist:
  • Get advice or leverage existing code
  • Agree on technical approach with reviewer (if the changes are nuanced)
  • Ensure that there is a testing strategy (and documented non-automated tests)
  • Ensure there is a documented monitoring strategy (if necessary)
  • Consider systems implications (Database connections, Grafana stats, CPU)

@brindy
brindy requested a review from subsymbolic November 5, 2017 18:35

@subsymbolic subsymbolic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work Chris, this is coming along nicely, I've added a few comments and am ignoring assets for now as I know you're still waiting on them.

}

private let suitName: String
private let suiteName: String

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✨

}


func testWhenUsingBlockedOnlCacheIsNotUsed() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo "Onl"

XCTAssertEqual(4, testee.siteScore(blockedOnly: false))
}

// Test all the adverse contions together

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo "contions"

Comment thread DuckDuckGo/en.lproj/Localizable.strings Outdated
"privacy.protection.major.trackers.found" = "%d Major Tracker Networks Found";
"privacy.protection.tos.unknown" = "Unknown Privacy Practices";
"privacy.protection.tos.good" = "Good Privacy Practices";
"privacy.protection.tos.some" = "Some Privacy Practices";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread Core/SiteRating.swift Outdated
return trackersBlocked.reduce(0) { $0 + $1.value }
}

private func majorTrackers(trackers: [Tracker: Int]) -> Int {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same again, rename to uniqueMajorTrackerNetworks?

Comment thread Core/SiteRating.swift Outdated
return trackersDetected.contains(where: { $0.key.fromMajorNetwork } )

public var majorTrackersDetected: Int {
return majorTrackers(trackers: trackersDetected)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really a count of the unique major tracker networks detected (not a total). Maybe rename to `uniqueMajorTrackerNetworksDetected?

Comment thread Core/SiteRating.swift Outdated

public var contrainsIpTracker: Bool {
return trackersDetected.contains(where: { $0.key.isIpTracker } )
public var majorTrackersBlocked: Int {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as before, rename to uniqueMajorTrackerNetworksBlocked?


public func length() -> Int {
return characters.count
return count

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✨

Comment thread DuckDuckGo/TabViewController.swift Outdated
fileprivate func onSiteRatingChanged() {
delegate?.tab(self, didChangeSiteRating: siteRating)
contentBlockerPopover?.updateSiteRating(siteRating: siteRating!)
// contentBlockerPopover?.updateSiteRating(siteRating: siteRating!)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete unused code

Comment thread DuckDuckGo/TabViewController.swift Outdated
delegate?.tab(self, didChangeSiteRating: siteRating)
contentBlockerPopover?.updateSiteRating(siteRating: siteRating!)
// contentBlockerPopover?.updateSiteRating(siteRating: siteRating!)
privacyDashboard?.updateSiteRating(siteRating!)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This predates your code but while this is being edited let's protect it with a let statement rather than a force unwrap and maybe dismiss or clear the privacyDashboard for the nil case?

@subsymbolic

subsymbolic commented Nov 7, 2017 •

Copy link
Copy Markdown
Contributor

I've noticed a slight weirdness with the detection counts. We are currently counting items as detected even if we choose not to block them (maybe because they are first party). This seems odd when comparing the protect on / off results for facebook as we're telling the user that there is a tracker and then not blocking it. There was some discussion about this ages ago, you might need to check the latest algorithm that extensions are using for this

screen shot 2017-11-07 at 10 32 30 screen shot 2017-11-07 at 12 01 27

@brindy

brindy commented Nov 7, 2017

Copy link
Copy Markdown
Contributor Author

@subsymbolic that's ready for review again.

I think that's more of a UX issue tbh. It's accurate in terms of what the text says. I'll address it as part of the algorithm review task I've got.

Thanks again!

Comment thread DuckDuckGo/TabViewController.swift Outdated
delegate?.tab(self, didChangeSiteRating: siteRating)
contentBlockerPopover?.updateSiteRating(siteRating: siteRating!)
if let siteRating = siteRating {
delegate?.tab(self, didChangeSiteRating: siteRating)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didChangeSiteRating accepts an optional (as nil is a valid case) so should be outside the let check.

Comment thread Core/SiteRating.swift Outdated
public var containsMajorTracker: Bool {
return trackersDetected.contains(where: { $0.key.fromMajorNetwork } )

public var uniqueMajorTrackersDetected: Int {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think the label for these is misleading. It's the number of unique major tracker networks detected not number of trackers. Sorry! If uniqueMajorTrackerNetworksDetected is too much how about uniqueMajorNetworksDetected? Happy with any label that captures the meaning!

@brindy

brindy commented Nov 7, 2017

Copy link
Copy Markdown
Contributor Author

Back to you @subsymbolic 🏸 :)

@subsymbolic subsymbolic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants