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

Add data-driven TunnelSettingsUpdate type and method for atomically applying them... #5809

Conversation

acb-mv
Copy link
Contributor

@acb-mv acb-mv commented Feb 13, 2024

modify Preferences{Interactor,ViewController} to use these.

This means that for each preferences change, the tunnel gets recreated only once. It also gives us a data-driven type for modelling changes to the preferences, factoring code out of TunnelManager into a self-contained type.


This change is Reviewable

@acb-mv acb-mv requested a review from buggmagnet February 13, 2024 15:19
Copy link

linear bot commented Feb 13, 2024

Copy link
Contributor

@rablador rablador left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @acb-mv)


ios/MullvadVPN/View controllers/Preferences/PreferencesInteractor.swift line 43 at r1 (raw file):

    }

    func setDNSSettings(_ newDNSSettings: DNSSettings, completion: (() -> Void)? = nil) {

Why do we keep this one around?

@buggmagnet buggmagnet requested a review from rablador February 14, 2024 07:49
Copy link
Contributor

@buggmagnet buggmagnet left a comment

Choose a reason for hiding this comment

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

Asides from the changes @rablador mentioned, this looks good.

2 things that don't appear in this PR but could be fixed here

  • ⚠️ Line Length Violation: Line should be 120 characters or less; currently it has 154 characters (line_length) inPreferencesViewController:166
  • ⚠️ Function Body Length Violation: Function body should span 50 lines or less excluding comments and whitespace: currently spans 54 lines (function_body_length) in PreferencesViewController:115

For the later one, we can just issue a // swiftlint:disable:next function_body_length directive

Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @rablador)


ios/MullvadVPN/View controllers/Preferences/PreferencesInteractor.swift line 43 at r1 (raw file):

Previously, rablador (Jon Petersson) wrote…

Why do we keep this one around?

Agreed, it looks like we can get rid of it

Copy link
Contributor Author

@acb-mv acb-mv left a comment

Choose a reason for hiding this comment

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

Reviewable status: 4 of 6 files reviewed, 1 unresolved discussion (waiting on @buggmagnet and @rablador)


ios/MullvadVPN/View controllers/Preferences/PreferencesInteractor.swift line 43 at r1 (raw file):

Previously, buggmagnet wrote…

Agreed, it looks like we can get rid of it

It is my plan to replace other setmethods with updateSettingsbefore the PR gets promoted from draft.

@acb-mv acb-mv marked this pull request as ready for review February 14, 2024 10:16
Copy link
Contributor

@buggmagnet buggmagnet left a comment

Choose a reason for hiding this comment

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

Reviewed 8 of 8 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @acb-mv and @rablador)


ios/MullvadVPNTests/MullvadSettings/TunnelSettingsUpdateTests.swift line 15 at r2 (raw file):

final class TunnelSettingsUpdateTests: XCTestCase {
    override func setUpWithError() throws {

nit
If we don't intend to use those, we can remove them

Copy link
Contributor Author

@acb-mv acb-mv left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: 8 of 9 files reviewed, 1 unresolved discussion (waiting on @buggmagnet and @rablador)

Copy link
Contributor

@rablador rablador left a comment

Choose a reason for hiding this comment

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

Reviewed 7 of 8 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

Copy link
Contributor

@buggmagnet buggmagnet left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

…pplying them, modify Preferences{Interactor,ViewController} to use these.
@buggmagnet buggmagnet force-pushed the deduplicate-tunnel-manager-changes-from-preferences-view-ios-510 branch from 92062fc to e329328 Compare February 14, 2024 15:29
@buggmagnet buggmagnet merged commit e2c4fb4 into main Feb 14, 2024
5 checks passed
@buggmagnet buggmagnet deleted the deduplicate-tunnel-manager-changes-from-preferences-view-ios-510 branch February 14, 2024 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants