Skip to content

Commit

Permalink
Enum fix
Browse files Browse the repository at this point in the history
Fixed issue with the StoreKitVersion enum that initiate the correct StoreKit class
  • Loading branch information
al-af committed Jan 19, 2025
1 parent 26b0a57 commit a7597a8
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 10 deletions.
6 changes: 3 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion ios/PCAppsFlyer.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

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

@implementation PCAppsFlyer
@synthesize bridge = _bridge;
Expand Down
2 changes: 2 additions & 0 deletions ios/RNAppsFlyer-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@

#import <Foundation/Foundation.h>
#import <PurchaseConnector/PurchaseConnector.h>
#import <React/RCTBridgeModule.h>
#import <React/RCTViewManager.h>

#endif /* _RNAppsFlyer_Bridging_Header_h */
2 changes: 2 additions & 0 deletions ios/RNAppsFlyer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#import <objc/message.h>
#if __has_include(<AppsFlyerLib/AppsFlyerLib.h>) // from Pod
#import <AppsFlyerLib/AppsFlyerLib.h>
@class PCAppsFlyer;

#else
#import "AppsFlyerLib.h"
#endif
Expand Down
10 changes: 6 additions & 4 deletions ios/RNAppsFlyer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down Expand Up @@ -38,8 +38,8 @@
7E215B3C2D3683B60088EE50 /* AppsFlyerLib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppsFlyerLib.h; sourceTree = "<group>"; };
7E215B3D2D3683B60088EE50 /* PCAppsFlyer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PCAppsFlyer.h; sourceTree = "<group>"; };
7E215B3E2D3683B60088EE50 /* PCAppsFlyer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PCAppsFlyer.m; sourceTree = "<group>"; };
7E215B3F2D3683B60088EE50 /* TransactionFetcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionFetcher.swift; sourceTree = "<group>"; };
7E215B492D37AEE10088EE50 /* RNAppsFlyer-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RNAppsFlyer-Bridging-Header.h"; sourceTree = "<group>"; };
7E64BC5A2D3D0DB10030E1A6 /* TransactionFetcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionFetcher.swift; sourceTree = "<group>"; };
943704C6209F6734005B3A22 /* AppsFlyerShareInviteHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppsFlyerShareInviteHelper.h; sourceTree = "<group>"; };
943704C7209F6734005B3A22 /* AppsFlyerLinkGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppsFlyerLinkGenerator.h; sourceTree = "<group>"; };
943704C9209F6735005B3A22 /* AppsFlyerCrossPromotionHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppsFlyerCrossPromotionHelper.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -69,6 +69,7 @@
58B511D21A9E6C8500147676 = {
isa = PBXGroup;
children = (
7E64BC5A2D3D0DB10030E1A6 /* TransactionFetcher.swift */,
7E215B352D3683B60088EE50 /* AFAdRevenueData.h */,
7E215B362D3683B60088EE50 /* AppsFlyerAttribution.h */,
7E215B372D3683B60088EE50 /* AppsFlyerAttribution.m */,
Expand All @@ -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 */,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
12 changes: 11 additions & 1 deletion ios/TransactionFetcher.swift
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -25,3 +34,4 @@ import PurchaseConnector
}
}
}
#endif
2 changes: 1 addition & 1 deletion react-native-appsflyer.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit a7597a8

Please sign in to comment.