Make NucleusApplicationScope implement Compose's ApplicationScope#372
Open
kdroidFilter wants to merge 1 commit into
Open
Make NucleusApplicationScope implement Compose's ApplicationScope#372kdroidFilter wants to merge 1 commit into
kdroidFilter wants to merge 1 commit into
Conversation
…pplicationScope Lets libraries scoped to androidx.compose.ui.window.ApplicationScope (e.g. ComposeNativeTray's Tray composables) work inside nucleusApplication blocks without Nucleus-specific overloads, so they no longer need to depend on nucleus-application at all. The parallel AWT variants of MaterialDecoratedWindow / MaterialDecoratedDialog / JewelDecoratedWindow become applicable inside nucleusApplication too; they are marked @LowPriorityInOverloadResolution so the Nucleus overloads keep winning. compose.desktop.common moves to api since the supertype is now part of the public API surface.
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
NucleusApplicationScopenow extendsandroidx.compose.ui.window.ApplicationScope(it already declared the interface's single member,exitApplication()).Motivation
Libraries whose composables are scoped to Compose's plain
ApplicationScope— most immediately theTraycomposables in ComposeNativeTray (NucleusFramework/ComposeNativeTray#418, NucleusFramework/ComposeNativeTray#419) — become callable insidenucleusApplication { }blocks with a single overload set. The tray core can then drop itsnucleus-applicationdependency entirely and work in both vanilla Composeapplication { }apps and Nucleus apps.Changes
NucleusApplicationScope : ApplicationScope(one-line supertype;exitApplicationbecomes an override).compose.desktop.commonmovesimplementation→apiinnucleus-applicationsince the supertype is now public API.MaterialDecoratedWindow,MaterialDecoratedDialogandJewelDecoratedWindow(receiverApplicationScope) are now also applicable insidenucleusApplication, and neither signature is more specific (thecontentlambdas differ). They are marked@LowPriorityInOverloadResolutionso the Nucleus overloads keep winning; in plainapplication { }blocks they remain the only applicable candidates, so behaviour there is unchanged.Compatibility
ApplicationScope/NucleusApplicationScopeoverload pairs could hit the same ambiguity and would need the same annotation — considered unlikely.Verification
:nucleus-application,:decorated-window-material3,:decorated-window-jewelbuild green.ApplicationScope-scopedTrayoverloads and nonucleus-applicationdependency; the demo (nucleusApplication+MaterialDecoratedWindow+Tray+TrayApp) compiles and its overloads resolve to the Nucleus variants.