Skip to content

Commit afec5aa

Browse files
committed
Merge branch 'master' into jay/MOB-4239-updateEmail-withToken
2 parents 5b7ebc8 + 33a2f48 commit afec5aa

17 files changed

+88
-40
lines changed

.github/workflows/e2e.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ jobs:
88

99
steps:
1010
- uses: actions/checkout@v2
11-
12-
- uses: maxim-lobanov/setup-xcode@v1.1
11+
12+
- uses: maxim-lobanov/setup-xcode@v1.3.0
1313
with:
14-
xcode-version: 12.0
14+
xcode-version: 13.0
1515

1616
- name: Build and test
1717
env:

inbox-ui-tests-app.entitlements

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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.security.app-sandbox</key>
6+
<true/>
7+
<key>com.apple.security.network.client</key>
8+
<true/>
9+
</dict>
10+
</plist>

scripts/create-xcframework-zips.sh

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
#!/bin/sh
1+
#!/bin/bash
2+
3+
set -eE
4+
trap 'printf "\e[31m%s: %s\e[m\n" "ERROR($?): $BASH_SOURCE:$LINENO $BASH_COMMAND"' ERR
25

36
if [ ! -d *".xcodeproj" ]
47
then
@@ -12,13 +15,9 @@ FULL_OUTPUT_PATH=${CURRENT_FOLDER}/${OUTPUT_FOLDER}
1215

1316
rm -rf "${OUTPUT_FOLDER}"
1417

15-
# -destination="iOS" -- seems like "-sdk iphoneos" is needed and not this?
16-
# proper format might be -destination "generic/platform=iOS"
17-
xcodebuild archive -scheme "swift-sdk" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES BITCODE_GENERATION_MODE=bitcode -archivePath "./${OUTPUT_FOLDER}/IterableSDK-iOS" -sdk iphoneos
18-
19-
# -destination="iOS Simulator" -- seems like "-sdk iphonesimulator" is needed and not this?
20-
# proper format might be -destination "generic/platform=iOS Simulator"
21-
xcodebuild archive -scheme "swift-sdk" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES BITCODE_GENERATION_MODE=bitcode -archivePath "./${OUTPUT_FOLDER}/IterableSDK-Simulator" -sdk iphonesimulator
18+
xcodebuild archive -scheme "swift-sdk" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES BITCODE_GENERATION_MODE=bitcode SUPPORTS_MACCATALYST=NO -archivePath "./${OUTPUT_FOLDER}/IterableSDK-iOS" -sdk iphoneos -destination "generic/platform=iOS" -configuration Release
19+
xcodebuild archive -scheme "swift-sdk" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES BITCODE_GENERATION_MODE=bitcode SUPPORTS_MACCATALYST=NO -archivePath "./${OUTPUT_FOLDER}/IterableSDK-Simulator" -sdk iphonesimulator -destination "generic/platform=iOS Simulator" -configuration Release
20+
xcodebuild archive -scheme "swift-sdk" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES BITCODE_GENERATION_MODE=bitcode SUPPORTS_MACCATALYST=YES -archivePath "./${OUTPUT_FOLDER}/IterableSDK-MC" -sdk iphoneos -destination "generic/platform=macOS,variant=Mac Catalyst" -configuration Release
2221

2322
# create IterableSDK.xcframework
2423
# -debug-symbols requires a full path specified
@@ -29,6 +28,8 @@ xcodebuild -create-xcframework \
2928
-debug-symbols "${FULL_OUTPUT_PATH}/IterableSDK-iOS.xcarchive/dSYMs/IterableSDK.framework.dSYM" \
3029
-framework "./${OUTPUT_FOLDER}/IterableSDK-Simulator.xcarchive/Products/Library/Frameworks/IterableSDK.framework" \
3130
-debug-symbols "${FULL_OUTPUT_PATH}/IterableSDK-Simulator.xcarchive/dSYMs/IterableSDK.framework.dSYM" \
31+
-framework "./${OUTPUT_FOLDER}/IterableSDK-MC.xcarchive/Products/Library/Frameworks/IterableSDK.framework" \
32+
-debug-symbols "${FULL_OUTPUT_PATH}/IterableSDK-MC.xcarchive/dSYMs/IterableSDK.framework.dSYM"
3233

3334
# create IterableAppExtensions.xcframework
3435
# -debug-symbols requires a full path specified
@@ -39,6 +40,8 @@ xcodebuild -create-xcframework \
3940
-debug-symbols "${FULL_OUTPUT_PATH}/IterableSDK-Simulator.xcarchive/dSYMs/IterableAppExtensions.framework.dSYM" \
4041
-framework "./${OUTPUT_FOLDER}/IterableSDK-Simulator.xcarchive/Products/Library/Frameworks/IterableAppExtensions.framework" \
4142
-debug-symbols "${FULL_OUTPUT_PATH}/IterableSDK-Simulator.xcarchive/dSYMs/IterableAppExtensions.framework.dSYM" \
43+
-framework "./${OUTPUT_FOLDER}/IterableSDK-MC.xcarchive/Products/Library/Frameworks/IterableAppExtensions.framework" \
44+
-debug-symbols "${FULL_OUTPUT_PATH}/IterableSDK-MC.xcarchive/dSYMs/IterableAppExtensions.framework.dSYM"
4245

4346
# create zips of both XCFrameworks
4447
cd "${OUTPUT_FOLDER}"
@@ -51,4 +54,4 @@ echo "----------------------------------------------------------------"
5154
swift package compute-checksum "IterableSDK.xcframework.zip"
5255
swift package compute-checksum "IterableAppExtensions.xcframework.zip"
5356

54-
echo "----------------------------------------------------------------"
57+
echo "----------------------------------------------------------------"

swift-sdk.xcodeproj/project.pbxproj

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,13 @@
251251
/* End PBXBuildFile section */
252252

253253
/* Begin PBXContainerItemProxy section */
254+
5B38881D27FAE6DB00482BE7 /* PBXContainerItemProxy */ = {
255+
isa = PBXContainerItemProxy;
256+
containerPortal = AC2263D620CF49B8009800EB /* Project object */;
257+
proxyType = 1;
258+
remoteGlobalIDString = ACF560D220E443BF000AAC23;
259+
remoteInfo = "host-app";
260+
};
254261
AC28480D24AA44C600C1FC7F /* PBXContainerItemProxy */ = {
255262
isa = PBXContainerItemProxy;
256263
containerPortal = AC2263D620CF49B8009800EB /* Project object */;
@@ -407,6 +414,7 @@
407414
55E6F45E238E066400808BCE /* DeepLinkTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeepLinkTests.swift; sourceTree = "<group>"; };
408415
5B49BB3D27CFB71500E6F00C /* PopupInboxSessionUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopupInboxSessionUITests.swift; sourceTree = "<group>"; };
409416
5B6C3C1027CE871F00B9A753 /* NavInboxSessionUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavInboxSessionUITests.swift; sourceTree = "<group>"; };
417+
5BFC7CED27FC9AF300E77479 /* inbox-ui-tests-app.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "inbox-ui-tests-app.entitlements"; sourceTree = "<group>"; };
410418
AC02480722791E2100495FB9 /* IterableInboxNavigationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IterableInboxNavigationViewController.swift; sourceTree = "<group>"; };
411419
AC02CAA5234E50B5006617E0 /* RegistrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegistrationTests.swift; sourceTree = "<group>"; };
412420
AC03094A21E532470003A288 /* InAppPersistence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InAppPersistence.swift; sourceTree = "<group>"; };
@@ -746,6 +754,7 @@
746754
AC2263D520CF49B8009800EB = {
747755
isa = PBXGroup;
748756
children = (
757+
5BFC7CED27FC9AF300E77479 /* inbox-ui-tests-app.entitlements */,
749758
AC2263E120CF49B8009800EB /* swift-sdk */,
750759
AC90C4C520D8632E00EECA5D /* notification-extension */,
751760
ACFCA72920EB02DB00BFB277 /* tests */,
@@ -1380,6 +1389,7 @@
13801389
);
13811390
dependencies = (
13821391
AC28480E24AA44C600C1FC7F /* PBXTargetDependency */,
1392+
5B38881E27FAE6DB00482BE7 /* PBXTargetDependency */,
13831393
);
13841394
name = "endpoint-tests";
13851395
productName = "endpoint-tests";
@@ -1572,6 +1582,7 @@
15721582
};
15731583
AC28480624AA44C600C1FC7F = {
15741584
CreatedOnToolsVersion = 11.5;
1585+
TestTargetID = ACF560D220E443BF000AAC23;
15751586
};
15761587
AC7B142A20D02CE200877BFE = {
15771588
CreatedOnToolsVersion = 9.4;
@@ -2036,6 +2047,11 @@
20362047
/* End PBXSourcesBuildPhase section */
20372048

20382049
/* Begin PBXTargetDependency section */
2050+
5B38881E27FAE6DB00482BE7 /* PBXTargetDependency */ = {
2051+
isa = PBXTargetDependency;
2052+
target = ACF560D220E443BF000AAC23 /* host-app */;
2053+
targetProxy = 5B38881D27FAE6DB00482BE7 /* PBXContainerItemProxy */;
2054+
};
20392055
AC28480E24AA44C600C1FC7F /* PBXTargetDependency */ = {
20402056
isa = PBXTargetDependency;
20412057
target = AC2263DE20CF49B8009800EB /* swift-sdk */;
@@ -2301,7 +2317,7 @@
23012317
PRODUCT_NAME = IterableSDK;
23022318
PROVISIONING_PROFILE_SPECIFIER = "";
23032319
SKIP_INSTALL = YES;
2304-
SUPPORTS_MACCATALYST = NO;
2320+
SUPPORTS_MACCATALYST = YES;
23052321
"SWIFT_ACTIVE_COMPILATION_CONDITIONS[arch=*]" = "DEBUG NETWORK_DEBUG";
23062322
TARGETED_DEVICE_FAMILY = "1,2";
23072323
};
@@ -2332,14 +2348,15 @@
23322348
PRODUCT_NAME = IterableSDK;
23332349
PROVISIONING_PROFILE_SPECIFIER = "";
23342350
SKIP_INSTALL = YES;
2335-
SUPPORTS_MACCATALYST = NO;
2351+
SUPPORTS_MACCATALYST = YES;
23362352
TARGETED_DEVICE_FAMILY = "1,2";
23372353
};
23382354
name = Release;
23392355
};
23402356
AC28480F24AA44C600C1FC7F /* Debug */ = {
23412357
isa = XCBuildConfiguration;
23422358
buildSettings = {
2359+
BUNDLE_LOADER = "$(TEST_HOST)";
23432360
CODE_SIGN_STYLE = Automatic;
23442361
DEVELOPMENT_TEAM = BP98Z28R86;
23452362
INFOPLIST_FILE = "tests/endpoint-tests/Info.plist";
@@ -2355,12 +2372,14 @@
23552372
PRODUCT_NAME = "$(TARGET_NAME)";
23562373
SWIFT_VERSION = 5.0;
23572374
TARGETED_DEVICE_FAMILY = "1,2";
2375+
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/host-app.app/host-app";
23582376
};
23592377
name = Debug;
23602378
};
23612379
AC28481024AA44C600C1FC7F /* Release */ = {
23622380
isa = XCBuildConfiguration;
23632381
buildSettings = {
2382+
BUNDLE_LOADER = "$(TEST_HOST)";
23642383
CODE_SIGN_STYLE = Automatic;
23652384
DEVELOPMENT_TEAM = BP98Z28R86;
23662385
INFOPLIST_FILE = "tests/endpoint-tests/Info.plist";
@@ -2375,6 +2394,7 @@
23752394
PRODUCT_NAME = "$(TARGET_NAME)";
23762395
SWIFT_VERSION = 5.0;
23772396
TARGETED_DEVICE_FAMILY = "1,2";
2397+
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/host-app.app/host-app";
23782398
};
23792399
name = Release;
23802400
};
@@ -2444,7 +2464,7 @@
24442464
PRODUCT_NAME = IterableAppExtensions;
24452465
PROVISIONING_PROFILE_SPECIFIER = "";
24462466
SKIP_INSTALL = YES;
2447-
SUPPORTS_MACCATALYST = NO;
2467+
SUPPORTS_MACCATALYST = YES;
24482468
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
24492469
TARGETED_DEVICE_FAMILY = "1,2";
24502470
};
@@ -2476,7 +2496,7 @@
24762496
PRODUCT_NAME = IterableAppExtensions;
24772497
PROVISIONING_PROFILE_SPECIFIER = "";
24782498
SKIP_INSTALL = YES;
2479-
SUPPORTS_MACCATALYST = NO;
2499+
SUPPORTS_MACCATALYST = YES;
24802500
TARGETED_DEVICE_FAMILY = "1,2";
24812501
};
24822502
name = Release;
@@ -2570,6 +2590,7 @@
25702590
buildSettings = {
25712591
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
25722592
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
2593+
CODE_SIGN_ENTITLEMENTS = "inbox-ui-tests-app.entitlements";
25732594
CODE_SIGN_STYLE = Automatic;
25742595
DEVELOPMENT_TEAM = BP98Z28R86;
25752596
INFOPLIST_FILE = "tests/hosting-apps/inbox-ui-tests-app/Info.plist";
@@ -2582,6 +2603,7 @@
25822603
MTL_FAST_MATH = YES;
25832604
PRODUCT_BUNDLE_IDENTIFIER = "iterable.inbox-ui-tests-app";
25842605
PRODUCT_NAME = "$(TARGET_NAME)";
2606+
SUPPORTS_MACCATALYST = YES;
25852607
SWIFT_VERSION = 5.0;
25862608
TARGETED_DEVICE_FAMILY = "1,2";
25872609
};
@@ -2592,6 +2614,7 @@
25922614
buildSettings = {
25932615
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
25942616
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
2617+
CODE_SIGN_ENTITLEMENTS = "inbox-ui-tests-app.entitlements";
25952618
CODE_SIGN_STYLE = Automatic;
25962619
DEVELOPMENT_TEAM = BP98Z28R86;
25972620
INFOPLIST_FILE = "tests/hosting-apps/inbox-ui-tests-app/Info.plist";
@@ -2603,6 +2626,7 @@
26032626
MTL_FAST_MATH = YES;
26042627
PRODUCT_BUNDLE_IDENTIFIER = "iterable.inbox-ui-tests-app";
26052628
PRODUCT_NAME = "$(TARGET_NAME)";
2629+
SUPPORTS_MACCATALYST = YES;
26062630
SWIFT_VERSION = 5.0;
26072631
TARGETED_DEVICE_FAMILY = "1,2";
26082632
};
@@ -2670,6 +2694,7 @@
26702694
);
26712695
PRODUCT_BUNDLE_IDENTIFIER = "iterable.host-app";
26722696
PRODUCT_NAME = "host-app";
2697+
SUPPORTS_MACCATALYST = YES;
26732698
TARGETED_DEVICE_FAMILY = "1,2";
26742699
};
26752700
name = Debug;
@@ -2691,6 +2716,7 @@
26912716
);
26922717
PRODUCT_BUNDLE_IDENTIFIER = "iterable.host-app";
26932718
PRODUCT_NAME = "host-app";
2719+
SUPPORTS_MACCATALYST = YES;
26942720
TARGETED_DEVICE_FAMILY = "1,2";
26952721
};
26962722
name = Release;
@@ -2757,6 +2783,7 @@
27572783
);
27582784
PRODUCT_BUNDLE_IDENTIFIER = "iterable.ui-tests-app";
27592785
PRODUCT_NAME = "ui-tests-app";
2786+
SUPPORTS_MACCATALYST = YES;
27602787
TARGETED_DEVICE_FAMILY = "1,2";
27612788
};
27622789
name = Debug;
@@ -2778,6 +2805,7 @@
27782805
);
27792806
PRODUCT_BUNDLE_IDENTIFIER = "iterable.ui-tests-app";
27802807
PRODUCT_NAME = "ui-tests-app";
2808+
SUPPORTS_MACCATALYST = YES;
27812809
TARGETED_DEVICE_FAMILY = "1,2";
27822810
};
27832811
name = Release;

swift-sdk/Internal/IterableCoreDataPersistence.swift

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ enum PersistenceConst {
2424
class PersistentContainer: NSPersistentContainer {
2525
static var shared: PersistentContainer?
2626

27-
static func initialize(fromBundle bundle: Bundle) -> PersistentContainer? {
27+
static func initialize() -> PersistentContainer? {
2828
if shared == nil {
29-
shared = create(fromBundle: bundle)
29+
shared = create()
3030
}
3131
return shared
3232
}
@@ -38,8 +38,8 @@ class PersistentContainer: NSPersistentContainer {
3838
return backgroundContext
3939
}
4040

41-
private static func create(fromBundle bundle: Bundle) -> PersistentContainer? {
42-
guard let managedObjectModel = createManagedObjectModel(fromBundle: bundle) else {
41+
private static func create() -> PersistentContainer? {
42+
guard let managedObjectModel = createManagedObjectModel() else {
4343
ITBError("Could not initialize managed object model")
4444
return nil
4545
}
@@ -58,26 +58,29 @@ class PersistentContainer: NSPersistentContainer {
5858
return container
5959
}
6060

61-
private static func createManagedObjectModel(fromBundle bundle: Bundle) -> NSManagedObjectModel? {
62-
guard let url = managedObjectUrl(fromBundle: bundle) else {
61+
private static func createManagedObjectModel() -> NSManagedObjectModel? {
62+
guard let url = dataModelUrl(fromBundles: [Bundle.main, Bundle(for: PersistentContainer.self)]) else {
6363
ITBError("Could not find \(PersistenceConst.dataModelFileName).\(PersistenceConst.dataModelExtension) in bundle")
6464
return nil
6565
}
6666
ITBInfo("DB Bundle url: \(url)")
6767
return NSManagedObjectModel(contentsOf: url)
6868
}
6969

70-
private static func managedObjectUrl(fromBundle bundle: Bundle) -> URL? {
70+
private static func dataModelUrl(fromBundles bundles: [Bundle]) -> URL? {
71+
bundles.lazy.compactMap(dataModelUrl(fromBundle:)).first
72+
}
73+
74+
private static func dataModelUrl(fromBundle bundle: Bundle) -> URL? {
7175
ResourceHelper.url(forResource: PersistenceConst.dataModelFileName,
7276
withExtension: PersistenceConst.dataModelExtension,
7377
fromBundle: bundle)
7478
}
7579
}
7680

7781
struct CoreDataPersistenceContextProvider: IterablePersistenceContextProvider {
78-
init?(dateProvider: DateProviderProtocol = SystemDateProvider(),
79-
fromBundle bundle: Bundle = Bundle.main) {
80-
guard let persistentContainer = PersistentContainer.initialize(fromBundle: bundle) else {
82+
init?(dateProvider: DateProviderProtocol = SystemDateProvider()) {
83+
guard let persistentContainer = PersistentContainer.initialize() else {
8184
return nil
8285
}
8386
self.persistentContainer = persistentContainer

swift-sdk/swiftui/InboxViewRepresentable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Copyright © 2021 Iterable. All rights reserved.
33
//
44

5-
#if canImport(SwiftUI) && !arch(arm)
5+
#if canImport(SwiftUI) && !arch(arm) && !arch(i386)
66

77
import Foundation
88
import SwiftUI

swift-sdk/swiftui/IterableInboxView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Copyright © 2021 Iterable. All rights reserved.
33
//
44

5-
#if canImport(SwiftUI) && !arch(arm)
5+
#if canImport(SwiftUI) && !arch(arm) && !arch(i386)
66

77
import Foundation
88
import SwiftUI

tests/endpoint-tests/OfflineModeE2ETests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class OfflineModeEndpointTests: XCTestCase {
116116
private static let pushTemplateId = Environment.pushTemplateId!
117117
private static let inAppCampaignId = Environment.inAppCampaignId!
118118
private lazy var persistenceContextProvider: IterablePersistenceContextProvider = {
119-
let provider = CoreDataPersistenceContextProvider(fromBundle: Bundle(for: PersistentContainer.self))!
119+
let provider = CoreDataPersistenceContextProvider()!
120120
return provider
121121
}()
122122
}

tests/endpoint-tests/scripts/run_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ sed -e "s/\(apiKey = \).*$/\1\"$api_key\"/" \
2222
xcodebuild -project swift-sdk.xcodeproj \
2323
-scheme endpoint-tests \
2424
-sdk iphonesimulator \
25-
-destination 'platform=iOS Simulator,name=iPhone 11' \
25+
-destination 'platform=iOS Simulator,name=iPhone 13' \
2626
test | xcpretty

tests/hosting-apps/host-app/host-app.entitlements

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@
88
<array>
99
<string>applinks:links.iterable.com</string>
1010
</array>
11+
<key>com.apple.security.app-sandbox</key>
12+
<true/>
13+
<key>com.apple.security.network.client</key>
14+
<true/>
1115
</dict>
1216
</plist>

0 commit comments

Comments
 (0)