@@ -89,9 +89,11 @@ class RequestHandler: RequestHandlerProtocol {
89
89
func updateCart( items: [ CommerceItem ] ,
90
90
onSuccess: OnSuccessHandler ? ,
91
91
onFailure: OnFailureHandler ? ) -> Pending < SendRequestValue , SendRequestError > {
92
- chooseRequestProcessor ( ) . updateCart ( items: items,
93
- onSuccess: onSuccess,
94
- onFailure: onFailure)
92
+ Pending < SendRequestValue , SendRequestError > . inBackgroundThread {
93
+ self . chooseRequestProcessor ( ) . updateCart ( items: items,
94
+ onSuccess: onSuccess,
95
+ onFailure: onFailure)
96
+ }
95
97
}
96
98
97
99
@discardableResult
@@ -102,13 +104,15 @@ class RequestHandler: RequestHandlerProtocol {
102
104
templateId: NSNumber ? ,
103
105
onSuccess: OnSuccessHandler ? ,
104
106
onFailure: OnFailureHandler ? ) -> Pending < SendRequestValue , SendRequestError > {
105
- chooseRequestProcessor ( ) . trackPurchase ( total,
106
- items: items,
107
- dataFields: dataFields,
108
- campaignId: campaignId,
109
- templateId: templateId,
110
- onSuccess: onSuccess,
111
- onFailure: onFailure)
107
+ Pending < SendRequestValue , SendRequestError > . inBackgroundThread {
108
+ self . chooseRequestProcessor ( ) . trackPurchase ( total,
109
+ items: items,
110
+ dataFields: dataFields,
111
+ campaignId: campaignId,
112
+ templateId: templateId,
113
+ onSuccess: onSuccess,
114
+ onFailure: onFailure)
115
+ }
112
116
}
113
117
114
118
@discardableResult
@@ -119,24 +123,28 @@ class RequestHandler: RequestHandlerProtocol {
119
123
dataFields: [ AnyHashable : Any ] ? ,
120
124
onSuccess: OnSuccessHandler ? ,
121
125
onFailure: OnFailureHandler ? ) -> Pending < SendRequestValue , SendRequestError > {
122
- chooseRequestProcessor ( ) . trackPushOpen ( campaignId,
123
- templateId: templateId,
124
- messageId: messageId,
125
- appAlreadyRunning: appAlreadyRunning,
126
- dataFields: dataFields,
127
- onSuccess: onSuccess,
128
- onFailure: onFailure)
126
+ Pending < SendRequestValue , SendRequestError > . inBackgroundThread {
127
+ self . chooseRequestProcessor ( ) . trackPushOpen ( campaignId,
128
+ templateId: templateId,
129
+ messageId: messageId,
130
+ appAlreadyRunning: appAlreadyRunning,
131
+ dataFields: dataFields,
132
+ onSuccess: onSuccess,
133
+ onFailure: onFailure)
134
+ }
129
135
}
130
136
131
137
@discardableResult
132
138
func track( event: String ,
133
139
dataFields: [ AnyHashable : Any ] ? ,
134
140
onSuccess: OnSuccessHandler ? ,
135
141
onFailure: OnFailureHandler ? ) -> Pending < SendRequestValue , SendRequestError > {
136
- chooseRequestProcessor ( ) . track ( event: event,
137
- dataFields: dataFields,
138
- onSuccess: onSuccess,
139
- onFailure: onFailure)
142
+ Pending < SendRequestValue , SendRequestError > . inBackgroundThread {
143
+ self . chooseRequestProcessor ( ) . track ( event: event,
144
+ dataFields: dataFields,
145
+ onSuccess: onSuccess,
146
+ onFailure: onFailure)
147
+ }
140
148
}
141
149
142
150
@discardableResult
@@ -154,11 +162,13 @@ class RequestHandler: RequestHandlerProtocol {
154
162
inboxSessionId: String ? ,
155
163
onSuccess: OnSuccessHandler ? ,
156
164
onFailure: OnFailureHandler ? ) -> Pending < SendRequestValue , SendRequestError > {
157
- chooseRequestProcessor ( ) . trackInAppOpen ( message,
158
- location: location,
159
- inboxSessionId: inboxSessionId,
160
- onSuccess: onSuccess,
161
- onFailure: onFailure)
165
+ Pending < SendRequestValue , SendRequestError > . inBackgroundThread {
166
+ self . chooseRequestProcessor ( ) . trackInAppOpen ( message,
167
+ location: location,
168
+ inboxSessionId: inboxSessionId,
169
+ onSuccess: onSuccess,
170
+ onFailure: onFailure)
171
+ }
162
172
}
163
173
164
174
@discardableResult
@@ -168,12 +178,14 @@ class RequestHandler: RequestHandlerProtocol {
168
178
clickedUrl: String ,
169
179
onSuccess: OnSuccessHandler ? ,
170
180
onFailure: OnFailureHandler ? ) -> Pending < SendRequestValue , SendRequestError > {
171
- chooseRequestProcessor ( ) . trackInAppClick ( message,
172
- location: location,
173
- inboxSessionId: inboxSessionId,
174
- clickedUrl: clickedUrl,
175
- onSuccess: onSuccess,
176
- onFailure: onFailure)
181
+ Pending < SendRequestValue , SendRequestError > . inBackgroundThread {
182
+ self . chooseRequestProcessor ( ) . trackInAppClick ( message,
183
+ location: location,
184
+ inboxSessionId: inboxSessionId,
185
+ clickedUrl: clickedUrl,
186
+ onSuccess: onSuccess,
187
+ onFailure: onFailure)
188
+ }
177
189
}
178
190
179
191
@discardableResult
@@ -184,40 +196,48 @@ class RequestHandler: RequestHandlerProtocol {
184
196
clickedUrl: String ? ,
185
197
onSuccess: OnSuccessHandler ? ,
186
198
onFailure: OnFailureHandler ? ) -> Pending < SendRequestValue , SendRequestError > {
187
- chooseRequestProcessor ( ) . trackInAppClose ( message,
188
- location: location,
189
- inboxSessionId: inboxSessionId,
190
- source: source,
191
- clickedUrl: clickedUrl,
192
- onSuccess: onSuccess,
193
- onFailure: onFailure)
199
+ Pending < SendRequestValue , SendRequestError > . inBackgroundThread {
200
+ self . chooseRequestProcessor ( ) . trackInAppClose ( message,
201
+ location: location,
202
+ inboxSessionId: inboxSessionId,
203
+ source: source,
204
+ clickedUrl: clickedUrl,
205
+ onSuccess: onSuccess,
206
+ onFailure: onFailure)
207
+ }
194
208
}
195
209
196
210
@discardableResult
197
211
func track( inboxSession: IterableInboxSession ,
198
212
onSuccess: OnSuccessHandler ? ,
199
213
onFailure: OnFailureHandler ? ) -> Pending < SendRequestValue , SendRequestError > {
200
- chooseRequestProcessor ( ) . track ( inboxSession: inboxSession,
201
- onSuccess: onSuccess,
202
- onFailure: onFailure)
214
+ Pending < SendRequestValue , SendRequestError > . inBackgroundThread {
215
+ self . chooseRequestProcessor ( ) . track ( inboxSession: inboxSession,
216
+ onSuccess: onSuccess,
217
+ onFailure: onFailure)
218
+ }
203
219
}
204
-
220
+
205
221
@discardableResult
206
222
func track( inAppDelivery message: IterableInAppMessage ,
207
223
onSuccess: OnSuccessHandler ? ,
208
224
onFailure: OnFailureHandler ? ) -> Pending < SendRequestValue , SendRequestError > {
209
- chooseRequestProcessor ( ) . track ( inAppDelivery: message,
210
- onSuccess: onSuccess,
211
- onFailure: onFailure)
225
+ Pending < SendRequestValue , SendRequestError > . inBackgroundThread {
226
+ self . chooseRequestProcessor ( ) . track ( inAppDelivery: message,
227
+ onSuccess: onSuccess,
228
+ onFailure: onFailure)
229
+ }
212
230
}
213
231
214
232
@discardableResult
215
233
func inAppConsume( _ messageId: String ,
216
234
onSuccess: OnSuccessHandler ? ,
217
235
onFailure: OnFailureHandler ? ) -> Pending < SendRequestValue , SendRequestError > {
218
- chooseRequestProcessor ( ) . inAppConsume ( messageId,
219
- onSuccess: onSuccess,
220
- onFailure: onFailure)
236
+ Pending < SendRequestValue , SendRequestError > . inBackgroundThread {
237
+ self . chooseRequestProcessor ( ) . inAppConsume ( messageId,
238
+ onSuccess: onSuccess,
239
+ onFailure: onFailure)
240
+ }
221
241
}
222
242
223
243
@discardableResult
@@ -227,12 +247,14 @@ class RequestHandler: RequestHandlerProtocol {
227
247
inboxSessionId: String ? ,
228
248
onSuccess: OnSuccessHandler ? ,
229
249
onFailure: OnFailureHandler ? ) -> Pending < SendRequestValue , SendRequestError > {
230
- chooseRequestProcessor ( ) . inAppConsume ( message: message,
231
- location: location,
232
- source: source,
233
- inboxSessionId: inboxSessionId,
234
- onSuccess: onSuccess,
235
- onFailure: onFailure)
250
+ Pending < SendRequestValue , SendRequestError > . inBackgroundThread {
251
+ self . chooseRequestProcessor ( ) . inAppConsume ( message: message,
252
+ location: location,
253
+ source: source,
254
+ inboxSessionId: inboxSessionId,
255
+ onSuccess: onSuccess,
256
+ onFailure: onFailure)
257
+ }
236
258
}
237
259
238
260
func getRemoteConfiguration( ) -> Pending < RemoteConfiguration , SendRequestError > {
0 commit comments