summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2021-12-16 09:55:12 +0100
committerAndrej Mihajlov <and@mullvad.net>2021-12-16 09:55:12 +0100
commitae94a78b4c1b9da70ec0c776b5d27e27cd4f4ebf (patch)
tree6ef2504878fd947f7186434f1570a31a3a0b0193
parent6c774e969f808209c42b1cc8e449f7ac6d6e6f25 (diff)
parent72e61644426d45d2f74f542b5bf746c1b9ec271c (diff)
downloadmullvadvpn-ae94a78b4c1b9da70ec0c776b5d27e27cd4f4ebf.tar.xz
mullvadvpn-ae94a78b4c1b9da70ec0c776b5d27e27cd4f4ebf.zip
Merge branch 'fix-threading-issue'
-rw-r--r--ios/CHANGELOG.md3
-rw-r--r--ios/MullvadVPN/Account.swift14
2 files changed, 11 insertions, 6 deletions
diff --git a/ios/CHANGELOG.md b/ios/CHANGELOG.md
index 36df73fa1b..e9a6f11048 100644
--- a/ios/CHANGELOG.md
+++ b/ios/CHANGELOG.md
@@ -26,6 +26,9 @@ Line wrap the file at 100 chars. Th
### Added
- Show privacy overlay when entering app switcher.
+### Fixed
+- Fix crash occurring after completing in-app purchase.
+
### Changed
- Increase hit area of settings (cog) button.
- Update launch screen.
diff --git a/ios/MullvadVPN/Account.swift b/ios/MullvadVPN/Account.swift
index 14a9e21326..716c6a35a5 100644
--- a/ios/MullvadVPN/Account.swift
+++ b/ios/MullvadVPN/Account.swift
@@ -245,13 +245,15 @@ extension Account: AppStorePaymentObserver {
func appStorePaymentManager(_ manager: AppStorePaymentManager, transaction: SKPaymentTransaction, accountToken: String, didFinishWithResponse response: REST.CreateApplePaymentResponse) {
dispatchQueue.async {
- let newExpiry = response.newExpiry
+ DispatchQueue.main.sync {
+ let newExpiry = response.newExpiry
- // Make sure that payment corresponds to the active account token
- if self.token == accountToken, self.expiry != newExpiry {
- self.expiry = newExpiry
- self.observerList.forEach { (observer) in
- observer.account(self, didUpdateExpiry: newExpiry)
+ // Make sure that payment corresponds to the active account token
+ if self.token == accountToken, self.expiry != newExpiry {
+ self.expiry = newExpiry
+ self.observerList.forEach { (observer) in
+ observer.account(self, didUpdateExpiry: newExpiry)
+ }
}
}
}