Skip to content

Commit

Permalink
Andrei.salavei/move local UI view controller to UI.uikit module (#1608)
Browse files Browse the repository at this point in the history
Fixes:
https://youtrack.jetbrains.com/issue/CMP-6771/Move-LocalUIViewController-to-ui.uikit-module

## Release Notes
### Highlights - iOS
- LocalUIViewController moved to the `androidx.compose.ui.uikit` module
  • Loading branch information
ASalavei authored Oct 15, 2024
1 parent 464e2eb commit de03785
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.isSpecified
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.drawscope.ContentDrawScope
import androidx.compose.ui.interop.LocalUIViewController
import androidx.compose.ui.layout.LayoutCoordinates
import androidx.compose.ui.layout.positionInWindow
import androidx.compose.ui.node.CompositionLocalConsumerModifierNode
Expand All @@ -42,6 +41,7 @@ import androidx.compose.ui.platform.debugInspectorInfo
import androidx.compose.ui.platform.inspectable
import androidx.compose.ui.semantics.SemanticsPropertyKey
import androidx.compose.ui.semantics.SemanticsPropertyReceiver
import androidx.compose.ui.uikit.LocalUIViewController
import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.IntSize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.interop.LocalUIViewController
import androidx.compose.ui.uikit.LocalUIViewController
import androidx.compose.ui.interop.UIKitView
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.ComposeUIViewController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.interop.LocalUIViewController
import androidx.compose.ui.platform.AccessibilityDebugLogger
import androidx.compose.ui.platform.AccessibilitySyncOptions
import androidx.compose.ui.uikit.LocalUIViewController
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.ComposeUIViewController
import androidx.compose.ui.window.Dialog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.interop.LocalUIViewController
import androidx.compose.ui.uikit.LocalUIViewController
import androidx.compose.ui.unit.dp
import platform.UIKit.UIStatusBarAnimation
import platform.UIKit.UIStatusBarStyleDarkContent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import androidx.compose.mpp.demo.Screen
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.interop.LocalUIViewController
import androidx.compose.ui.uikit.LocalUIViewController
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.ComposeUIViewController
import platform.UIKit.UIModalPresentationFormSheet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import androidx.compose.mpp.demo.Screen
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.interop.LocalUIViewController
import androidx.compose.ui.uikit.LocalUIViewController
import platform.AVFoundation.AVPlayer
import platform.AVKit.AVPlayerViewController
import platform.Foundation.NSURL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@

package androidx.compose.ui.interop

import androidx.compose.runtime.staticCompositionLocalOf
import platform.UIKit.UIViewController

/**
* public value to get UIViewController of Compose window for library authors.
* Public value to get UIViewController of Compose window for library authors.
* Maybe useful for features, like VideoPlayer and Bottom menus.
* Please use it careful and don't remove another views.
* Please use it carefully and don't add or remove other views - check
* [androidx.compose.ui.interop.UIKitView] for those purposes.
*/
// TODO: Move to androidx.compose.ui.uikit
val LocalUIViewController = staticCompositionLocalOf<UIViewController> {
error("CompositionLocal UIViewController not provided")
}
@Deprecated(
message = "LocalUIViewController was moved to androidx.compose.ui.uikit",
replaceWith = ReplaceWith(
expression = "LocalUIViewController",
imports = arrayOf("androidx.compose.ui.uikit.LocalUIViewController")
)
)
val LocalUIViewController get() = androidx.compose.ui.uikit.LocalUIViewController
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ import androidx.compose.ui.LocalSystemTheme
import androidx.compose.ui.SystemTheme
import androidx.compose.ui.graphics.asComposeCanvas
import androidx.compose.ui.hapticfeedback.CupertinoHapticFeedback
import androidx.compose.ui.interop.LocalUIViewController
import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.platform.LocalInternalViewModelStoreOwner
import androidx.compose.ui.platform.PlatformContext
import androidx.compose.ui.platform.PlatformWindowContext
import androidx.compose.ui.uikit.ComposeUIViewControllerConfiguration
import androidx.compose.ui.uikit.InterfaceOrientation
import androidx.compose.ui.uikit.LocalInterfaceOrientation
import androidx.compose.ui.uikit.LocalUIViewController
import androidx.compose.ui.uikit.PlistSanityCheck
import androidx.compose.ui.uikit.density
import androidx.compose.ui.uikit.embedSubview
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright 2024 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package androidx.compose.ui.uikit

import androidx.compose.runtime.staticCompositionLocalOf
import platform.UIKit.UIViewController

/**
* Public value to get UIViewController of Compose window for library authors.
* Maybe useful for features, like VideoPlayer and Bottom menus.
* Please use it carefully and don't add or remove other views - check
* [androidx.compose.ui.interop.UIKitView] for those purposes.
*/
val LocalUIViewController = staticCompositionLocalOf<UIViewController> {
error("CompositionLocal UIViewController not provided")
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
package androidx.compose.ui.viewinterop

import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.interop.LocalUIViewController
import androidx.compose.ui.uikit.LocalUIViewController
import platform.UIKit.UIViewController

/**
Expand Down

0 comments on commit de03785

Please sign in to comment.