Commit 88775eb0 authored by Jose Blaya's avatar Jose Blaya
Browse files

Retrieve available inapp products from backend service

parent 27db9b77
This diff is collapsed.
......@@ -104,10 +104,30 @@ class Bootstrapper {
PIATunnelProfile.vpnType: AppConfiguration.VPN.piaDefaultConfigurationBuilder.build()
]
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)
Client.providers.accountProvider.updatePlanProductIdentifiers { [weak self] (products, error) in
if let _ = error {
self?.setDefaultPlanProducts()
}
if let products = products,
products.count > 0 {
for product in products {
if product.legacy {
if product.plan == .monthly {
Client.configuration.setPlan(.legacyMonthly, forProductIdentifier: product.identifier)
} else if product.plan == .yearly {
Client.configuration.setPlan(.legacyYearly, forProductIdentifier: product.identifier)
}
} else {
Client.configuration.setPlan(product.plan, forProductIdentifier: product.identifier)
}
}
}
Client.refreshProducts()
}
if (self.isSimulator || Flags.shared.usesMockVPN) {
Client.configuration.enablesConnectivityUpdates = false
......@@ -164,6 +184,13 @@ class Bootstrapper {
}
}
private func setDefaultPlanProducts() {
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)
}
func dispose() {
Client.dispose()
......
......@@ -56,7 +56,7 @@ end
def shared_main_pods
pod 'AlamofireImage'
#library_by_path('')
library_by_git('85edc27')
library_by_git('ac88c39')
#library_by_version('~> 1.1.3')
end
......
......@@ -114,10 +114,10 @@ DEPENDENCIES:
- FXPageControl
- HockeySDK
- iRate
- PIALibrary/Library (from `https://github.com/pia-foss/client-library-apple`, commit `85edc27`)
- PIALibrary/Mock (from `https://github.com/pia-foss/client-library-apple`, commit `85edc27`)
- PIALibrary/UI (from `https://github.com/pia-foss/client-library-apple`, commit `85edc27`)
- PIALibrary/VPN (from `https://github.com/pia-foss/client-library-apple`, commit `85edc27`)
- PIALibrary/Library (from `https://github.com/pia-foss/client-library-apple`, commit `ac88c39`)
- PIALibrary/Mock (from `https://github.com/pia-foss/client-library-apple`, commit `ac88c39`)
- PIALibrary/UI (from `https://github.com/pia-foss/client-library-apple`, commit `ac88c39`)
- PIALibrary/VPN (from `https://github.com/pia-foss/client-library-apple`, commit `ac88c39`)
- PIATunnel (from `https://github.com/pia-foss/tunnel-apple`, commit `257296c`)
- PopupDialog
- SideMenu (= 3.1.5)
......@@ -154,7 +154,7 @@ SPEC REPOS:
EXTERNAL SOURCES:
PIALibrary:
:commit: 85edc27
:commit: ac88c39
:git: https://github.com/pia-foss/client-library-apple
PIATunnel:
:commit: 257296c
......@@ -162,7 +162,7 @@ EXTERNAL SOURCES:
CHECKOUT OPTIONS:
PIALibrary:
:commit: 85edc27
:commit: ac88c39
:git: https://github.com/pia-foss/client-library-apple
PIATunnel:
:commit: 257296c
......@@ -198,6 +198,6 @@ SPEC CHECKSUMS:
SwiftyBeaver: 4cc0080d2e23f980652e28978db11a5c9da39165
TPKeyboardAvoiding: cb69d5ddbe90ce0170e4bc2db1e5e41d4a3ad9a4
PODFILE CHECKSUM: 102f615cc4d115c44baacd7ad469ed8c9e4cbd47
PODFILE CHECKSUM: 2b195f440f43c61a73477f7f88982f3df3e67a78
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