Fix crash on in-app purchase

Concurrency issue. Purchase is however credited after app relaunch.
This commit is contained in:
Davide De Rosa 2021-07-20 00:21:14 +02:00
parent 414ba01dad
commit 83b6adbf86
4 changed files with 23 additions and 18 deletions

View File

@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## 1.15.3 Beta 2669 (2021-07-16) ## Unreleased
### Added ### Added
@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Crash when adding dynamically updated provider. - Crash when adding dynamically updated provider.
- In-app purchases might crash the app and not be credited until relaunch.
## 1.15.2 (2021-04-17) ## 1.15.2 (2021-04-17)

View File

@ -298,13 +298,17 @@ public class ProductManager: NSObject {
extension ProductManager: SKPaymentTransactionObserver { extension ProductManager: SKPaymentTransactionObserver {
public func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) { public func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
reloadReceipt() DispatchQueue.main.async { [weak self] in
self?.reloadReceipt()
}
} }
} }
extension ProductManager: SKRequestDelegate { extension ProductManager: SKRequestDelegate {
public func requestDidFinish(_ request: SKRequest) { public func requestDidFinish(_ request: SKRequest) {
reloadReceipt() DispatchQueue.main.async { [weak self] in
self?.reloadReceipt()
}
inApp.restorePurchases { [weak self] (finished, _, error) in inApp.restorePurchases { [weak self] (finished, _, error) in
guard finished else { guard finished else {
return return

View File

@ -16,13 +16,13 @@ end
def shared_pods_ios def shared_pods_ios
shared_pods shared_pods
for spec in ['About', 'Alerts', 'Dialogs', 'InApp', 'Misc', 'Options', 'Persistence', 'Reviewer', 'Tables', 'WebServices'] do for spec in ['About', 'Alerts', 'Dialogs', 'InApp', 'Misc', 'Options', 'Persistence', 'Reviewer', 'Tables', 'WebServices'] do
pod "Convenience/#{spec}", :git => 'https://github.com/keeshux/convenience', :commit => 'b30816a' pod "Convenience/#{spec}", :git => 'https://github.com/keeshux/convenience', :commit => '5ed1fe0'
end end
end end
def shared_pods_macos def shared_pods_macos
shared_pods shared_pods
for spec in ['InApp', 'Misc', 'Persistence', 'Reviewer', 'WebServices'] do for spec in ['InApp', 'Misc', 'Persistence', 'Reviewer', 'WebServices'] do
pod "Convenience/#{spec}", :git => 'https://github.com/keeshux/convenience', :commit => 'b30816a' pod "Convenience/#{spec}", :git => 'https://github.com/keeshux/convenience', :commit => '5ed1fe0'
end end
end end

View File

@ -39,16 +39,16 @@ PODS:
- TunnelKit/Manager - TunnelKit/Manager
DEPENDENCIES: DEPENDENCIES:
- Convenience/About (from `https://github.com/keeshux/convenience`, commit `b30816a`) - Convenience/About (from `https://github.com/keeshux/convenience`, commit `5ed1fe0`)
- Convenience/Alerts (from `https://github.com/keeshux/convenience`, commit `b30816a`) - Convenience/Alerts (from `https://github.com/keeshux/convenience`, commit `5ed1fe0`)
- Convenience/Dialogs (from `https://github.com/keeshux/convenience`, commit `b30816a`) - Convenience/Dialogs (from `https://github.com/keeshux/convenience`, commit `5ed1fe0`)
- Convenience/InApp (from `https://github.com/keeshux/convenience`, commit `b30816a`) - Convenience/InApp (from `https://github.com/keeshux/convenience`, commit `5ed1fe0`)
- Convenience/Misc (from `https://github.com/keeshux/convenience`, commit `b30816a`) - Convenience/Misc (from `https://github.com/keeshux/convenience`, commit `5ed1fe0`)
- Convenience/Options (from `https://github.com/keeshux/convenience`, commit `b30816a`) - Convenience/Options (from `https://github.com/keeshux/convenience`, commit `5ed1fe0`)
- Convenience/Persistence (from `https://github.com/keeshux/convenience`, commit `b30816a`) - Convenience/Persistence (from `https://github.com/keeshux/convenience`, commit `5ed1fe0`)
- Convenience/Reviewer (from `https://github.com/keeshux/convenience`, commit `b30816a`) - Convenience/Reviewer (from `https://github.com/keeshux/convenience`, commit `5ed1fe0`)
- Convenience/Tables (from `https://github.com/keeshux/convenience`, commit `b30816a`) - Convenience/Tables (from `https://github.com/keeshux/convenience`, commit `5ed1fe0`)
- Convenience/WebServices (from `https://github.com/keeshux/convenience`, commit `b30816a`) - Convenience/WebServices (from `https://github.com/keeshux/convenience`, commit `5ed1fe0`)
- Kvitto - Kvitto
- MBProgressHUD - MBProgressHUD
- SSZipArchive - SSZipArchive
@ -67,12 +67,12 @@ SPEC REPOS:
EXTERNAL SOURCES: EXTERNAL SOURCES:
Convenience: Convenience:
:commit: b30816a :commit: 5ed1fe0
:git: https://github.com/keeshux/convenience :git: https://github.com/keeshux/convenience
CHECKOUT OPTIONS: CHECKOUT OPTIONS:
Convenience: Convenience:
:commit: b30816a :commit: 5ed1fe0
:git: https://github.com/keeshux/convenience :git: https://github.com/keeshux/convenience
SPEC CHECKSUMS: SPEC CHECKSUMS:
@ -85,6 +85,6 @@ SPEC CHECKSUMS:
SwiftyBeaver: 84069991dd5dca07d7069100985badaca7f0ce82 SwiftyBeaver: 84069991dd5dca07d7069100985badaca7f0ce82
TunnelKit: 068ff24480fa0f10e2209f3e9a75cfed9b4d78ec TunnelKit: 068ff24480fa0f10e2209f3e9a75cfed9b4d78ec
PODFILE CHECKSUM: 1ee335adb14f0e5517ddeed41e8bed5b0de59ec9 PODFILE CHECKSUM: f88917df911decd28e1ada0b866f3370fb4ae70e
COCOAPODS: 1.10.1 COCOAPODS: 1.10.1