Skip to content

Commit

Permalink
removed position usage
Browse files Browse the repository at this point in the history
  • Loading branch information
mrehan27 committed Sep 11, 2024
1 parent 7048bf5 commit b1f907b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions Sources/MessagingInApp/Gist/Managers/MessageManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class MessageManager: EngineWebDelegate {
private let currentMessage: Message
private var currentRoute: String
private let isMessageEmbed: Bool
private var messagePosition: MessagePosition = .center

@Atomic private var isMessageLoaded: Bool = false
private var inAppMessageStoreSubscriber: InAppMessageStoreSubscriber?
Expand Down Expand Up @@ -79,9 +78,8 @@ class MessageManager: EngineWebDelegate {
}()
}

func showMessage(position: MessagePosition) {
func showMessage() {
elapsedTimer.start(title: "Displaying modal for message: \(currentMessage.messageId)")
messagePosition = position
}

private func loadModalMessage() {
Expand All @@ -91,7 +89,7 @@ class MessageManager: EngineWebDelegate {
}

logger.logWithModuleTag("Loading modal message: \(currentMessage.describeForLogs)", level: .debug)
modalViewManager = ModalViewManager(gistView: gistView, position: messagePosition)
modalViewManager = ModalViewManager(gistView: gistView, position: currentMessage.gistProperties.position)
modalViewManager?.showModalView { [weak self] in
guard let self = self else { return }

Expand Down
2 changes: 1 addition & 1 deletion Sources/MessagingInApp/State/InAppMessageMiddleware.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func modalMessageDisplayStateMiddleware(logger: Logger, threadUtil: ThreadUtil)
// Show message on main thread to avoid unexpected crashes
threadUtil.runMain {
let messageManager = MessageManager(state: state, message: message)
messageManager.showMessage(position: message.gistProperties.position)
messageManager.showMessage()
}

return next(action)
Expand Down

0 comments on commit b1f907b

Please sign in to comment.