Skip to content

Commit 078a479

Browse files
authored
Merge pull request #481 from Iterable/MOB-2994-deprecations
[MOB-2994] deprecations
2 parents abc29dc + 5566920 commit 078a479

20 files changed

+70
-641
lines changed

swift-sdk.xcodeproj/project.pbxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
00B6FACE210E88ED007535CF /* prod-1.mobileprovision in Resources */ = {isa = PBXBuildFile; fileRef = 00B6FACD210E874D007535CF /* prod-1.mobileprovision */; };
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 */; };
14-
551E5C10234D485A005FEE9E /* DeprecatedFunctionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 551E5C0F234D485A005FEE9E /* DeprecatedFunctionsTests.swift */; };
1514
5531CDAC22A997A4000D05E2 /* IterableInboxViewControllerUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5585DF9022A877E6000A32B9 /* IterableInboxViewControllerUITests.swift */; };
1615
5531CDAE22A9C992000D05E2 /* ClassExtensionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5531CDAD22A9C992000D05E2 /* ClassExtensionsTests.swift */; };
1716
5536781F2576FF9000DB3652 /* IterableUtilTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5536781E2576FF9000DB3652 /* IterableUtilTests.swift */; };
@@ -365,7 +364,6 @@
365364
00B6FACD210E874D007535CF /* prod-1.mobileprovision */ = {isa = PBXFileReference; lastKnownFileType = file; path = "prod-1.mobileprovision"; sourceTree = "<group>"; };
366365
00B6FAD0210E8D90007535CF /* dev-1.mobileprovision */ = {isa = PBXFileReference; lastKnownFileType = file; path = "dev-1.mobileprovision"; sourceTree = "<group>"; };
367366
00CB31B4210960C4004ACDEC /* TestUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestUtils.swift; sourceTree = "<group>"; };
368-
551E5C0F234D485A005FEE9E /* DeprecatedFunctionsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeprecatedFunctionsTests.swift; sourceTree = "<group>"; };
369367
55298B222501A5AB00190BAE /* AuthManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthManager.swift; sourceTree = "<group>"; };
370368
5531CDAD22A9C992000D05E2 /* ClassExtensionsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClassExtensionsTests.swift; sourceTree = "<group>"; };
371369
5536781E2576FF9000DB3652 /* IterableUtilTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IterableUtilTests.swift; sourceTree = "<group>"; };
@@ -1027,7 +1025,6 @@
10271025
AC3A305C262EE24100425435 /* inbox-tests */,
10281026
AC3A3075262EE26D00425435 /* request-tests */,
10291027
55B9F15024B3D33700E8198A /* AuthTests.swift */,
1030-
551E5C0F234D485A005FEE9E /* DeprecatedFunctionsTests.swift */,
10311028
AC2C668620D3435700D46CC9 /* IterableActionRunnerTests.swift */,
10321029
AC64626A2140AACF0046E1BD /* IterableAPIResponseTests.swift */,
10331030
ACD6116D21080564003E7F6B /* IterableAPITests.swift */,
@@ -1839,7 +1836,6 @@
18391836
AC995F9A2166EEB50099A184 /* CommonMocks.swift in Sources */,
18401837
5585DF8F22A73390000A32B9 /* IterableInboxViewControllerTests.swift in Sources */,
18411838
55B9F15124B3D33700E8198A /* AuthTests.swift in Sources */,
1842-
551E5C10234D485A005FEE9E /* DeprecatedFunctionsTests.swift in Sources */,
18431839
ACED4C01213F50B30055A497 /* LoggingTests.swift in Sources */,
18441840
ACC3FD9E2536D7A30004A2E0 /* InAppFilePersistenceTests.swift in Sources */,
18451841
55B37FC42297135F0042F13A /* NotificationMetadataTests.swift in Sources */,

swift-sdk/Internal/ApiClient.swift

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -203,20 +203,3 @@ extension ApiClient: ApiClientProtocol {
203203
return send(iterableRequestResult: result)
204204
}
205205
}
206-
207-
// MARK: - DEPRECATED
208-
209-
extension ApiClient {
210-
// deprecated - will be removed in version 6.3.x or above
211-
func track(inAppOpen messageId: String) -> Future<SendRequestValue, SendRequestError> {
212-
let value = createRequestCreator().flatMap { $0.createTrackInAppOpenRequest(messageId) }
213-
return send(iterableRequestResult: value)
214-
}
215-
216-
// deprecated - will be removed in version 6.3.x or above
217-
func track(inAppClick messageId: String, clickedUrl: String) -> Future<SendRequestValue, SendRequestError> {
218-
let result = createRequestCreator().flatMap { $0.createTrackInAppClickRequest(messageId,
219-
clickedUrl: clickedUrl) }
220-
return send(iterableRequestResult: result)
221-
}
222-
}

swift-sdk/Internal/ApiClientProtocol.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,8 @@ protocol ApiClientProtocol: AnyObject {
2626

2727
func getInAppMessages(_ count: NSNumber) -> Future<SendRequestValue, SendRequestError>
2828

29-
// deprecated - will be removed in version 6.3.x or above
30-
func track(inAppOpen messageId: String) -> Future<SendRequestValue, SendRequestError>
31-
3229
func track(inAppOpen inAppMessageContext: InAppMessageContext) -> Future<SendRequestValue, SendRequestError>
3330

34-
// deprecated - will be removed in version 6.3.x or above
35-
func track(inAppClick messageId: String, clickedUrl: String) -> Future<SendRequestValue, SendRequestError>
36-
3731
func track(inAppClick inAppMessageContext: InAppMessageContext, clickedUrl: String) -> Future<SendRequestValue, SendRequestError>
3832

3933
func track(inAppClose inAppMessageContext: InAppMessageContext, source: InAppCloseSource?, clickedUrl: String?) -> Future<SendRequestValue, SendRequestError>

swift-sdk/Internal/InAppDisplayer.swift

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -71,29 +71,6 @@ class InAppDisplayer: InAppDisplayerProtocol {
7171
return .shown(createResult.futureClickedURL)
7272
}
7373

74-
// deprecated - will be removed in version 6.3.x or above
75-
static func showSystemNotification(withTitle title: String,
76-
body: String,
77-
buttonLeft: String?,
78-
buttonRight: String?,
79-
callbackBlock: ITEActionBlock?) {
80-
guard let topViewController = getTopViewController() else {
81-
return
82-
}
83-
84-
let alertController = UIAlertController(title: title, message: body, preferredStyle: .alert)
85-
86-
if let buttonLeft = buttonLeft {
87-
addAlertActionButton(alertController: alertController, keyString: buttonLeft, callbackBlock: callbackBlock)
88-
}
89-
90-
if let buttonRight = buttonRight {
91-
addAlertActionButton(alertController: alertController, keyString: buttonRight, callbackBlock: callbackBlock)
92-
}
93-
94-
topViewController.show(alertController, sender: self)
95-
}
96-
9774
fileprivate static func isShowingIterableMessage() -> Bool {
9875
guard Thread.isMainThread else {
9976
ITBError("Must be called from main thread")
@@ -132,23 +109,4 @@ class InAppDisplayer: InAppDisplayerProtocol {
132109
messageMetadata: metadata,
133110
padding: content.padding)
134111
}
135-
136-
// deprecated - will be removed in version 6.3.x or above
137-
/**
138-
Creates and adds an alert action button to an alertController
139-
140-
- parameter alertController: The alert controller to add the button to
141-
- parameter keyString: the text of the button
142-
- parameter callbackBlock: the callback to send after a button on the notification is clicked
143-
144-
- remarks: passes the string of the button clicked to the callbackBlock
145-
*/
146-
private static func addAlertActionButton(alertController: UIAlertController, keyString: String, callbackBlock: ITEActionBlock?) {
147-
let button = UIAlertAction(title: keyString, style: .default) { _ in
148-
alertController.dismiss(animated: false)
149-
callbackBlock?(keyString)
150-
}
151-
152-
alertController.addAction(button)
153-
}
154112
}

swift-sdk/Internal/InternalIterableAPI.swift

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -648,38 +648,3 @@ final class InternalIterableAPI: NSObject, PushTrackerProtocol, AuthProvider {
648648
requestHandler.stop()
649649
}
650650
}
651-
652-
// MARK: - DEPRECATED
653-
654-
extension InternalIterableAPI {
655-
// deprecated - will be removed in version 6.3.x or above
656-
@discardableResult
657-
func trackInAppOpen(_ messageId: String,
658-
onSuccess: OnSuccessHandler? = nil,
659-
onFailure: OnFailureHandler? = nil) -> Future<SendRequestValue, SendRequestError> {
660-
requestHandler.trackInAppOpen(messageId, onSuccess: onSuccess, onFailure: onFailure)
661-
}
662-
663-
// deprecated - will be removed in version 6.3.x or above
664-
@discardableResult
665-
func trackInAppClick(_ messageId: String,
666-
clickedUrl: String,
667-
onSuccess: OnSuccessHandler? = nil,
668-
onFailure: OnFailureHandler? = nil) -> Future<SendRequestValue, SendRequestError> {
669-
requestHandler.trackInAppClick(messageId, clickedUrl: clickedUrl, onSuccess: onSuccess, onFailure: onFailure)
670-
}
671-
672-
// deprecated - will be removed in version 6.3.x or above
673-
func showSystemNotification(withTitle title: String, body: String, buttonLeft: String? = nil, buttonRight: String? = nil, callbackBlock: ITEActionBlock?) {
674-
InAppDisplayer.showSystemNotification(withTitle: title, body: body, buttonLeft: buttonLeft, buttonRight: buttonRight, callbackBlock: callbackBlock)
675-
}
676-
677-
// deprecated - will be removed in version 6.3.x or above
678-
@discardableResult func getAndTrack(deepLink: URL, callbackBlock: @escaping ITEActionBlock) -> Future<IterableAttributionInfo?, Error>? {
679-
deepLinkManager.getAndTrack(deepLink: deepLink, callbackBlock: callbackBlock).onSuccess { attributionInfo in
680-
if let attributionInfo = attributionInfo {
681-
self.attributionInfo = attributionInfo
682-
}
683-
}
684-
}
685-
}

swift-sdk/Internal/IterableDeepLinkManager.swift

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,6 @@
55
import Foundation
66

77
class IterableDeepLinkManager: NSObject {
8-
/**
9-
Tracks a link click and passes the redirected URL to the callback
10-
11-
- parameter webpageURL: the URL that was clicked
12-
- parameter callbackBlock: the callback to send after the webpageURL is called
13-
14-
- remark: passes the string of the redirected URL to the callback
15-
*/
16-
17-
// deprecated - will be removed in version 6.3.x or above
18-
func getAndTrack(deepLink: URL, callbackBlock: @escaping ITEActionBlock) -> Future<IterableAttributionInfo?, Error> {
19-
resolve(appLinkURL: deepLink).map { resolvedURL, attributionInfo in
20-
callbackBlock(resolvedURL?.absoluteString)
21-
return attributionInfo
22-
}
23-
}
24-
258
/// Handles a Universal Link
269
/// For Iterable links, it will track the click and retrieve the original URL,
2710
/// pass it to `IterableURLDelegate` for handling

swift-sdk/Internal/LegacyRequestHandler.swift

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -225,30 +225,6 @@ class LegacyRequestHandler: RequestHandlerProtocol {
225225
forResult: result)
226226
}
227227

228-
// MARK: DEPRECATED
229-
230-
@discardableResult
231-
func trackInAppOpen(_ messageId: String,
232-
onSuccess: OnSuccessHandler? = nil,
233-
onFailure: OnFailureHandler? = nil) -> Future<SendRequestValue, SendRequestError> {
234-
let result = apiClient.track(inAppOpen: messageId)
235-
return applyCallbacks(successHandler: onSuccess,
236-
andFailureHandler: onFailure,
237-
withIdentifier: "trackInAppOpen",
238-
forResult: result)
239-
}
240-
241-
@discardableResult
242-
func trackInAppClick(_ messageId: String,
243-
clickedUrl: String,
244-
onSuccess: OnSuccessHandler? = nil,
245-
onFailure: OnFailureHandler? = nil) -> Future<SendRequestValue, SendRequestError> {
246-
applyCallbacks(successHandler: onSuccess,
247-
andFailureHandler: onFailure,
248-
withIdentifier: "trackInAppClick",
249-
forResult: apiClient.track(inAppClick: messageId, clickedUrl: clickedUrl))
250-
}
251-
252228
func handleLogout() {
253229
}
254230

swift-sdk/Internal/OfflineRequestProcessor.swift

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -213,37 +213,6 @@ struct OfflineRequestProcessor: RequestProcessorProtocol {
213213
identifier: #function)
214214
}
215215

216-
// MARK: DEPRECATED
217-
218-
@discardableResult
219-
func trackInAppOpen(_ messageId: String,
220-
onSuccess: OnSuccessHandler?,
221-
onFailure: OnFailureHandler?) -> Future<SendRequestValue, SendRequestError> {
222-
let requestGenerator = { (requestCreator: RequestCreator) in
223-
requestCreator.createTrackInAppOpenRequest(messageId)
224-
}
225-
226-
return sendIterableRequest(requestGenerator: requestGenerator,
227-
successHandler: onSuccess,
228-
failureHandler: onFailure,
229-
identifier: #function)
230-
}
231-
232-
@discardableResult
233-
func trackInAppClick(_ messageId: String,
234-
clickedUrl: String,
235-
onSuccess: OnSuccessHandler?,
236-
onFailure: OnFailureHandler?) -> Future<SendRequestValue, SendRequestError> {
237-
let requestGenerator = { (requestCreator: RequestCreator) in
238-
requestCreator.createTrackInAppClickRequest(messageId, clickedUrl: clickedUrl)
239-
}
240-
241-
return sendIterableRequest(requestGenerator: requestGenerator,
242-
successHandler: onSuccess,
243-
failureHandler: onFailure,
244-
identifier: #function)
245-
}
246-
247216
func deleteAllTasks() {
248217
ITBInfo()
249218
taskScheduler.deleteAllTasks()

swift-sdk/Internal/OnlineRequestProcessor.swift

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -219,30 +219,6 @@ struct OnlineRequestProcessor: RequestProcessorProtocol {
219219
apiClient.getRemoteConfiguration()
220220
}
221221

222-
// MARK: DEPRECATED
223-
224-
@discardableResult
225-
func trackInAppOpen(_ messageId: String,
226-
onSuccess: OnSuccessHandler? = nil,
227-
onFailure: OnFailureHandler? = nil) -> Future<SendRequestValue, SendRequestError> {
228-
let result = apiClient.track(inAppOpen: messageId)
229-
return applyCallbacks(successHandler: onSuccess,
230-
andFailureHandler: onFailure,
231-
withIdentifier: "trackInAppOpen",
232-
forResult: result)
233-
}
234-
235-
@discardableResult
236-
func trackInAppClick(_ messageId: String,
237-
clickedUrl: String,
238-
onSuccess: OnSuccessHandler? = nil,
239-
onFailure: OnFailureHandler? = nil) -> Future<SendRequestValue, SendRequestError> {
240-
applyCallbacks(successHandler: onSuccess,
241-
andFailureHandler: onFailure,
242-
withIdentifier: "trackInAppClick",
243-
forResult: apiClient.track(inAppClick: messageId, clickedUrl: clickedUrl))
244-
}
245-
246222
private let apiClient: ApiClientProtocol
247223
private weak var authManager: IterableInternalAuthManagerProtocol?
248224

swift-sdk/Internal/RequestCreator.swift

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -443,48 +443,3 @@ struct RequestCreator {
443443

444444
}
445445
}
446-
447-
// MARK: - DEPRECATED
448-
449-
extension RequestCreator {
450-
// deprecated - will be removed in version 6.3.x or above
451-
func createTrackInAppOpenRequest(_ messageId: String) -> Result<IterableRequest, IterableError> {
452-
if case .none = auth.emailOrUserId {
453-
ITBError("Both email and userId are nil")
454-
return .failure(IterableError.general(description: "Both email and userId are nil"))
455-
}
456-
457-
var body = [AnyHashable: Any]()
458-
459-
body.setValue(for: JsonKey.messageId, value: messageId)
460-
461-
setCurrentUser(inDict: &body)
462-
463-
let inAppMessageContext = InAppMessageContext.from(messageId: messageId, deviceMetadata: deviceMetadata)
464-
body.setValue(for: JsonKey.inAppMessageContext, value: inAppMessageContext.toMessageContextDictionary())
465-
body.setValue(for: JsonKey.deviceInfo, value: deviceMetadata.asDictionary())
466-
467-
return .success(.post(createPostRequest(path: Const.Path.trackInAppOpen, body: body)))
468-
}
469-
470-
// deprecated - will be removed in version 6.3.x or above
471-
func createTrackInAppClickRequest(_ messageId: String, clickedUrl: String) -> Result<IterableRequest, IterableError> {
472-
if case .none = auth.emailOrUserId {
473-
ITBError("Both email and userId are nil")
474-
return .failure(IterableError.general(description: "Both email and userId are nil"))
475-
}
476-
477-
var body = [AnyHashable: Any]()
478-
479-
body.setValue(for: JsonKey.messageId, value: messageId)
480-
body.setValue(for: JsonKey.clickedUrl, value: clickedUrl)
481-
482-
setCurrentUser(inDict: &body)
483-
484-
let inAppMessageContext = InAppMessageContext.from(messageId: messageId, deviceMetadata: deviceMetadata)
485-
body.setValue(for: JsonKey.inAppMessageContext, value: inAppMessageContext.toMessageContextDictionary())
486-
body.setValue(for: JsonKey.deviceInfo, value: deviceMetadata.asDictionary())
487-
488-
return .success(.post(createPostRequest(path: Const.Path.trackInAppClick, body: body)))
489-
}
490-
}

0 commit comments

Comments
 (0)