diff --git a/experimental/examples/chat-mpp/.gitignore b/experimental/examples/chat-mpp/.gitignore index 7921cd4d1c..74989f6092 100644 --- a/experimental/examples/chat-mpp/.gitignore +++ b/experimental/examples/chat-mpp/.gitignore @@ -1,2 +1,8 @@ local.properties .idea +iosApp/Podfile.lock +iosApp/Pods/* +iosApp/Chat.xcworkspace/* +iosApp/Chat.xcodeproj/* +!iosApp/Chat.xcodeproj/project.pbxproj +shared/shared.podspec diff --git a/experimental/examples/chat-mpp/.run/desktopApp.run.xml b/experimental/examples/chat-mpp/.run/desktopApp.run.xml new file mode 100644 index 0000000000..7af7e15f4b --- /dev/null +++ b/experimental/examples/chat-mpp/.run/desktopApp.run.xml @@ -0,0 +1,28 @@ + + + + + + + + true + true + false + + + \ No newline at end of file diff --git a/experimental/examples/chat-mpp/.run/iosApp (Android Studio).run.xml b/experimental/examples/chat-mpp/.run/iosApp (Android Studio).run.xml new file mode 100644 index 0000000000..7db93f44c2 --- /dev/null +++ b/experimental/examples/chat-mpp/.run/iosApp (Android Studio).run.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/experimental/examples/chat-mpp/.run/iosApp.run.xml b/experimental/examples/chat-mpp/.run/iosApp.run.xml new file mode 100644 index 0000000000..52af717eaf --- /dev/null +++ b/experimental/examples/chat-mpp/.run/iosApp.run.xml @@ -0,0 +1,8 @@ + + + + + + + \ No newline at end of file diff --git a/experimental/examples/chat-mpp/.run/jsApp.run.xml b/experimental/examples/chat-mpp/.run/jsApp.run.xml new file mode 100644 index 0000000000..6135d902e4 --- /dev/null +++ b/experimental/examples/chat-mpp/.run/jsApp.run.xml @@ -0,0 +1,28 @@ + + + + + + + + true + true + false + + + \ No newline at end of file diff --git a/experimental/examples/chat-mpp/README.md b/experimental/examples/chat-mpp/README.md index 5788efda1b..e9318eee36 100644 --- a/experimental/examples/chat-mpp/README.md +++ b/experimental/examples/chat-mpp/README.md @@ -1,23 +1,28 @@ # Chat example app -## Run on Android: -- connect device or emulator -- `./gradlew installDebug` -- open app +Example can run on Android, iOS, desktop or in a browser. -## Run on Desktop jvm - `./gradlew run` +*Prerequisites*: to run on iOS and Android, you should have "Kotlin Multiplatform Mobile" plugin installed either + in Android Studio or in AppCode with [installed CocoaPods](https://kotlinlang.org/docs/native-cocoapods.html). -## Run native on MacOS - `./gradlew runDebugExecutableMacosX64` (Works on Intel processors) -## Run web assembly in browser - `./gradlew jsBrowserDevelopmentRun` +## How to run -## Run on iOS simulator - `./gradlew iosDeployIPhone8Debug` - `./gradlew iosDeployIPadDebug` +Choose a run configuration for an appropriate target in IDE and run it. -## Run on iOS device -- Read about iOS target in [falling-balls-mpp/README.md](../falling-balls-mpp/README.md) -- `./gradlew iosDeployDeviceRelease` +![run-configurations.png](run-configurations.png) + +To run on iOS device, please correct `iosApp/Configuration/TeamId.xcconfig` with your Apple Team ID. +Alternatively, you may setup signing within XCode opening `iosApp/Chat.xcworkspace` and then +using "Signing & Capabilities" tab of `Chat` target. + +Then choose **iosApp** configuration in IDE and run it +(may also be referred as `Chat` in the Run Configurations or `iosApp (Android Studio)` for Android studio). + +## Run on desktop via Gradle + +`./gradlew desktopApp:run` + +## Run JS in browser with WebAssembly Skia via Gradle + +`./gradlew jsApp:jsBrowserDevelopmentRun` diff --git a/experimental/examples/chat-mpp/androidApp/build.gradle.kts b/experimental/examples/chat-mpp/androidApp/build.gradle.kts new file mode 100644 index 0000000000..148f74a370 --- /dev/null +++ b/experimental/examples/chat-mpp/androidApp/build.gradle.kts @@ -0,0 +1,33 @@ +plugins { + kotlin("multiplatform") + id("com.android.application") + id("org.jetbrains.compose") +} + +kotlin { + android() + sourceSets { + val androidMain by getting { + dependencies { + implementation(project(":shared")) + implementation("androidx.appcompat:appcompat:1.5.1") + implementation("androidx.activity:activity-compose:1.6.1") + } + } + } +} + +android { + compileSdk = 33 + defaultConfig { + applicationId = "org.jetbrains.Chat" + minSdk = 24 + targetSdk = 33 + versionCode = 1 + versionName = "1.0" + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } +} \ No newline at end of file diff --git a/experimental/examples/chat-mpp/src/androidMain/AndroidManifest.xml b/experimental/examples/chat-mpp/androidApp/src/main/AndroidManifest.xml similarity index 100% rename from experimental/examples/chat-mpp/src/androidMain/AndroidManifest.xml rename to experimental/examples/chat-mpp/androidApp/src/main/AndroidManifest.xml diff --git a/experimental/examples/chat-mpp/src/androidMain/kotlin/MainActivity.kt b/experimental/examples/chat-mpp/androidApp/src/main/kotlin/MainActivity.kt similarity index 78% rename from experimental/examples/chat-mpp/src/androidMain/kotlin/MainActivity.kt rename to experimental/examples/chat-mpp/androidApp/src/main/kotlin/MainActivity.kt index ba87a23dcf..dc9ecb1aec 100644 --- a/experimental/examples/chat-mpp/src/androidMain/kotlin/MainActivity.kt +++ b/experimental/examples/chat-mpp/androidApp/src/main/kotlin/MainActivity.kt @@ -3,15 +3,13 @@ package org.jetbrains.chat import android.os.Bundle import androidx.activity.compose.setContent import androidx.appcompat.app.AppCompatActivity -import java.io.File -import java.io.FileOutputStream -import ChatApp +import MainView class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { - ChatApp() + MainView() } } } diff --git a/experimental/examples/chat-mpp/src/androidMain/res/values/strings.xml b/experimental/examples/chat-mpp/androidApp/src/main/res/values/strings.xml similarity index 100% rename from experimental/examples/chat-mpp/src/androidMain/res/values/strings.xml rename to experimental/examples/chat-mpp/androidApp/src/main/res/values/strings.xml diff --git a/experimental/examples/chat-mpp/build.gradle.kts b/experimental/examples/chat-mpp/build.gradle.kts index 27c6ada080..0c00883af5 100644 --- a/experimental/examples/chat-mpp/build.gradle.kts +++ b/experimental/examples/chat-mpp/build.gradle.kts @@ -1,217 +1,18 @@ -import org.jetbrains.compose.compose -import org.jetbrains.compose.desktop.application.dsl.TargetFormat -import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension -import org.jetbrains.compose.experimental.dsl.IOSDevices - plugins { - id("com.android.application") - kotlin("multiplatform") - id("org.jetbrains.compose") -} - -version = "1.0-SNAPSHOT" - -repositories { - mavenLocal() - google() - mavenCentral() - maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") -} - -kotlin { - android() - jvm("desktop") - js(IR) { - browser() - binaries.executable() - } - macosX64 { - binaries { - executable { - entryPoint = "main" - freeCompilerArgs += listOf( - "-linker-option", "-framework", "-linker-option", "Metal" - ) - } - } - } - macosArm64 { - binaries { - executable { - entryPoint = "main" - freeCompilerArgs += listOf( - "-linker-option", "-framework", "-linker-option", "Metal" - ) - } - } - } - - // Workaround for an issue: - // https://youtrack.jetbrains.com/issue/KT-53561/Invalid-LLVM-module-inlinable-function-call-in-a-function-with-debug-info-must-have-a-dbg-location - // Compose compiler produces nodes without line information sometimes that provokes Kotlin native compiler to report errors. - // TODO: remove workaround when switch to Kotlin 1.8 - val disableKonanVerification = "-Xverify-compiler=false" - - iosX64("uikitX64") { - binaries { - executable() { - entryPoint = "main" - freeCompilerArgs += listOf( - "-linker-option", "-framework", "-linker-option", "Metal", - "-linker-option", "-framework", "-linker-option", "CoreText", - "-linker-option", "-framework", "-linker-option", "CoreGraphics", - disableKonanVerification - ) - } - } - } - iosArm64("uikitArm64") { - binaries { - executable() { - entryPoint = "main" - freeCompilerArgs += listOf( - "-linker-option", "-framework", "-linker-option", "Metal", - "-linker-option", "-framework", "-linker-option", "CoreText", - "-linker-option", "-framework", "-linker-option", "CoreGraphics", - disableKonanVerification - ) - } - } - } - - sourceSets { - val commonMain by getting { - dependencies { - implementation(compose.ui) - implementation(compose.foundation) - implementation(compose.material) - implementation(compose.runtime) - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.3") - } - } - - val commonTest by getting { - dependencies { - implementation(kotlin("test-common")) - implementation(kotlin("test-annotations-common")) - } - } - - val androidMain by getting { - dependsOn(commonMain) - kotlin.srcDirs("src/jvmMain/kotlin") - dependencies { - implementation("androidx.appcompat:appcompat:1.5.1") - implementation("androidx.activity:activity-compose:1.5.0") - } - } - - val desktopMain by getting { - dependencies { - implementation(compose.desktop.currentOs) - } - } - - val jsMain by getting { - dependencies { - implementation(compose.web.core) - } - } - - val nativeMain by creating { - dependsOn(commonMain) - } - val macosMain by creating { - dependsOn(nativeMain) - } - val macosX64Main by getting { - dependsOn(macosMain) - } - val macosArm64Main by getting { - dependsOn(macosMain) - } - val uikitMain by creating { - dependsOn(nativeMain) - } - val uikitX64Main by getting { - dependsOn(uikitMain) - } - val uikitArm64Main by getting { - dependsOn(uikitMain) - } - } -} - -compose.desktop { - application { - mainClass = "Main_desktopKt" - } -} - -compose.experimental { - web.application {} - uikit.application { - bundleIdPrefix = "org.jetbrains" - projectName = "Chat" - deployConfigurations { - simulator("IPhone8") { - //Usage: ./gradlew iosDeployIPhone8Debug - device = IOSDevices.IPHONE_8 - } - simulator("IPad") { - //Usage: ./gradlew iosDeployIPadDebug - device = IOSDevices.IPAD_MINI_6th_Gen - } - connectedDevice("Device") { - //First need specify your teamId here, or in local.properties (compose.ios.teamId=***) - //teamId="***" - //Usage: ./gradlew iosDeployDeviceRelease - } - } - } -} - -tasks.withType { - kotlinOptions.jvmTarget = "11" -} - -compose.desktop.nativeApplication { - targets(kotlin.targets.getByName("macosX64")) - distributions { - targetFormats(TargetFormat.Dmg) - packageName = "Chat" - packageVersion = "1.0.0" - } -} - -// a temporary workaround for a bug in jsRun invocation - see https://youtrack.jetbrains.com/issue/KT-48273 -afterEvaluate { - rootProject.extensions.configure { - versions.webpackDevServer.version = "4.0.0" - versions.webpackCli.version = "4.9.0" - nodeVersion = "16.0.0" - } -} - -android { - compileSdk = 32 - - defaultConfig { - minSdk = 26 - targetSdk = 32 - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 - } - - sourceSets { - named("main") { - manifest.srcFile("src/androidMain/AndroidManifest.xml") - res.srcDirs("src/androidMain/res", "src/commonMain/resources") - } + // this is necessary to avoid the plugins to be loaded multiple times + // in each subproject's classloader + kotlin("jvm") apply false + kotlin("multiplatform") apply false + kotlin("android") apply false + id("com.android.application") apply false + id("com.android.library") apply false + id("org.jetbrains.compose") apply false +} + +allprojects { + repositories { + google() + mavenCentral() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") } } diff --git a/experimental/examples/chat-mpp/desktopApp/build.gradle.kts b/experimental/examples/chat-mpp/desktopApp/build.gradle.kts new file mode 100644 index 0000000000..5c28f890f9 --- /dev/null +++ b/experimental/examples/chat-mpp/desktopApp/build.gradle.kts @@ -0,0 +1,22 @@ +plugins { + kotlin("multiplatform") + id("org.jetbrains.compose") +} + +kotlin { + jvm {} + sourceSets { + val jvmMain by getting { + dependencies { + implementation(compose.desktop.currentOs) + implementation(project(":shared")) + } + } + } +} + +compose.desktop { + application { + mainClass = "MainKt" + } +} diff --git a/experimental/examples/chat-mpp/src/desktopMain/kotlin/main.desktop.kt b/experimental/examples/chat-mpp/desktopApp/src/jvmMain/kotlin/Main.kt similarity index 64% rename from experimental/examples/chat-mpp/src/desktopMain/kotlin/main.desktop.kt rename to experimental/examples/chat-mpp/desktopApp/src/jvmMain/kotlin/Main.kt index db2b97a4cb..b65393717e 100644 --- a/experimental/examples/chat-mpp/src/desktopMain/kotlin/main.desktop.kt +++ b/experimental/examples/chat-mpp/desktopApp/src/jvmMain/kotlin/Main.kt @@ -1,5 +1,3 @@ -import androidx.compose.desktop.ui.tooling.preview.Preview -import androidx.compose.runtime.Composable import androidx.compose.ui.unit.DpSize import androidx.compose.ui.unit.dp import androidx.compose.ui.window.WindowState @@ -10,11 +8,5 @@ fun main() = title = "Chat", state = WindowState(size = DpSize(500.dp, 800.dp)) ) { - ChatApp() + MainView() } - -@Preview -@Composable -fun ChatPreview() { - ChatApp() -} diff --git a/experimental/examples/chat-mpp/gradle.properties b/experimental/examples/chat-mpp/gradle.properties index e6fa271a3c..d589487b61 100644 --- a/experimental/examples/chat-mpp/gradle.properties +++ b/experimental/examples/chat-mpp/gradle.properties @@ -1,17 +1,17 @@ -compose.version=1.3.0-alpha01-dev827 -kotlin.version=1.7.10 -agp.version=7.0.4 -org.gradle.jvmargs=-Xmx3g kotlin.code.style=official +xcodeproj=./iosApp +kotlin.native.cocoapods.generate.wrapper=true +android.useAndroidX=true +org.gradle.jvmargs=-Xmx3g +org.jetbrains.compose.experimental.jscanvas.enabled=true +org.jetbrains.compose.experimental.macos.enabled=true +org.jetbrains.compose.experimental.uikit.enabled=true kotlin.native.cacheKind=none kotlin.native.useEmbeddableCompilerJar=true kotlin.native.enableDependencyPropagation=false kotlin.mpp.enableGranularSourceSetsMetadata=true # Enable kotlin/native experimental memory model kotlin.native.binary.memoryModel=experimental -compose.desktop.verbose=true -android.useAndroidX=true -kotlin.js.webpack.major.version=4 -org.jetbrains.compose.experimental.jscanvas.enabled=true -org.jetbrains.compose.experimental.macos.enabled=true -org.jetbrains.compose.experimental.uikit.enabled=true +kotlin.version=1.7.20 +agp.version=7.1.3 +compose.version=1.2.1 diff --git a/experimental/examples/chat-mpp/iosApp/Chat.xcodeproj/project.pbxproj b/experimental/examples/chat-mpp/iosApp/Chat.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..d25847ef19 --- /dev/null +++ b/experimental/examples/chat-mpp/iosApp/Chat.xcodeproj/project.pbxproj @@ -0,0 +1,380 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 2152FB042600AC8F00CF470E /* iosApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iosApp.swift */; }; + C1FC908188C4E8695729CB06 /* Pods_Chat.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DE96E47030356CE6AD9794A /* Pods_Chat.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 1EB65E27D2C0F884D0A1A133 /* Pods-Chat.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Chat.debug.xcconfig"; path = "Target Support Files/Pods-Chat/Pods-Chat.debug.xcconfig"; sourceTree = ""; }; + 2152FB032600AC8F00CF470E /* iosApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iosApp.swift; sourceTree = ""; }; + 3D7A606AB0AD7636269BD9D0 /* Pods-Chat.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Chat.release.xcconfig"; path = "Target Support Files/Pods-Chat/Pods-Chat.release.xcconfig"; sourceTree = ""; }; + 7555FF7B242A565900829871 /* Chat.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Chat.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 8DE96E47030356CE6AD9794A /* Pods_Chat.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Chat.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + AB3632DC29227652001CCB65 /* TeamId.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = TeamId.xcconfig; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 9964867F0862B4D9FB6ABFC7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + C1FC908188C4E8695729CB06 /* Pods_Chat.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 7555FF72242A565900829871 = { + isa = PBXGroup; + children = ( + AB1DB47929225F7C00F7AF9C /* Configuration */, + 7555FF7D242A565900829871 /* iosApp */, + 7555FF7C242A565900829871 /* Products */, + E1DAFBE8E1CFC0878361EF0E /* Pods */, + B62309C7396AD7BF607A63B2 /* Frameworks */, + ); + sourceTree = ""; + }; + 7555FF7C242A565900829871 /* Products */ = { + isa = PBXGroup; + children = ( + 7555FF7B242A565900829871 /* Chat.app */, + ); + name = Products; + sourceTree = ""; + }; + 7555FF7D242A565900829871 /* iosApp */ = { + isa = PBXGroup; + children = ( + 7555FF8C242A565B00829871 /* Info.plist */, + 2152FB032600AC8F00CF470E /* iosApp.swift */, + ); + path = iosApp; + sourceTree = ""; + }; + AB1DB47929225F7C00F7AF9C /* Configuration */ = { + isa = PBXGroup; + children = ( + AB3632DC29227652001CCB65 /* TeamId.xcconfig */, + ); + path = Configuration; + sourceTree = ""; + }; + B62309C7396AD7BF607A63B2 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 8DE96E47030356CE6AD9794A /* Pods_Chat.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + E1DAFBE8E1CFC0878361EF0E /* Pods */ = { + isa = PBXGroup; + children = ( + 1EB65E27D2C0F884D0A1A133 /* Pods-Chat.debug.xcconfig */, + 3D7A606AB0AD7636269BD9D0 /* Pods-Chat.release.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 7555FF7A242A565900829871 /* Chat */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "Chat" */; + buildPhases = ( + E8D673591E7196AEA2EA10E2 /* [CP] Check Pods Manifest.lock */, + 7555FF77242A565900829871 /* Sources */, + 7555FF79242A565900829871 /* Resources */, + 9964867F0862B4D9FB6ABFC7 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Chat; + productName = iosApp; + productReference = 7555FF7B242A565900829871 /* Chat.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 7555FF73242A565900829871 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1130; + LastUpgradeCheck = 1130; + ORGANIZATIONNAME = org.jetbrains; + TargetAttributes = { + 7555FF7A242A565900829871 = { + CreatedOnToolsVersion = 11.3.1; + }; + }; + }; + buildConfigurationList = 7555FF76242A565900829871 /* Build configuration list for PBXProject "Chat" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 7555FF72242A565900829871; + productRefGroup = 7555FF7C242A565900829871 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 7555FF7A242A565900829871 /* Chat */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 7555FF79242A565900829871 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + E8D673591E7196AEA2EA10E2 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Chat-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 7555FF77242A565900829871 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2152FB042600AC8F00CF470E /* iosApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 7555FFA3242A565B00829871 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AB3632DC29227652001CCB65 /* TeamId.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 7555FFA4242A565B00829871 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AB3632DC29227652001CCB65 /* TeamId.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 7555FFA6242A565B00829871 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1EB65E27D2C0F884D0A1A133 /* Pods-Chat.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = ""; + DEVELOPMENT_TEAM = "${TEAM_ID}"; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = iosApp/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "org.jetbrains.Chat${TEAM_ID}"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 7555FFA7242A565B00829871 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 3D7A606AB0AD7636269BD9D0 /* Pods-Chat.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = ""; + DEVELOPMENT_TEAM = "${TEAM_ID}"; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = iosApp/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.1; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "org.jetbrains.Chat${TEAM_ID}"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 7555FF76242A565900829871 /* Build configuration list for PBXProject "Chat" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7555FFA3242A565B00829871 /* Debug */, + 7555FFA4242A565B00829871 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "Chat" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7555FFA6242A565B00829871 /* Debug */, + 7555FFA7242A565B00829871 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 7555FF73242A565900829871 /* Project object */; +} diff --git a/experimental/examples/chat-mpp/iosApp/Configuration/TeamId.xcconfig b/experimental/examples/chat-mpp/iosApp/Configuration/TeamId.xcconfig new file mode 100644 index 0000000000..bf06eb27e9 --- /dev/null +++ b/experimental/examples/chat-mpp/iosApp/Configuration/TeamId.xcconfig @@ -0,0 +1 @@ +TEAM_ID= diff --git a/experimental/examples/chat-mpp/iosApp/Podfile b/experimental/examples/chat-mpp/iosApp/Podfile new file mode 100644 index 0000000000..34ff925f6a --- /dev/null +++ b/experimental/examples/chat-mpp/iosApp/Podfile @@ -0,0 +1,5 @@ +target 'Chat' do + use_frameworks! + platform :ios, '14.1' + pod 'shared', :path => '../shared' +end \ No newline at end of file diff --git a/experimental/examples/chat-mpp/iosApp/iosApp/Info.plist b/experimental/examples/chat-mpp/iosApp/iosApp/Info.plist new file mode 100644 index 0000000000..9a269f5eaa --- /dev/null +++ b/experimental/examples/chat-mpp/iosApp/iosApp/Info.plist @@ -0,0 +1,48 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + + UILaunchScreen + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/experimental/examples/chat-mpp/iosApp/iosApp/iosApp.swift b/experimental/examples/chat-mpp/iosApp/iosApp/iosApp.swift new file mode 100644 index 0000000000..b42016a6fc --- /dev/null +++ b/experimental/examples/chat-mpp/iosApp/iosApp/iosApp.swift @@ -0,0 +1,15 @@ +import UIKit +import shared + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + var window: UIWindow? + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + window = UIWindow(frame: UIScreen.main.bounds) + let mainViewController = Main_iosKt.MainViewController() + window?.rootViewController = mainViewController + window?.makeKeyAndVisible() + return true + } +} diff --git a/experimental/examples/chat-mpp/jsApp/build.gradle.kts b/experimental/examples/chat-mpp/jsApp/build.gradle.kts new file mode 100644 index 0000000000..99f2073a62 --- /dev/null +++ b/experimental/examples/chat-mpp/jsApp/build.gradle.kts @@ -0,0 +1,23 @@ +plugins { + kotlin("multiplatform") + id("org.jetbrains.compose") +} + +kotlin { + js(IR) { + browser() + binaries.executable() + } + sourceSets { + val jsMain by getting { + dependencies { + implementation(project(":shared")) + } + } + } +} + +compose.experimental { + web.application {} +} + diff --git a/experimental/examples/chat-mpp/src/jsMain/kotlin/main.js.kt b/experimental/examples/chat-mpp/jsApp/src/jsMain/kotlin/main.js.kt similarity index 93% rename from experimental/examples/chat-mpp/src/jsMain/kotlin/main.js.kt rename to experimental/examples/chat-mpp/jsApp/src/jsMain/kotlin/main.js.kt index 1fa9d98d97..e9128595e5 100644 --- a/experimental/examples/chat-mpp/src/jsMain/kotlin/main.js.kt +++ b/experimental/examples/chat-mpp/jsApp/src/jsMain/kotlin/main.js.kt @@ -8,7 +8,7 @@ fun main() { onWasmReady { Window("Chat") { Column(modifier = Modifier.fillMaxSize()) { - ChatApp() + MainView() } } } diff --git a/experimental/examples/chat-mpp/src/jsMain/resources/index.html b/experimental/examples/chat-mpp/jsApp/src/jsMain/resources/index.html similarity index 89% rename from experimental/examples/chat-mpp/src/jsMain/resources/index.html rename to experimental/examples/chat-mpp/jsApp/src/jsMain/resources/index.html index 60a68afca1..11dddb763a 100644 --- a/experimental/examples/chat-mpp/src/jsMain/resources/index.html +++ b/experimental/examples/chat-mpp/jsApp/src/jsMain/resources/index.html @@ -10,6 +10,6 @@
- + diff --git a/experimental/examples/chat-mpp/src/jsMain/resources/styles.css b/experimental/examples/chat-mpp/jsApp/src/jsMain/resources/styles.css similarity index 100% rename from experimental/examples/chat-mpp/src/jsMain/resources/styles.css rename to experimental/examples/chat-mpp/jsApp/src/jsMain/resources/styles.css diff --git a/experimental/examples/chat-mpp/run-configurations.png b/experimental/examples/chat-mpp/run-configurations.png new file mode 100644 index 0000000000..3a904f61c3 Binary files /dev/null and b/experimental/examples/chat-mpp/run-configurations.png differ diff --git a/experimental/examples/chat-mpp/settings.gradle.kts b/experimental/examples/chat-mpp/settings.gradle.kts index 3698d56c08..bccac02bc0 100644 --- a/experimental/examples/chat-mpp/settings.gradle.kts +++ b/experimental/examples/chat-mpp/settings.gradle.kts @@ -1,7 +1,5 @@ pluginManagement { repositories { - mavenLocal() - mavenCentral() gradlePluginPortal() maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") google() @@ -9,15 +7,22 @@ pluginManagement { plugins { val kotlinVersion = extra["kotlin.version"] as String + val agpVersion = extra["agp.version"] as String + val composeVersion = extra["compose.version"] as String + + kotlin("jvm").version(kotlinVersion) kotlin("multiplatform").version(kotlinVersion) kotlin("android").version(kotlinVersion) - - val agpVersion = extra["agp.version"] as String + id("com.android.base").version(agpVersion) id("com.android.application").version(agpVersion) - - val composeVersion = extra["compose.version"] as String + id("com.android.library").version(agpVersion) id("org.jetbrains.compose").version(composeVersion) } } rootProject.name = "chat-mpp" + +include(":androidApp") +include(":shared") +include(":desktopApp") +include(":jsApp") diff --git a/experimental/examples/chat-mpp/shared/build.gradle.kts b/experimental/examples/chat-mpp/shared/build.gradle.kts new file mode 100644 index 0000000000..e9c19abb1d --- /dev/null +++ b/experimental/examples/chat-mpp/shared/build.gradle.kts @@ -0,0 +1,111 @@ +plugins { + kotlin("multiplatform") + kotlin("native.cocoapods") + id("com.android.library") + id("org.jetbrains.compose") +} + +version = "1.0-SNAPSHOT" + +kotlin { + android() + + jvm("desktop") + + ios() + iosSimulatorArm64() + + js(IR) { + browser() + } + + macosX64 { + binaries { + executable { + entryPoint = "main" + } + } + } + macosArm64 { + binaries { + executable { + entryPoint = "main" + } + } + } + + cocoapods { + summary = "Shared code for the sample" + homepage = "https://github.com/JetBrains/compose-jb" + ios.deploymentTarget = "14.1" + podfile = project.file("../iosApp/Podfile") + framework { + baseName = "shared" + isStatic = true + } + extraSpecAttributes["resources"] = "['src/commonMain/resources/**', 'src/iosMain/resources/**']" + } + + sourceSets { + val commonMain by getting { + dependencies { + implementation(compose.ui) + implementation(compose.foundation) + implementation(compose.material) + implementation(compose.runtime) + } + } + val commonTest by getting { + dependencies { + implementation(kotlin("test")) + } + } + val androidMain by getting { + dependencies { + implementation("com.google.android.material:material:1.7.0") + } + } + val androidTest by getting { + dependencies { + implementation("junit:junit:4.13.2") + } + } + val iosMain by getting + val iosTest by getting + val iosSimulatorArm64Main by getting { + dependsOn(iosMain) + } + val iosSimulatorArm64Test by getting { + dependsOn(iosTest) + } + + val desktopMain by getting { + dependencies { + implementation(compose.desktop.common) + } + } + + val macosMain by creating { + dependsOn(commonMain) + } + val macosX64Main by getting { + dependsOn(macosMain) + } + val macosArm64Main by getting { + dependsOn(macosMain) + } + } +} + +android { + compileSdk = 33 + sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") + defaultConfig { + minSdk = 24 + targetSdk = 33 + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } +} \ No newline at end of file diff --git a/experimental/examples/chat-mpp/shared/src/androidMain/AndroidManifest.xml b/experimental/examples/chat-mpp/shared/src/androidMain/AndroidManifest.xml new file mode 100644 index 0000000000..45fde946a8 --- /dev/null +++ b/experimental/examples/chat-mpp/shared/src/androidMain/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/experimental/examples/chat-mpp/src/androidMain/kotlin/currentTime.android.kt b/experimental/examples/chat-mpp/shared/src/androidMain/kotlin/currentTime.android.kt similarity index 100% rename from experimental/examples/chat-mpp/src/androidMain/kotlin/currentTime.android.kt rename to experimental/examples/chat-mpp/shared/src/androidMain/kotlin/currentTime.android.kt diff --git a/experimental/examples/chat-mpp/shared/src/androidMain/kotlin/main.android.kt b/experimental/examples/chat-mpp/shared/src/androidMain/kotlin/main.android.kt new file mode 100644 index 0000000000..bef1ebc77c --- /dev/null +++ b/experimental/examples/chat-mpp/shared/src/androidMain/kotlin/main.android.kt @@ -0,0 +1,4 @@ +import androidx.compose.runtime.Composable + +@Composable +fun MainView() = ChatApp() \ No newline at end of file diff --git a/experimental/examples/chat-mpp/src/commonMain/kotlin/ChatApp.kt b/experimental/examples/chat-mpp/shared/src/commonMain/kotlin/ChatApp.kt similarity index 98% rename from experimental/examples/chat-mpp/src/commonMain/kotlin/ChatApp.kt rename to experimental/examples/chat-mpp/shared/src/commonMain/kotlin/ChatApp.kt index bc59e53674..873212b97b 100644 --- a/experimental/examples/chat-mpp/src/commonMain/kotlin/ChatApp.kt +++ b/experimental/examples/chat-mpp/shared/src/commonMain/kotlin/ChatApp.kt @@ -14,7 +14,7 @@ val friendMessages = listOf( ) @Composable -fun ChatApp() { +internal fun ChatApp() { val coroutineScope = rememberCoroutineScope() val store = remember { coroutineScope.createStore() } val state by store.stateFlow.collectAsState() diff --git a/experimental/examples/chat-mpp/src/commonMain/kotlin/Data.kt b/experimental/examples/chat-mpp/shared/src/commonMain/kotlin/Data.kt similarity index 100% rename from experimental/examples/chat-mpp/src/commonMain/kotlin/Data.kt rename to experimental/examples/chat-mpp/shared/src/commonMain/kotlin/Data.kt diff --git a/experimental/examples/chat-mpp/src/commonMain/kotlin/Messages.kt b/experimental/examples/chat-mpp/shared/src/commonMain/kotlin/Messages.kt similarity index 100% rename from experimental/examples/chat-mpp/src/commonMain/kotlin/Messages.kt rename to experimental/examples/chat-mpp/shared/src/commonMain/kotlin/Messages.kt diff --git a/experimental/examples/chat-mpp/src/commonMain/kotlin/Reducer.kt b/experimental/examples/chat-mpp/shared/src/commonMain/kotlin/Reducer.kt similarity index 100% rename from experimental/examples/chat-mpp/src/commonMain/kotlin/Reducer.kt rename to experimental/examples/chat-mpp/shared/src/commonMain/kotlin/Reducer.kt diff --git a/experimental/examples/chat-mpp/src/commonMain/kotlin/SendMessage.kt b/experimental/examples/chat-mpp/shared/src/commonMain/kotlin/SendMessage.kt similarity index 100% rename from experimental/examples/chat-mpp/src/commonMain/kotlin/SendMessage.kt rename to experimental/examples/chat-mpp/shared/src/commonMain/kotlin/SendMessage.kt diff --git a/experimental/examples/chat-mpp/src/commonMain/kotlin/Store.kt b/experimental/examples/chat-mpp/shared/src/commonMain/kotlin/Store.kt similarity index 100% rename from experimental/examples/chat-mpp/src/commonMain/kotlin/Store.kt rename to experimental/examples/chat-mpp/shared/src/commonMain/kotlin/Store.kt diff --git a/experimental/examples/chat-mpp/src/commonMain/kotlin/currentTime.common.kt b/experimental/examples/chat-mpp/shared/src/commonMain/kotlin/currentTime.common.kt similarity index 100% rename from experimental/examples/chat-mpp/src/commonMain/kotlin/currentTime.common.kt rename to experimental/examples/chat-mpp/shared/src/commonMain/kotlin/currentTime.common.kt diff --git a/experimental/examples/chat-mpp/src/desktopMain/kotlin/currentTime.desktop.kt b/experimental/examples/chat-mpp/shared/src/desktopMain/kotlin/currentTime.desktop.kt similarity index 100% rename from experimental/examples/chat-mpp/src/desktopMain/kotlin/currentTime.desktop.kt rename to experimental/examples/chat-mpp/shared/src/desktopMain/kotlin/currentTime.desktop.kt diff --git a/experimental/examples/chat-mpp/shared/src/desktopMain/kotlin/main.desktop.kt b/experimental/examples/chat-mpp/shared/src/desktopMain/kotlin/main.desktop.kt new file mode 100644 index 0000000000..b5f998e2c7 --- /dev/null +++ b/experimental/examples/chat-mpp/shared/src/desktopMain/kotlin/main.desktop.kt @@ -0,0 +1,11 @@ +import androidx.compose.desktop.ui.tooling.preview.Preview +import androidx.compose.runtime.Composable + +@Composable +fun MainView() = ChatApp() + +@Preview +@Composable +fun ChatPreview() { + ChatApp() +} diff --git a/experimental/examples/chat-mpp/src/uikitMain/kotlin/currentTime.uikit.kt b/experimental/examples/chat-mpp/shared/src/iosMain/kotlin/currentTime.ios.kt similarity index 100% rename from experimental/examples/chat-mpp/src/uikitMain/kotlin/currentTime.uikit.kt rename to experimental/examples/chat-mpp/shared/src/iosMain/kotlin/currentTime.ios.kt diff --git a/experimental/examples/chat-mpp/shared/src/iosMain/kotlin/main.ios.kt b/experimental/examples/chat-mpp/shared/src/iosMain/kotlin/main.ios.kt new file mode 100644 index 0000000000..c643166f94 --- /dev/null +++ b/experimental/examples/chat-mpp/shared/src/iosMain/kotlin/main.ios.kt @@ -0,0 +1,8 @@ +import androidx.compose.ui.window.Application +import platform.UIKit.UIViewController + +fun MainViewController(): UIViewController = + Application("Chat") { + ChatApp() + } + diff --git a/experimental/examples/chat-mpp/src/jsMain/kotlin/currentTime.js.kt b/experimental/examples/chat-mpp/shared/src/jsMain/kotlin/currentTime.js.kt similarity index 100% rename from experimental/examples/chat-mpp/src/jsMain/kotlin/currentTime.js.kt rename to experimental/examples/chat-mpp/shared/src/jsMain/kotlin/currentTime.js.kt diff --git a/experimental/examples/chat-mpp/shared/src/jsMain/kotlin/main.js.kt b/experimental/examples/chat-mpp/shared/src/jsMain/kotlin/main.js.kt new file mode 100644 index 0000000000..6ea0df4686 --- /dev/null +++ b/experimental/examples/chat-mpp/shared/src/jsMain/kotlin/main.js.kt @@ -0,0 +1,6 @@ +import androidx.compose.runtime.Composable + +@Composable +fun MainView() = ChatApp() + + diff --git a/experimental/examples/chat-mpp/src/macosMain/kotlin/currentTime.macos.kt b/experimental/examples/chat-mpp/shared/src/macosMain/kotlin/currentTime.macos.kt similarity index 100% rename from experimental/examples/chat-mpp/src/macosMain/kotlin/currentTime.macos.kt rename to experimental/examples/chat-mpp/shared/src/macosMain/kotlin/currentTime.macos.kt diff --git a/experimental/examples/chat-mpp/src/macosMain/kotlin/main.macos.kt b/experimental/examples/chat-mpp/shared/src/macosMain/kotlin/main.macos.kt similarity index 100% rename from experimental/examples/chat-mpp/src/macosMain/kotlin/main.macos.kt rename to experimental/examples/chat-mpp/shared/src/macosMain/kotlin/main.macos.kt diff --git a/experimental/examples/chat-mpp/src/uikitMain/kotlin/main.uikit.kt b/experimental/examples/chat-mpp/src/uikitMain/kotlin/main.uikit.kt deleted file mode 100644 index 100b7b98d2..0000000000 --- a/experimental/examples/chat-mpp/src/uikitMain/kotlin/main.uikit.kt +++ /dev/null @@ -1,8 +0,0 @@ -import androidx.compose.ui.window.Application -import androidx.compose.ui.main.defaultUIKitMain - -fun main() { - defaultUIKitMain("Chat", Application("Chat") { - ChatApp() - }) -}