@@ -170,16 +170,15 @@ class IterableInAppManager: NSObject {
170170 }
171171 }
172172
173- enum HandleInAppResult {
173+ enum ShowInAppResult {
174174 case success( opened: Bool , messageId: String )
175175 case failure( reason: String , messageId: String ? )
176176 }
177177
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 > {
180179 switch parseResult {
181180 case . success( let inAppDetails) :
182- let result = Promise < HandleInAppResult > ( )
181+ let result = Promise < ShowInAppResult > ( )
183182 let notificationMetadata = IterableNotificationMetadata . metadata ( fromInAppOptions: inAppDetails. messageId)
184183
185184 DispatchQueue . main. async {
@@ -192,10 +191,11 @@ class IterableInAppManager: NSObject {
192191 }
193192 return result
194193 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) )
196195 }
197196 }
198197
198+
199199 private static func getTopViewController( ) -> UIViewController ? {
200200 guard let rootViewController = IterableUtil . rootViewController else {
201201 return nil
@@ -207,12 +207,12 @@ class IterableInAppManager: NSObject {
207207 return topViewController
208208 }
209209
210- private enum InAppParseResult {
210+ enum InAppParseResult {
211211 case success( InAppDetails )
212212 case failure( reason: String , messageId: String ? )
213213 }
214214
215- private struct InAppDetails {
215+ struct InAppDetails {
216216 let edgeInsets : UIEdgeInsets
217217 let backgroundAlpha : Double
218218 let messageId : String
@@ -221,7 +221,7 @@ class IterableInAppManager: NSObject {
221221
222222 // Payload is what comes from Api
223223 // If successful you get InAppDetails
224- private static func parseInApp( fromPayload payload: [ AnyHashable : Any ] ) -> InAppParseResult {
224+ static func parseInApp( fromPayload payload: [ AnyHashable : Any ] ) -> InAppParseResult {
225225 guard let dialogOptions = IterableInAppManager . getNextMessageFromPayload ( payload) else {
226226 return . failure( reason: " No notifications found for inApp payload \( payload) " , messageId: nil )
227227 }
0 commit comments