Commit 742f92c8 authored by Jose Blaya's avatar Jose Blaya
Browse files

- Use new product ids for plan purchases

parent 7ecc3fd8
......@@ -29,8 +29,12 @@ struct AppConstants {
}
struct InApp {
static let yearlyProductIdentifier = "com.privateinternetaccess.ios.iap.2019.1year"
static let monthlyProductIdentifier = "com.privateinternetaccess.ios.iap.2019.1month"
}
struct LegacyInApp {
static let yearlyProductIdentifier = "com.privateinternetaccess.ios.iap.1year"
static let monthlyProductIdentifier = "com.privateinternetaccess.ios.iap.1month"
}
......
......@@ -106,7 +106,9 @@ class Bootstrapper {
Client.configuration.setPlan(.yearly, forProductIdentifier: AppConstants.InApp.yearlyProductIdentifier)
Client.configuration.setPlan(.monthly, forProductIdentifier: AppConstants.InApp.monthlyProductIdentifier)
Client.configuration.setPlan(.legacyYearly, forProductIdentifier: AppConstants.LegacyInApp.yearlyProductIdentifier)
Client.configuration.setPlan(.legacyMonthly, forProductIdentifier: AppConstants.LegacyInApp.monthlyProductIdentifier)
if (self.isSimulator || Flags.shared.usesMockVPN) {
Client.configuration.enablesConnectivityUpdates = false
Client.useMockVPNProvider()
......
......@@ -164,10 +164,30 @@ class MenuViewController: AutolayoutViewController {
private func handleRenewablePlans(_ plans: [Plan]) {
log.debug("Account: Renewable plans are: \(plans)")
// TODO: allow users to upgrade from monthly to yearly (plans.count == 2)
guard let uniquePlan = plans.first else {
guard var uniquePlan = plans.first else {
fatalError("At least a renewable plan must be available")
}
//Now we need to filter if legacy plan or not
if let currentUser = currentUser,
let productId = currentUser.info?.productId {
switch productId {
case AppConstants.InApp.monthlyProductIdentifier:
uniquePlan = .monthly
case AppConstants.InApp.yearlyProductIdentifier:
uniquePlan = .yearly
case AppConstants.LegacyInApp.monthlyProductIdentifier:
uniquePlan = .legacyMonthly
case AppConstants.LegacyInApp.yearlyProductIdentifier:
uniquePlan = .legacyYearly
default:
break
}
}
// TODO: allow users to upgrade from monthly to yearly (plans.count == 2)
purchaseProductWithPlan(uniquePlan)
}
......
......@@ -53,7 +53,7 @@ end
def shared_main_pods
pod 'AlamofireImage'
#library_by_path('')
library_by_git('d266916')
library_by_git('dee3c84')
#library_by_version('~> 1.1.3')
end
......
......@@ -104,10 +104,10 @@ DEPENDENCIES:
- HockeySDK
- iRate
- MBProgressHUD
- PIALibrary/Library (from `https://github.com/pia-foss/client-library-apple`, commit `d266916`)
- PIALibrary/Mock (from `https://github.com/pia-foss/client-library-apple`, commit `d266916`)
- PIALibrary/UI (from `https://github.com/pia-foss/client-library-apple`, commit `d266916`)
- PIALibrary/VPN (from `https://github.com/pia-foss/client-library-apple`, commit `d266916`)
- PIALibrary/Library (from `https://github.com/pia-foss/client-library-apple`, commit `dee3c84`)
- PIALibrary/Mock (from `https://github.com/pia-foss/client-library-apple`, commit `dee3c84`)
- PIALibrary/UI (from `https://github.com/pia-foss/client-library-apple`, commit `dee3c84`)
- PIALibrary/VPN (from `https://github.com/pia-foss/client-library-apple`, commit `dee3c84`)
- PIATunnel (from `https://github.com/pia-foss/tunnel-apple`, commit `269d6d1`)
- SideMenu (= 3.1.5)
- TPKeyboardAvoiding
......@@ -138,7 +138,7 @@ SPEC REPOS:
EXTERNAL SOURCES:
PIALibrary:
:commit: d266916
:commit: dee3c84
:git: https://github.com/pia-foss/client-library-apple
PIATunnel:
:commit: 269d6d1
......@@ -146,7 +146,7 @@ EXTERNAL SOURCES:
CHECKOUT OPTIONS:
PIALibrary:
:commit: d266916
:commit: dee3c84
:git: https://github.com/pia-foss/client-library-apple
PIATunnel:
:commit: 269d6d1
......@@ -177,6 +177,6 @@ SPEC CHECKSUMS:
SwiftyBeaver: ccfcdf85a04d429f1633f668650b0ce8020bda3a
TPKeyboardAvoiding: cb69d5ddbe90ce0170e4bc2db1e5e41d4a3ad9a4
PODFILE CHECKSUM: 4dd18d15840913997a7adb96c2198d80a476a3ed
PODFILE CHECKSUM: e3c928438759e03526dd20aa361155c37ad097b9
COCOAPODS: 1.5.3
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment