@@ -170,16 +170,15 @@ class IterableInAppManager: NSObject {
170
170
}
171
171
}
172
172
173
- enum HandleInAppResult {
173
+ enum ShowInAppResult {
174
174
case success( opened: Bool , messageId: String )
175
175
case failure( reason: String , messageId: String ? )
176
176
}
177
177
178
- static func handleInApp( withPayload payload: [ AnyHashable : Any ] , callbackBlock: ITEActionBlock ? ) -> Future < HandleInAppResult > {
179
- let parseResult = parseInApp ( fromPayload: payload)
178
+ static func showInApp( parseResult: InAppParseResult , callbackBlock: ITEActionBlock ? ) -> Future < ShowInAppResult > {
180
179
switch parseResult {
181
180
case . success( let inAppDetails) :
182
- let result = Promise < HandleInAppResult > ( )
181
+ let result = Promise < ShowInAppResult > ( )
183
182
let notificationMetadata = IterableNotificationMetadata . metadata ( fromInAppOptions: inAppDetails. messageId)
184
183
185
184
DispatchQueue . main. async {
@@ -192,10 +191,11 @@ class IterableInAppManager: NSObject {
192
191
}
193
192
return result
194
193
case . failure( let reason, let messageId) :
195
- return Promise < HandleInAppResult > ( value: . failure( reason: reason, messageId: messageId) )
194
+ return Promise < ShowInAppResult > ( value: . failure( reason: reason, messageId: messageId) )
196
195
}
197
196
}
198
197
198
+
199
199
private static func getTopViewController( ) -> UIViewController ? {
200
200
guard let rootViewController = IterableUtil . rootViewController else {
201
201
return nil
@@ -207,12 +207,12 @@ class IterableInAppManager: NSObject {
207
207
return topViewController
208
208
}
209
209
210
- private enum InAppParseResult {
210
+ enum InAppParseResult {
211
211
case success( InAppDetails )
212
212
case failure( reason: String , messageId: String ? )
213
213
}
214
214
215
- private struct InAppDetails {
215
+ struct InAppDetails {
216
216
let edgeInsets : UIEdgeInsets
217
217
let backgroundAlpha : Double
218
218
let messageId : String
@@ -221,7 +221,7 @@ class IterableInAppManager: NSObject {
221
221
222
222
// Payload is what comes from Api
223
223
// If successful you get InAppDetails
224
- private static func parseInApp( fromPayload payload: [ AnyHashable : Any ] ) -> InAppParseResult {
224
+ static func parseInApp( fromPayload payload: [ AnyHashable : Any ] ) -> InAppParseResult {
225
225
guard let dialogOptions = IterableInAppManager . getNextMessageFromPayload ( payload) else {
226
226
return . failure( reason: " No notifications found for inApp payload \( payload) " , messageId: nil )
227
227
}
0 commit comments