Skip to content

Commit 0ae380f

Browse files
committed
fixes
1 parent 39e637e commit 0ae380f

File tree

4 files changed

+64
-9
lines changed

4 files changed

+64
-9
lines changed

swift-sdk/Internal/EmptyInAppManager.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,24 @@ class EmptyInAppManager: IterableInternalInAppManagerProtocol {
3333

3434
func show(message _: IterableInAppMessage, consume _: Bool, callback _: ITBURLCallback?) {}
3535

36+
func remove(message _: IterableInAppMessage) {}
37+
3638
func remove(message _: IterableInAppMessage, successHandler _: OnSuccessHandler?, failureHandler _: OnFailureHandler?) {}
3739

40+
func remove(message _: IterableInAppMessage, location _: InAppLocation) {}
41+
3842
func remove(message _: IterableInAppMessage, location _: InAppLocation, successHandler _: OnSuccessHandler?, failureHandler _: OnFailureHandler?) {}
3943

44+
func remove(message _: IterableInAppMessage, location _: InAppLocation, source _: InAppDeleteSource) {}
45+
4046
func remove(message _: IterableInAppMessage, location _: InAppLocation, source _: InAppDeleteSource, successHandler _: OnSuccessHandler?, failureHandler _: OnFailureHandler?) {}
4147

48+
func remove(message _: IterableInAppMessage, location _: InAppLocation, source _: InAppDeleteSource, inboxSessionId _: String?) {}
49+
4250
func remove(message _: IterableInAppMessage, location _: InAppLocation, source _: InAppDeleteSource, inboxSessionId _: String?, successHandler _: OnSuccessHandler?, failureHandler _: OnFailureHandler?) {}
4351

52+
func set(read _: Bool, forMessage _: IterableInAppMessage) {}
53+
4454
func set(read _: Bool, forMessage _: IterableInAppMessage, successHandler _: OnSuccessHandler?, failureHandler _: OnFailureHandler?) {}
4555

4656
func getMessage(withId _: String) -> IterableInAppMessage? {

swift-sdk/Internal/InAppManager.swift

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ protocol IterableInternalInAppManagerProtocol: IterableInAppManagerProtocol, InA
1919
/// - parameter inboxSessionId: The ID of the inbox session that the message originates from.
2020
func handleClick(clickedUrl url: URL?, forMessage message: IterableInAppMessage, location: InAppLocation, inboxSessionId: String?)
2121

22+
23+
/// - parameter message: The message to remove.
24+
/// - parameter location: The location from where this message was shown. `inbox` or `inApp`.
25+
/// - parameter source: The source of deletion `inboxSwipe` or `deleteButton`.`
26+
/// - parameter inboxSessionId: The ID of the inbox session that the message originates from.
27+
func remove(message: IterableInAppMessage, location: InAppLocation, source: InAppDeleteSource, inboxSessionId: String?)
28+
2229
/// - parameter message: The message to remove.
2330
/// - parameter location: The location from where this message was shown. `inbox` or `inApp`.
2431
/// - parameter source: The source of deletion `inboxSwipe` or `deleteButton`.`
@@ -124,22 +131,39 @@ class InAppManager: NSObject, IterableInternalInAppManagerProtocol {
124131
}
125132
}
126133

127-
func remove(message: IterableInAppMessage, location: InAppLocation, successHandler: OnSuccessHandler? = nil, failureHandler: OnFailureHandler? = nil) {
134+
func remove(message: IterableInAppMessage, location: InAppLocation) {
128135
ITBInfo()
136+
137+
remove(message: message, location: location, successHandler: nil, failureHandler: nil)
138+
}
139+
140+
func remove(message: IterableInAppMessage, location: InAppLocation, successHandler: OnSuccessHandler? = nil, failureHandler: OnFailureHandler? = nil) {
129141
removePrivate(message: message, location: location, successHandler: successHandler, failureHandler: failureHandler)
130142
}
131143

144+
func remove(message: IterableInAppMessage, location: InAppLocation, source: InAppDeleteSource) {
145+
remove(message: message, location: location, source: source, successHandler: nil, failureHandler: nil)
146+
}
147+
132148
func remove(message: IterableInAppMessage, location: InAppLocation, source: InAppDeleteSource, successHandler: OnSuccessHandler? = nil, failureHandler: OnFailureHandler? = nil) {
133-
ITBInfo()
149+
134150
removePrivate(message: message, location: location, source: source, successHandler: successHandler, failureHandler: failureHandler)
135151
}
136152

137-
func remove(message: IterableInAppMessage, location: InAppLocation, source: InAppDeleteSource, inboxSessionId: String? = nil, successHandler: OnSuccessHandler? = nil, failureHandler: OnFailureHandler? = nil) {
153+
func remove(message: IterableInAppMessage, location: InAppLocation, source: InAppDeleteSource, inboxSessionId: String?) {
138154
ITBInfo()
139155

156+
remove(message: message, location: location, source: source, inboxSessionId: inboxSessionId, successHandler: nil, failureHandler: nil)
157+
}
158+
159+
func remove(message: IterableInAppMessage, location: InAppLocation, source: InAppDeleteSource, inboxSessionId: String? = nil, successHandler: OnSuccessHandler? = nil, failureHandler: OnFailureHandler? = nil) {
140160
removePrivate(message: message, location: location, source: source, inboxSessionId: inboxSessionId, successHandler: successHandler, failureHandler: failureHandler)
141161
}
142162

163+
func set(read: Bool, forMessage message: IterableInAppMessage) {
164+
set(read: read, forMessage: message, successHandler: nil, failureHandler: nil)
165+
}
166+
143167
func set(read: Bool, forMessage message: IterableInAppMessage, successHandler: OnSuccessHandler? = nil, failureHandler: OnFailureHandler? = nil) {
144168
updateMessage(message, read: read).onSuccess { [weak self] _ in
145169
successHandler?([:])
@@ -187,9 +211,13 @@ class InAppManager: NSObject, IterableInternalInAppManagerProtocol {
187211
}
188212
}
189213

190-
func remove(message: IterableInAppMessage, successHandler: OnSuccessHandler?, failureHandler: OnFailureHandler?) {
214+
func remove(message: IterableInAppMessage) {
191215
ITBInfo()
192-
216+
217+
remove(message: message, successHandler: nil, failureHandler: nil)
218+
}
219+
220+
func remove(message: IterableInAppMessage, successHandler: OnSuccessHandler?, failureHandler: OnFailureHandler?) {
193221
removePrivate(message: message, location: .inApp, source: nil, successHandler: successHandler, failureHandler: failureHandler)
194222
}
195223

swift-sdk/Internal/InboxState.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,14 @@ class InboxState: InboxStateProtocol {
6161
}
6262

6363
func set(read: Bool, forMessage message: InboxMessageViewModel) {
64-
inAppManager?.set(read: read, forMessage: message.iterableMessage, successHandler: nil, failureHandler: nil)
64+
inAppManager?.set(read: read, forMessage: message.iterableMessage)
6565
}
6666

6767
func remove(message: InboxMessageViewModel, inboxSessionId: String?) {
6868
inAppManager?.remove(message: message.iterableMessage,
6969
location: .inbox,
7070
source: .inboxSwipe,
71-
inboxSessionId: inboxSessionId,
72-
successHandler: nil,
73-
failureHandler: nil)
71+
inboxSessionId: inboxSessionId)
7472
}
7573

7674
init(internalAPIProvider: @escaping @autoclosure () -> InternalIterableAPI? = IterableAPI.internalImplementation) {

swift-sdk/IterableInAppManagerProtocol.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,43 @@ import Foundation
2828
/// Note that this callback is called in addition to calling `IterableCustomActionDelegate` or `IterableUrlDelegate` on the button action.
2929
@objc(showMessage:consume:callbackBlock:) func show(message: IterableInAppMessage, consume: Bool, callback: ITBURLCallback?)
3030

31+
32+
/// - parameter message: The message to remove.
33+
@objc(removeMessage:) func remove(message: IterableInAppMessage)
34+
3135
/// - parameter message: The message to remove.
3236
/// - parameter successHandler: The callback which returns `success.
3337
/// - parameter failureHandler: The callback which returns `failure.
3438
@objc(removeMessage:successHandler:failureHandler:) func remove(message: IterableInAppMessage, successHandler: OnSuccessHandler?, failureHandler: OnFailureHandler?)
3539

40+
41+
/// - parameter message: The message to remove.
42+
/// - parameter location: The location from where this message was shown. `inbox` or `inApp`.
43+
@objc(removeMessage:location:) func remove(message: IterableInAppMessage, location: InAppLocation)
44+
3645
/// - parameter message: The message to remove.
3746
/// - parameter location: The location from where this message was shown. `inbox` or `inApp`.
3847
/// - parameter successHandler: The callback which returns `success.
3948
/// - parameter failureHandler: The callback which returns `failure.
4049
@objc(removeMessage:location:successHandler:failureHandler:) func remove(message: IterableInAppMessage, location: InAppLocation, successHandler: OnSuccessHandler?, failureHandler: OnFailureHandler?)
4150

51+
52+
/// - parameter message: The message to remove.
53+
/// - parameter location: The location from where this message was shown. `inbox` or `inApp`.
54+
/// - parameter source: The source of deletion `inboxSwipe` or `deleteButton`.`
55+
@objc(removeMessage:location:source:) func remove(message: IterableInAppMessage, location: InAppLocation, source: InAppDeleteSource)
56+
4257
/// - parameter message: The message to remove.
4358
/// - parameter location: The location from where this message was shown. `inbox` or `inApp`.
4459
/// - parameter source: The source of deletion `inboxSwipe` or `deleteButton`.`
4560
/// - parameter successHandler: The callback which returns `success.
4661
/// - parameter failureHandler: The callback which returns `failure.
4762
@objc(removeMessage:location:source:successHandler:failureHandler:) func remove(message: IterableInAppMessage, location: InAppLocation, source: InAppDeleteSource, successHandler: OnSuccessHandler?, failureHandler: OnFailureHandler?)
4863

64+
/// - parameter read: Whether this inbox message was read
65+
/// - parameter message: The inbox message
66+
@objc(setRead:forMessage:) func set(read: Bool, forMessage message: IterableInAppMessage)
67+
4968
/// - parameter read: Whether this inbox message was read
5069
/// - parameter message: The inbox message
5170
/// - parameter successHandler: The callback which returns `success.

0 commit comments

Comments
 (0)