Skip to content

Commit a7597a8

Browse files
committed
Enum fix
Fixed issue with the StoreKitVersion enum that initiate the correct StoreKit class
1 parent 26b0a57 commit a7597a8

File tree

8 files changed

+30
-10
lines changed

8 files changed

+30
-10
lines changed

index.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ declare module "react-native-appsflyer" {
166166
/**
167167
* PurchaseConnector
168168
*/
169-
export const StoreKitVersion = {
170-
SK1: "SK1",
171-
SK2: "SK2",
169+
export enum StoreKitVersion {
170+
SK1,
171+
SK2,
172172
};
173173

174174
export interface PurchaseConnectorConfig {

index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,11 @@ function logConsumableTransaction(transactionId){
203203

204204
AppsFlyerPurchaseConnector.logConsumableTransaction = logConsumableTransaction;
205205

206+
export const StoreKitVersion = Object.freeze({
207+
SK1: "SK1",
208+
SK2: "SK2",
209+
});
210+
206211
const AppsFlyerPurchaseConnectorConfig = {
207212
setConfig: ({ logSubscriptions, logInApps, sandbox, storeKitVersion }) => {
208213
return {

ios/PCAppsFlyer.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
#if __has_include(<PurchaseConnector/PurchaseConnector.h>)
99
#import <PurchaseConnector/PurchaseConnector.h>
10-
#import "RNAppsFlyer-Swift.h"
1110

1211
@implementation PCAppsFlyer
1312
@synthesize bridge = _bridge;

ios/RNAppsFlyer-Bridging-Header.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@
1111

1212
#import <Foundation/Foundation.h>
1313
#import <PurchaseConnector/PurchaseConnector.h>
14+
#import <React/RCTBridgeModule.h>
15+
#import <React/RCTViewManager.h>
1416

1517
#endif /* _RNAppsFlyer_Bridging_Header_h */

ios/RNAppsFlyer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#import <objc/message.h>
1313
#if __has_include(<AppsFlyerLib/AppsFlyerLib.h>) // from Pod
1414
#import <AppsFlyerLib/AppsFlyerLib.h>
15+
@class PCAppsFlyer;
16+
1517
#else
1618
#import "AppsFlyerLib.h"
1719
#endif

ios/RNAppsFlyer.xcodeproj/project.pbxproj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
/* Begin PBXBuildFile section */
1010
7E215B402D3683B60088EE50 /* PCAppsFlyer.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E215B3E2D3683B60088EE50 /* PCAppsFlyer.m */; };
11-
7E215B412D3683B60088EE50 /* TransactionFetcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E215B3F2D3683B60088EE50 /* TransactionFetcher.swift */; };
1211
7E215B422D3683B60088EE50 /* AppsFlyerAttribution.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E215B372D3683B60088EE50 /* AppsFlyerAttribution.m */; };
1312
7E215B4B2D37AFF60088EE50 /* RNAppsFlyer-Bridging-Header.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E215B492D37AEE10088EE50 /* RNAppsFlyer-Bridging-Header.h */; settings = {ATTRIBUTES = (Private, ); }; };
13+
7E64BC5B2D3D0DB10030E1A6 /* TransactionFetcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E64BC5A2D3D0DB10030E1A6 /* TransactionFetcher.swift */; };
1414
B3E7B58A1CC2AC0600A0062D /* RNAppsFlyer.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNAppsFlyer.m */; };
1515
/* End PBXBuildFile section */
1616

@@ -38,8 +38,8 @@
3838
7E215B3C2D3683B60088EE50 /* AppsFlyerLib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppsFlyerLib.h; sourceTree = "<group>"; };
3939
7E215B3D2D3683B60088EE50 /* PCAppsFlyer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PCAppsFlyer.h; sourceTree = "<group>"; };
4040
7E215B3E2D3683B60088EE50 /* PCAppsFlyer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PCAppsFlyer.m; sourceTree = "<group>"; };
41-
7E215B3F2D3683B60088EE50 /* TransactionFetcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionFetcher.swift; sourceTree = "<group>"; };
4241
7E215B492D37AEE10088EE50 /* RNAppsFlyer-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RNAppsFlyer-Bridging-Header.h"; sourceTree = "<group>"; };
42+
7E64BC5A2D3D0DB10030E1A6 /* TransactionFetcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionFetcher.swift; sourceTree = "<group>"; };
4343
943704C6209F6734005B3A22 /* AppsFlyerShareInviteHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppsFlyerShareInviteHelper.h; sourceTree = "<group>"; };
4444
943704C7209F6734005B3A22 /* AppsFlyerLinkGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppsFlyerLinkGenerator.h; sourceTree = "<group>"; };
4545
943704C9209F6735005B3A22 /* AppsFlyerCrossPromotionHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppsFlyerCrossPromotionHelper.h; sourceTree = "<group>"; };
@@ -69,6 +69,7 @@
6969
58B511D21A9E6C8500147676 = {
7070
isa = PBXGroup;
7171
children = (
72+
7E64BC5A2D3D0DB10030E1A6 /* TransactionFetcher.swift */,
7273
7E215B352D3683B60088EE50 /* AFAdRevenueData.h */,
7374
7E215B362D3683B60088EE50 /* AppsFlyerAttribution.h */,
7475
7E215B372D3683B60088EE50 /* AppsFlyerAttribution.m */,
@@ -79,7 +80,6 @@
7980
7E215B3C2D3683B60088EE50 /* AppsFlyerLib.h */,
8081
7E215B3D2D3683B60088EE50 /* PCAppsFlyer.h */,
8182
7E215B3E2D3683B60088EE50 /* PCAppsFlyer.m */,
82-
7E215B3F2D3683B60088EE50 /* TransactionFetcher.swift */,
8383
943704C9209F6735005B3A22 /* AppsFlyerCrossPromotionHelper.h */,
8484
943704C7209F6734005B3A22 /* AppsFlyerLinkGenerator.h */,
8585
943704C6209F6734005B3A22 /* AppsFlyerShareInviteHelper.h */,
@@ -170,7 +170,7 @@
170170
files = (
171171
B3E7B58A1CC2AC0600A0062D /* RNAppsFlyer.m in Sources */,
172172
7E215B402D3683B60088EE50 /* PCAppsFlyer.m in Sources */,
173-
7E215B412D3683B60088EE50 /* TransactionFetcher.swift in Sources */,
173+
7E64BC5B2D3D0DB10030E1A6 /* TransactionFetcher.swift in Sources */,
174174
7E215B422D3683B60088EE50 /* AppsFlyerAttribution.m in Sources */,
175175
);
176176
runOnlyForDeploymentPostprocessing = 0;
@@ -256,6 +256,7 @@
256256
isa = XCBuildConfiguration;
257257
buildSettings = {
258258
CLANG_ENABLE_MODULES = YES;
259+
DEFINES_MODULE = YES;
259260
HEADER_SEARCH_PATHS = (
260261
"$(inherited)",
261262
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
@@ -277,6 +278,7 @@
277278
isa = XCBuildConfiguration;
278279
buildSettings = {
279280
CLANG_ENABLE_MODULES = YES;
281+
DEFINES_MODULE = YES;
280282
HEADER_SEARCH_PATHS = (
281283
"$(inherited)",
282284
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,

ios/TransactionFetcher.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1+
//
2+
// TransactionFetcher.swift
3+
// RNAppsFlyer
4+
//
5+
// Created by Amit Levy on 19/01/2025.
6+
// Copyright © 2025 Facebook. All rights reserved.
7+
//
8+
19
import Foundation
210
import StoreKit
3-
import PurchaseConnector
411

12+
#if canImport(PurchaseConnector)
13+
import PurchaseConnector
514
@objc class TransactionFetcher: NSObject {
615
@objc static func fetchTransaction(withId transactionId: String, completion: @escaping (AFSDKTransactionSK2?) -> Void) {
716
Task {
@@ -25,3 +34,4 @@ import PurchaseConnector
2534
}
2635
}
2736
}
37+
#endif

react-native-appsflyer.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Pod::Spec.new do |s|
1414
s.platform = :ios, "12.0"
1515
s.static_framework = true
1616
s.dependency 'React'
17-
17+
1818
# AppsFlyerPurchaseConnector
1919
if defined?($AppsFlyerPurchaseConnector) && ($AppsFlyerPurchaseConnector == true)
2020
Pod::UI.puts "#{s.name}: Including PurchaseConnector."

0 commit comments

Comments
 (0)