Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logins+ authentication #438

Merged
merged 129 commits into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from 116 commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
a7f9c29
Scroll to credentials found on a website.
samsymons Jan 20, 2022
72d1a3f
Select the first login if the match isn't found.
samsymons Jan 20, 2022
f1b8abc
Merge branch 'develop' into sam/automatically-select-available-login
samsymons Jan 24, 2022
f8faa6f
Retain the filtering logic on 10.15.
samsymons Jan 24, 2022
c0e9caf
Remove the timer.
samsymons Jan 24, 2022
c235cad
Rename a view. Could still be clearer maybe?
samsymons Jan 24, 2022
c4751f5
Merge branch 'develop' into sam/automatically-select-available-login
samsymons Jan 26, 2022
81a7285
Drop the "www." prefix of domains when selecting.
samsymons Jan 26, 2022
39dea60
Work on login filtering.
samsymons Jan 28, 2022
887d6a7
More sorting work. Inefficient at the moment though.
samsymons Jan 30, 2022
0eb476f
Add new menu items. Need proper pixels.
samsymons Jan 31, 2022
c459235
Update the images to be templates.
samsymons Jan 31, 2022
4b66fbd
Fix unit tests.
samsymons Jan 31, 2022
2dfba9c
Move sorting code out into a separate file.
samsymons Jan 31, 2022
eabe4b3
More sorting work.
samsymons Jan 31, 2022
6c871cb
Monitor the scroll offset to fade in the divider.
samsymons Jan 31, 2022
97d93f6
Merge branch 'develop' into sam/logins-filtering-and-sorting
samsymons Jan 31, 2022
4fc8625
Use the custom NSPopUpButton in the PWM list view.
samsymons Feb 1, 2022
ad3d2e2
Merge branch 'develop' into sam/logins-filtering-and-sorting
samsymons Feb 3, 2022
c7c87ed
Fix merge issues.
samsymons Feb 3, 2022
35a92bd
Temporarily move back to VStack.
samsymons Feb 3, 2022
ca2fbf9
Update the sorting icon.
samsymons Feb 3, 2022
e03692d
Update assets.
samsymons Feb 6, 2022
b856665
Update filter UI styling.
samsymons Feb 6, 2022
54882aa
Merge branch 'develop' into sam/logins-filtering-and-sorting
samsymons Feb 9, 2022
9dcaba8
Rename some assets.
samsymons Feb 9, 2022
3e731a0
Remove padding on the top section's title.
samsymons Feb 9, 2022
33f16e8
Use category colors for the pop up button.
samsymons Feb 9, 2022
91eb7b3
Use the right appearance for allItems.
samsymons Feb 9, 2022
1a5fac1
Try adding an empty state.
samsymons Feb 9, 2022
3804c7c
Merge branch 'develop' into sam/logins-filtering-and-sorting
samsymons Feb 10, 2022
db07e9b
Silence a build warning.
samsymons Feb 10, 2022
52ca120
Add icons to the Add menu.
samsymons Feb 10, 2022
5aa0fee
Play with appearance changes.
samsymons Feb 10, 2022
c3cef28
Merge branch 'develop' into sam/logins-filtering-and-sorting
samsymons Feb 13, 2022
a67d6b1
Add the rough PopUpButton implementation.
samsymons Feb 13, 2022
e80ee5a
Line up the category button frames.
samsymons Feb 13, 2022
9fbe9e4
Change category picker colors.
samsymons Feb 13, 2022
62d9001
Improve the way empty states are displayed.
samsymons Feb 13, 2022
3a9c8c2
Avoid uppercasing the month string.
samsymons Feb 14, 2022
001de8a
Merge branch 'develop' into sam/logins-filtering-and-sorting
samsymons Feb 15, 2022
c5f88a1
Sort out the image rendering issue once and for all.
samsymons Feb 16, 2022
f4d4775
Update pixels.
samsymons Feb 16, 2022
4580db9
Work on self-review items.
samsymons Feb 16, 2022
51d5d38
Fix unit test compilation.
samsymons Feb 16, 2022
0581643
Add list section unit tests.
samsymons Feb 16, 2022
b58da31
Move strings into UserText.
samsymons Feb 16, 2022
7d4d388
Add another section test.
samsymons Feb 16, 2022
48a6315
More UserText changes.
samsymons Feb 16, 2022
2e6ec34
Fix a compilation error when building for release.
samsymons Feb 16, 2022
578b499
Remember the sort descriptor when opening Logins+.
samsymons Feb 16, 2022
ac0d48b
Fix the image issue… again!
samsymons Feb 16, 2022
0e2b7dd
Partially fix the preferences divider rendering.
samsymons Feb 16, 2022
21f351a
Test out a way to detect the idle state of the system.
samsymons Feb 16, 2022
c067185
Add the initial UI for Logins+ authentication.
samsymons Feb 16, 2022
9328c21
Store preferences in user defaults.
samsymons Feb 16, 2022
8e841a9
Begin sketching out the authentication service flow.
samsymons Feb 16, 2022
aa355b9
Avoid closing the popover when authenticating.
samsymons Feb 16, 2022
8a78f9e
Add logging.
samsymons Feb 17, 2022
ac053a3
Implement more of the lock screen.
samsymons Feb 17, 2022
a397cf9
Make sure that the timer runs all the time.
samsymons Feb 17, 2022
b12faef
Lock Logins+ while it’s visible.
samsymons Feb 17, 2022
e9c10a1
Use the correct LAContext policy.
samsymons Feb 17, 2022
a022250
Add a new background color for the Auto-Lock screen.
samsymons Feb 17, 2022
ef68ed8
Rig up the user preferences link.
samsymons Feb 17, 2022
c833d1f
Use the correct asset for the device state.
samsymons Feb 17, 2022
122d558
Change the timer to 30 seconds.
samsymons Feb 17, 2022
eca52f1
Make sure that the New Item buttons always work.
samsymons Feb 17, 2022
7d0bcc1
Always authenticate credit card information.
samsymons Feb 17, 2022
35be5ed
Set the dev timer to 15 seconds.
samsymons Feb 17, 2022
97bdc42
Clean up some table view positioning.
samsymons Feb 18, 2022
c81f8a3
Prevent the GPC text from intercepting scrolling.
samsymons Feb 18, 2022
80d90bf
More layout refinement.
samsymons Feb 18, 2022
9f0cdf1
Tweak cell resizing.
samsymons Feb 18, 2022
8f3d8df
Clean up warnings.
samsymons Feb 18, 2022
a7f9ab3
Intercept click events inside ColorView.
samsymons Feb 18, 2022
6e94aec
Fix lock screen text colors.
samsymons Feb 18, 2022
bc04eb4
Merge branch 'develop' into sam/logins-filtering-and-sorting
samsymons Feb 18, 2022
7c07d51
Re-enable a SwiftLint warning fix.
samsymons Feb 18, 2022
145518d
Ensure that items within sections are sorted correctly.
samsymons Feb 18, 2022
b663971
Merge branch 'sam/logins-filtering-and-sorting' into sam/logins-authe…
samsymons Feb 18, 2022
000bc14
Use an empty to calculate the empty state.
samsymons Feb 18, 2022
532070b
Update unit tests to reflect the sorting change.
samsymons Feb 18, 2022
3ecace9
Add some unit tests for the new empty state logic.
samsymons Feb 18, 2022
15d5d46
Fix self-review comments.
samsymons Feb 18, 2022
c41e9f2
Clean up some string value calculation.
samsymons Feb 18, 2022
f4e940a
Clean up the new menu code.
samsymons Feb 19, 2022
fcaf462
Swap to the correct category when selecting an item.
samsymons Feb 19, 2022
d7327bc
Merge branch 'sam/logins-filtering-and-sorting' into sam/logins-authe…
samsymons Feb 19, 2022
c96a855
Use the correct color for the unlock button.
samsymons Feb 19, 2022
9f04035
Dismiss the logins popover when clicking the Preferences button.
samsymons Feb 19, 2022
185dc0c
Remove first responder when showing the lock screen.
samsymons Feb 19, 2022
905e542
Clean up the NSImage tint function.
samsymons Feb 19, 2022
cffd948
Move the empty state code to its own section.
samsymons Feb 19, 2022
156a0d5
Update the way selected items are managed.
samsymons Feb 21, 2022
7e6796d
Disable category changes when editing.
samsymons Feb 21, 2022
b8b19d3
Merge branch 'sam/logins-filtering-and-sorting' into sam/logins-authe…
samsymons Feb 21, 2022
610583e
Merge branch 'develop' into sam/logins-filtering-and-sorting
samsymons Feb 21, 2022
66fac7a
Merge branch 'sam/logins-filtering-and-sorting' into sam/logins-authe…
samsymons Feb 21, 2022
e0f59c3
Don’t request permission every time settings change.
samsymons Feb 21, 2022
61b9dc6
Hide the password manager popover if clicking the button while it’s a…
samsymons Feb 21, 2022
ecd6d68
Avoid the default empty state appearing at unexpected times.
samsymons Feb 21, 2022
bd62272
Merge branch 'sam/logins-filtering-and-sorting' into sam/logins-authe…
samsymons Feb 21, 2022
aeb650c
Apply more dependency injection to the DeviceAuthenticator.
samsymons Feb 22, 2022
eb9fc5b
Add unit tests.
samsymons Feb 22, 2022
09d7ec2
Merge branch 'develop' into sam/logins-filtering-and-sorting
samsymons Feb 22, 2022
f187c96
Disable the search field when editing.
samsymons Feb 22, 2022
b31e6a2
Merge branch 'sam/logins-filtering-and-sorting' into sam/logins-authe…
samsymons Feb 23, 2022
b8351d7
Point to the logins authentication BSK branch.
samsymons Feb 23, 2022
7848480
Add pixels.
samsymons Feb 23, 2022
c02ec3e
Clean up some commented code.
samsymons Feb 23, 2022
4c3864f
Fix a compilation error.
samsymons Feb 23, 2022
57c215f
Merge branch 'develop' into sam/logins-authentication
samsymons Feb 24, 2022
88e0361
Fix a couple last-minute issues.
samsymons Feb 24, 2022
8144fe3
Display the correct unlock reason.
samsymons Feb 24, 2022
89a95ce
Resolve self-review comments.
samsymons Feb 24, 2022
b9751ca
Set the privacy dashboard back to the correct version.
samsymons Feb 24, 2022
4012441
Remove a duplicate file.
samsymons Feb 24, 2022
47beac6
Remove the App Delegate timer call.
samsymons Feb 24, 2022
387b239
Fix unit tests.
samsymons Feb 24, 2022
89a33cb
Resolve warnings now that Logins preferences aren’t a struct.
samsymons Feb 24, 2022
467434f
Move remaining strings into UserText.
samsymons Feb 24, 2022
2987dfe
update packages resolved
brindy Feb 25, 2022
1db7eb0
Merge branch 'develop' into sam/logins-authentication
samsymons Feb 25, 2022
7b3d8eb
Update the logins authentication BSK commit.
samsymons Feb 25, 2022
9c8c2f5
Use an enum to return the authentication state.
samsymons Feb 25, 2022
9b518af
Update ContentOverlayViewController to implement SecureVaultManagerDe…
samsymons Feb 27, 2022
2cda779
Merge branch 'develop' into sam/logins-authentication
samsymons Mar 1, 2022
fc2d6b0
Point to BSK 11.0.0.
samsymons Mar 1, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 62 additions & 2 deletions DuckDuckGo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"package": "BrowserServicesKit",
"repositoryURL": "https://github.com/duckduckgo/BrowserServicesKit",
"state": {
"branch": null,
"revision": "b00ea4f240613766e303ccdcf7c5fed15f60ddd1",
"version": "10.0.0"
"branch": "sam/logins-authentication",
"revision": "cd2c4270595b33571d72fbc595804dd7ca5b4ad9",
"version": null
}
},
{
Expand Down
2 changes: 2 additions & 0 deletions DuckDuckGo/AppDelegate/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
#endif
urlEventHandler.applicationDidFinishLaunching()

DeviceAuthenticator.shared.beginCheckingIdleTimer()

UserDefaultsWrapper<Any>.clearRemovedKeys()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.100",
"blue" : "0.000",
"green" : "0.000",
"red" : "0.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.100",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.600",
"blue" : "0.000",
"green" : "0.000",
"red" : "0.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.600",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xF0",
"green" : "0xEF",
"red" : "0xF1"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.200",
"green" : "0.200",
"red" : "0.200"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
12 changes: 12 additions & 0 deletions DuckDuckGo/Assets.xcassets/Images/Logins+.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Logins+.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "LoginsLockPassword.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"images" : [
{
"filename" : "LoginsLockTouchID.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "LoginsLockTouchID@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "LoginsLockTouchID@3x.png",
"idiom" : "universal",
"scale" : "3x"
samsymons marked this conversation as resolved.
Show resolved Hide resolved
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "original"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion DuckDuckGo/BrowserTab/Model/Tab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ final class Tab: NSObject {
return .homepage
} else if url == .welcome {
return .onboarding
} else if url == .preferences {
return .preferences
} else {
return .url(url ?? .blankPage)
}
Expand Down Expand Up @@ -688,7 +690,13 @@ extension Tab: SecureVaultManagerDelegate {

func secureVaultManager(_: SecureVaultManager, didAutofill type: AutofillType, withObjectId objectId: Int64) {
Pixel.fire(.formAutofilled(kind: type.formAutofillKind))
}
}

func secureVaultManager(_: SecureVaultManager, didRequestAuthenticationWithCompletionHandler handler: @escaping (Bool) -> Void) {
DeviceAuthenticator.shared.authenticateUser(reason: .autofill) { authenticated in
handler(authenticated)
}
}

func secureVaultInitFailed(_ error: SecureVaultError) {
SecureVaultErrorReporter.shared.secureVaultInitFailed(error)
Expand Down
4 changes: 4 additions & 0 deletions DuckDuckGo/Common/Extensions/URLExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ extension URL {
static var welcome: URL {
return URL(string: "about:welcome")!
}

static var preferences: URL {
return URL(string: "about:preferences")!
}

// MARK: Pixel

Expand Down
7 changes: 7 additions & 0 deletions DuckDuckGo/Common/Utilities/Logging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ extension OSLog {
static var favicons: OSLog {
Logging.faviconLoggingEnabled ? Logging.faviconLog : .disabled
}

static var autoLock: OSLog {
Logging.autoLockLoggingEnabled ? Logging.autoLockLog : .disabled
}

}

Expand Down Expand Up @@ -83,6 +87,9 @@ struct Logging {

fileprivate static let faviconLoggingEnabled = false
fileprivate static let faviconLog: OSLog = OSLog(subsystem: Bundle.main.bundleIdentifier ?? "DuckDuckGo", category: "Favicons")

fileprivate static let autoLockLoggingEnabled = false
samsymons marked this conversation as resolved.
Show resolved Hide resolved
fileprivate static let autoLockLog: OSLog = OSLog(subsystem: Bundle.main.bundleIdentifier ?? "DuckDuckGo", category: "Auto-Lock")

fileprivate static let autoconsentLoggingEnabled = false
fileprivate static let autoconsentLog: OSLog = OSLog(subsystem: Bundle.main.bundleIdentifier ?? "DuckDuckGo", category: "Autoconsent")
Expand Down
22 changes: 22 additions & 0 deletions DuckDuckGo/Common/View/AppKit/ColorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ final class ColorView: NSView {
layer?.borderWidth = borderWidth
}
}

@IBInspectable var interceptClickEvents: Bool = false

func setupView() {
self.wantsLayer = true
Expand All @@ -66,5 +68,25 @@ final class ColorView: NSView {
layer?.backgroundColor = backgroundColor?.cgColor
layer?.borderColor = borderColor?.cgColor
}

// MARK: - Click Event Interception

override func mouseDown(with event: NSEvent) {
if !interceptClickEvents {
super.mouseDown(with: event)
}
}

override func mouseUp(with event: NSEvent) {
if !interceptClickEvents {
super.mouseUp(with: event)
}
}

override func mouseDragged(with event: NSEvent) {
if !interceptClickEvents {
super.mouseDragged(with: event)
}
}

}
46 changes: 46 additions & 0 deletions DuckDuckGo/Common/View/AppKit/FlatButton.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// FlatButton.swift
//
// Copyright © 2022 DuckDuckGo. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import Foundation

@IBDesignable class FlatButton: NSButton {

@IBInspectable var cornerRadius: CGFloat = 5
@IBInspectable var horizontalPadding: CGFloat = 10
@IBInspectable var verticalPadding: CGFloat = 10
@IBInspectable var backgroundColor: NSColor = .blue

override func draw(_ dirtyRect: NSRect) {

self.wantsLayer = true
self.layer?.cornerRadius = cornerRadius

if isHighlighted {
layer?.backgroundColor = backgroundColor.blended(withFraction: 0.2, of: .black)?.cgColor
} else {
layer?.backgroundColor = backgroundColor.cgColor
}

let originalBounds = self.bounds
defer { self.bounds = originalBounds }

self.bounds = originalBounds.insetBy(dx: horizontalPadding, dy: verticalPadding)

super.draw(dirtyRect)
}
}
35 changes: 35 additions & 0 deletions DuckDuckGo/Common/View/AppKit/ToggleableScrollView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// ToggleableScrollView.swift
//
// Copyright © 2022 DuckDuckGo. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import Foundation

@IBDesignable

public class ToggleableScrollView: NSScrollView {

@IBInspectable public var isEnabled: Bool = true

public override func scrollWheel(with event: NSEvent) {
if isEnabled {
super.scrollWheel(with: event)
} else {
nextResponder?.scrollWheel(with: event)
}
}
samsymons marked this conversation as resolved.
Show resolved Hide resolved

}
27 changes: 27 additions & 0 deletions DuckDuckGo/Device Authentication/DeviceAuthenticationService.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// DeviceAuthenticationService.swift
//
// Copyright © 2022 DuckDuckGo. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import Foundation

protocol DeviceAuthenticationService {

typealias DeviceAuthenticationResult = (Bool) -> Void
samsymons marked this conversation as resolved.
Show resolved Hide resolved

func authenticateDevice(reason: String, result: @escaping DeviceAuthenticationResult)

}
Loading