OmSession: use Owner.JAVASCRIPT impression owner for HTML display - #8
Merged
Merged
Conversation
The v4 KontextKit OMID config used `Owner.NATIVE` as impressionOwner
for HTML_DISPLAY sessions on the assumption that the native SDK firing
loaded() + impressionOccurred() would stop the JS verification scripts
from polling geometry. In practice the JS still polled, and after the
hosting WebView was detached from its window the next poll emitted a
spurious `geometryChange { reasons: ["notFound"] }`.
Both reference implementations use Owner.JAVASCRIPT for HTML display:
- IAB OMID Android v1.6.4 demo (`OM-DemoApp/.../AdSessionUtil.java:55`):
Owner.JAVASCRIPT, BEGIN_TO_RENDER, mediaOwner = NONE for HTML_DISPLAY.
- kontextkit-ios (`Sources/OMSDK/OMManager.swift:107-115`):
.javaScriptOwner for both display and video.
- v3 sdk-kotlin (`internal/utils/om/WebViewOmSession.kt:75`): same.
All four converge: HTML display sessions are JS-impression-owner. The
in-iframe `use-omid-display-session` hook (in ads/packages/omsdk) fires
`adEvents.loaded(null)` + `adEvents.impressionOccurred()` from the
`sessionStart` observer; the native side just constructs the session
and calls `start()`.
Switching impressionOwner also drops the native AdEvents creation —
no longer needed for any creative type, since the verification scripts
own loaded/impression for both display and video now. `loaded()` and
`impressionOccurred()` on `OmSession` become no-ops kept only for SDK
API compatibility (sdk-kotlin still references them today; can be
removed in a follow-up).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`OmSession.loaded()` and `impressionOccurred()` became no-ops in the parent commit (`62a497c`) — the JS verification scripts own these events now that `impressionOwner = Owner.JAVASCRIPT` for both display and video. The two private booleans that guarded re-entry against those methods are no longer referenced anywhere; detekt's `UnusedPrivateProperty` flagged them and failed CI. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Aligns KontextKit's toolchain with sdk-kotlin's 2.1 baseline (used in the v3 2.0.1 release) so consuming apps already on Kotlin 2.x stop hitting compiler-output / metadata mismatches when pulling KontextKit transitively. v4 dropped Ktor (uses HttpURLConnection) so the bump here is purely toolchain — no library API changes. Versions: - Kotlin 1.9.22 → 2.1.0 - AGP 8.6.1 → 8.7.3 (requires Gradle 8.9+) - Gradle 8.7 → 8.9 - detekt 1.23.4 → 1.23.8 (Kotlin 2.x compat) - spotless 6.25.0 → 7.2.1 - kit 0.0.4 → 0.0.5 Verified locally with `./gradlew spotlessCheck detekt test` — clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
JakubMrozek
added a commit
to kontextso/sdk-kotlin
that referenced
this pull request
May 22, 2026
Toolchain alignment with the v3 2.0.1 baseline so publisher apps
already on Kotlin 2.x stop hitting compiler-output / metadata
mismatches when consuming sdk-kotlin v4. v4 already dropped Ktor
(uses `HttpURLConnection`), so this bump is pure toolchain — no
public API changes.
Versions:
- Kotlin 1.9.22 → 2.1.0
- AGP 8.6.1 → 8.7.3 (requires Gradle 8.9+)
- Gradle 8.7 → 8.9
- detekt 1.23.4 → 1.23.8 (Kotlin 2.x compat)
- spotless 6.25.0 → 7.2.1
- compose-bom 2024.01.00 → 2024.12.01
- kontext-kit 0.0.4 → 0.0.5 (OMID HTML display impression owner
now Owner.JAVASCRIPT — see
kontextso/kontextkit-android#8)
Compose plugin:
The `composeOptions { kotlinCompilerExtensionVersion }` block is
unsupported on Kotlin 2.x. Applied the new
`org.jetbrains.kotlin.plugin.compose` plugin to both `:ads` and
`:example`. Dropped the now-unused `compose-compiler` version
constant from the catalog.
Tests:
Removed two stale tests in `AdTest.kt` that referenced the
`finishOmSessionNow()` method deleted during the OMID rework
earlier in this PR. Kotlin 1.9.22 silently passed them; Kotlin
2.1.0 reports them as unresolved references.
Spotless reformatted a handful of files under
`ads/src/main/kotlin/so/kontext/ads/ui/` to match the 7.2.1
ktlint baseline — formatting-only.
Verified:
- `./gradlew spotlessCheck detekt :ads:testDebug` clean
- `./gradlew :example:installDebug` installs cleanly on a Pixel 9a
emulator (Android 16)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Switches HTML display sessions from
Owner.NATIVEtoOwner.JAVASCRIPTfor the impression owner, matching the two reference implementations:internal/utils/om/WebViewOmSession.kt:75) —Owner.JAVASCRIPTfor both display and videoSources/OMSDK/OMManager.swift:107-115) —.javaScriptOwnerfor both display and videoOM-DemoApp/.../AdSessionUtil.java:55) —Owner.JAVASCRIPT,BEGIN_TO_RENDER,mediaOwner: NONEforHTML_DISPLAYThe v4 KontextKit deviated to
Owner.NATIVEon the assumption that firingloaded()+impressionOccurred()natively would stop the JS verification scripts from polling geometry. In practice that wasn't the case — the JS layer still polled, and the IAB validator flagged the resulting impression events on the Kontext sdk-kotlin OMID submission.Changes
src/main/kotlin/so/kontext/kit/omsdk/OmSession.kt— setimpressionOwner = jsOwnerunconditionally (wasnativeOwnerfor display). Drop the now-unusednativeOwnerlocal and theAdEventscreation block — both display and video are now JS-impression-owner, so the in-iframeuseOmidDisplaySession/useOmidVideoSessionhooks own theloaded+impressionOccurredcalls.OmSession.loaded()andOmSession.impressionOccurred()are kept as no-ops for SDK API compatibility — sdk-kotlin v4 still calls them today; cleanup is a follow-up.Companion change (waits on this release)
loaded()+impressionOccurred()calls inAd.kt(startOmSessionDelayed) since JS owns them now. Currently consumes KontextKit via local `includeBuild` for testing. After this PR merges + releases as a new KontextKit version, sdk-kotlin's `gradle/libs.versions.toml` will be bumped to point at the new version.Test plan
🤖 Generated with Claude Code