Skip to content

Commit 243722c

Browse files
authored
Merge pull request #795 from Iterable/feature/embedded/SDK-237-ios-setup-embedded-integration-for-ios
[SDK-237] Set up embedded for iOS
2 parents 64ebe17 + 0894bad commit 243722c

File tree

4 files changed

+31
-11
lines changed

4 files changed

+31
-11
lines changed

example/ios/ReactNativeSdkExample.xcodeproj/project.pbxproj

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
13B07F961A680F5B00A75B9A /* ReactNativeSdkExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ReactNativeSdkExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
3636
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = ReactNativeSdkExample/Images.xcassets; sourceTree = "<group>"; };
3737
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = ReactNativeSdkExample/Info.plist; sourceTree = "<group>"; };
38+
13B07FB71A68108700A75B9A /* ReactNativeSdkExample.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; name = ReactNativeSdkExample.entitlements; path = ReactNativeSdkExample/ReactNativeSdkExample.entitlements; sourceTree = "<group>"; };
3839
13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = ReactNativeSdkExample/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
3940
1FC6B09E65A7BD9F6864C5D8 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = ReactNativeSdkExample/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
4041
3A95ED4563D4389808EDEA8F /* 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>"; };
@@ -91,6 +92,7 @@
9192
children = (
9293
13B07FB51A68108700A75B9A /* Images.xcassets */,
9394
779227332DFA3FB500D69EC0 /* AppDelegate.swift */,
95+
13B07FB71A68108700A75B9A /* ReactNativeSdkExample.entitlements */,
9496
13B07FB61A68108700A75B9A /* Info.plist */,
9597
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */,
9698
13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */,
@@ -277,14 +279,10 @@
277279
inputFileListPaths = (
278280
"${PODS_ROOT}/Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample-frameworks-${CONFIGURATION}-input-files.xcfilelist",
279281
);
280-
inputPaths = (
281-
);
282282
name = "[CP] Embed Pods Frameworks";
283283
outputFileListPaths = (
284284
"${PODS_ROOT}/Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample-frameworks-${CONFIGURATION}-output-files.xcfilelist",
285285
);
286-
outputPaths = (
287-
);
288286
runOnlyForDeploymentPostprocessing = 0;
289287
shellPath = /bin/sh;
290288
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample-frameworks.sh\"\n";
@@ -320,14 +318,10 @@
320318
inputFileListPaths = (
321319
"${PODS_ROOT}/Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample-resources-${CONFIGURATION}-input-files.xcfilelist",
322320
);
323-
inputPaths = (
324-
);
325321
name = "[CP] Copy Pods Resources";
326322
outputFileListPaths = (
327323
"${PODS_ROOT}/Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample-resources-${CONFIGURATION}-output-files.xcfilelist",
328324
);
329-
outputPaths = (
330-
);
331325
runOnlyForDeploymentPostprocessing = 0;
332326
shellPath = /bin/sh;
333327
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample-resources.sh\"\n";
@@ -430,6 +424,7 @@
430424
buildSettings = {
431425
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
432426
CLANG_ENABLE_MODULES = YES;
427+
CODE_SIGN_ENTITLEMENTS = ReactNativeSdkExample/ReactNativeSdkExample.entitlements;
433428
CURRENT_PROJECT_VERSION = 1;
434429
DEVELOPMENT_TEAM = BP98Z28R86;
435430
ENABLE_BITCODE = NO;
@@ -460,6 +455,7 @@
460455
buildSettings = {
461456
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
462457
CLANG_ENABLE_MODULES = YES;
458+
CODE_SIGN_ENTITLEMENTS = ReactNativeSdkExample/ReactNativeSdkExample.entitlements;
463459
CURRENT_PROJECT_VERSION = 1;
464460
DEVELOPMENT_TEAM = BP98Z28R86;
465461
INFOPLIST_FILE = ReactNativeSdkExample/Info.plist;
@@ -555,7 +551,10 @@
555551
"-DFOLLY_CFG_NO_COROUTINES=1",
556552
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
557553
);
558-
OTHER_LDFLAGS = "$(inherited) ";
554+
OTHER_LDFLAGS = (
555+
"$(inherited)",
556+
" ",
557+
);
559558
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
560559
SDKROOT = iphoneos;
561560
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
@@ -628,7 +627,10 @@
628627
"-DFOLLY_CFG_NO_COROUTINES=1",
629628
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
630629
);
631-
OTHER_LDFLAGS = "$(inherited) ";
630+
OTHER_LDFLAGS = (
631+
"$(inherited)",
632+
" ",
633+
);
632634
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
633635
SDKROOT = iphoneos;
634636
USE_HERMES = true;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.developer.web-browser</key>
6+
<true/>
7+
</dict>
8+
</plist>

example/src/hooks/useIterableApp.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
useState,
77
type FunctionComponent,
88
} from 'react';
9-
import { Alert } from 'react-native';
9+
import { Alert, Platform } from 'react-native';
1010

1111
import {
1212
Iterable,
@@ -252,6 +252,12 @@ export const IterableAppProvider: FunctionComponent<
252252
'`Iterable.initialize` failed with the following error',
253253
err
254254
);
255+
256+
if (Platform.OS === 'ios' && getUserId()) {
257+
setIsInitialized(true);
258+
return login();
259+
}
260+
255261
setIsInitialized(false);
256262
setLoginInProgress(false);
257263
return Promise.reject(err);

ios/RNIterableAPI/Serialization.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ extension IterableConfig {
8383
config.useInMemoryStorageForInApps = useInMemoryStorageForInApp
8484
}
8585

86+
if let enableEmbeddedMessaging = dict["enableEmbeddedMessaging"] as? Bool {
87+
config.enableEmbeddedMessaging = enableEmbeddedMessaging
88+
}
89+
8690
if let dataRegion = dict["dataRegion"] as? NSNumber {
8791
switch dataRegion {
8892
case 0:

0 commit comments

Comments
 (0)