Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
40 changes: 34 additions & 6 deletions IVPNClient.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@
82E3B21E29DDD32B00998F67 /* MainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82E3B21D29DDD32B00998F67 /* MainView.swift */; };
82E4FCB023D71FDF00BEBA1A /* UIApplication+ExtTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82E4FCAF23D71FDF00BEBA1A /* UIApplication+ExtTests.swift */; };
82E5449224EE584E006DEF8D /* UIImageView+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82E5449124EE584E006DEF8D /* UIImageView+Ext.swift */; };
82E6C0382FD06C550024F094 /* SelectPlanViewController.swift‎.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82E6C0372FD06C530024F094 /* SelectPlanViewController.swift‎.swift */; };
82E6C03A2FD06C750024F094 /* SelectPlanView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82E6C0392FD06C720024F094 /* SelectPlanView.swift */; };
82E6C03C2FD06C840024F094 /* PlanLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82E6C03B2FD06C830024F094 /* PlanLabel.swift */; };
82E7167E2181E8AF00D6B7C2 /* TunnelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82E7167D2181E8AF00D6B7C2 /* TunnelType.swift */; };
82E716812181E8AF00D6B7C2 /* TunnelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82E7167D2181E8AF00D6B7C2 /* TunnelType.swift */; };
82E716822181E8AF00D6B7C2 /* TunnelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82E7167D2181E8AF00D6B7C2 /* TunnelType.swift */; };
Expand Down Expand Up @@ -697,6 +700,9 @@
82E3B21D29DDD32B00998F67 /* MainView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainView.swift; sourceTree = "<group>"; };
82E4FCAF23D71FDF00BEBA1A /* UIApplication+ExtTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIApplication+ExtTests.swift"; sourceTree = "<group>"; };
82E5449124EE584E006DEF8D /* UIImageView+Ext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImageView+Ext.swift"; sourceTree = "<group>"; };
82E6C0372FD06C530024F094 /* SelectPlanViewController.swift‎.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SelectPlanViewController.swift‎.swift"; sourceTree = "<group>"; };
82E6C0392FD06C720024F094 /* SelectPlanView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectPlanView.swift; sourceTree = "<group>"; };
82E6C03B2FD06C830024F094 /* PlanLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlanLabel.swift; sourceTree = "<group>"; };
82E7167D2181E8AF00D6B7C2 /* TunnelType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TunnelType.swift; sourceTree = "<group>"; };
82E716832181E8E100D6B7C2 /* ProviderConfigurationKeys.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProviderConfigurationKeys.swift; sourceTree = "<group>"; };
82E716892181E8E900D6B7C2 /* WireGuardProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WireGuardProtocol.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1456,6 +1462,7 @@
82DEF01B2447149000CCB5CD /* Signup */ = {
isa = PBXGroup;
children = (
82E6C0352FD06C370024F094 /* SelectPlan */,
82DEF01C244714B300CCB5CD /* Scanner */,
82DEF0222447280300CCB5CD /* CreateAccount */,
82DEF0242447282E00CCB5CD /* Payment */,
Expand Down Expand Up @@ -1541,6 +1548,24 @@
path = Scene;
sourceTree = "<group>";
};
82E6C0352FD06C370024F094 /* SelectPlan */ = {
isa = PBXGroup;
children = (
82E6C0372FD06C530024F094 /* SelectPlanViewController.swift‎.swift */,
82E6C0362FD06C420024F094 /* View */,
);
path = SelectPlan;
sourceTree = "<group>";
};
82E6C0362FD06C420024F094 /* View */ = {
isa = PBXGroup;
children = (
82E6C03B2FD06C830024F094 /* PlanLabel.swift */,
82E6C0392FD06C720024F094 /* SelectPlanView.swift */,
);
path = View;
sourceTree = "<group>";
};
82E81AE52449C42C00D81FB7 /* View */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -2252,6 +2277,7 @@
822B85D921B941A200715691 /* NotificationName+Ext.swift in Sources */,
8290195F243CB27500777B6E /* ControlPanelView.swift in Sources */,
82D598C021A6991B000FABDE /* NetworkManager.swift in Sources */,
82E6C03A2FD06C750024F094 /* SelectPlanView.swift in Sources */,
82D598AC21A566CD000FABDE /* NetworkProtectionTableViewCell.swift in Sources */,
826C1F8425DBEF1800314C4B /* DNSManager.swift in Sources */,
8208525623FD56870008C112 /* FloatingPanelMainLayout.swift in Sources */,
Expand Down Expand Up @@ -2286,6 +2312,7 @@
82FF0D442315587000440E5D /* UITextFieldPadding.swift in Sources */,
8243584425DAA7BD005FDEBB /* SecureDNSViewController.swift in Sources */,
82BBF26D21AE95C000589766 /* UIApplication+Ext.swift in Sources */,
82E6C03C2FD06C840024F094 /* PlanLabel.swift in Sources */,
82B329CB29F7C9F400F3ED9B /* UIWindow+Ext.swift in Sources */,
82C973A0217DFA9C00CE06D4 /* Host.swift in Sources */,
82A160BA221C4E2000730577 /* Server+CoreDataClass.swift in Sources */,
Expand Down Expand Up @@ -2390,6 +2417,7 @@
821CA2D7287C5AB20067F70D /* PortViewController.swift in Sources */,
82061F66238D2730009DDF4D /* ICMPHeader.swift in Sources */,
824BC466240906ED00A61B29 /* VPNStatusViewModel.swift in Sources */,
82E6C0382FD06C550024F094 /* SelectPlanViewController.swift‎.swift in Sources */,
8247E1DE22687C28006C0C08 /* ProductId.swift in Sources */,
829DF2822497953C000DC2DB /* UIButton+Ext.swift in Sources */,
82234B6721BA7F3500B082DE /* Logger.swift in Sources */,
Expand Down Expand Up @@ -2825,7 +2853,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = IVPNClient/IVPNClient.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 5;
DEVELOPMENT_TEAM = WQXXM75BYN;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -2843,7 +2871,7 @@
"$(inherited)",
"$(PROJECT_DIR)/IVPNClient/liboqs",
);
MARKETING_VERSION = 2.14.1;
MARKETING_VERSION = 2.14.2;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "$(inherited)";
OTHER_SWIFT_FLAGS = "-D DEBUG";
Expand Down Expand Up @@ -3314,7 +3342,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = IVPNClient/IVPNClient.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 5;
DEVELOPMENT_TEAM = WQXXM75BYN;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -3332,7 +3360,7 @@
"$(inherited)",
"$(PROJECT_DIR)/IVPNClient/liboqs",
);
MARKETING_VERSION = 2.14.1;
MARKETING_VERSION = 2.14.2;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "$(inherited)";
OTHER_SWIFT_FLAGS = "-D DEBUG";
Expand All @@ -3353,7 +3381,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = IVPNClient/IVPNClient.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 5;
DEVELOPMENT_TEAM = WQXXM75BYN;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -3371,7 +3399,7 @@
"$(inherited)",
"$(PROJECT_DIR)/IVPNClient/liboqs",
);
MARKETING_VERSION = 2.14.1;
MARKETING_VERSION = 2.14.2;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "$(inherited)";
OTHER_SWIFT_FLAGS = "-D RELEASE";
Expand Down
2 changes: 1 addition & 1 deletion IVPNClient/Config/servers.json

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions IVPNClient/Managers/NavigationManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,32 @@ class NavigationManager {
return navController!
}

static func getChangePlanViewController() -> UIViewController {
let storyBoard = UIStoryboard(name: "Signup", bundle: nil)
let navController = storyBoard.instantiateViewController(withIdentifier: "selectPlanView") as? UINavigationController
navController?.modalPresentationStyle = .formSheet

if let viewController = navController?.topViewController as? SelectPlanViewController {
let serviceType = ServiceType.getType(currentPlan: Application.shared.serviceStatus.currentPlan)
viewController.changingPlan = true
viewController.service = Service(type: serviceType, duration: .month)
}

return navController!
}

static func getSelectPlanViewController() -> UIViewController {
let storyBoard = UIStoryboard(name: "Signup", bundle: nil)
let navController = storyBoard.instantiateViewController(withIdentifier: "selectPlanView") as? UINavigationController
navController?.modalPresentationStyle = .formSheet

if let viewController = navController?.topViewController as? SelectPlanViewController {
viewController.selectingPlan = true
}

return navController!
}

static func getSubscriptionViewController() -> UIViewController {
let storyBoard = UIStoryboard(name: "Signup", bundle: nil)
let navController = storyBoard.instantiateViewController(withIdentifier: "subscriptionView") as? UINavigationController
Expand Down
6 changes: 4 additions & 2 deletions IVPNClient/Managers/PurchaseManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class PurchaseManager: NSObject {
case .userCancelled:
// ^^^
log(.info, message: "[Store] Purchase \(productId): userCancelled")
delegate?.purchaseError(error: ErrorResult(status: 500, message: "User canelled the purchase."))
delegate?.purchaseError(error: ErrorResult(status: 500, message: "User cancelled the purchase."))
break
@unknown default:
break
Expand Down Expand Up @@ -168,7 +168,9 @@ class PurchaseManager: NSObject {
ApiService.shared.requestCustomError(request) { (result: ResultCustomError<SessionStatus, ErrorResult>) in
switch result {
case .success(let sessionStatus):
Application.shared.serviceStatus = sessionStatus.serviceStatus
Application.shared.serviceStatus.isActive = sessionStatus.serviceStatus.isActive
Application.shared.serviceStatus.activeUntil = sessionStatus.serviceStatus.activeUntil
Application.shared.serviceStatus.currentPlan = sessionStatus.serviceStatus.currentPlan
Task {
await transaction.finish()
self.delegate?.purchaseSuccess(activeUntil: sessionStatus.serviceStatus.activeUntilString(), extended: sessionStatus.extended ?? !sessionStatus.serviceStatus.isNewStyleAccount())
Expand Down
12 changes: 11 additions & 1 deletion IVPNClient/Models/ProductId.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,24 @@ struct ProductId {
static let standardYear = "net.ivpn.subscriptions.standard.1year"
static let standardTwoYears = "net.ivpn.subscriptions.standard.2year"
static let standardThreeYears = "net.ivpn.subscriptions.standard.3year"
static let proWeek = "net.ivpn.subscriptions.pro.1week"
static let proMonth = "net.ivpn.subscriptions.pro.1month"
static let proYear = "net.ivpn.subscriptions.pro.1year"
static let proTwoYears = "net.ivpn.subscriptions.pro.2year"
static let proThreeYears = "net.ivpn.subscriptions.pro.3year"

static var all: Set<String> {
return [
standardWeek,
standardMonth,
standardYear,
standardTwoYears,
standardThreeYears
standardThreeYears,
proWeek,
proMonth,
proYear,
proTwoYears,
proThreeYears
]
}

Expand Down
94 changes: 72 additions & 22 deletions IVPNClient/Models/Service.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,40 +56,90 @@ struct Service {
}

var discountText: String? {
switch duration {
case .week:
switch type {
case .standard:
switch duration {
case .week:
return nil
case .month:
return nil
case .year:
return "-16%"
case .twoYears:
return "-30%"
case .threeYears:
return "-35%"
}
case .pro:
switch duration {
case .week:
return nil
case .month:
return nil
case .year:
return "-16%"
case .twoYears:
return "-33%"
case .threeYears:
return "-38%"
}
case .plus:
return nil
case .month:
return nil
case .year:
return "-16%"
case .twoYears:
return "-30%"
case .threeYears:
return "-35%"
}
}

var productId: String {
switch duration {
case .week:
return ProductId.standardWeek
case .month:
return ProductId.standardMonth
case .year:
return ProductId.standardYear
case .twoYears:
return ProductId.standardTwoYears
case .threeYears:
return ProductId.standardThreeYears
switch type {
case .standard:
switch duration {
case .week:
return ProductId.standardWeek
case .month:
return ProductId.standardMonth
case .year:
return ProductId.standardYear
case .twoYears:
return ProductId.standardTwoYears
case .threeYears:
return ProductId.standardThreeYears
}
case .pro:
switch duration {
case .week:
return ProductId.proWeek
case .month:
return ProductId.proMonth
case .year:
return ProductId.proYear
case .twoYears:
return ProductId.proTwoYears
case .threeYears:
return ProductId.proThreeYears
}
case .plus:
return ""
}
}

var typeText: String {
return "Standard"
switch type {
case .standard:
return "Standard"
case .pro:
return "Pro Suite"
case .plus:
return "Plus"
}
}

var collection: [Service] {
if Application.shared.authentication.isLoggedIn && !Application.shared.serviceStatus.isNewStyleAccount() {
return [
Service(type: type, duration: .month),
Service(type: type, duration: .year)
]
}

return ServiceDuration.allCases.map { Service(type: type, duration: $0) }
}

Expand Down
Loading
Loading