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