Repository navigation
Fix network detail gating and live audio volume - #1
Merged
Merged
Conversation
NetworkInfoProvider: CoreTelephony reports the cellular radio's RAT
even when Wi-Fi is the active path (the radio stays up on 5G/LTE
for calls and fallback). Without gating, the SDK was shipping
{type: "wifi", detail: "5g"} which misrepresents the data path to
DSPs. Match sdk-react-native's AdsProvider behaviour by returning
`detail` only when `type == "cellular"`.
AudioInfoProvider: `AVAudioSession.outputVolume` is documented as
undefined unless the session is active, AND iOS only continuously
refreshes the property when something is observing it via KVO (or
audio is playing). Previously `collect()` didn't activate the
session, so it returned a value cached at app launch — fine for
the first preload, frozen on every subsequent one even after the
user changes device volume. Activate the session at the top of
`collect()` and install a permanent KVO observer inside
`ensureSessionActive()` so the value tracks user changes without
needing a video ad on screen.
Tests:
- detailIsNilOnNonCellular / dictOmitsDetailOnNonCellular
- collectActivatesSessionImplicitly
- consecutiveCollectsKeepSessionActive
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <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
Two device-info collection bugs surfaced during sdk-swift v4 wire-shape testing on a real iPhone:
NetworkInfoProvider.collect()reported{type: "wifi", detail: "5g"}because CoreTelephony's cellular RAT lookup is independent ofNWPathMonitor's active-path read. The cellular radio stays up on 5G/LTE for calls/fallback even when Wi-Fi is carrying data, sodetailwas describing the wrong connection. Match sdk-react-native by gatingdetailontype == "cellular".AudioInfoProvider.collect()returned a volume reading that updated only on the first preload after app launch and was frozen on every subsequent call — even after the user changed device volume — becauseAVAudioSession.outputVolumeis documented as undefined unless the session is active, and iOS only continuously refreshes the property while something is observing it via KVO. Activate the session at the top ofcollect()and install a permanent KVO observer inensureSessionActive()so volume tracks user changes without needing a video ad on screen.Test plan
swift test/xcodebuild test -scheme KontextKit— 39 tests pass.detailIsNilOnNonCellular+dictOmitsDetailOnNonCellular(NetworkInfoProvider)collectActivatesSessionImplicitly(AudioInfoProvider)consecutiveCollectsKeepSessionActive(AudioInfoProvider)detailappears/disappears.🤖 Generated with Claude Code