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

Fix VPN bug: Nearest city breaks register requests #2589

Merged
merged 3 commits into from
Apr 10, 2024

Conversation

graeme
Copy link
Collaborator

@graeme graeme commented Apr 9, 2024

Task/Issue URL: https://app.asana.com/0/1203137811378537/1207044169885477/f

Description:

Due to a bug in the VPNLocationViewModel, we were using the string “Nearest” as a city ID which ended up making it to the register request. This only happens when we explicitly select Nearest rather than just selecting the country (which has the same effect).

Steps to test this PR:

  1. Make sure you’re hitting the production VPN environment (so you get the full countries + cities).
  2. Go to VPN Location screen
  3. Go to a country with multiple cities (currently only the US) and select any specific city
  4. Now select Nearest (explicitly using the drop-down)
  5. Go to the VPN management popover (e.g nav bar → … → VPN) and connect

Expected
VPN connects to the nearest city in that country


Internal references:

Pull Request Review Checklist
Software Engineering Expectations
Technical Design Template
Pull Request Documentation

@@ -80,7 +80,8 @@ final class VPNLocationViewModel: ObservableObject {

func onCountryItemSelection(id: String, cityId: String? = nil) async {
DailyPixel.fire(pixel: .networkProtectionGeoswitchingSetCustom, frequency: .dailyAndCount)
let location = NetworkProtectionSelectedLocation(country: id, city: cityId)
let city = cityId == VPNCityItemModel.nearest.id ? nil : cityId
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fix for issue. Though, longterm, it would be better to rethink the id’s type. It’s not ideal right now using the string value like we are.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree - can you scope up a follow up task to do this?

@graeme graeme marked this pull request as ready for review April 10, 2024 11:31
@github-actions github-actions bot added the bot: not in app board Added by automation for pull requests with tasks not added to macOS App Board Asana project label Apr 10, 2024
@graeme graeme changed the title Fix nearest geoswitching city bug Fix VPN bug: Nearest city breaks register requests Apr 10, 2024
Copy link
Contributor

@diegoreymendez diegoreymendez left a comment

Choose a reason for hiding this comment

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

Working great but I added one review comment.

Also, more importantly, this should be merged to the internals.

@@ -80,7 +80,8 @@ final class VPNLocationViewModel: ObservableObject {

func onCountryItemSelection(id: String, cityId: String? = nil) async {
DailyPixel.fire(pixel: .networkProtectionGeoswitchingSetCustom, frequency: .dailyAndCount)
let location = NetworkProtectionSelectedLocation(country: id, city: cityId)
let city = cityId == VPNCityItemModel.nearest.id ? nil : cityId
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree - can you scope up a follow up task to do this?

@graeme graeme force-pushed the graeme/fix-nearest-city-bug branch from 7c382c0 to 40bd2d0 Compare April 10, 2024 15:27
@graeme graeme changed the base branch from main to release/1.83.0 April 10, 2024 15:28
@github-actions github-actions bot removed the bot: not in app board Added by automation for pull requests with tasks not added to macOS App Board Asana project label Apr 10, 2024
Copy link
Contributor

@diegoreymendez diegoreymendez left a comment

Choose a reason for hiding this comment

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

Works great!

@graeme graeme merged commit 69680b0 into release/1.83.0 Apr 10, 2024
17 checks passed
@graeme graeme deleted the graeme/fix-nearest-city-bug branch April 10, 2024 16:34
samsymons added a commit that referenced this pull request Apr 11, 2024
# By Dax the Duck (1) and Graeme Arthur (1)
# Via Dax the Duck
* release/1.83.0:
  Bump version to 1.83.0 (158)
  Fix VPN bug: Nearest city breaks register requests (#2589)

# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
#	LocalPackages/DataBrokerProtection/Package.swift
#	LocalPackages/NetworkProtectionMac/Package.swift
#	LocalPackages/SubscriptionUI/Package.swift
samsymons added a commit that referenced this pull request Apr 12, 2024
# By Dax the Duck (10) and others
# Via GitHub (6) and others
* main: (40 commits)
  Bump version to 1.83.0 (160)
  macOS VPN: Ask users to reboot if system extension was not uninstalled (#2603)
  macOS VPN: Ask users to reboot if system extension was not uninstalled (#2603)
  Fix popover not displayed reliably when VPN shortcut is unpinned (#2606)
  Automatically mark / close stale PRs (#2596)
  Update copy for DBP open button (#2586)
  Bump version to 1.83.0 (159)
  [Release PR] Fix lottie high Windowserver load (#2598)
  Bump version to 1.83.0 (158)
  BSK release 133.1.0 (#2597)
  Fix VPN bug: Nearest city breaks register requests (#2589)
  Fix lottie high Windowserver load (#2595)
  drop Downloads storyboard (#2556)
  Disable directory download (#2585)
  Add supported document types (#2581)
  Allow choosing downloads location in App Store builds (#2532)
  Fix Open Downloads not working (#2576)
  Update Privacy Dashboard URL on navigation commit (#2583)
  Percent-decode download filenames (#2584)
  Bump version to 1.83.0 (157)
  ...

# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
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.

2 participants