Skip to content

Adds support for UiMediaScope in iOS - #3340

Open
Apolo (ApoloApps) wants to merge 11 commits into
JetBrains:jb-mainfrom
ApoloApps:uiMediaSupportInIos
Open

Adds support for UiMediaScope in iOS#3340
Apolo (ApoloApps) wants to merge 11 commits into
JetBrains:jb-mainfrom
ApoloApps:uiMediaSupportInIos

Conversation

@ApoloApps

@ApoloApps Apolo (ApoloApps) commented Aug 25, 2026

Copy link
Copy Markdown

Follow-up of #3339
Merge after mentioned PR is merged (iOS changes only, skiko logic is handled in said PR)

Fixes https://youtrack.jetbrains.com/issue/CMP-10740/iOS-Report-real-device-characteristics-to-mediaQuery

Release Notes

N/A

@ApoloApps

Copy link
Copy Markdown
Author

@ASalavei Andrei Salavei (ASalavei) left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

iOS part LGTM

)
private val systemThemeState: MutableState<SystemTheme> = mutableStateOf(SystemTheme.UNKNOWN)

private val systemDensityState: MutableState<Density> = mutableStateOf(window?.density ?: Density(1f))

Choose a reason for hiding this comment

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

There is screenDensity currently in WindowContext. These two should be consolidated as they represent the same value dependent on the current window.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done! Removed the one from MediaEnvironment as it it unused and leftover from previous pr


val systemTheme: SystemTheme
get() = systemThemeState.value
val systemDensity: Density

Choose a reason for hiding this comment

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

I am not sure this value belongs here. IMO better to keep it in WindowContext as it is tied to window.

I see that it is not required by the UiMediaScope interface.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

what are you referring to here? the system theme or density? The latter has been removed since it did not have usages

Ivan Matkov (MatkovIvan) pushed a commit that referenced this pull request Sep 1, 2026
Smaller change to support UiMediaScope in skiko platforms

Fixes
[CMP-10481](https://youtrack.jetbrains.com/issue/CMP-10481/Add-Support-for-UiMediaScope)
(common part)

iOS PR:
#3340
Desktop PR:
#3341


## Release Notes
### Features - Multiple Platforms
- Add support for mediaQuery calls which allows to modify Composables
depending on device characteristics
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.

3 participants