Browse Source

remove todoapp lite sample (#5366)

Part of CMP-8573

## Release Notes
N/A
pull/5383/head v1.9.10+dev2778
Victor Kropp 4 months ago committed by GitHub
parent
commit
6bac55e456
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      examples/README.md
  2. 15
      examples/todoapp-lite/.gitignore
  3. 28
      examples/todoapp-lite/.run/desktopApp.run.xml
  4. 26
      examples/todoapp-lite/README.md
  5. 37
      examples/todoapp-lite/androidApp/build.gradle.kts
  6. 22
      examples/todoapp-lite/androidApp/src/androidMain/AndroidManifest.xml
  7. 24
      examples/todoapp-lite/androidApp/src/androidMain/kotlin/example/todoapp/lite/MainActivity.kt
  8. 19
      examples/todoapp-lite/build.gradle.kts
  9. 38
      examples/todoapp-lite/desktopApp/build.gradle.kts
  10. 26
      examples/todoapp-lite/desktopApp/src/jvmMain/kotlin/example/todoapp/lite/Main.kt
  11. 15
      examples/todoapp-lite/gradle.properties
  12. BIN
      examples/todoapp-lite/gradle/wrapper/gradle-wrapper.jar
  13. 5
      examples/todoapp-lite/gradle/wrapper/gradle-wrapper.properties
  14. 240
      examples/todoapp-lite/gradlew
  15. 91
      examples/todoapp-lite/gradlew.bat
  16. 3
      examples/todoapp-lite/iosApp/Configuration/Config.xcconfig
  17. 382
      examples/todoapp-lite/iosApp/iosApp.xcodeproj/project.pbxproj
  18. 11
      examples/todoapp-lite/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json
  19. 98
      examples/todoapp-lite/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json
  20. 6
      examples/todoapp-lite/iosApp/iosApp/Assets.xcassets/Contents.json
  21. 20
      examples/todoapp-lite/iosApp/iosApp/ContentView.swift
  22. 50
      examples/todoapp-lite/iosApp/iosApp/Info.plist
  23. 6
      examples/todoapp-lite/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json
  24. 10
      examples/todoapp-lite/iosApp/iosApp/iOSApp.swift
  25. BIN
      examples/todoapp-lite/run-configurations.png
  26. BIN
      examples/todoapp-lite/screenshots/todoapplite.png
  27. 31
      examples/todoapp-lite/settings.gradle.kts
  28. 80
      examples/todoapp-lite/shared/build.gradle.kts
  29. 2
      examples/todoapp-lite/shared/src/androidMain/AndroidManifest.xml
  30. 26
      examples/todoapp-lite/shared/src/androidMain/kotlin/example/todoapp/lite/common/Utils.kt
  31. 6
      examples/todoapp-lite/shared/src/androidMain/kotlin/main.android.kt
  32. 34
      examples/todoapp-lite/shared/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml
  33. 170
      examples/todoapp-lite/shared/src/androidMain/res/drawable/ic_launcher_background.xml
  34. 5
      examples/todoapp-lite/shared/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml
  35. 5
      examples/todoapp-lite/shared/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml
  36. BIN
      examples/todoapp-lite/shared/src/androidMain/res/mipmap-hdpi/ic_launcher.png
  37. BIN
      examples/todoapp-lite/shared/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png
  38. BIN
      examples/todoapp-lite/shared/src/androidMain/res/mipmap-mdpi/ic_launcher.png
  39. BIN
      examples/todoapp-lite/shared/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png
  40. BIN
      examples/todoapp-lite/shared/src/androidMain/res/mipmap-xhdpi/ic_launcher.png
  41. BIN
      examples/todoapp-lite/shared/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png
  42. BIN
      examples/todoapp-lite/shared/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png
  43. BIN
      examples/todoapp-lite/shared/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png
  44. BIN
      examples/todoapp-lite/shared/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png
  45. BIN
      examples/todoapp-lite/shared/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png
  46. 4
      examples/todoapp-lite/shared/src/androidMain/res/values/strings.xml
  47. 92
      examples/todoapp-lite/shared/src/commonMain/kotlin/example/todoapp/lite/common/EditDialog.kt
  48. 158
      examples/todoapp-lite/shared/src/commonMain/kotlin/example/todoapp/lite/common/MainContent.kt
  49. 40
      examples/todoapp-lite/shared/src/commonMain/kotlin/example/todoapp/lite/common/RootContent.kt
  50. 80
      examples/todoapp-lite/shared/src/commonMain/kotlin/example/todoapp/lite/common/RootStore.kt
  51. 7
      examples/todoapp-lite/shared/src/commonMain/kotlin/example/todoapp/lite/common/TodoItem.kt
  52. 34
      examples/todoapp-lite/shared/src/commonMain/kotlin/example/todoapp/lite/common/Utils.kt
  53. 29
      examples/todoapp-lite/shared/src/desktopMain/kotlin/example/todoapp/lite/common/Utils.kt
  54. 6
      examples/todoapp-lite/shared/src/desktopMain/kotlin/main.desktop.kt
  55. 23
      examples/todoapp-lite/shared/src/iosMain/kotlin/example/todoapp/lite/common/Utils.kt
  56. 14
      examples/todoapp-lite/shared/src/iosMain/kotlin/main.ios.kt
  57. 1
      examples/validateExamples.sh
  58. 2
      examples/validateExamplesAndroid.sh
  59. 1
      examples/validateExamplesIos.sh

1
examples/README.md

@ -5,7 +5,6 @@ @@ -5,7 +5,6 @@
| [Codeviewer](codeviewer) | File browser and code viewer application | Android, iOS, Desktop |
| [Chat](chat) | A simple chat | Android, iOS, Desktop |
| [Graphics2D](graphics-2d) | 2D Games and graphics examples | Android, iOS, Desktop |
| [Todoapp Lite](todoapp-lite) | A simple todo app fully based on Compose | Android, iOS, Desktop |
| [Nav Cupcake](nav_cupcake) | Multiscreen app to demonstrate the use of Compose Navigation | Android, iOS, Desktop |
| [Issues tracker](issues) | GitHub issue tracker with an adaptive UI and ktor-client | Android, Desktop |
| [HTML based samples](html/README.md) | Examples written with Compose HTML Library |

15
examples/todoapp-lite/.gitignore vendored

@ -1,15 +0,0 @@ @@ -1,15 +0,0 @@
*.iml
.gradle
/local.properties
/.idea/
.DS_Store
build/
/captures
.externalNativeBuild
.cxx
iosApp/Podfile.lock
iosApp/Pods/*
iosApp/iosApp.xcworkspace/*
iosApp/iosApp.xcodeproj/*
!iosApp/iosApp.xcodeproj/project.pbxproj
shared/shared.podspec

28
examples/todoapp-lite/.run/desktopApp.run.xml

@ -1,28 +0,0 @@ @@ -1,28 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="desktopApp" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="env">
<map>
<entry key="DEVELOPER_DIR" value="/Applications/Xcode.app/Contents/Developer" />
</map>
</option>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":desktopApp:run" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>

26
examples/todoapp-lite/README.md

@ -1,26 +0,0 @@ @@ -1,26 +0,0 @@
# TodoApp (lite version)
A simplified version of the [TodoApp example](https://github.com/JetBrains/compose-jb/tree/master/examples/todoapp), fully based on Jetpack Compose and without using any third-party libraries.
Supported targets: Android, Desktop and iOS.
## Setting up your development environment
To setup the environment, please consult these [instructions](https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-multiplatform-setup.html).
## How to run
Choose a run configuration for an appropriate target in Android Studio and run it.
![run-configurations.png](run-configurations.png)
## Run on desktop via Gradle
`./gradlew desktopApp:run`
## Building native desktop distribution
```
./gradlew :desktopApp:packageDistributionForCurrentOS
# outputs are written to desktopApp/build/compose/binaries
```
![Desktop](screenshots/todoapplite.png)

37
examples/todoapp-lite/androidApp/build.gradle.kts

@ -1,37 +0,0 @@ @@ -1,37 +0,0 @@
plugins {
kotlin("multiplatform")
kotlin("plugin.compose")
id("com.android.application")
id("org.jetbrains.compose")
}
kotlin {
androidTarget()
sourceSets {
val androidMain by getting {
dependencies {
implementation(project(":shared"))
implementation(compose.material)
}
}
}
}
android {
compileSdk = 35
namespace = "example.todoapp.lite"
defaultConfig {
applicationId = "org.jetbrains.TodoAppLite"
minSdk = 26
targetSdk = 35
versionCode = 1
versionName = "1.0"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlin {
jvmToolchain(17)
}
}

22
examples/todoapp-lite/androidApp/src/androidMain/AndroidManifest.xml

@ -1,22 +0,0 @@ @@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
<activity
android:name=".MainActivity"
android:exported="true"
>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>

24
examples/todoapp-lite/androidApp/src/androidMain/kotlin/example/todoapp/lite/MainActivity.kt

@ -1,24 +0,0 @@ @@ -1,24 +0,0 @@
package example.todoapp.lite
import MainView
import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MaterialTheme {
Surface(color = MaterialTheme.colors.background) {
MainView()
}
}
}
}
}

19
examples/todoapp-lite/build.gradle.kts

@ -1,19 +0,0 @@ @@ -1,19 +0,0 @@
plugins {
// 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("plugin.compose") 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")
}
}

38
examples/todoapp-lite/desktopApp/build.gradle.kts

@ -1,38 +0,0 @@ @@ -1,38 +0,0 @@
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins {
kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose")
}
kotlin {
jvm {}
sourceSets {
val jvmMain by getting {
dependencies {
implementation(compose.desktop.currentOs)
implementation(project(":shared"))
}
}
}
}
compose.desktop {
application {
mainClass = "example.todoapp.lite.MainKt"
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "TodoApp Lite"
packageVersion = "1.0.0"
windows {
menuGroup = "Compose Examples"
// see https://wixtoolset.org/documentation/manual/v3/howtos/general/generate_guids.html
upgradeUuid = "5ac63736-d8c7-4a65-a66b-6870df88ddfe"
}
}
}
}

26
examples/todoapp-lite/desktopApp/src/jvmMain/kotlin/example/todoapp/lite/Main.kt

@ -1,26 +0,0 @@ @@ -1,26 +0,0 @@
package example.todoapp.lite
import MainView
import androidx.compose.material.MaterialTheme
import androidx.compose.ui.Alignment
import androidx.compose.ui.window.Window
import androidx.compose.ui.window.WindowPosition
import androidx.compose.ui.window.application
import androidx.compose.ui.window.rememberWindowState
fun main() {
application {
Window(
onCloseRequest = ::exitApplication,
title = "TodoApp Lite",
state = rememberWindowState(
position = WindowPosition(alignment = Alignment.Center),
),
) {
MaterialTheme {
MainView()
}
}
}
}

15
examples/todoapp-lite/gradle.properties

@ -1,15 +0,0 @@ @@ -1,15 +0,0 @@
kotlin.code.style=official
xcodeproj=./iosApp
android.useAndroidX=true
org.gradle.jvmargs=-Xmx8g
org.gradle.configuration-cache=true
org.gradle.caching=true
org.jetbrains.compose.experimental.jscanvas.enabled=true
org.jetbrains.compose.experimental.macos.enabled=true
kotlin.native.useEmbeddableCompilerJar=true
kotlin.mpp.androidSourceSetLayoutVersion=2
# Enable kotlin/native experimental memory model
kotlin.native.binary.memoryModel=experimental
kotlin.version=2.1.20
agp.version=8.5.0
compose.version=1.8.2

BIN
examples/todoapp-lite/gradle/wrapper/gradle-wrapper.jar vendored

Binary file not shown.

5
examples/todoapp-lite/gradle/wrapper/gradle-wrapper.properties vendored

@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

240
examples/todoapp-lite/gradlew vendored

@ -1,240 +0,0 @@ @@ -1,240 +0,0 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# 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
#
# https://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.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

91
examples/todoapp-lite/gradlew.bat vendored

@ -1,91 +0,0 @@ @@ -1,91 +0,0 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

3
examples/todoapp-lite/iosApp/Configuration/Config.xcconfig

@ -1,3 +0,0 @@ @@ -1,3 +0,0 @@
TEAM_ID=
BUNDLE_ID=org.jetbrains.TodoAppLite
APP_NAME=TodoAppLite

382
examples/todoapp-lite/iosApp/iosApp.xcodeproj/project.pbxproj

@ -1,382 +0,0 @@ @@ -1,382 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557BA273AAA24004C7B11 /* Assets.xcassets */; };
058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */; };
2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; };
3251B1422AA8DC67001521C0 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3251B1412AA8DC67001521C0 /* ContentView.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = "<group>"; };
3251B1412AA8DC67001521C0 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
7555FF7B242A565900829871 /* TodoAppLite.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TodoAppLite.app; sourceTree = BUILT_PRODUCTS_DIR; };
7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
AB3632DC29227652001CCB65 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
F85CB1118929364A9C6EFABC /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
058557D7273AAEEB004C7B11 /* Preview Content */ = {
isa = PBXGroup;
children = (
058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */,
);
path = "Preview Content";
sourceTree = "<group>";
};
7555FF72242A565900829871 = {
isa = PBXGroup;
children = (
AB1DB47929225F7C00F7AF9C /* Configuration */,
7555FF7D242A565900829871 /* iosApp */,
7555FF7C242A565900829871 /* Products */,
);
sourceTree = "<group>";
};
7555FF7C242A565900829871 /* Products */ = {
isa = PBXGroup;
children = (
7555FF7B242A565900829871 /* TodoAppLite.app */,
);
name = Products;
sourceTree = "<group>";
};
7555FF7D242A565900829871 /* iosApp */ = {
isa = PBXGroup;
children = (
058557BA273AAA24004C7B11 /* Assets.xcassets */,
7555FF8C242A565B00829871 /* Info.plist */,
2152FB032600AC8F00CF470E /* iOSApp.swift */,
058557D7273AAEEB004C7B11 /* Preview Content */,
3251B1412AA8DC67001521C0 /* ContentView.swift */,
);
path = iosApp;
sourceTree = "<group>";
};
AB1DB47929225F7C00F7AF9C /* Configuration */ = {
isa = PBXGroup;
children = (
AB3632DC29227652001CCB65 /* Config.xcconfig */,
);
path = Configuration;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
7555FF7A242A565900829871 /* iosApp */ = {
isa = PBXNativeTarget;
buildConfigurationList = 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */;
buildPhases = (
0548D1B92A8FD622002E7F63 /* Compile Kotlin */,
7555FF77242A565900829871 /* Sources */,
7555FF79242A565900829871 /* Resources */,
F85CB1118929364A9C6EFABC /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = iosApp;
productName = iosApp;
productReference = 7555FF7B242A565900829871 /* TodoAppLite.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
7555FF73242A565900829871 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1130;
LastUpgradeCheck = 1130;
ORGANIZATIONNAME = orgName;
TargetAttributes = {
7555FF7A242A565900829871 = {
CreatedOnToolsVersion = 11.3.1;
};
};
};
buildConfigurationList = 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 7555FF72242A565900829871;
productRefGroup = 7555FF7C242A565900829871 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
7555FF7A242A565900829871 /* iosApp */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
7555FF79242A565900829871 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */,
058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
0548D1B92A8FD622002E7F63 /* Compile Kotlin */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Compile Kotlin";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "cd \"$SRCROOT/..\"\n./gradlew :shared:embedAndSignAppleFrameworkForXcode\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
7555FF77242A565900829871 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3251B1422AA8DC67001521C0 /* ContentView.swift in Sources */,
2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
7555FFA3242A565B00829871 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = AB3632DC29227652001CCB65 /* Config.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 /* Config.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;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
DEVELOPMENT_TEAM = "${TEAM_ID}";
ENABLE_PREVIEWS = YES;
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)\n";
INFOPLIST_FILE = iosApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
OTHER_LDFLAGS = (
"$(inherited)",
"-framework",
"shared\n",
);
PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}";
PRODUCT_NAME = "${APP_NAME}";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
7555FFA7242A565B00829871 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
DEVELOPMENT_TEAM = "${TEAM_ID}";
ENABLE_PREVIEWS = YES;
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)\n";
INFOPLIST_FILE = iosApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
OTHER_LDFLAGS = (
"$(inherited)",
"-framework",
"shared\n",
);
PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}";
PRODUCT_NAME = "${APP_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 "iosApp" */ = {
isa = XCConfigurationList;
buildConfigurations = (
7555FFA3242A565B00829871 /* Debug */,
7555FFA4242A565B00829871 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */ = {
isa = XCConfigurationList;
buildConfigurations = (
7555FFA6242A565B00829871 /* Debug */,
7555FFA7242A565B00829871 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 7555FF73242A565900829871 /* Project object */;
}

11
examples/todoapp-lite/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json

@ -1,11 +0,0 @@ @@ -1,11 +0,0 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

98
examples/todoapp-lite/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json

@ -1,98 +0,0 @@ @@ -1,98 +0,0 @@
{
"images" : [
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

6
examples/todoapp-lite/iosApp/iosApp/Assets.xcassets/Contents.json

@ -1,6 +0,0 @@ @@ -1,6 +0,0 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

20
examples/todoapp-lite/iosApp/iosApp/ContentView.swift

@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
import UIKit
import SwiftUI
import shared
struct ContentView: View {
var body: some View {
ComposeView()
.ignoresSafeArea(.keyboard) // Compose has own keyboard handler
}
}
struct ComposeView: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> UIViewController {
Main_iosKt.MainViewController()
}
func updateUIViewController(_ uiViewController: UIViewController, context: Context) {
}
}

50
examples/todoapp-lite/iosApp/iosApp/Info.plist

@ -1,50 +0,0 @@ @@ -1,50 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
</dict>
<key>UILaunchScreen</key>
<dict/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

6
examples/todoapp-lite/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json

@ -1,6 +0,0 @@ @@ -1,6 +0,0 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

10
examples/todoapp-lite/iosApp/iosApp/iOSApp.swift

@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
import SwiftUI
@main
struct iOSApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}

BIN
examples/todoapp-lite/run-configurations.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

BIN
examples/todoapp-lite/screenshots/todoapplite.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 KiB

31
examples/todoapp-lite/settings.gradle.kts

@ -1,31 +0,0 @@ @@ -1,31 +0,0 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
google()
}
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("plugin.compose").version(kotlinVersion)
kotlin("android").version(kotlinVersion)
id("com.android.application").version(agpVersion)
id("com.android.library").version(agpVersion)
id("org.jetbrains.compose").version(composeVersion)
}
}
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version("0.4.0")
}
rootProject.name = "todoapp-lite"
include(":androidApp")
include(":shared")
include(":desktopApp")

80
examples/todoapp-lite/shared/build.gradle.kts

@ -1,80 +0,0 @@ @@ -1,80 +0,0 @@
@file:Suppress("OPT_IN_IS_NOT_ENABLED")
plugins {
kotlin("multiplatform")
kotlin("plugin.compose")
id("com.android.library")
id("org.jetbrains.compose")
}
version = "1.0-SNAPSHOT"
kotlin {
androidTarget()
jvm("desktop")
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "shared"
isStatic = true
}
}
sourceSets {
val commonMain by getting {
dependencies {
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material)
implementation("org.jetbrains.compose.material:material-icons-core:1.6.11")
}
}
val androidMain by getting {
dependencies {
api("androidx.activity:activity-compose:1.7.2")
api("androidx.appcompat:appcompat:1.6.1")
api("androidx.core:core-ktx:1.10.1")
}
}
val iosMain by creating {
dependsOn(commonMain)
}
val iosX64Main by getting {
dependsOn(iosMain)
}
val iosArm64Main by getting {
dependsOn(iosMain)
}
val iosSimulatorArm64Main by getting {
dependsOn(iosMain)
}
val desktopMain by getting {
dependencies {
implementation(compose.desktop.common)
}
}
}
}
android {
compileSdk = 35
namespace = "example.todoapp.lite.common"
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
sourceSets["main"].res.srcDirs("src/androidMain/res")
defaultConfig {
minSdk = 26
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlin {
jvmToolchain(17)
}
}

2
examples/todoapp-lite/shared/src/androidMain/AndroidManifest.xml

@ -1,2 +0,0 @@ @@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

26
examples/todoapp-lite/shared/src/androidMain/kotlin/example/todoapp/lite/common/Utils.kt

@ -1,26 +0,0 @@ @@ -1,26 +0,0 @@
@file:JvmName("Utils")
package example.todoapp.lite.common
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
internal actual val MARGIN_SCROLLBAR: Dp = 0.dp
internal actual interface ScrollbarAdapter
@Composable
internal actual fun rememberScrollbarAdapter(scrollState: LazyListState): ScrollbarAdapter =
object : ScrollbarAdapter {}
@Composable
internal actual fun VerticalScrollbar(
modifier: Modifier,
adapter: ScrollbarAdapter
) {
// no-op
}

6
examples/todoapp-lite/shared/src/androidMain/kotlin/main.android.kt

@ -1,6 +0,0 @@ @@ -1,6 +0,0 @@
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import example.todoapp.lite.common.RootContent
@Composable fun MainView() = RootContent(Modifier.fillMaxSize())

34
examples/todoapp-lite/shared/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml

@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth="1"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

170
examples/todoapp-lite/shared/src/androidMain/res/drawable/ic_launcher_background.xml

@ -1,170 +0,0 @@ @@ -1,170 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#008577"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

5
examples/todoapp-lite/shared/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml

@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

5
examples/todoapp-lite/shared/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml

@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

BIN
examples/todoapp-lite/shared/src/androidMain/res/mipmap-hdpi/ic_launcher.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

BIN
examples/todoapp-lite/shared/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

BIN
examples/todoapp-lite/shared/src/androidMain/res/mipmap-mdpi/ic_launcher.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

BIN
examples/todoapp-lite/shared/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

BIN
examples/todoapp-lite/shared/src/androidMain/res/mipmap-xhdpi/ic_launcher.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

BIN
examples/todoapp-lite/shared/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

BIN
examples/todoapp-lite/shared/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

BIN
examples/todoapp-lite/shared/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
examples/todoapp-lite/shared/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

BIN
examples/todoapp-lite/shared/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

4
examples/todoapp-lite/shared/src/androidMain/res/values/strings.xml

@ -1,4 +0,0 @@ @@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">TodoApp Lite</string>
</resources>

92
examples/todoapp-lite/shared/src/commonMain/kotlin/example/todoapp/lite/common/EditDialog.kt

@ -1,92 +0,0 @@ @@ -1,92 +0,0 @@
package example.todoapp.lite.common
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.sizeIn
import androidx.compose.material.Button
import androidx.compose.material.Card
import androidx.compose.material.Checkbox
import androidx.compose.material.MaterialTheme
import androidx.compose.material.ProvideTextStyle
import androidx.compose.material.Text
import androidx.compose.material.TextField
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
@Composable
internal fun EditDialog(
item: TodoItem,
onCloseClicked: () -> Unit,
onTextChanged: (String) -> Unit,
onDoneChanged: (Boolean) -> Unit,
) {
EditDialog(
onCloseRequest = onCloseClicked,
) {
Column(horizontalAlignment = Alignment.CenterHorizontally) {
TextField(
value = item.text,
modifier = Modifier.weight(1F).fillMaxWidth().sizeIn(minHeight = 192.dp),
label = { Text("Todo text") },
onValueChange = onTextChanged,
)
Spacer(modifier = Modifier.height(8.dp))
Row {
Text(text = "Completed", Modifier.padding(15.dp))
Checkbox(
checked = item.isDone,
onCheckedChange = onDoneChanged,
)
}
}
}
}
@Composable
private fun EditDialog(
onCloseRequest: () -> Unit,
content: @Composable () -> Unit
) {
Dialog(
onDismissRequest = onCloseRequest,
) {
Card(elevation = 8.dp) {
Column(
modifier = Modifier
.padding(8.dp)
.height(IntrinsicSize.Min)
) {
ProvideTextStyle(MaterialTheme.typography.subtitle1) {
Text(text = "Edit todo")
}
Spacer(modifier = Modifier.height(8.dp))
Box(modifier = Modifier.weight(1F)) {
content()
}
Spacer(modifier = Modifier.height(8.dp))
Button(
onClick = onCloseRequest,
modifier = Modifier.align(Alignment.End)
) {
Text(text = "Done")
}
}
}
}
}

158
examples/todoapp-lite/shared/src/commonMain/kotlin/example/todoapp/lite/common/MainContent.kt

@ -1,158 +0,0 @@ @@ -1,158 +0,0 @@
package example.todoapp.lite.common
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material.Checkbox
import androidx.compose.material.Divider
import androidx.compose.material.Icon
import androidx.compose.material.IconButton
import androidx.compose.material.OutlinedTextField
import androidx.compose.material.Text
import androidx.compose.material.TopAppBar
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Delete
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.key.Key
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
@Composable
internal fun MainContent(
modifier: Modifier = Modifier,
items: List<TodoItem>,
inputText: String,
onItemClicked: (id: Long) -> Unit,
onItemDoneChanged: (id: Long, isDone: Boolean) -> Unit,
onItemDeleteClicked: (id: Long) -> Unit,
onAddItemClicked: () -> Unit,
onInputTextChanged: (String) -> Unit,
) {
Column(modifier) {
TopAppBar(title = { Text(text = "Todo List") })
Box(Modifier.weight(1F)) {
ListContent(
items = items,
onItemClicked = onItemClicked,
onItemDoneChanged = onItemDoneChanged,
onItemDeleteClicked = onItemDeleteClicked
)
}
Input(
text = inputText,
onAddClicked = onAddItemClicked,
onTextChanged = onInputTextChanged
)
}
}
@Composable
private fun ListContent(
items: List<TodoItem>,
onItemClicked: (id: Long) -> Unit,
onItemDoneChanged: (id: Long, isDone: Boolean) -> Unit,
onItemDeleteClicked: (id: Long) -> Unit,
) {
Box {
val listState = rememberLazyListState()
LazyColumn(state = listState) {
items(items) { item ->
Item(
item = item,
onClicked = { onItemClicked(item.id) },
onDoneChanged = { onItemDoneChanged(item.id, it) },
onDeleteClicked = { onItemDeleteClicked(item.id) }
)
Divider()
}
}
VerticalScrollbar(
modifier = Modifier.align(Alignment.CenterEnd).fillMaxHeight(),
adapter = rememberScrollbarAdapter(scrollState = listState)
)
}
}
@Composable
private fun Item(
item: TodoItem,
onClicked: () -> Unit,
onDoneChanged: (Boolean) -> Unit,
onDeleteClicked: () -> Unit
) {
Row(modifier = Modifier.clickable(onClick = onClicked)) {
Spacer(modifier = Modifier.width(8.dp))
Checkbox(
checked = item.isDone,
modifier = Modifier.align(Alignment.CenterVertically),
onCheckedChange = onDoneChanged,
)
Spacer(modifier = Modifier.width(8.dp))
Text(
text = AnnotatedString(item.text),
modifier = Modifier.weight(1F).align(Alignment.CenterVertically),
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
Spacer(modifier = Modifier.width(8.dp))
IconButton(onClick = onDeleteClicked) {
Icon(
imageVector = Icons.Default.Delete,
contentDescription = null
)
}
Spacer(modifier = Modifier.width(MARGIN_SCROLLBAR))
}
}
@OptIn(ExperimentalComposeUiApi::class)
@Composable
private fun Input(
text: String,
onTextChanged: (String) -> Unit,
onAddClicked: () -> Unit
) {
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(8.dp)) {
OutlinedTextField(
value = text,
modifier = Modifier
.weight(weight = 1F)
.onKeyUp(key = Key.Enter, action = onAddClicked),
onValueChange = onTextChanged,
label = { Text(text = "Add a todo") }
)
Spacer(modifier = Modifier.width(8.dp))
IconButton(onClick = onAddClicked) {
Icon(
imageVector = Icons.Default.Add,
contentDescription = null
)
}
}
}

40
examples/todoapp-lite/shared/src/commonMain/kotlin/example/todoapp/lite/common/RootContent.kt

@ -1,40 +0,0 @@ @@ -1,40 +0,0 @@
package example.todoapp.lite.common
import androidx.compose.foundation.background
import androidx.compose.material.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import example.todoapp.lite.common.RootStore.RootState
@Composable
fun RootContent(modifier: Modifier = Modifier) {
val model = remember { RootStore() }
val state = model.state
MainContent(
modifier = modifier.background(MaterialTheme.colors.background),
items = state.items,
inputText = state.inputText,
onItemClicked = model::onItemClicked,
onItemDoneChanged = model::onItemDoneChanged,
onItemDeleteClicked = model::onItemDeleteClicked,
onAddItemClicked = model::onAddItemClicked,
onInputTextChanged = model::onInputTextChanged,
)
state.editingItem?.also { item ->
EditDialog(
item = item,
onCloseClicked = model::onEditorCloseClicked,
onTextChanged = model::onEditorTextChanged,
onDoneChanged = model::onEditorDoneChanged,
)
}
}
private val RootState.editingItem: TodoItem?
get() = editingItemId?.let(items::firstById)
private fun List<TodoItem>.firstById(id: Long): TodoItem? =
firstOrNull { it.id == id }

80
examples/todoapp-lite/shared/src/commonMain/kotlin/example/todoapp/lite/common/RootStore.kt

@ -1,80 +0,0 @@ @@ -1,80 +0,0 @@
package example.todoapp.lite.common
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
internal class RootStore {
var state: RootState by mutableStateOf(initialState())
private set
fun onItemClicked(id: Long) {
setState { copy(editingItemId = id) }
}
fun onItemDoneChanged(id: Long, isDone: Boolean) {
setState {
updateItem(id = id) { it.copy(isDone = isDone) }
}
}
fun onItemDeleteClicked(id: Long) {
setState { copy(items = items.filterNot { it.id == id }) }
}
fun onAddItemClicked() {
setState {
val newItem =
TodoItem(
id = items.maxOfOrNull(TodoItem::id)?.plus(1L) ?: 1L,
text = inputText,
)
copy(items = items + newItem, inputText = "")
}
}
fun onInputTextChanged(text: String) {
setState { copy(inputText = text) }
}
fun onEditorCloseClicked() {
setState { copy(editingItemId = null) }
}
fun onEditorTextChanged(text: String) {
setState {
updateItem(id = requireNotNull(editingItemId)) { it.copy(text = text) }
}
}
fun onEditorDoneChanged(isDone: Boolean) {
setState {
updateItem(id = requireNotNull(editingItemId)) { it.copy(isDone = isDone) }
}
}
private fun RootState.updateItem(id: Long, transformer: (TodoItem) -> TodoItem): RootState =
copy(items = items.updateItem(id = id, transformer = transformer))
private fun List<TodoItem>.updateItem(id: Long, transformer: (TodoItem) -> TodoItem): List<TodoItem> =
map { item -> if (item.id == id) transformer(item) else item }
private fun initialState(): RootState =
RootState(
items = (1L..5L).map { id ->
TodoItem(id = id, text = "Some text $id")
}
)
private inline fun setState(update: RootState.() -> RootState) {
state = state.update()
}
data class RootState(
val items: List<TodoItem> = emptyList(),
val inputText: String = "",
val editingItemId: Long? = null,
)
}

7
examples/todoapp-lite/shared/src/commonMain/kotlin/example/todoapp/lite/common/TodoItem.kt

@ -1,7 +0,0 @@ @@ -1,7 +0,0 @@
package example.todoapp.lite.common
internal data class TodoItem(
val id: Long = 0L,
val text: String = "",
val isDone: Boolean = false
)

34
examples/todoapp-lite/shared/src/commonMain/kotlin/example/todoapp/lite/common/Utils.kt

@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
package example.todoapp.lite.common
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.key.Key
import androidx.compose.ui.input.key.KeyEventType
import androidx.compose.ui.input.key.key
import androidx.compose.ui.input.key.onKeyEvent
import androidx.compose.ui.input.key.type
import androidx.compose.ui.unit.Dp
internal expect val MARGIN_SCROLLBAR: Dp
internal expect interface ScrollbarAdapter
@Composable
internal expect fun rememberScrollbarAdapter(scrollState: LazyListState): ScrollbarAdapter
@Composable
internal expect fun VerticalScrollbar(
modifier: Modifier,
adapter: ScrollbarAdapter
)
internal fun Modifier.onKeyUp(key: Key, action: () -> Unit): Modifier =
onKeyEvent { event ->
if ((event.type == KeyEventType.KeyUp) && (event.key == key)) {
action()
true
} else {
false
}
}

29
examples/todoapp-lite/shared/src/desktopMain/kotlin/example/todoapp/lite/common/Utils.kt

@ -1,29 +0,0 @@ @@ -1,29 +0,0 @@
@file:JvmName("Utils")
package example.todoapp.lite.common
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
internal actual val MARGIN_SCROLLBAR: Dp = 8.dp
@Suppress("ACTUAL_WITHOUT_EXPECT") // Workaround https://youtrack.jetbrains.com/issue/KT-37316
internal actual typealias ScrollbarAdapter = androidx.compose.foundation.v2.ScrollbarAdapter
@Composable
internal actual fun rememberScrollbarAdapter(scrollState: LazyListState): ScrollbarAdapter =
androidx.compose.foundation.rememberScrollbarAdapter(scrollState)
@Composable
internal actual fun VerticalScrollbar(
modifier: Modifier,
adapter: ScrollbarAdapter
) {
androidx.compose.foundation.VerticalScrollbar(
modifier = modifier,
adapter = adapter
)
}

6
examples/todoapp-lite/shared/src/desktopMain/kotlin/main.desktop.kt

@ -1,6 +0,0 @@ @@ -1,6 +0,0 @@
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import example.todoapp.lite.common.RootContent
@Composable fun MainView() = RootContent(Modifier.fillMaxSize())

23
examples/todoapp-lite/shared/src/iosMain/kotlin/example/todoapp/lite/common/Utils.kt

@ -1,23 +0,0 @@ @@ -1,23 +0,0 @@
package example.todoapp.lite.common
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
internal actual val MARGIN_SCROLLBAR: Dp = 0.dp
internal actual interface ScrollbarAdapter
@Composable
internal actual fun rememberScrollbarAdapter(scrollState: LazyListState): ScrollbarAdapter =
object : ScrollbarAdapter {}
@Composable
internal actual fun VerticalScrollbar(
modifier: Modifier,
adapter: ScrollbarAdapter
) {
// no-op
}

14
examples/todoapp-lite/shared/src/iosMain/kotlin/main.ios.kt

@ -1,14 +0,0 @@ @@ -1,14 +0,0 @@
/*
* Copyright 2020-2021 JetBrains s.r.o. and respective authors and developers.
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
*/
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.ui.Modifier
import androidx.compose.ui.window.ComposeUIViewController
import example.todoapp.lite.common.RootContent
import platform.UIKit.UIViewController
fun MainViewController() : UIViewController = ComposeUIViewController {
RootContent(modifier = Modifier.fillMaxSize())
}

1
examples/validateExamples.sh

@ -23,6 +23,5 @@ runGradle chat packageDistributionForCurrentOS @@ -23,6 +23,5 @@ runGradle chat packageDistributionForCurrentOS
runGradle codeviewer packageDistributionForCurrentOS
runGradle imageviewer packageDistributionForCurrentOS
runGradle issues packageDistributionForCurrentOS
runGradle todoapp-lite packageDistributionForCurrentOS
runGradle graphics-2d packageDistributionForCurrentOS
runGradle jetsnack packageDistributionForCurrentOS

2
examples/validateExamplesAndroid.sh

@ -25,6 +25,4 @@ runGradle codeviewer installDebug @@ -25,6 +25,4 @@ runGradle codeviewer installDebug
runGradle imageviewer installDebug
runGradle issues installDebug
runGradle graphics-2d installDebug
runGradle todoapp-lite installDebug
runGradle todoapp installDebug
runGradle jetsnack installDebug

1
examples/validateExamplesIos.sh

@ -34,6 +34,5 @@ runGradle() { @@ -34,6 +34,5 @@ runGradle() {
runGradle chat
runGradle codeviewer
runGradle imageviewer
runGradle todoapp-lite
runGradle graphics-2d
runGradle jetsnack

Loading…
Cancel
Save