-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding to PCConfiguration storeKitVersion enum, adding logConsumableTransaction and transactionFetcher class to handle it.
- Loading branch information
Showing
8 changed files
with
156 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// RNAppsFlyer-Bridging-Header.h | ||
// RNAppsFlyer | ||
// | ||
// Created by Amit Levy on 15/01/2025. | ||
// Copyright © 2025 Facebook. All rights reserved. | ||
// | ||
|
||
#ifndef _RNAppsFlyer_Bridging_Header_h | ||
#define _RNAppsFlyer_Bridging_Header_h | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <PurchaseConnector/PurchaseConnector.h> | ||
|
||
#endif /* _RNAppsFlyer_Bridging_Header_h */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import Foundation | ||
import StoreKit | ||
import PurchaseConnector | ||
|
||
@objc class TransactionFetcher: NSObject { | ||
@objc static func fetchTransaction(withId transactionId: String, completion: @escaping (AFSDKTransactionSK2?) -> Void) { | ||
Task { | ||
if #available(iOS 15.0, *) { | ||
do { | ||
let allTransactions = try await Transaction.all | ||
if let matchingTransaction = allTransactions.first(where: { $0.id == UInt64(transactionId) }) { | ||
let afTransaction = AFSDKTransactionSK2(transaction: matchingTransaction) | ||
completion(afTransaction) | ||
} else { | ||
completion(nil) | ||
} | ||
} catch { | ||
print("Error fetching transactions: \(error)") | ||
completion(nil) | ||
} | ||
} else { | ||
print("StoreKit 2 is not available on this iOS version.") | ||
completion(nil) | ||
} | ||
} | ||
} | ||
} |