From f5daa997814adf256c9793d805aa205b1a41376e Mon Sep 17 00:00:00 2001 From: Soner YUKSEL Date: Mon, 12 Jun 2023 13:50:24 -0400 Subject: [PATCH] Fix #7449- Ref #7413: VPN Region country flag is not shown when relaunching Brave - VPN profile fails to initialize after purchase (#7571) Setting user as paying user before fetching a fresh profile Update package Guardian_Connect to 1.8.5 release --- .../xcshareddata/swiftpm/Package.resolved | 4 ++-- Package.swift | 2 +- Sources/BraveVPN/BraveVPN.swift | 5 ++++- Sources/BraveVPN/InstallVPNViewController.swift | 5 +++++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/App/Client.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/App/Client.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 1b9efaa0c31..877cdf97d60 100644 --- a/App/Client.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/App/Client.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -23,8 +23,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/GuardianFirewall/GuardianConnect", "state" : { - "revision" : "cf99f1babca17a3d94ea20e2fc56cc48dfd65575", - "version" : "1.8.4" + "revision" : "2b97ae55edd9642cf721520129e807e576642e4f", + "version" : "1.8.5" } }, { diff --git a/Package.swift b/Package.swift index 7ba0cc5c901..b7021516f80 100644 --- a/Package.swift +++ b/Package.swift @@ -60,7 +60,7 @@ var package = Package( .package(url: "https://github.com/apple/swift-algorithms", from: "1.0.0"), .package(url: "https://github.com/devxoul/Then", from: "2.7.0"), .package(url: "https://github.com/mkrd/Swift-BigInt", from: "2.0.0"), - .package(url: "https://github.com/GuardianFirewall/GuardianConnect", exact: "1.8.4"), + .package(url: "https://github.com/GuardianFirewall/GuardianConnect", exact: "1.8.5"), .package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "0.6.0"), .package(name: "Static", path: "ThirdParty/Static"), ], diff --git a/Sources/BraveVPN/BraveVPN.swift b/Sources/BraveVPN/BraveVPN.swift index 29459283a59..c52aca6a77d 100644 --- a/Sources/BraveVPN/BraveVPN.swift +++ b/Sources/BraveVPN/BraveVPN.swift @@ -411,11 +411,14 @@ public class BraveVPN { let activeTunnelProtocol = GRDTransportProtocol.getUserPreferredTransportProtocol() helper.configureFirstTimeUser(for: activeTunnelProtocol, with: region) { success, error in + let subcredentials = "Credentials \(GRDKeychain.getPasswordString(forAccount: kKeychainStr_SubscriberCredential) ?? "Empty")" + if success { Logger.module.debug("Changed VPN region to \(region?.regionName ?? "default selection")") completion(true) } else { - Logger.module.debug("connection failed: \(error ?? "nil")") + Logger.module.debug("Connection failed: \(error ?? "nil")") + Logger.module.debug("Region change connection failed for subcredentials \(subcredentials)") completion(false) } } diff --git a/Sources/BraveVPN/InstallVPNViewController.swift b/Sources/BraveVPN/InstallVPNViewController.swift index 29f1af33d8b..cec46bc8160 100644 --- a/Sources/BraveVPN/InstallVPNViewController.swift +++ b/Sources/BraveVPN/InstallVPNViewController.swift @@ -7,6 +7,7 @@ import UIKit import Shared import Lottie import BraveUI +import GuardianConnect class InstallVPNViewController: VPNSetupLoadingController { @@ -52,6 +53,10 @@ class InstallVPNViewController: VPNSetupLoadingController { @objc func installVPNAction() { isLoading = true + // Used to set whether our current user is actively a paying customer + // This has to be set before adding the profile otherwise it might fail + GRDSubscriptionManager.setIsPayingUser(true) + installProfileAndConnectVPNFirstTime { [weak self] status in guard let self else { return }