Skip to content

Commit 410f5ea

Browse files
committed
refactor: update NativeRNIterableAPI types for better clarity and consistency
1 parent 499913d commit 410f5ea

2 files changed

Lines changed: 73 additions & 53 deletions

File tree

example/ios/ReactNativeSdkExample.xcodeproj/project.pbxproj

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/* Begin PBXBuildFile section */
1010
00E356F31AD99517003FC87E /* ReactNativeSdkExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* ReactNativeSdkExampleTests.m */; };
1111
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
12-
44AE598FCF24A67370DF7811 /* libPods-ReactNativeSdkExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 724C4B19358944A8B03F3B7A /* libPods-ReactNativeSdkExample.a */; };
12+
596450DDB3A40A1A73EC25AF /* libPods-ReactNativeSdkExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4356A0CDA6783C42DC7C18B4 /* libPods-ReactNativeSdkExample.a */; };
1313
779227342DFA3FB500D69EC0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 779227332DFA3FB500D69EC0 /* AppDelegate.swift */; };
1414
77E3B5772EA71A4B001449CE /* IterableJwtGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77E3B5742EA71A4B001449CE /* IterableJwtGenerator.swift */; };
1515
77E3B5782EA71A4B001449CE /* JwtTokenModule.mm in Sources */ = {isa = PBXBuildFile; fileRef = 77E3B5752EA71A4B001449CE /* JwtTokenModule.mm */; };
@@ -38,17 +38,17 @@
3838
13B07FB71A68108700A75B9A /* ReactNativeSdkExample.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; name = ReactNativeSdkExample.entitlements; path = ReactNativeSdkExample/ReactNativeSdkExample.entitlements; sourceTree = "<group>"; };
3939
13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = ReactNativeSdkExample/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
4040
1FC6B09E65A7BD9F6864C5D8 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = ReactNativeSdkExample/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
41-
3AFE1C7C1E38AF7B1761840C /* Pods-ReactNativeSdkExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeSdkExample.debug.xcconfig"; path = "Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample.debug.xcconfig"; sourceTree = "<group>"; };
42-
724C4B19358944A8B03F3B7A /* libPods-ReactNativeSdkExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ReactNativeSdkExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
41+
4356A0CDA6783C42DC7C18B4 /* libPods-ReactNativeSdkExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ReactNativeSdkExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
42+
5E8CF46506AE2695007560C5 /* Pods-ReactNativeSdkExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeSdkExample.release.xcconfig"; path = "Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample.release.xcconfig"; sourceTree = "<group>"; };
4343
779227312DFA3FB500D69EC0 /* ReactNativeSdkExample-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ReactNativeSdkExample-Bridging-Header.h"; sourceTree = "<group>"; };
4444
779227322DFA3FB500D69EC0 /* ReactNativeSdkExampleTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ReactNativeSdkExampleTests-Bridging-Header.h"; sourceTree = "<group>"; };
4545
779227332DFA3FB500D69EC0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = ReactNativeSdkExample/AppDelegate.swift; sourceTree = "<group>"; };
4646
77E3B5742EA71A4B001449CE /* IterableJwtGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IterableJwtGenerator.swift; sourceTree = "<group>"; };
4747
77E3B5752EA71A4B001449CE /* JwtTokenModule.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = JwtTokenModule.mm; sourceTree = "<group>"; };
4848
77E3B5762EA71A4B001449CE /* JwtTokenModule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JwtTokenModule.swift; sourceTree = "<group>"; };
4949
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = ReactNativeSdkExample/LaunchScreen.storyboard; sourceTree = "<group>"; };
50+
93837B700FD8897068E97CF6 /* Pods-ReactNativeSdkExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeSdkExample.debug.xcconfig"; path = "Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample.debug.xcconfig"; sourceTree = "<group>"; };
5051
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
51-
FE76BB2F9801A4485C56C8C8 /* Pods-ReactNativeSdkExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeSdkExample.release.xcconfig"; path = "Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample.release.xcconfig"; sourceTree = "<group>"; };
5252
/* End PBXFileReference section */
5353

5454
/* Begin PBXFrameworksBuildPhase section */
@@ -63,7 +63,7 @@
6363
isa = PBXFrameworksBuildPhase;
6464
buildActionMask = 2147483647;
6565
files = (
66-
44AE598FCF24A67370DF7811 /* libPods-ReactNativeSdkExample.a in Frameworks */,
66+
596450DDB3A40A1A73EC25AF /* libPods-ReactNativeSdkExample.a in Frameworks */,
6767
);
6868
runOnlyForDeploymentPostprocessing = 0;
6969
};
@@ -107,7 +107,7 @@
107107
isa = PBXGroup;
108108
children = (
109109
ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
110-
724C4B19358944A8B03F3B7A /* libPods-ReactNativeSdkExample.a */,
110+
4356A0CDA6783C42DC7C18B4 /* libPods-ReactNativeSdkExample.a */,
111111
);
112112
name = Frameworks;
113113
sourceTree = "<group>";
@@ -149,8 +149,8 @@
149149
BBD78D7AC51CEA395F1C20DB /* Pods */ = {
150150
isa = PBXGroup;
151151
children = (
152-
3AFE1C7C1E38AF7B1761840C /* Pods-ReactNativeSdkExample.debug.xcconfig */,
153-
FE76BB2F9801A4485C56C8C8 /* Pods-ReactNativeSdkExample.release.xcconfig */,
152+
93837B700FD8897068E97CF6 /* Pods-ReactNativeSdkExample.debug.xcconfig */,
153+
5E8CF46506AE2695007560C5 /* Pods-ReactNativeSdkExample.release.xcconfig */,
154154
);
155155
path = Pods;
156156
sourceTree = "<group>";
@@ -180,13 +180,13 @@
180180
isa = PBXNativeTarget;
181181
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ReactNativeSdkExample" */;
182182
buildPhases = (
183-
73EB3CBE3FC03355C1E58442 /* [CP] Check Pods Manifest.lock */,
183+
0ED7BA884DACF5A6E38ACDCC /* [CP] Check Pods Manifest.lock */,
184184
13B07F871A680F5B00A75B9A /* Sources */,
185185
13B07F8C1A680F5B00A75B9A /* Frameworks */,
186186
13B07F8E1A680F5B00A75B9A /* Resources */,
187187
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
188-
446825949D92109949A800CD /* [CP] Embed Pods Frameworks */,
189-
E8AD8F487921A3B589C003A6 /* [CP] Copy Pods Resources */,
188+
3DAD599FC24B58D2906BFF04 /* [CP] Embed Pods Frameworks */,
189+
785550DFF7BFF643D9B70F09 /* [CP] Copy Pods Resources */,
190190
);
191191
buildRules = (
192192
);
@@ -271,46 +271,46 @@
271271
shellPath = /bin/sh;
272272
shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"\\\"$WITH_ENVIRONMENT\\\" \\\"$REACT_NATIVE_XCODE\\\"\"\n";
273273
};
274-
446825949D92109949A800CD /* [CP] Embed Pods Frameworks */ = {
274+
0ED7BA884DACF5A6E38ACDCC /* [CP] Check Pods Manifest.lock */ = {
275275
isa = PBXShellScriptBuildPhase;
276276
buildActionMask = 2147483647;
277277
files = (
278278
);
279279
inputFileListPaths = (
280-
"${PODS_ROOT}/Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample-frameworks-${CONFIGURATION}-input-files.xcfilelist",
281280
);
282-
name = "[CP] Embed Pods Frameworks";
281+
inputPaths = (
282+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
283+
"${PODS_ROOT}/Manifest.lock",
284+
);
285+
name = "[CP] Check Pods Manifest.lock";
283286
outputFileListPaths = (
284-
"${PODS_ROOT}/Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample-frameworks-${CONFIGURATION}-output-files.xcfilelist",
287+
);
288+
outputPaths = (
289+
"$(DERIVED_FILE_DIR)/Pods-ReactNativeSdkExample-checkManifestLockResult.txt",
285290
);
286291
runOnlyForDeploymentPostprocessing = 0;
287292
shellPath = /bin/sh;
288-
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample-frameworks.sh\"\n";
293+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
289294
showEnvVarsInLog = 0;
290295
};
291-
73EB3CBE3FC03355C1E58442 /* [CP] Check Pods Manifest.lock */ = {
296+
3DAD599FC24B58D2906BFF04 /* [CP] Embed Pods Frameworks */ = {
292297
isa = PBXShellScriptBuildPhase;
293298
buildActionMask = 2147483647;
294299
files = (
295300
);
296301
inputFileListPaths = (
302+
"${PODS_ROOT}/Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample-frameworks-${CONFIGURATION}-input-files.xcfilelist",
297303
);
298-
inputPaths = (
299-
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
300-
"${PODS_ROOT}/Manifest.lock",
301-
);
302-
name = "[CP] Check Pods Manifest.lock";
304+
name = "[CP] Embed Pods Frameworks";
303305
outputFileListPaths = (
304-
);
305-
outputPaths = (
306-
"$(DERIVED_FILE_DIR)/Pods-ReactNativeSdkExample-checkManifestLockResult.txt",
306+
"${PODS_ROOT}/Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample-frameworks-${CONFIGURATION}-output-files.xcfilelist",
307307
);
308308
runOnlyForDeploymentPostprocessing = 0;
309309
shellPath = /bin/sh;
310-
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
310+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample-frameworks.sh\"\n";
311311
showEnvVarsInLog = 0;
312312
};
313-
E8AD8F487921A3B589C003A6 /* [CP] Copy Pods Resources */ = {
313+
785550DFF7BFF643D9B70F09 /* [CP] Copy Pods Resources */ = {
314314
isa = PBXShellScriptBuildPhase;
315315
buildActionMask = 2147483647;
316316
files = (
@@ -420,7 +420,7 @@
420420
};
421421
13B07F941A680F5B00A75B9A /* Debug */ = {
422422
isa = XCBuildConfiguration;
423-
baseConfigurationReference = 3AFE1C7C1E38AF7B1761840C /* Pods-ReactNativeSdkExample.debug.xcconfig */;
423+
baseConfigurationReference = 93837B700FD8897068E97CF6 /* Pods-ReactNativeSdkExample.debug.xcconfig */;
424424
buildSettings = {
425425
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
426426
CLANG_ENABLE_MODULES = YES;
@@ -453,7 +453,7 @@
453453
};
454454
13B07F951A680F5B00A75B9A /* Release */ = {
455455
isa = XCBuildConfiguration;
456-
baseConfigurationReference = FE76BB2F9801A4485C56C8C8 /* Pods-ReactNativeSdkExample.release.xcconfig */;
456+
baseConfigurationReference = 5E8CF46506AE2695007560C5 /* Pods-ReactNativeSdkExample.release.xcconfig */;
457457
buildSettings = {
458458
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
459459
CLANG_ENABLE_MODULES = YES;
@@ -558,14 +558,18 @@
558558
);
559559
MTL_ENABLE_DEBUG_INFO = YES;
560560
ONLY_ACTIVE_ARCH = YES;
561-
OTHER_CFLAGS = "$(inherited)";
561+
OTHER_CFLAGS = (
562+
"$(inherited)",
563+
"-DRCT_REMOVE_LEGACY_ARCH=1",
564+
);
562565
OTHER_CPLUSPLUSFLAGS = (
563566
"$(OTHER_CFLAGS)",
564567
"-DFOLLY_NO_CONFIG",
565568
"-DFOLLY_MOBILE=1",
566569
"-DFOLLY_USE_LIBCPP=1",
567570
"-DFOLLY_CFG_NO_COROUTINES=1",
568571
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
572+
"-DRCT_REMOVE_LEGACY_ARCH=1",
569573
);
570574
OTHER_LDFLAGS = (
571575
"$(inherited)",
@@ -574,6 +578,7 @@
574578
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
575579
SDKROOT = iphoneos;
576580
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
581+
SWIFT_ENABLE_EXPLICIT_MODULES = NO;
577582
USE_HERMES = true;
578583
};
579584
name = Debug;
@@ -646,21 +651,26 @@
646651
"\"$(inherited)\"",
647652
);
648653
MTL_ENABLE_DEBUG_INFO = NO;
649-
OTHER_CFLAGS = "$(inherited)";
654+
OTHER_CFLAGS = (
655+
"$(inherited)",
656+
"-DRCT_REMOVE_LEGACY_ARCH=1",
657+
);
650658
OTHER_CPLUSPLUSFLAGS = (
651659
"$(OTHER_CFLAGS)",
652660
"-DFOLLY_NO_CONFIG",
653661
"-DFOLLY_MOBILE=1",
654662
"-DFOLLY_USE_LIBCPP=1",
655663
"-DFOLLY_CFG_NO_COROUTINES=1",
656664
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
665+
"-DRCT_REMOVE_LEGACY_ARCH=1",
657666
);
658667
OTHER_LDFLAGS = (
659668
"$(inherited)",
660669
" ",
661670
);
662671
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
663672
SDKROOT = iphoneos;
673+
SWIFT_ENABLE_EXPLICIT_MODULES = NO;
664674
USE_HERMES = true;
665675
VALIDATE_PRODUCT = YES;
666676
};

src/api/NativeRNIterableAPI.ts

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,20 @@ interface EmbeddedMessage {
1111
isProof?: boolean;
1212
};
1313
elements: {
14-
buttons?:
15-
| {
16-
id: string;
17-
title?: string | null;
18-
action: { type: string; data?: string } | null;
19-
}[]
20-
| null;
14+
buttons?: Array<{
15+
id: string;
16+
title?: string | null;
17+
action: { type: string; data?: string } | null;
18+
}> | null;
2119
body?: string | null;
2220
mediaUrl?: string | null;
2321
mediaUrlCaption?: string | null;
2422
defaultAction?: { type: string; data?: string } | null;
25-
text?: { id: string; text?: string | null; label?: string | null }[] | null;
23+
text?: Array<{
24+
id: string;
25+
text?: string | null;
26+
label?: string | null;
27+
}> | null;
2628
title?: string | null;
2729
} | null;
2830
payload?: { [key: string]: string | number | boolean | null } | null;
@@ -32,13 +34,15 @@ export interface Spec extends TurboModule {
3234
// Initialization
3335
initializeWithApiKey(
3436
apiKey: string,
35-
config: { [key: string]: string | number | boolean | undefined | string[] },
37+
// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types -- RN codegen requires `Object`, not `object`
38+
config: Object,
3639
version: string
3740
): Promise<boolean>;
3841

3942
initialize2WithApiKey(
4043
apiKey: string,
41-
config: { [key: string]: string | number | boolean | undefined | string[] },
44+
// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types -- RN codegen requires `Object`, not `object`
45+
config: Object,
4246
version: string,
4347
apiEndPointOverride: string
4448
): Promise<boolean>;
@@ -51,8 +55,12 @@ export interface Spec extends TurboModule {
5155

5256
// In-app messaging
5357
setInAppShowResponse(number: number): void;
54-
getInAppMessages(): Promise<{ [key: string]: string | number | boolean }[]>;
55-
getInboxMessages(): Promise<{ [key: string]: string | number | boolean }[]>;
58+
getInAppMessages(): Promise<
59+
Array<{ [key: string]: string | number | boolean }>
60+
>;
61+
getInboxMessages(): Promise<
62+
Array<{ [key: string]: string | number | boolean }>
63+
>;
5664
getUnreadInboxMessagesCount(): Promise<number>;
5765
showMessage(messageId: string, consume: boolean): Promise<string | null>;
5866
removeMessage(messageId: string, location: number, source: number): void;
@@ -86,10 +94,12 @@ export interface Spec extends TurboModule {
8694
inAppConsume(messageId: string, location: number, source: number): void;
8795

8896
// Commerce
89-
updateCart(items: { [key: string]: string | number | boolean }[]): void;
97+
updateCart(
98+
items: Array<{ [key: string]: string | number | boolean }>
99+
): void;
90100
trackPurchase(
91101
total: number,
92-
items: { [key: string]: string | number | boolean }[],
102+
items: Array<{ [key: string]: string | number | boolean }>,
93103
dataFields?: { [key: string]: string | number | boolean }
94104
): void;
95105

@@ -124,21 +134,21 @@ export interface Spec extends TurboModule {
124134

125135
// Subscriptions
126136
updateSubscriptions(
127-
emailListIds: number[] | null,
128-
unsubscribedChannelIds: number[] | null,
129-
unsubscribedMessageTypeIds: number[] | null,
130-
subscribedMessageTypeIds: number[] | null,
137+
emailListIds: Array<number> | null,
138+
unsubscribedChannelIds: Array<number> | null,
139+
unsubscribedMessageTypeIds: Array<number> | null,
140+
subscribedMessageTypeIds: Array<number> | null,
131141
campaignId: number,
132142
templateId: number
133143
): void;
134144

135145
// Session tracking
136146
startSession(
137-
visibleRows: { [key: string]: string | number | boolean }[]
147+
visibleRows: Array<{ [key: string]: string | number | boolean }>
138148
): void;
139149
endSession(): void;
140150
updateVisibleRows(
141-
visibleRows: { [key: string]: string | number | boolean }[]
151+
visibleRows: Array<{ [key: string]: string | number | boolean }>
142152
): void;
143153

144154
// Auth
@@ -152,8 +162,8 @@ export interface Spec extends TurboModule {
152162
startEmbeddedImpression(messageId: string, placementId: number): void;
153163
pauseEmbeddedImpression(messageId: string): void;
154164
getEmbeddedMessages(
155-
placementIds: number[] | null
156-
): Promise<EmbeddedMessage[]>;
165+
placementIds: Array<number> | null
166+
): Promise<Array<EmbeddedMessage>>;
157167
trackEmbeddedClick(
158168
message: EmbeddedMessage,
159169
buttonId: string | null,

0 commit comments

Comments
 (0)