Skip to content

Commit c7f6f43

Browse files
authored
Merge branch 'feature/itbl_track_anon_user' into feature/MOB-9310-Write-automated-unit-tests-against-Complex-criteria
2 parents 4e36187 + 0c7981a commit c7f6f43

File tree

13 files changed

+251
-29
lines changed

13 files changed

+251
-29
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
All notable changes to this project will be documented in this file.
44
This project adheres to [Semantic Versioning](http://semver.org/).
55

6+
## [6.5.7]
7+
### Fixed
8+
- Fixed deeplink re-routing issue where delegate would only return `false` value. Thanks to @scottasoutherland :)
9+
610
## [6.5.6]
711
### Fixed
812
- Fixed an issue where push notification were not being delivered in iOS 18 beta Sandbox builds.

Iterable-iOS-AppExtensions.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22
s.name = "Iterable-iOS-AppExtensions"
33
s.module_name = "IterableAppExtensions"
4-
s.version = "6.5.6"
4+
s.version = "6.5.7"
55
s.summary = "App Extensions for Iterable SDK"
66

77
s.description = <<-DESC

Iterable-iOS-SDK.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22
s.name = "Iterable-iOS-SDK"
33
s.module_name = "IterableSDK"
4-
s.version = "6.5.6"
4+
s.version = "6.5.7"
55
s.summary = "Iterable's official SDK for iOS"
66

77
s.description = <<-DESC

sample-apps/objc-sample-app/objc-sample-app/AppDelegate.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ - (BOOL)handleIterableURL:(NSURL *)url context:(IterableActionContext *)context
134134
- (BOOL)handleIterableCustomAction:(IterableAction *)action context:(IterableActionContext *)context {
135135
if ([action.type isEqualToString:@"handleFindCoffee"]) {
136136
if (action.userInput != nil) {
137-
NSString *urlString = [[NSString alloc] initWithFormat:@"https://majumder.me/coffee?q=%@", action.userInput];
137+
NSString *urlString = [[NSString alloc] initWithFormat:@"https://example.com/coffee?q=%@", action.userInput];
138138
NSURL *url = [[NSURL alloc] initWithString:urlString];
139139
return [DeepLinkHandler handleURL:url];
140140
}

sample-apps/objc-sample-app/objc-sample-app/objc-sample-app.entitlements

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<string>development</string>
77
<key>com.apple.developer.associated-domains</key>
88
<array>
9-
<string>applinks:majumder.me</string>
10-
<string>applinks:links.majumder.me</string>
9+
<string>applinks:example.com</string>
10+
<string>applinks:links.example.com</string>
1111
</array>
1212
</dict>
1313
</plist>

sample-apps/swift-sample-app/swift-sample-app.xcodeproj/project.pbxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -497,13 +497,13 @@
497497
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
498498
CODE_SIGN_ENTITLEMENTS = "swift-sample-app/swift-sample-app.entitlements";
499499
CODE_SIGN_STYLE = Automatic;
500-
DEVELOPMENT_TEAM = BP98Z28R86;
500+
DEVELOPMENT_TEAM = "";
501501
INFOPLIST_FILE = "swift-sample-app/Info.plist";
502502
LD_RUNPATH_SEARCH_PATHS = (
503503
"$(inherited)",
504504
"@executable_path/Frameworks",
505505
);
506-
PRODUCT_BUNDLE_IDENTIFIER = "iterable.swift-sample-app";
506+
PRODUCT_BUNDLE_IDENTIFIER = "com.example.iterable.swift-sample-app";
507507
PRODUCT_NAME = "$(TARGET_NAME)";
508508
SWIFT_VERSION = 5.0;
509509
TARGETED_DEVICE_FAMILY = "1,2";
@@ -516,13 +516,13 @@
516516
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
517517
CODE_SIGN_ENTITLEMENTS = "swift-sample-app/swift-sample-app.entitlements";
518518
CODE_SIGN_STYLE = Automatic;
519-
DEVELOPMENT_TEAM = BP98Z28R86;
519+
DEVELOPMENT_TEAM = "";
520520
INFOPLIST_FILE = "swift-sample-app/Info.plist";
521521
LD_RUNPATH_SEARCH_PATHS = (
522522
"$(inherited)",
523523
"@executable_path/Frameworks",
524524
);
525-
PRODUCT_BUNDLE_IDENTIFIER = "iterable.swift-sample-app";
525+
PRODUCT_BUNDLE_IDENTIFIER = "com.example.iterable.swift-sample-app";
526526
PRODUCT_NAME = "$(TARGET_NAME)";
527527
SWIFT_VERSION = 5.0;
528528
TARGETED_DEVICE_FAMILY = "1,2";
@@ -533,14 +533,14 @@
533533
isa = XCBuildConfiguration;
534534
buildSettings = {
535535
CODE_SIGN_STYLE = Automatic;
536-
DEVELOPMENT_TEAM = BP98Z28R86;
536+
DEVELOPMENT_TEAM = "";
537537
INFOPLIST_FILE = "swift-sample-app-notification-extension/Info.plist";
538538
LD_RUNPATH_SEARCH_PATHS = (
539539
"$(inherited)",
540540
"@executable_path/Frameworks",
541541
"@executable_path/../../Frameworks",
542542
);
543-
PRODUCT_BUNDLE_IDENTIFIER = "iterable.swift-sample-app.swift-sample-app-notification-extension";
543+
PRODUCT_BUNDLE_IDENTIFIER = "com.example.iterable.swift-sample-app.swift-sample-app-notification-extension";
544544
PRODUCT_NAME = "$(TARGET_NAME)";
545545
SKIP_INSTALL = YES;
546546
SWIFT_VERSION = 5.0;
@@ -552,14 +552,14 @@
552552
isa = XCBuildConfiguration;
553553
buildSettings = {
554554
CODE_SIGN_STYLE = Automatic;
555-
DEVELOPMENT_TEAM = BP98Z28R86;
555+
DEVELOPMENT_TEAM = "";
556556
INFOPLIST_FILE = "swift-sample-app-notification-extension/Info.plist";
557557
LD_RUNPATH_SEARCH_PATHS = (
558558
"$(inherited)",
559559
"@executable_path/Frameworks",
560560
"@executable_path/../../Frameworks",
561561
);
562-
PRODUCT_BUNDLE_IDENTIFIER = "iterable.swift-sample-app.swift-sample-app-notification-extension";
562+
PRODUCT_BUNDLE_IDENTIFIER = "com.example.iterable.swift-sample-app.swift-sample-app-notification-extension";
563563
PRODUCT_NAME = "$(TARGET_NAME)";
564564
SKIP_INSTALL = YES;
565565
SWIFT_VERSION = 5.0;

sample-apps/swift-sample-app/swift-sample-app/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ extension AppDelegate: IterableCustomActionDelegate {
171171
func handle(iterableCustomAction action: IterableAction, inContext _: IterableActionContext) -> Bool {
172172
if action.type == "handleFindCoffee" {
173173
if let query = action.userInput {
174-
return DeepLinkHandler.handle(url: URL(string: "https://majumder.me/coffee?q=\(query)")!)
174+
return DeepLinkHandler.handle(url: URL(string: "https://example.com/coffee?q=\(query)")!)
175175
}
176176
}
177177
return false

sample-apps/swift-sample-app/swift-sample-app/swift-sample-app.entitlements

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<string>development</string>
77
<key>com.apple.developer.associated-domains</key>
88
<array>
9-
<string>applinks:majumder.me</string>
10-
<string>applinks:links.majumder.me</string>
9+
<string>applinks:example.com</string>
10+
<string>applinks:links.example.com</string>
1111
</array>
1212
</dict>
1313
</plist>

swift-sdk/Internal/AnonymousUserManager+Functions.swift

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -377,23 +377,49 @@ struct CriteriaCompletionChecker {
377377
} else {
378378
doesKeyExist = filteredLocalDataKeys.filter {$0 as! String == field }.count > 0
379379
}
380-
380+
381381
if field.contains(".") {
382-
if let firstKey = field.components(separatedBy: ".").first, let dataArray = eventData[firstKey] as? [Any], let eventType = query[JsonKey.eventType] as? String {
383-
return dataArray.contains { item in
384-
let dataItem: [String: Any] = [ firstKey: item,
385-
JsonKey.eventType: eventType ]
386-
return evaluateFieldLogic(searchQueries: searchQueries, eventData: dataItem)
382+
var fields = field.split(separator: ".").map { String($0) }
383+
if let type = eventData[JsonKey.eventType] as? String, let name = eventData[JsonKey.eventName] as? String, type == EventType.customEvent, name == fields.first {
384+
fields = Array(fields.dropFirst())
385+
}
386+
387+
var fieldValue: Any = eventData
388+
var isSubFieldArray = false
389+
var isSubMatch = false
390+
391+
for subField in fields {
392+
if let subFieldValue = (fieldValue as? [String: Any])?[subField] {
393+
if let arrayValue = subFieldValue as? [[String: Any]] {
394+
isSubFieldArray = true
395+
isSubMatch = arrayValue.contains { item in
396+
let data = fields.reversed().reduce([String: Any]()) { acc, key in
397+
if key == subField {
398+
return [key: item]
399+
}
400+
return [key: acc]
401+
}
402+
return evaluateFieldLogic(searchQueries: searchQueries, eventData: eventData.merging(data) { $1 })
403+
}
404+
} else {
405+
fieldValue = subFieldValue
406+
}
387407
}
388408
}
389-
if let valueFromObj = getFieldValue(data: eventData, field: field), let comparatorType = query[JsonKey.CriteriaItem.comparatorType] as? String {
409+
410+
if isSubFieldArray {
411+
return isSubMatch
412+
}
413+
414+
if let valueFromObj = getFieldValue(data: eventData, field: field), let comparatorType = query[JsonKey.CriteriaItem.comparatorType] as? String {
390415
return evaluateComparison(comparatorType: comparatorType, matchObj: valueFromObj, valueToCompare: query[JsonKey.CriteriaItem.value] ?? query[JsonKey.CriteriaItem.values])
391416
}
392417
} else if doesKeyExist {
393418
if let comparatorType = query[JsonKey.CriteriaItem.comparatorType] as? String, (evaluateComparison(comparatorType: comparatorType, matchObj: eventData[field] ?? "", valueToCompare: query[JsonKey.CriteriaItem.value] ?? query[JsonKey.CriteriaItem.values])) {
394419
return true
395420
}
396421
}
422+
397423
return false
398424
}
399425
return matchResult

swift-sdk/Internal/DeepLinkManager.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,18 @@ class DeepLinkManager: NSObject {
4343
// Always return true for deep link
4444
return (true, pending)
4545
} else {
46+
var result: Bool = false
4647
if let action = IterableAction.actionOpenUrl(fromUrlString: url.absoluteString) {
4748
let context = IterableActionContext(action: action, source: .universalLink)
4849

49-
ActionRunner.execute(action: action,
50+
result = ActionRunner.execute(action: action,
5051
context: context,
5152
urlHandler: IterableUtil.urlHandler(fromUrlDelegate: urlDelegate,
5253
inContext: context),
5354
urlOpener: urlOpener,
5455
allowedProtocols: allowedProtocols)
5556
}
56-
return (false, Fulfill<IterableAttributionInfo?, Error>(value: nil))
57+
return (result, Fulfill<IterableAttributionInfo?, Error>(value: nil))
5758
}
5859
}
5960

0 commit comments

Comments
 (0)