Skip to content

MOBILEWEBVIEW-34: Refactoring close inapp#687

Open
enotniy wants to merge 3 commits intomission/webview-inappfrom
feature/MOBILEWEBVIEW-34
Open

MOBILEWEBVIEW-34: Refactoring close inapp#687
enotniy wants to merge 3 commits intomission/webview-inappfrom
feature/MOBILEWEBVIEW-34

Conversation

@enotniy
Copy link
Collaborator

@enotniy enotniy commented Mar 4, 2026

@enotniy enotniy requested a review from sergeysozinov March 4, 2026 09:15
val view: WebViewPlatformView = controller.view
inAppLayout.removeView(view)
view.parent.safeAs<ViewGroup>()?.removeView(view)
controller.destroy()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут destroy вызывается и ещё ниже следом
webViewController?.destroy()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

убрал один

mindboxLogI("In-app dismissed by webview action ${message.action} with payload ${message.payload}")
hide()
release()
inAppController.close()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь и в других аналогичных местах с onInAppDismiss проблема будет:

Вызывается closeCurrentInapp , а там внутри

  if (isInAppActive()) {
                currentHolder?.wrapper?.inAppActionCallbacks
                    ?.copy(onInAppDismiss = { mindboxLogI("Do not save the closing timestamp for in-app as it's restored automatically when the session is reopened") })
                    ?.onInAppDismiss
                    ?.onDismiss()
            }

флаг isInAppActive мы нигде не сбрасываем в false.

Поэтому дисмисс внутри closeCurrentInApp так же выполнитится

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

я поправил. Это условие сделано только для скрытия после окончания сессии. Выделил под это отдельный метод

controller.executeOnViewThread {
hide()
release()
inAppController.close()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не понимаю почему, но потестил и заметил , что при разворачивании приложения, где WebView каждый раз отправляется Inapp.Show и счетчики показа увеличиваются. Видимо из-за того что pausedHolder затираем

15:14:04.067  I  InAppMessageManagerImpl: Render time is 373602ms, prepared time is 452ms
15:14:04.067  I  InAppRepositoryImpl: Increase count of shown inapp per session, previous count 7
15:14:04.071  I  InAppRepositoryImpl: Increase count of shown inapp per day

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Поправил. Это было из-за того, что неправильно pausedHolder работал

@enotniy enotniy requested a review from sergeysozinov March 10, 2026 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants