Skip to content

Commit c10ca72

Browse files
authored
⏪ Revert MOB-11490 commit (#966)
1 parent faf43dc commit c10ca72

File tree

4 files changed

+1
-481
lines changed

4 files changed

+1
-481
lines changed

swift-sdk.xcodeproj/project.pbxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
00B6FAD1210E8D90007535CF /* dev-1.mobileprovision in Resources */ = {isa = PBXBuildFile; fileRef = 00B6FAD0210E8D90007535CF /* dev-1.mobileprovision */; };
1313
00CB31B621096129004ACDEC /* TestUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00CB31B4210960C4004ACDEC /* TestUtils.swift */; };
1414
092D01942D3038F600E3066A /* NotificationObserverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 092D01932D3038F600E3066A /* NotificationObserverTests.swift */; };
15-
09876F3D2DF1D0290051F047 /* RedirectNetworkSessionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09876F3C2DF1D0290051F047 /* RedirectNetworkSessionTests.swift */; };
1615
09CAA47B2D4B9AD80057FB72 /* IterableApiCriteriaFetchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09CAA47A2D4B9AD80057FB72 /* IterableApiCriteriaFetchTests.swift */; };
1716
09E8F2F92E29008200E92ABB /* ConsentTrackingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09E8F2F82E29008200E92ABB /* ConsentTrackingTests.swift */; };
1817
1802C00F2CA2C99E009DEA2B /* CombinationComplexCriteria.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1802C00E2CA2C99E009DEA2B /* CombinationComplexCriteria.swift */; };
@@ -579,7 +578,6 @@
579578
00B6FAD0210E8D90007535CF /* dev-1.mobileprovision */ = {isa = PBXFileReference; lastKnownFileType = file; path = "dev-1.mobileprovision"; sourceTree = "<group>"; };
580579
00CB31B4210960C4004ACDEC /* TestUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestUtils.swift; sourceTree = "<group>"; };
581580
092D01932D3038F600E3066A /* NotificationObserverTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationObserverTests.swift; sourceTree = "<group>"; };
582-
09876F3C2DF1D0290051F047 /* RedirectNetworkSessionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RedirectNetworkSessionTests.swift; sourceTree = "<group>"; };
583581
09CAA47A2D4B9AD80057FB72 /* IterableApiCriteriaFetchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IterableApiCriteriaFetchTests.swift; sourceTree = "<group>"; };
584582
09E8F2F82E29008200E92ABB /* ConsentTrackingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConsentTrackingTests.swift; sourceTree = "<group>"; };
585583
1802C00E2CA2C99E009DEA2B /* CombinationComplexCriteria.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CombinationComplexCriteria.swift; sourceTree = "<group>"; };
@@ -1356,7 +1354,6 @@
13561354
AC3A3029262EE04400425435 /* deep-linking-tests */ = {
13571355
isa = PBXGroup;
13581356
children = (
1359-
09876F3C2DF1D0290051F047 /* RedirectNetworkSessionTests.swift */,
13601357
55E6F45E238E066400808BCE /* DeepLinkTests.swift */,
13611358
);
13621359
name = "deep-linking-tests";
@@ -2425,7 +2422,6 @@
24252422
AC776DA4211A17C700C27C27 /* IterableRequestUtilTests.swift in Sources */,
24262423
ACAA816E231163660035C743 /* RequestCreatorTests.swift in Sources */,
24272424
ACE34AB5213776CB00691224 /* LocalStorageTests.swift in Sources */,
2428-
09876F3D2DF1D0290051F047 /* RedirectNetworkSessionTests.swift in Sources */,
24292425
55B37FEE229F59290042F13A /* InAppPersistenceTests.swift in Sources */,
24302426
8A272FD02DD3775800634559 /* IterableDataRegionObjCTests.m in Sources */,
24312427
AC6FDD8C20F56309005D811E /* InAppParsingTests.swift in Sources */,

swift-sdk/Internal/Network/NetworkSession.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ extension RedirectNetworkSession: URLSessionDelegate, URLSessionTaskDelegate {
133133
}
134134

135135
delegate?.onRedirect(deepLinkLocation: deepLinkLocation, campaignId: campaignId, templateId: templateId, messageId: messageId)
136-
completionHandler(request)
136+
completionHandler(nil)
137137
}
138138

139139
private func number(fromString str: String) -> NSNumber {

tests/unit-tests/DeepLinkTests.swift

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -182,94 +182,6 @@ class DeepLinkTests: XCTestCase {
182182
private func createCookieValue(nameValuePairs values: Any...) -> String {
183183
values.take(2).map { "\($0[0])=\($0[1])" }.joined(separator: ";,")
184184
}
185-
186-
// MARK: - GreenFi SMS Deep Link Tests
187-
188-
func testGreenFiSMSDeepLinkRedirect() {
189-
let expectation1 = expectation(description: "Deep link resolves successfully")
190-
let expectation2 = expectation(description: "Attribution info extracted")
191-
192-
let greenfiSmsUrl = "https://links.greenfi.com/a/JsvVI"
193-
let destinationUrl = "https://app.greenfi.com/dashboard"
194-
let campaignId = 123456
195-
let templateId = 789012
196-
let messageId = "sms-campaign-123"
197-
198-
let mockUrlDelegate = MockUrlDelegate(returnValue: true)
199-
mockUrlDelegate.callback = { url, context in
200-
XCTAssertEqual(url.absoluteString, destinationUrl)
201-
XCTAssertEqual(context.action.type, IterableAction.actionTypeOpenUrl)
202-
XCTAssertTrue(Thread.isMainThread)
203-
expectation1.fulfill()
204-
}
205-
206-
// Create network session that simulates GreenFi's 303 redirect response
207-
let networkSession = MockNetworkSession()
208-
networkSession.responseCallback = { _ in
209-
MockNetworkSession.MockResponse(
210-
statusCode: 303, // GreenFi returns 303 redirect
211-
data: Dictionary<AnyHashable, Any>().toJsonData(),
212-
delay: 0.0,
213-
error: nil,
214-
headerFields: [
215-
"Location": destinationUrl,
216-
"Set-Cookie": self.createCookieValue(nameValuePairs: "iterableEmailCampaignId", campaignId, "iterableTemplateId", templateId, "iterableMessageId", messageId),
217-
]
218-
)
219-
}
220-
221-
let networkSessionProvider = MockRedirectNetworkSessionProvider(networkSession: networkSession)
222-
let deepLinkManager = DeepLinkManager(redirectNetworkSessionProvider: networkSessionProvider)
223-
224-
let (isIterableLink, attributionInfoFuture) = deepLinkManager.handleUniversalLink(
225-
URL(string: greenfiSmsUrl)!,
226-
urlDelegate: mockUrlDelegate,
227-
urlOpener: MockUrlOpener()
228-
)
229-
230-
XCTAssertTrue(isIterableLink, "GreenFi URL should be recognized as Iterable deep link")
231-
232-
attributionInfoFuture.onSuccess { attributionInfo in
233-
XCTAssertNotNil(attributionInfo, "Should extract attribution info from 303 response")
234-
XCTAssertEqual(attributionInfo?.campaignId, NSNumber(value: campaignId))
235-
XCTAssertEqual(attributionInfo?.templateId, NSNumber(value: templateId))
236-
XCTAssertEqual(attributionInfo?.messageId, messageId)
237-
expectation2.fulfill()
238-
}
239-
240-
wait(for: [expectation1, expectation2], timeout: testExpectationTimeout)
241-
}
242-
243-
func testGreenFiDeepLinkWithoutRedirect() {
244-
let expectation1 = expectation(description: "Deep link handled without redirect")
245-
246-
let greenfiSmsUrl = "https://links.greenfi.com/a/JsvVI"
247-
248-
let mockUrlDelegate = MockUrlDelegate(returnValue: true)
249-
mockUrlDelegate.callback = { url, context in
250-
// When no redirect occurs, should get original URL
251-
XCTAssertEqual(url.absoluteString, greenfiSmsUrl)
252-
XCTAssertEqual(context.action.type, IterableAction.actionTypeOpenUrl)
253-
expectation1.fulfill()
254-
}
255-
256-
// Use no-redirect provider to simulate timeout/failure scenario
257-
let deepLinkManager = DeepLinkManager(redirectNetworkSessionProvider: createNoRedirectNetworkSessionProvider())
258-
259-
let (isIterableLink, attributionInfoFuture) = deepLinkManager.handleUniversalLink(
260-
URL(string: greenfiSmsUrl)!,
261-
urlDelegate: mockUrlDelegate,
262-
urlOpener: MockUrlOpener()
263-
)
264-
265-
XCTAssertTrue(isIterableLink, "GreenFi URL should be recognized as Iterable deep link")
266-
267-
attributionInfoFuture.onSuccess { attributionInfo in
268-
XCTAssertNil(attributionInfo, "Should not have attribution info when redirect fails")
269-
}
270-
271-
wait(for: [expectation1], timeout: testExpectationTimeout)
272-
}
273185
}
274186

275187
private struct MockNoRedirectNetworkSessionProvider: RedirectNetworkSessionProvider {

0 commit comments

Comments
 (0)