diff --git a/index.d.ts b/index.d.ts index 7bac9dd6..c07a4215 100644 --- a/index.d.ts +++ b/index.d.ts @@ -166,9 +166,9 @@ declare module "react-native-appsflyer" { /** * PurchaseConnector */ - export const StoreKitVersion = { - SK1: "SK1", - SK2: "SK2", + export enum StoreKitVersion { + SK1, + SK2, }; export interface PurchaseConnectorConfig { diff --git a/index.js b/index.js index 17a6a755..86f2d7a3 100755 --- a/index.js +++ b/index.js @@ -203,6 +203,11 @@ function logConsumableTransaction(transactionId){ AppsFlyerPurchaseConnector.logConsumableTransaction = logConsumableTransaction; +export const StoreKitVersion = Object.freeze({ + SK1: "SK1", + SK2: "SK2", +}); + const AppsFlyerPurchaseConnectorConfig = { setConfig: ({ logSubscriptions, logInApps, sandbox, storeKitVersion }) => { return { diff --git a/ios/PCAppsFlyer.m b/ios/PCAppsFlyer.m index e3a3654a..52ab75a1 100644 --- a/ios/PCAppsFlyer.m +++ b/ios/PCAppsFlyer.m @@ -7,7 +7,6 @@ #if __has_include() #import -#import "RNAppsFlyer-Swift.h" @implementation PCAppsFlyer @synthesize bridge = _bridge; diff --git a/ios/RNAppsFlyer-Bridging-Header.h b/ios/RNAppsFlyer-Bridging-Header.h index cfb64c9b..68728491 100644 --- a/ios/RNAppsFlyer-Bridging-Header.h +++ b/ios/RNAppsFlyer-Bridging-Header.h @@ -11,5 +11,7 @@ #import #import +#import +#import #endif /* _RNAppsFlyer_Bridging_Header_h */ diff --git a/ios/RNAppsFlyer.h b/ios/RNAppsFlyer.h index 8a4123f0..a6bf8bc5 100755 --- a/ios/RNAppsFlyer.h +++ b/ios/RNAppsFlyer.h @@ -12,6 +12,8 @@ #import #if __has_include() // from Pod #import +@class PCAppsFlyer; + #else #import "AppsFlyerLib.h" #endif diff --git a/ios/RNAppsFlyer.xcodeproj/project.pbxproj b/ios/RNAppsFlyer.xcodeproj/project.pbxproj index 7d710e59..9194410a 100644 --- a/ios/RNAppsFlyer.xcodeproj/project.pbxproj +++ b/ios/RNAppsFlyer.xcodeproj/project.pbxproj @@ -8,9 +8,9 @@ /* Begin PBXBuildFile section */ 7E215B402D3683B60088EE50 /* PCAppsFlyer.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E215B3E2D3683B60088EE50 /* PCAppsFlyer.m */; }; - 7E215B412D3683B60088EE50 /* TransactionFetcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E215B3F2D3683B60088EE50 /* TransactionFetcher.swift */; }; 7E215B422D3683B60088EE50 /* AppsFlyerAttribution.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E215B372D3683B60088EE50 /* AppsFlyerAttribution.m */; }; 7E215B4B2D37AFF60088EE50 /* RNAppsFlyer-Bridging-Header.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E215B492D37AEE10088EE50 /* RNAppsFlyer-Bridging-Header.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 7E64BC5B2D3D0DB10030E1A6 /* TransactionFetcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E64BC5A2D3D0DB10030E1A6 /* TransactionFetcher.swift */; }; B3E7B58A1CC2AC0600A0062D /* RNAppsFlyer.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNAppsFlyer.m */; }; /* End PBXBuildFile section */ @@ -38,8 +38,8 @@ 7E215B3C2D3683B60088EE50 /* AppsFlyerLib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppsFlyerLib.h; sourceTree = ""; }; 7E215B3D2D3683B60088EE50 /* PCAppsFlyer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PCAppsFlyer.h; sourceTree = ""; }; 7E215B3E2D3683B60088EE50 /* PCAppsFlyer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PCAppsFlyer.m; sourceTree = ""; }; - 7E215B3F2D3683B60088EE50 /* TransactionFetcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionFetcher.swift; sourceTree = ""; }; 7E215B492D37AEE10088EE50 /* RNAppsFlyer-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RNAppsFlyer-Bridging-Header.h"; sourceTree = ""; }; + 7E64BC5A2D3D0DB10030E1A6 /* TransactionFetcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionFetcher.swift; sourceTree = ""; }; 943704C6209F6734005B3A22 /* AppsFlyerShareInviteHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppsFlyerShareInviteHelper.h; sourceTree = ""; }; 943704C7209F6734005B3A22 /* AppsFlyerLinkGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppsFlyerLinkGenerator.h; sourceTree = ""; }; 943704C9209F6735005B3A22 /* AppsFlyerCrossPromotionHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppsFlyerCrossPromotionHelper.h; sourceTree = ""; }; @@ -69,6 +69,7 @@ 58B511D21A9E6C8500147676 = { isa = PBXGroup; children = ( + 7E64BC5A2D3D0DB10030E1A6 /* TransactionFetcher.swift */, 7E215B352D3683B60088EE50 /* AFAdRevenueData.h */, 7E215B362D3683B60088EE50 /* AppsFlyerAttribution.h */, 7E215B372D3683B60088EE50 /* AppsFlyerAttribution.m */, @@ -79,7 +80,6 @@ 7E215B3C2D3683B60088EE50 /* AppsFlyerLib.h */, 7E215B3D2D3683B60088EE50 /* PCAppsFlyer.h */, 7E215B3E2D3683B60088EE50 /* PCAppsFlyer.m */, - 7E215B3F2D3683B60088EE50 /* TransactionFetcher.swift */, 943704C9209F6735005B3A22 /* AppsFlyerCrossPromotionHelper.h */, 943704C7209F6734005B3A22 /* AppsFlyerLinkGenerator.h */, 943704C6209F6734005B3A22 /* AppsFlyerShareInviteHelper.h */, @@ -170,7 +170,7 @@ files = ( B3E7B58A1CC2AC0600A0062D /* RNAppsFlyer.m in Sources */, 7E215B402D3683B60088EE50 /* PCAppsFlyer.m in Sources */, - 7E215B412D3683B60088EE50 /* TransactionFetcher.swift in Sources */, + 7E64BC5B2D3D0DB10030E1A6 /* TransactionFetcher.swift in Sources */, 7E215B422D3683B60088EE50 /* AppsFlyerAttribution.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -256,6 +256,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; + DEFINES_MODULE = YES; HEADER_SEARCH_PATHS = ( "$(inherited)", /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, @@ -277,6 +278,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; + DEFINES_MODULE = YES; HEADER_SEARCH_PATHS = ( "$(inherited)", /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, diff --git a/ios/TransactionFetcher.swift b/ios/TransactionFetcher.swift index f116c5dc..9bb802e1 100644 --- a/ios/TransactionFetcher.swift +++ b/ios/TransactionFetcher.swift @@ -1,7 +1,16 @@ +// +// TransactionFetcher.swift +// RNAppsFlyer +// +// Created by Amit Levy on 19/01/2025. +// Copyright © 2025 Facebook. All rights reserved. +// + import Foundation import StoreKit -import PurchaseConnector +#if canImport(PurchaseConnector) +import PurchaseConnector @objc class TransactionFetcher: NSObject { @objc static func fetchTransaction(withId transactionId: String, completion: @escaping (AFSDKTransactionSK2?) -> Void) { Task { @@ -25,3 +34,4 @@ import PurchaseConnector } } } +#endif diff --git a/react-native-appsflyer.podspec b/react-native-appsflyer.podspec index 4e3c7b35..4790e8cd 100644 --- a/react-native-appsflyer.podspec +++ b/react-native-appsflyer.podspec @@ -14,7 +14,7 @@ Pod::Spec.new do |s| s.platform = :ios, "12.0" s.static_framework = true s.dependency 'React' - + # AppsFlyerPurchaseConnector if defined?($AppsFlyerPurchaseConnector) && ($AppsFlyerPurchaseConnector == true) Pod::UI.puts "#{s.name}: Including PurchaseConnector."