commit 0652c6add4949c5a3710e1ff2387fb4d159219f5 Author: Kgothatso Ngako Date: Mon Mar 23 01:41:39 2026 +0200 Pass the torch... initial commit. diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..adfa9bff --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +*.iml +.kotlin +.gradle +**/build/ +xcuserdata +!src/**/build/ +local.properties +.idea +.DS_Store +captures +.externalNativeBuild +.cxx +*.xcodeproj/* +!*.xcodeproj/project.pbxproj +!*.xcodeproj/xcshareddata/ +!*.xcodeproj/project.xcworkspace/ +!*.xcworkspace/contents.xcworkspacedata +**/xcshareddata/WorkspaceSettings.xcsettings +node_modules/ diff --git a/README.md b/README.md new file mode 100644 index 00000000..3cc70ff2 --- /dev/null +++ b/README.md @@ -0,0 +1,48 @@ +This is a Kotlin Multiplatform project targeting Android, iOS, Desktop (JVM). + +* [/composeApp](./composeApp/src) is for code that will be shared across your Compose Multiplatform applications. + It contains several subfolders: + - [commonMain](./composeApp/src/commonMain/kotlin) is for code that’s common for all targets. + - Other folders are for Kotlin code that will be compiled for only the platform indicated in the folder name. + For example, if you want to use Apple’s CoreCrypto for the iOS part of your Kotlin app, + the [iosMain](./composeApp/src/iosMain/kotlin) folder would be the right place for such calls. + Similarly, if you want to edit the Desktop (JVM) specific part, the [jvmMain](./composeApp/src/jvmMain/kotlin) + folder is the appropriate location. + +* [/iosApp](./iosApp/iosApp) contains iOS applications. Even if you’re sharing your UI with Compose Multiplatform, + you need this entry point for your iOS app. This is also where you should add SwiftUI code for your project. + +### Build and Run Android Application + +To build and run the development version of the Android app, use the run configuration from the run widget +in your IDE’s toolbar or build it directly from the terminal: +- on macOS/Linux + ```shell + ./gradlew :composeApp:assembleDebug + ``` +- on Windows + ```shell + .\gradlew.bat :composeApp:assembleDebug + ``` + +### Build and Run Desktop (JVM) Application + +To build and run the development version of the desktop app, use the run configuration from the run widget +in your IDE’s toolbar or run it directly from the terminal: +- on macOS/Linux + ```shell + ./gradlew :composeApp:run + ``` +- on Windows + ```shell + .\gradlew.bat :composeApp:run + ``` + +### Build and Run iOS Application + +To build and run the development version of the iOS app, use the run configuration from the run widget +in your IDE’s toolbar or open the [/iosApp](./iosApp) directory in Xcode and run it from there. + +--- + +Learn more about [Kotlin Multiplatform](https://www.jetbrains.com/help/kotlin-multiplatform-dev/get-started.html)… \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..98ddb8c6 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,10 @@ +plugins { + // this is necessary to avoid the plugins to be loaded multiple times + // in each subproject's classloader + alias(libs.plugins.androidApplication) apply false + alias(libs.plugins.androidLibrary) apply false + alias(libs.plugins.composeHotReload) apply false + alias(libs.plugins.composeMultiplatform) apply false + alias(libs.plugins.composeCompiler) apply false + alias(libs.plugins.kotlinMultiplatform) apply false +} \ No newline at end of file diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts new file mode 100644 index 00000000..ca58dde9 --- /dev/null +++ b/composeApp/build.gradle.kts @@ -0,0 +1,106 @@ +import org.jetbrains.compose.desktop.application.dsl.TargetFormat +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + +plugins { + alias(libs.plugins.kotlinMultiplatform) + alias(libs.plugins.androidApplication) + alias(libs.plugins.composeMultiplatform) + alias(libs.plugins.composeCompiler) + alias(libs.plugins.composeHotReload) +} + +kotlin { + androidTarget { + compilerOptions { + jvmTarget.set(JvmTarget.JVM_11) + } + } + + listOf( + iosArm64(), + iosSimulatorArm64() + ).forEach { iosTarget -> + iosTarget.binaries.framework { + baseName = "ComposeApp" + isStatic = true + } + } + + jvm() + + sourceSets { + androidMain.dependencies { + implementation(libs.compose.uiToolingPreview) + implementation(libs.androidx.activity.compose) + } + commonMain.dependencies { + implementation(libs.compose.runtime) + implementation(libs.compose.foundation) + implementation(libs.compose.material3) + implementation (libs.compose.material.icons.core) + implementation (libs.compose.material.icons.extended) + implementation(libs.compose.ui) + implementation(libs.compose.components.resources) + implementation(libs.compose.uiToolingPreview) + implementation(libs.androidx.lifecycle.viewmodelCompose) + implementation(libs.androidx.lifecycle.runtimeCompose) + + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.10.0") + implementation(libs.navigation.compose) + + implementation(libs.kermit) + + implementation("com.vitorpamplona.quartz:quartz:1:05.0") + } + commonTest.dependencies { + implementation(libs.kotlin.test) + } + jvmMain.dependencies { + implementation(compose.desktop.currentOs) + implementation(libs.kotlinx.coroutinesSwing) + } + } +} + +android { + namespace = "ac.aux.compose" + compileSdk = libs.versions.android.compileSdk.get().toInt() + + defaultConfig { + applicationId = "ac.aux.compose" + minSdk = libs.versions.android.minSdk.get().toInt() + targetSdk = libs.versions.android.targetSdk.get().toInt() + versionCode = 1 + versionName = "1.0" + } + packaging { + resources { + excludes += "/META-INF/{AL2.0,LGPL2.1}" + } + } + buildTypes { + getByName("release") { + isMinifyEnabled = false + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } +} + +dependencies { + debugImplementation(libs.compose.uiTooling) +} + +compose.desktop { + application { + mainClass = "ac.aux.compose.MainKt" + + nativeDistributions { + targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) + packageName = "ac.aux.compose" + packageVersion = "1.0.0" + } + } +} diff --git a/composeApp/src/androidMain/AndroidManifest.xml b/composeApp/src/androidMain/AndroidManifest.xml new file mode 100644 index 00000000..26403a75 --- /dev/null +++ b/composeApp/src/androidMain/AndroidManifest.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/composeApp/src/androidMain/kotlin/ac/aux/compose/MainActivity.kt b/composeApp/src/androidMain/kotlin/ac/aux/compose/MainActivity.kt new file mode 100644 index 00000000..fd938cf7 --- /dev/null +++ b/composeApp/src/androidMain/kotlin/ac/aux/compose/MainActivity.kt @@ -0,0 +1,25 @@ +package ac.aux.compose + +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.activity.enableEdgeToEdge +import androidx.compose.runtime.Composable +import androidx.compose.ui.tooling.preview.Preview + +class MainActivity : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + enableEdgeToEdge() + super.onCreate(savedInstanceState) + + setContent { + AuxApp() + } + } +} + +@Preview +@Composable +fun AuxAppAndroidPreview() { + AuxApp() +} \ No newline at end of file diff --git a/composeApp/src/androidMain/kotlin/ac/aux/compose/Platform.android.kt b/composeApp/src/androidMain/kotlin/ac/aux/compose/Platform.android.kt new file mode 100644 index 00000000..e16569be --- /dev/null +++ b/composeApp/src/androidMain/kotlin/ac/aux/compose/Platform.android.kt @@ -0,0 +1,9 @@ +package ac.aux.compose + +import android.os.Build + +class AndroidPlatform : Platform { + override val name: String = "Android ${Build.VERSION.SDK_INT}" +} + +actual fun getPlatform(): Platform = AndroidPlatform() \ No newline at end of file diff --git a/composeApp/src/androidMain/kotlin/ac/aux/compose/ui/theme/Theme.android.kt b/composeApp/src/androidMain/kotlin/ac/aux/compose/ui/theme/Theme.android.kt new file mode 100644 index 00000000..a889a118 --- /dev/null +++ b/composeApp/src/androidMain/kotlin/ac/aux/compose/ui/theme/Theme.android.kt @@ -0,0 +1,26 @@ +package ac.aux.compose.ui.theme + +import android.os.Build +import androidx.compose.material3.ColorScheme +import androidx.compose.material3.dynamicDarkColorScheme +import androidx.compose.material3.dynamicLightColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.platform.LocalContext + +@Composable +actual fun themeColorScheme( + darkTheme: Boolean, + dynamicColor: Boolean, + darkScheme: ColorScheme, + lightScheme: ColorScheme +): ColorScheme { + return when { + dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { + val context = LocalContext.current + if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) + } + + darkTheme -> darkScheme + else -> lightScheme + } +} \ No newline at end of file diff --git a/composeApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml b/composeApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..2b068d11 --- /dev/null +++ b/composeApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/composeApp/src/androidMain/res/drawable/ic_launcher_background.xml b/composeApp/src/androidMain/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..e93e11ad --- /dev/null +++ b/composeApp/src/androidMain/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml b/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml b/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png b/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 00000000..a571e600 Binary files /dev/null and b/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png differ diff --git a/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png b/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 00000000..61da551c Binary files /dev/null and b/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png b/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 00000000..c41dd285 Binary files /dev/null and b/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png differ diff --git a/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png b/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 00000000..db5080a7 Binary files /dev/null and b/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png b/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 00000000..6dba46da Binary files /dev/null and b/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png b/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 00000000..da31a871 Binary files /dev/null and b/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png b/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 00000000..15ac6817 Binary files /dev/null and b/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png b/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 00000000..b216f2d3 Binary files /dev/null and b/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png b/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 00000000..f25a4197 Binary files /dev/null and b/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png b/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 00000000..e96783cc Binary files /dev/null and b/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/composeApp/src/androidMain/res/values/strings.xml b/composeApp/src/androidMain/res/values/strings.xml new file mode 100644 index 00000000..adc8a767 --- /dev/null +++ b/composeApp/src/androidMain/res/values/strings.xml @@ -0,0 +1,3 @@ + + Aux + \ No newline at end of file diff --git a/composeApp/src/commonMain/composeResources/drawable/compose-multiplatform.xml b/composeApp/src/commonMain/composeResources/drawable/compose-multiplatform.xml new file mode 100644 index 00000000..1ffc948c --- /dev/null +++ b/composeApp/src/commonMain/composeResources/drawable/compose-multiplatform.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/AuxApp.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/AuxApp.kt new file mode 100644 index 00000000..ce7f0712 --- /dev/null +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/AuxApp.kt @@ -0,0 +1,66 @@ +package ac.aux.compose + +import ac.aux.compose.ui.composable.navigation.AuxNavHost +import ac.aux.compose.ui.theme.AuxTheme +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.foundation.Image +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.safeContentPadding +import androidx.compose.material3.Button +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface +import androidx.compose.material3.Text +import androidx.compose.runtime.* +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import androidx.navigation.NavHostController +import org.jetbrains.compose.resources.painterResource + +import aux.composeapp.generated.resources.Res +import aux.composeapp.generated.resources.compose_multiplatform + +@Composable +fun AuxApp( + navController: NavHostController, +) { + AuxTheme { + Surface( + modifier = Modifier.fillMaxSize() + ) { + AuxNavHost( + + navController = navController, + startDestination = LandingRoute + ) + + } + } + MaterialTheme { + var showContent by remember { mutableStateOf(false) } + Column( + modifier = Modifier + .background(MaterialTheme.colorScheme.primaryContainer) + .safeContentPadding() + .fillMaxSize(), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Button(onClick = { showContent = !showContent }) { + Text("Click me!") + } + AnimatedVisibility(showContent) { + val greeting = remember { Greeting().greet() } + Column( + modifier = Modifier.fillMaxWidth(), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Image(painterResource(Res.drawable.compose_multiplatform), null) + Text("Compose: $greeting") + } + } + } + } +} \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/Greeting.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/Greeting.kt new file mode 100644 index 00000000..037fac7c --- /dev/null +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/Greeting.kt @@ -0,0 +1,9 @@ +package ac.aux.compose + +class Greeting { + private val platform = getPlatform() + + fun greet(): String { + return "Hello, ${platform.name}!" + } +} \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/Platform.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/Platform.kt new file mode 100644 index 00000000..40166042 --- /dev/null +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/Platform.kt @@ -0,0 +1,7 @@ +package ac.aux.compose + +interface Platform { + val name: String +} + +expect fun getPlatform(): Platform \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/CreateProfileScreen.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/CreateProfileScreen.kt new file mode 100644 index 00000000..faacac4f --- /dev/null +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/CreateProfileScreen.kt @@ -0,0 +1,282 @@ +package ac.aux.compose.ui.composable + +import ac.aux.compose.ui.theme.AuxTheme +import ac.aux.compose.ui.view.model.CreateProfileViewModel +import ac.aux.compose.ui.view.state.CreateProfileUIState +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.text.KeyboardOptions +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Badge +import androidx.compose.material.icons.filled.Description +import androidx.compose.material3.Button +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Surface +import androidx.compose.material3.Text +import androidx.compose.material3.TextField +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.text.input.KeyboardType +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import androidx.lifecycle.viewmodel.compose.viewModel + +@Composable +fun CreateProfileScreen( + initialCreateProfileUIState: CreateProfileUIState = CreateProfileUIState.Declaration, + onNavigateToChatListRoute: () -> Unit +) { + val createProfileViewModel: CreateProfileViewModel = viewModel ( + factory = CreateProfileViewModel.factory( + initialCreateProfileUIState + ) + ) + Scaffold { innerPadding -> + Column( + modifier = Modifier.padding(innerPadding) + ) { + + Column( + modifier = Modifier.fillMaxWidth().padding( + 10.dp + ), + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.spacedBy(20.dp) + ) { + + when (val createAccountUIState = createProfileViewModel.createProfileUIState.value) { + is CreateProfileUIState.Declaration -> { + + Text( + "Create Profile", + style = MaterialTheme.typography.headlineSmall + ) + + Text( + "You are about to create a NOSTR profile.", + style = MaterialTheme.typography.bodyMedium, + textAlign = TextAlign.Center + ) + + Text( + "It is cryptographical secure, and decentralized, putting you in total control of your digital profile", + style = MaterialTheme.typography.bodyMedium, + textAlign = TextAlign.Center + ) + + Spacer( + modifier = Modifier.weight(1f) + ) + + Button( + onClick = { + + createProfileViewModel.createProfileUIState.value = CreateProfileUIState.InputPrompt + } + ) { + Text( + text = "Start" + ) + } + } + is CreateProfileUIState.InputPrompt -> { + Text( + "Create Profile", + style = MaterialTheme.typography.headlineSmall + ) + + TextField( + modifier = Modifier.fillMaxWidth(), + value = createProfileViewModel.createProfileFormState.nameField.text.value, + onValueChange = { + + }, + isError = createProfileViewModel.createProfileFormState.nameField.errorMessage.value != null, + supportingText = createProfileViewModel.createProfileFormState.nameField.errorMessage.value?.let { + { + Text( + text = it, + modifier = Modifier.padding( + bottom = 8.dp + ) + ) + } + }, + maxLines = 1, + keyboardOptions = KeyboardOptions( + keyboardType = KeyboardType.Phone, + ), + label = { + Text( + text = "Name (eg. Alan Turin)", + maxLines = 1, + ) + }, + placeholder = { + Text( + text = "Enter the name you want to use for your profile", + maxLines = 1, + ) + }, + leadingIcon = { + Icon( + Icons.Default.Badge, + contentDescription = "Name" + ) + } + ) + + Text( + text = "This will be the display name for your profile and also important for search.", + style = MaterialTheme.typography.labelMedium, + textAlign = TextAlign.Center + ) + + TextField( + modifier = Modifier.fillMaxWidth(), + value = createProfileViewModel.createProfileFormState.biographyField.text.value, + onValueChange = { + + }, + isError = createProfileViewModel.createProfileFormState.biographyField.errorMessage.value != null, + supportingText = createProfileViewModel.createProfileFormState.biographyField.errorMessage.value?.let { + { + Text( + text = it, + modifier = Modifier.padding( + bottom = 8.dp + ) + ) + } + }, + maxLines = 1, + keyboardOptions = KeyboardOptions( + keyboardType = KeyboardType.Phone, + ), + label = { + Text( + text = "Introduce yourself", + maxLines = 1, + + ) + }, + placeholder = { + Text( + text = "What should people know about you?", + maxLines = 1, + ) + }, + leadingIcon = { + Icon( + Icons.Default.Description, + contentDescription = "Name" + ) + } + ) + + Text( + text = "This will be shown when people open your profile.", + style = MaterialTheme.typography.labelMedium, + textAlign = TextAlign.Center + ) + + Button( + onClick = { + + createProfileViewModel.createProfileUIState.value = + CreateProfileUIState.ConfirmInput( + name = createProfileViewModel.createProfileFormState.nameField.text.value, + bio = createProfileViewModel.createProfileFormState.biographyField.text.value + ) + } + ) { + Text( + "Next" + ) + } + + } + is CreateProfileUIState.ConfirmInput -> { + + Text( + text = "Name", + style = MaterialTheme.typography.labelLarge + ) + + Text( + text = createAccountUIState.name, + style = MaterialTheme.typography.bodyLarge, + textAlign = TextAlign.Center + ) + + Text( + text = "Bio", + style = MaterialTheme.typography.labelLarge + ) + + Text( + text = createAccountUIState.bio, + style = MaterialTheme.typography.bodyLarge, + textAlign = TextAlign.Center + ) + + + + Text( + text = "The above will be your profile.", + style = MaterialTheme.typography.bodySmall + ) + + Spacer( + modifier = Modifier.weight(1f) + ) + + Text( + text = "You will be in full control of this profile. If you would like to use it for the long term please remember to backup the profile/keys.", + style = MaterialTheme.typography.labelSmall, + textAlign = TextAlign.Center + ) + + Button( + onClick = onNavigateToChatListRoute + ) { + Text( + text = "Create Profile" + ) + } + } + } + + + } + } + } +} + +@Preview +@Composable +fun CreateAccountScreenPreview() { + AuxTheme { + Surface( + modifier = Modifier.fillMaxSize() + ) { + CreateProfileScreen( + initialCreateProfileUIState = +// CreateProfileUIState.InputPrompt + CreateProfileUIState.ConfirmInput( + name = "Alan Turing", + bio = "Polyglot: Math... is my middle name, computer scientist. cryptographer, and gold hider." + ), + onNavigateToChatListRoute = {} + ) + } + } +} \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/ImplementationPendingScreen.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/ImplementationPendingScreen.kt new file mode 100644 index 00000000..5e60f01b --- /dev/null +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/ImplementationPendingScreen.kt @@ -0,0 +1,51 @@ +package ac.aux.compose.ui.composable + +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Surface +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import org.jetbrains.compose.ui.tooling.preview.Preview + +@Composable +fun ImplementationPendingScreen( + text: String +) { + + Scaffold { innerPadding -> + Column( + modifier = Modifier.padding(innerPadding).fillMaxSize() + ) { + Column( + modifier = Modifier.padding(20.dp).fillMaxSize(), + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.Center + ) { + Text( + "\"$text\" functionality coming soon", + + ) + } + } + } +} + +@Preview +@Composable +private fun ImplementationPendingScreenPreview() { + AuxTheme { + Surface( + modifier = Modifier.padding(20.dp) + ) { + ImplementationPendingScreen( + "Sign in" + ) + } + } +} \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/LandingScreen.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/LandingScreen.kt new file mode 100644 index 00000000..26de16f8 --- /dev/null +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/LandingScreen.kt @@ -0,0 +1,112 @@ +package ac.aux.compose.ui.composable + +import ac.aux.compose.ui.theme.AuxTheme +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Button +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Surface +import androidx.compose.material3.Text +import androidx.compose.material3.TextButton +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp + +@Composable +fun LandingScreen( + onNavigateToLearnMore: () -> Unit, + onNavigateToSignIn: () -> Unit, + onNavigateToCreateProfile: () -> Unit +) { + Scaffold { innerPadding -> + Column( + modifier = Modifier.padding(innerPadding) + ) { + Column( + verticalArrangement = Arrangement.spacedBy(10.dp) + ) { + Text( + text = "Aux", + style = MaterialTheme.typography.headlineLarge + ) + + Text( + text = "Keep the feed alive." + ) + + TextButton( + onClick = onNavigateToLearnMore + ) { + Text( + text = "Learn More", + style = MaterialTheme.typography.labelLarge, + ) + } + + Spacer( + modifier = Modifier.weight(1f) + ) + + Button( + onClick = onNavigateToSignIn + ) { + + Text( + "Sign in", + style = MaterialTheme.typography.bodyLarge + ) + } + + Text( + text = "Sign in to Torch via nsec, or remote signer", + modifier = Modifier.padding(10.dp), + style = MaterialTheme.typography.labelSmall, + textAlign = TextAlign.Center + ) + + Spacer( + modifier = Modifier.height(20.dp) + ) + + Button( + onClick = onNavigateToCreateProfile + ) { + Text( + "Create Profile", + style = MaterialTheme.typography.bodyLarge + ) + + } + Text( + text = "If you are new to Torch or just want to create a fresh profile", + modifier = Modifier.padding(10.dp), + style = MaterialTheme.typography.labelSmall, + textAlign = TextAlign.Center + ) + } + } + } +} + +@Preview +@Composable +private fun LandingScreenPreview() { + AuxTheme { + Surface( + modifier = Modifier.fillMaxSize() + ) { + LandingScreen( + onNavigateToSignIn = {}, + onNavigateToLearnMore = {}, + onNavigateToCreateProfile = {} + ) + } + } +} \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/navigation/AuxNavHost.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/navigation/AuxNavHost.kt new file mode 100644 index 00000000..8eb8cf38 --- /dev/null +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/navigation/AuxNavHost.kt @@ -0,0 +1,62 @@ +package ac.aux.compose.ui.composable.navigation + +import ac.aux.compose.ui.composable.CreateProfileScreen +import ac.aux.compose.ui.composable.ImplementationPendingScreen +import ac.aux.compose.ui.composable.LandingScreen +import ac.aux.compose.ui.composable.navigation.routes.CreateProfileRoute +import ac.aux.compose.ui.composable.navigation.routes.ImplementationPendingRoute +import ac.aux.compose.ui.composable.navigation.routes.LandingRoute +import androidx.compose.runtime.Composable +import androidx.navigation.NavHostController +import androidx.navigation.compose.NavHost +import androidx.navigation.compose.composable +import androidx.navigation.toRoute +import ac.aux.compose.ui.composable.navigation.routes.Route + +@Composable +fun AuxNavHost( + navController: NavHostController, + startDestination: Route +) { + + NavHost( + navController = navController, + startDestination = startDestination + ) { + composable { + LandingScreen( + onNavigateToLearnMore = { + navController.navigate( + route = ImplementationPendingRoute("Learn more") + ) + }, + onNavigateToSignIn = { + navController.navigate( + route = ImplementationPendingRoute("Sign in") + ) + }, + onNavigateToCreateProfile = { + navController.navigate( + route = CreateProfileRoute + ) + } + ) + } + composable { + CreateProfileScreen( + onNavigateToChatListRoute = { + navController.navigate( + route = ImplementationPendingRoute("Chat List") + ) + } + ) + } + composable { backStackEntry -> + val route: ImplementationPendingRoute = backStackEntry.toRoute() + ImplementationPendingScreen( + route.name + ) + } + } + +} \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/navigation/routes/CreateProfileRoute.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/navigation/routes/CreateProfileRoute.kt new file mode 100755 index 00000000..1bc6cf47 --- /dev/null +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/navigation/routes/CreateProfileRoute.kt @@ -0,0 +1,7 @@ +package ac.aux.compose.ui.composable.navigation.routes + +import kotlinx.serialization.Serializable + +@Serializable +object CreateProfileRoute: Route() { +} \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/navigation/routes/ImplementationPendingRoute.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/navigation/routes/ImplementationPendingRoute.kt new file mode 100755 index 00000000..eedf1a34 --- /dev/null +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/navigation/routes/ImplementationPendingRoute.kt @@ -0,0 +1,9 @@ +package ac.aux.compose.ui.composable.navigation.routes + +import kotlinx.serialization.Serializable + +@Serializable +data class ImplementationPendingRoute( + val name: String +): Route() { +} \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/navigation/routes/LandingRoute.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/navigation/routes/LandingRoute.kt new file mode 100755 index 00000000..207b2631 --- /dev/null +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/navigation/routes/LandingRoute.kt @@ -0,0 +1,7 @@ +package ac.aux.compose.ui.composable.navigation.routes + +import kotlinx.serialization.Serializable + +@Serializable +object LandingRoute: Route() { +} \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/navigation/routes/Route.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/navigation/routes/Route.kt new file mode 100755 index 00000000..222ffd9e --- /dev/null +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/navigation/routes/Route.kt @@ -0,0 +1,3 @@ +package ac.aux.compose.ui.composable.navigation.routes + +abstract class Route \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/widgets/LoadingDataIndicator.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/widgets/LoadingDataIndicator.kt new file mode 100755 index 00000000..df717d0b --- /dev/null +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/widgets/LoadingDataIndicator.kt @@ -0,0 +1,51 @@ +package ac.aux.compose.ui.composable.widgets + +import ac.aux.compose.ui.theme.AuxTheme +import androidx.compose.foundation.layout.* +import androidx.compose.material3.CircularProgressIndicator +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp + +@Composable +fun LoadingDataIndicator( + modifier: Modifier = Modifier.fillMaxWidth(), + color: Color = MaterialTheme.colorScheme.secondary, + fillScreen: Boolean = true, +) { + Column( + modifier = modifier, + horizontalAlignment = Alignment.CenterHorizontally, + ) { + if (fillScreen) { + Spacer(modifier = Modifier.weight(1f)) + } + + CircularProgressIndicator( + modifier = Modifier.width(80.dp).aspectRatio(1f), + color = color, + trackColor = MaterialTheme.colorScheme.surfaceVariant, + ) + + if (fillScreen) { + Spacer(modifier = Modifier.weight(3f)) + } + + } +} + + +@Preview +@Composable +private fun TransferHistoryScreenPreview() { + AuxTheme { + Surface(modifier = Modifier.fillMaxSize()) { + LoadingDataIndicator() + } + } +} \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/theme/Color.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/theme/Color.kt new file mode 100644 index 00000000..d5d256cd --- /dev/null +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/theme/Color.kt @@ -0,0 +1,226 @@ +package ac.aux.compose.ui.theme + +import androidx.compose.ui.graphics.Color + +val primaryLight = Color(0xFF000000) +val onPrimaryLight = Color(0xFFFFFFFF) +val primaryContainerLight = Color(0xFF1B1B1B) +val onPrimaryContainerLight = Color(0xFF848484) +val secondaryLight = Color(0xFF745B00) +val onSecondaryLight = Color(0xFFFFFFFF) +val secondaryContainerLight = Color(0xFFEFBF04) +val onSecondaryContainerLight = Color(0xFF644F00) +val tertiaryLight = Color(0xFF000000) +val onTertiaryLight = Color(0xFFFFFFFF) +val tertiaryContainerLight = Color(0xFF1B1B1B) +val onTertiaryContainerLight = Color(0xFF848484) +val errorLight = Color(0xFFBA1A1A) +val onErrorLight = Color(0xFFFFFFFF) +val errorContainerLight = Color(0xFFFFDAD6) +val onErrorContainerLight = Color(0xFF93000A) +val backgroundLight = Color(0xFFF9F9F9) +val onBackgroundLight = Color(0xFF1B1B1B) +val surfaceLight = Color(0xFFF9F9F9) +val onSurfaceLight = Color(0xFF1B1B1B) +val surfaceVariantLight = Color(0xFFEBE0E1) +val onSurfaceVariantLight = Color(0xFF4C4546) +val outlineLight = Color(0xFF7E7576) +val outlineVariantLight = Color(0xFFCFC4C5) +val scrimLight = Color(0xFF000000) +val inverseSurfaceLight = Color(0xFF303030) +val inverseOnSurfaceLight = Color(0xFFF1F1F1) +val inversePrimaryLight = Color(0xFFC6C6C6) +val surfaceDimLight = Color(0xFFDADADA) +val surfaceBrightLight = Color(0xFFF9F9F9) +val surfaceContainerLowestLight = Color(0xFFFFFFFF) +val surfaceContainerLowLight = Color(0xFFF3F3F3) +val surfaceContainerLight = Color(0xFFEEEEEE) +val surfaceContainerHighLight = Color(0xFFE8E8E8) +val surfaceContainerHighestLight = Color(0xFFE2E2E2) + +val primaryLightMediumContrast = Color(0xFF000000) +val onPrimaryLightMediumContrast = Color(0xFFFFFFFF) +val primaryContainerLightMediumContrast = Color(0xFF1B1B1B) +val onPrimaryContainerLightMediumContrast = Color(0xFFA7A7A7) +val secondaryLightMediumContrast = Color(0xFF443400) +val onSecondaryLightMediumContrast = Color(0xFFFFFFFF) +val secondaryContainerLightMediumContrast = Color(0xFF866A00) +val onSecondaryContainerLightMediumContrast = Color(0xFFFFFFFF) +val tertiaryLightMediumContrast = Color(0xFF000000) +val onTertiaryLightMediumContrast = Color(0xFFFFFFFF) +val tertiaryContainerLightMediumContrast = Color(0xFF1B1B1B) +val onTertiaryContainerLightMediumContrast = Color(0xFFA7A7A7) +val errorLightMediumContrast = Color(0xFF740006) +val onErrorLightMediumContrast = Color(0xFFFFFFFF) +val errorContainerLightMediumContrast = Color(0xFFCF2C27) +val onErrorContainerLightMediumContrast = Color(0xFFFFFFFF) +val backgroundLightMediumContrast = Color(0xFFF9F9F9) +val onBackgroundLightMediumContrast = Color(0xFF1B1B1B) +val surfaceLightMediumContrast = Color(0xFFF9F9F9) +val onSurfaceLightMediumContrast = Color(0xFF111111) +val surfaceVariantLightMediumContrast = Color(0xFFEBE0E1) +val onSurfaceVariantLightMediumContrast = Color(0xFF3B3436) +val outlineLightMediumContrast = Color(0xFF585152) +val outlineVariantLightMediumContrast = Color(0xFF736B6C) +val scrimLightMediumContrast = Color(0xFF000000) +val inverseSurfaceLightMediumContrast = Color(0xFF303030) +val inverseOnSurfaceLightMediumContrast = Color(0xFFF1F1F1) +val inversePrimaryLightMediumContrast = Color(0xFFC6C6C6) +val surfaceDimLightMediumContrast = Color(0xFFC6C6C6) +val surfaceBrightLightMediumContrast = Color(0xFFF9F9F9) +val surfaceContainerLowestLightMediumContrast = Color(0xFFFFFFFF) +val surfaceContainerLowLightMediumContrast = Color(0xFFF3F3F3) +val surfaceContainerLightMediumContrast = Color(0xFFE8E8E8) +val surfaceContainerHighLightMediumContrast = Color(0xFFDDDDDD) +val surfaceContainerHighestLightMediumContrast = Color(0xFFD1D1D1) + +val primaryLightHighContrast = Color(0xFF000000) +val onPrimaryLightHighContrast = Color(0xFFFFFFFF) +val primaryContainerLightHighContrast = Color(0xFF1B1B1B) +val onPrimaryContainerLightHighContrast = Color(0xFFD0D0D0) +val secondaryLightHighContrast = Color(0xFF382A00) +val onSecondaryLightHighContrast = Color(0xFFFFFFFF) +val secondaryContainerLightHighContrast = Color(0xFF5A4700) +val onSecondaryContainerLightHighContrast = Color(0xFFFFFFFF) +val tertiaryLightHighContrast = Color(0xFF000000) +val onTertiaryLightHighContrast = Color(0xFFFFFFFF) +val tertiaryContainerLightHighContrast = Color(0xFF1B1B1B) +val onTertiaryContainerLightHighContrast = Color(0xFFD0D0D0) +val errorLightHighContrast = Color(0xFF600004) +val onErrorLightHighContrast = Color(0xFFFFFFFF) +val errorContainerLightHighContrast = Color(0xFF98000A) +val onErrorContainerLightHighContrast = Color(0xFFFFFFFF) +val backgroundLightHighContrast = Color(0xFFF9F9F9) +val onBackgroundLightHighContrast = Color(0xFF1B1B1B) +val surfaceLightHighContrast = Color(0xFFF9F9F9) +val onSurfaceLightHighContrast = Color(0xFF000000) +val surfaceVariantLightHighContrast = Color(0xFFEBE0E1) +val onSurfaceVariantLightHighContrast = Color(0xFF000000) +val outlineLightHighContrast = Color(0xFF312B2C) +val outlineVariantLightHighContrast = Color(0xFF4F4749) +val scrimLightHighContrast = Color(0xFF000000) +val inverseSurfaceLightHighContrast = Color(0xFF303030) +val inverseOnSurfaceLightHighContrast = Color(0xFFFFFFFF) +val inversePrimaryLightHighContrast = Color(0xFFC6C6C6) +val surfaceDimLightHighContrast = Color(0xFFB9B9B9) +val surfaceBrightLightHighContrast = Color(0xFFF9F9F9) +val surfaceContainerLowestLightHighContrast = Color(0xFFFFFFFF) +val surfaceContainerLowLightHighContrast = Color(0xFFF1F1F1) +val surfaceContainerLightHighContrast = Color(0xFFE2E2E2) +val surfaceContainerHighLightHighContrast = Color(0xFFD4D4D4) +val surfaceContainerHighestLightHighContrast = Color(0xFFC6C6C6) + +val primaryDark = Color(0xFFC6C6C6) +val onPrimaryDark = Color(0xFF303030) +val primaryContainerDark = Color(0xFF000000) +val onPrimaryContainerDark = Color(0xFF757575) +val secondaryDark = Color(0xFFFFDE82) +val onSecondaryDark = Color(0xFF3D2F00) +val secondaryContainerDark = Color(0xFFEFBF04) +val onSecondaryContainerDark = Color(0xFF644F00) +val tertiaryDark = Color(0xFFC6C6C6) +val onTertiaryDark = Color(0xFF303030) +val tertiaryContainerDark = Color(0xFF000000) +val onTertiaryContainerDark = Color(0xFF757575) +val errorDark = Color(0xFFFFB4AB) +val onErrorDark = Color(0xFF690005) +val errorContainerDark = Color(0xFF93000A) +val onErrorContainerDark = Color(0xFFFFDAD6) +val backgroundDark = Color(0xFF131313) +val onBackgroundDark = Color(0xFFE2E2E2) +val surfaceDark = Color(0xFF131313) +val onSurfaceDark = Color(0xFFE2E2E2) +val surfaceVariantDark = Color(0xFF4C4546) +val onSurfaceVariantDark = Color(0xFFCFC4C5) +val outlineDark = Color(0xFF988E90) +val outlineVariantDark = Color(0xFF4C4546) +val scrimDark = Color(0xFF000000) +val inverseSurfaceDark = Color(0xFFE2E2E2) +val inverseOnSurfaceDark = Color(0xFF303030) +val inversePrimaryDark = Color(0xFF5E5E5E) +val surfaceDimDark = Color(0xFF131313) +val surfaceBrightDark = Color(0xFF393939) +val surfaceContainerLowestDark = Color(0xFF0E0E0E) +val surfaceContainerLowDark = Color(0xFF1B1B1B) +val surfaceContainerDark = Color(0xFF1F1F1F) +val surfaceContainerHighDark = Color(0xFF2A2A2A) +val surfaceContainerHighestDark = Color(0xFF353535) + +val primaryDarkMediumContrast = Color(0xFFDCDCDC) +val onPrimaryDarkMediumContrast = Color(0xFF262626) +val primaryContainerDarkMediumContrast = Color(0xFF919191) +val onPrimaryContainerDarkMediumContrast = Color(0xFF000000) +val secondaryDarkMediumContrast = Color(0xFFFFDE82) +val onSecondaryDarkMediumContrast = Color(0xFF342700) +val secondaryContainerDarkMediumContrast = Color(0xFFEFBF04) +val onSecondaryContainerDarkMediumContrast = Color(0xFF423300) +val tertiaryDarkMediumContrast = Color(0xFFDCDCDC) +val onTertiaryDarkMediumContrast = Color(0xFF262626) +val tertiaryContainerDarkMediumContrast = Color(0xFF919191) +val onTertiaryContainerDarkMediumContrast = Color(0xFF000000) +val errorDarkMediumContrast = Color(0xFFFFD2CC) +val onErrorDarkMediumContrast = Color(0xFF540003) +val errorContainerDarkMediumContrast = Color(0xFFFF5449) +val onErrorContainerDarkMediumContrast = Color(0xFF000000) +val backgroundDarkMediumContrast = Color(0xFF131313) +val onBackgroundDarkMediumContrast = Color(0xFFE2E2E2) +val surfaceDarkMediumContrast = Color(0xFF131313) +val onSurfaceDarkMediumContrast = Color(0xFFFFFFFF) +val surfaceVariantDarkMediumContrast = Color(0xFF4C4546) +val onSurfaceVariantDarkMediumContrast = Color(0xFFE5DADB) +val outlineDarkMediumContrast = Color(0xFFBAAFB1) +val outlineVariantDarkMediumContrast = Color(0xFF988E8F) +val scrimDarkMediumContrast = Color(0xFF000000) +val inverseSurfaceDarkMediumContrast = Color(0xFFE2E2E2) +val inverseOnSurfaceDarkMediumContrast = Color(0xFF2A2A2A) +val inversePrimaryDarkMediumContrast = Color(0xFF484848) +val surfaceDimDarkMediumContrast = Color(0xFF131313) +val surfaceBrightDarkMediumContrast = Color(0xFF444444) +val surfaceContainerLowestDarkMediumContrast = Color(0xFF070707) +val surfaceContainerLowDarkMediumContrast = Color(0xFF1D1D1D) +val surfaceContainerDarkMediumContrast = Color(0xFF282828) +val surfaceContainerHighDarkMediumContrast = Color(0xFF323232) +val surfaceContainerHighestDarkMediumContrast = Color(0xFF3E3E3E) + +val primaryDarkHighContrast = Color(0xFFF0F0F0) +val onPrimaryDarkHighContrast = Color(0xFF000000) +val primaryContainerDarkHighContrast = Color(0xFFC2C2C2) +val onPrimaryContainerDarkHighContrast = Color(0xFF0B0B0B) +val secondaryDarkHighContrast = Color(0xFFFFEFCA) +val onSecondaryDarkHighContrast = Color(0xFF000000) +val secondaryContainerDarkHighContrast = Color(0xFFEFBF04) +val onSecondaryContainerDarkHighContrast = Color(0xFF140E00) +val tertiaryDarkHighContrast = Color(0xFFF0F0F0) +val onTertiaryDarkHighContrast = Color(0xFF000000) +val tertiaryContainerDarkHighContrast = Color(0xFFC2C2C2) +val onTertiaryContainerDarkHighContrast = Color(0xFF0B0B0B) +val errorDarkHighContrast = Color(0xFFFFECE9) +val onErrorDarkHighContrast = Color(0xFF000000) +val errorContainerDarkHighContrast = Color(0xFFFFAEA4) +val onErrorContainerDarkHighContrast = Color(0xFF220001) +val backgroundDarkHighContrast = Color(0xFF131313) +val onBackgroundDarkHighContrast = Color(0xFFE2E2E2) +val surfaceDarkHighContrast = Color(0xFF131313) +val onSurfaceDarkHighContrast = Color(0xFFFFFFFF) +val surfaceVariantDarkHighContrast = Color(0xFF4C4546) +val onSurfaceVariantDarkHighContrast = Color(0xFFFFFFFF) +val outlineDarkHighContrast = Color(0xFFF9EDEF) +val outlineVariantDarkHighContrast = Color(0xFFCBC0C1) +val scrimDarkHighContrast = Color(0xFF000000) +val inverseSurfaceDarkHighContrast = Color(0xFFE2E2E2) +val inverseOnSurfaceDarkHighContrast = Color(0xFF000000) +val inversePrimaryDarkHighContrast = Color(0xFF484848) +val surfaceDimDarkHighContrast = Color(0xFF131313) +val surfaceBrightDarkHighContrast = Color(0xFF505050) +val surfaceContainerLowestDarkHighContrast = Color(0xFF000000) +val surfaceContainerLowDarkHighContrast = Color(0xFF1F1F1F) +val surfaceContainerDarkHighContrast = Color(0xFF303030) +val surfaceContainerHighDarkHighContrast = Color(0xFF3B3B3B) +val surfaceContainerHighestDarkHighContrast = Color(0xFF474747) + + + + + + + diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/theme/Theme.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/theme/Theme.kt new file mode 100644 index 00000000..692860a8 --- /dev/null +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/theme/Theme.kt @@ -0,0 +1,280 @@ +package ac.aux.compose.ui.theme + +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material3.ColorScheme +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.material3.darkColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.runtime.Immutable +import androidx.compose.ui.graphics.Color +import com.example.ui.theme.AuxTypography + +private val lightScheme = lightColorScheme( + primary = primaryLight, + onPrimary = onPrimaryLight, + primaryContainer = primaryContainerLight, + onPrimaryContainer = onPrimaryContainerLight, + secondary = secondaryLight, + onSecondary = onSecondaryLight, + secondaryContainer = secondaryContainerLight, + onSecondaryContainer = onSecondaryContainerLight, + tertiary = tertiaryLight, + onTertiary = onTertiaryLight, + tertiaryContainer = tertiaryContainerLight, + onTertiaryContainer = onTertiaryContainerLight, + error = errorLight, + onError = onErrorLight, + errorContainer = errorContainerLight, + onErrorContainer = onErrorContainerLight, + background = backgroundLight, + onBackground = onBackgroundLight, + surface = surfaceLight, + onSurface = onSurfaceLight, + surfaceVariant = surfaceVariantLight, + onSurfaceVariant = onSurfaceVariantLight, + outline = outlineLight, + outlineVariant = outlineVariantLight, + scrim = scrimLight, + inverseSurface = inverseSurfaceLight, + inverseOnSurface = inverseOnSurfaceLight, + inversePrimary = inversePrimaryLight, + surfaceDim = surfaceDimLight, + surfaceBright = surfaceBrightLight, + surfaceContainerLowest = surfaceContainerLowestLight, + surfaceContainerLow = surfaceContainerLowLight, + surfaceContainer = surfaceContainerLight, + surfaceContainerHigh = surfaceContainerHighLight, + surfaceContainerHighest = surfaceContainerHighestLight, +) + +private val darkScheme = darkColorScheme( + primary = primaryDark, + onPrimary = onPrimaryDark, + primaryContainer = primaryContainerDark, + onPrimaryContainer = onPrimaryContainerDark, + secondary = secondaryDark, + onSecondary = onSecondaryDark, + secondaryContainer = secondaryContainerDark, + onSecondaryContainer = onSecondaryContainerDark, + tertiary = tertiaryDark, + onTertiary = onTertiaryDark, + tertiaryContainer = tertiaryContainerDark, + onTertiaryContainer = onTertiaryContainerDark, + error = errorDark, + onError = onErrorDark, + errorContainer = errorContainerDark, + onErrorContainer = onErrorContainerDark, + background = backgroundDark, + onBackground = onBackgroundDark, + surface = surfaceDark, + onSurface = onSurfaceDark, + surfaceVariant = surfaceVariantDark, + onSurfaceVariant = onSurfaceVariantDark, + outline = outlineDark, + outlineVariant = outlineVariantDark, + scrim = scrimDark, + inverseSurface = inverseSurfaceDark, + inverseOnSurface = inverseOnSurfaceDark, + inversePrimary = inversePrimaryDark, + surfaceDim = surfaceDimDark, + surfaceBright = surfaceBrightDark, + surfaceContainerLowest = surfaceContainerLowestDark, + surfaceContainerLow = surfaceContainerLowDark, + surfaceContainer = surfaceContainerDark, + surfaceContainerHigh = surfaceContainerHighDark, + surfaceContainerHighest = surfaceContainerHighestDark, +) + +private val mediumContrastLightColorScheme = lightColorScheme( + primary = primaryLightMediumContrast, + onPrimary = onPrimaryLightMediumContrast, + primaryContainer = primaryContainerLightMediumContrast, + onPrimaryContainer = onPrimaryContainerLightMediumContrast, + secondary = secondaryLightMediumContrast, + onSecondary = onSecondaryLightMediumContrast, + secondaryContainer = secondaryContainerLightMediumContrast, + onSecondaryContainer = onSecondaryContainerLightMediumContrast, + tertiary = tertiaryLightMediumContrast, + onTertiary = onTertiaryLightMediumContrast, + tertiaryContainer = tertiaryContainerLightMediumContrast, + onTertiaryContainer = onTertiaryContainerLightMediumContrast, + error = errorLightMediumContrast, + onError = onErrorLightMediumContrast, + errorContainer = errorContainerLightMediumContrast, + onErrorContainer = onErrorContainerLightMediumContrast, + background = backgroundLightMediumContrast, + onBackground = onBackgroundLightMediumContrast, + surface = surfaceLightMediumContrast, + onSurface = onSurfaceLightMediumContrast, + surfaceVariant = surfaceVariantLightMediumContrast, + onSurfaceVariant = onSurfaceVariantLightMediumContrast, + outline = outlineLightMediumContrast, + outlineVariant = outlineVariantLightMediumContrast, + scrim = scrimLightMediumContrast, + inverseSurface = inverseSurfaceLightMediumContrast, + inverseOnSurface = inverseOnSurfaceLightMediumContrast, + inversePrimary = inversePrimaryLightMediumContrast, + surfaceDim = surfaceDimLightMediumContrast, + surfaceBright = surfaceBrightLightMediumContrast, + surfaceContainerLowest = surfaceContainerLowestLightMediumContrast, + surfaceContainerLow = surfaceContainerLowLightMediumContrast, + surfaceContainer = surfaceContainerLightMediumContrast, + surfaceContainerHigh = surfaceContainerHighLightMediumContrast, + surfaceContainerHighest = surfaceContainerHighestLightMediumContrast, +) + +private val highContrastLightColorScheme = lightColorScheme( + primary = primaryLightHighContrast, + onPrimary = onPrimaryLightHighContrast, + primaryContainer = primaryContainerLightHighContrast, + onPrimaryContainer = onPrimaryContainerLightHighContrast, + secondary = secondaryLightHighContrast, + onSecondary = onSecondaryLightHighContrast, + secondaryContainer = secondaryContainerLightHighContrast, + onSecondaryContainer = onSecondaryContainerLightHighContrast, + tertiary = tertiaryLightHighContrast, + onTertiary = onTertiaryLightHighContrast, + tertiaryContainer = tertiaryContainerLightHighContrast, + onTertiaryContainer = onTertiaryContainerLightHighContrast, + error = errorLightHighContrast, + onError = onErrorLightHighContrast, + errorContainer = errorContainerLightHighContrast, + onErrorContainer = onErrorContainerLightHighContrast, + background = backgroundLightHighContrast, + onBackground = onBackgroundLightHighContrast, + surface = surfaceLightHighContrast, + onSurface = onSurfaceLightHighContrast, + surfaceVariant = surfaceVariantLightHighContrast, + onSurfaceVariant = onSurfaceVariantLightHighContrast, + outline = outlineLightHighContrast, + outlineVariant = outlineVariantLightHighContrast, + scrim = scrimLightHighContrast, + inverseSurface = inverseSurfaceLightHighContrast, + inverseOnSurface = inverseOnSurfaceLightHighContrast, + inversePrimary = inversePrimaryLightHighContrast, + surfaceDim = surfaceDimLightHighContrast, + surfaceBright = surfaceBrightLightHighContrast, + surfaceContainerLowest = surfaceContainerLowestLightHighContrast, + surfaceContainerLow = surfaceContainerLowLightHighContrast, + surfaceContainer = surfaceContainerLightHighContrast, + surfaceContainerHigh = surfaceContainerHighLightHighContrast, + surfaceContainerHighest = surfaceContainerHighestLightHighContrast, +) + +private val mediumContrastDarkColorScheme = darkColorScheme( + primary = primaryDarkMediumContrast, + onPrimary = onPrimaryDarkMediumContrast, + primaryContainer = primaryContainerDarkMediumContrast, + onPrimaryContainer = onPrimaryContainerDarkMediumContrast, + secondary = secondaryDarkMediumContrast, + onSecondary = onSecondaryDarkMediumContrast, + secondaryContainer = secondaryContainerDarkMediumContrast, + onSecondaryContainer = onSecondaryContainerDarkMediumContrast, + tertiary = tertiaryDarkMediumContrast, + onTertiary = onTertiaryDarkMediumContrast, + tertiaryContainer = tertiaryContainerDarkMediumContrast, + onTertiaryContainer = onTertiaryContainerDarkMediumContrast, + error = errorDarkMediumContrast, + onError = onErrorDarkMediumContrast, + errorContainer = errorContainerDarkMediumContrast, + onErrorContainer = onErrorContainerDarkMediumContrast, + background = backgroundDarkMediumContrast, + onBackground = onBackgroundDarkMediumContrast, + surface = surfaceDarkMediumContrast, + onSurface = onSurfaceDarkMediumContrast, + surfaceVariant = surfaceVariantDarkMediumContrast, + onSurfaceVariant = onSurfaceVariantDarkMediumContrast, + outline = outlineDarkMediumContrast, + outlineVariant = outlineVariantDarkMediumContrast, + scrim = scrimDarkMediumContrast, + inverseSurface = inverseSurfaceDarkMediumContrast, + inverseOnSurface = inverseOnSurfaceDarkMediumContrast, + inversePrimary = inversePrimaryDarkMediumContrast, + surfaceDim = surfaceDimDarkMediumContrast, + surfaceBright = surfaceBrightDarkMediumContrast, + surfaceContainerLowest = surfaceContainerLowestDarkMediumContrast, + surfaceContainerLow = surfaceContainerLowDarkMediumContrast, + surfaceContainer = surfaceContainerDarkMediumContrast, + surfaceContainerHigh = surfaceContainerHighDarkMediumContrast, + surfaceContainerHighest = surfaceContainerHighestDarkMediumContrast, +) + +private val highContrastDarkColorScheme = darkColorScheme( + primary = primaryDarkHighContrast, + onPrimary = onPrimaryDarkHighContrast, + primaryContainer = primaryContainerDarkHighContrast, + onPrimaryContainer = onPrimaryContainerDarkHighContrast, + secondary = secondaryDarkHighContrast, + onSecondary = onSecondaryDarkHighContrast, + secondaryContainer = secondaryContainerDarkHighContrast, + onSecondaryContainer = onSecondaryContainerDarkHighContrast, + tertiary = tertiaryDarkHighContrast, + onTertiary = onTertiaryDarkHighContrast, + tertiaryContainer = tertiaryContainerDarkHighContrast, + onTertiaryContainer = onTertiaryContainerDarkHighContrast, + error = errorDarkHighContrast, + onError = onErrorDarkHighContrast, + errorContainer = errorContainerDarkHighContrast, + onErrorContainer = onErrorContainerDarkHighContrast, + background = backgroundDarkHighContrast, + onBackground = onBackgroundDarkHighContrast, + surface = surfaceDarkHighContrast, + onSurface = onSurfaceDarkHighContrast, + surfaceVariant = surfaceVariantDarkHighContrast, + onSurfaceVariant = onSurfaceVariantDarkHighContrast, + outline = outlineDarkHighContrast, + outlineVariant = outlineVariantDarkHighContrast, + scrim = scrimDarkHighContrast, + inverseSurface = inverseSurfaceDarkHighContrast, + inverseOnSurface = inverseOnSurfaceDarkHighContrast, + inversePrimary = inversePrimaryDarkHighContrast, + surfaceDim = surfaceDimDarkHighContrast, + surfaceBright = surfaceBrightDarkHighContrast, + surfaceContainerLowest = surfaceContainerLowestDarkHighContrast, + surfaceContainerLow = surfaceContainerLowDarkHighContrast, + surfaceContainer = surfaceContainerDarkHighContrast, + surfaceContainerHigh = surfaceContainerHighDarkHighContrast, + surfaceContainerHighest = surfaceContainerHighestDarkHighContrast, +) + +@Immutable +data class ColorFamily( + val color: Color, + val onColor: Color, + val colorContainer: Color, + val onColorContainer: Color +) + +val unspecified_scheme = ColorFamily( + Color.Unspecified, Color.Unspecified, Color.Unspecified, Color.Unspecified +) + +@Composable +fun AuxTheme( + darkTheme: Boolean = isSystemInDarkTheme(), + // Dynamic color is available on Android 12+ + dynamicColor: Boolean = true, + content: @Composable() () -> Unit +) { + val colorScheme = themeColorScheme( + darkTheme, + dynamicColor, + darkScheme, + lightScheme + ) + + MaterialTheme( + colorScheme = colorScheme, + typography = AuxTypography, + content = content + ) +} + +@Composable +expect fun themeColorScheme( + darkTheme: Boolean, + dynamicColor: Boolean, + darkScheme: ColorScheme, + lightScheme: ColorScheme +): ColorScheme diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/theme/Type.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/theme/Type.kt new file mode 100644 index 00000000..e26cd745 --- /dev/null +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/theme/Type.kt @@ -0,0 +1,9 @@ +package com.example.ui.theme + +import androidx.compose.material3.Typography +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.sp + +val AuxTypography = Typography() diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/view/model/CreateProfileViewModel.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/view/model/CreateProfileViewModel.kt new file mode 100644 index 00000000..5ee8ea76 --- /dev/null +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/view/model/CreateProfileViewModel.kt @@ -0,0 +1,46 @@ +package ac.aux.compose.ui.view.model + +import ac.aux.compose.ui.view.state.CreateProfileUIState +import androidx.compose.runtime.MutableState +import androidx.compose.runtime.mutableStateOf +import androidx.lifecycle.ViewModel +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory +import ac.aux.compose.ui.view.state.form.CreateProfileFormState +import co.touchlab.kermit.Logger + +class CreateProfileViewModel( + val initialCreateProfileUIState: CreateProfileUIState, + val createProfileFormState: CreateProfileFormState = CreateProfileFormState(), +): ViewModel() { + companion object { + private const val TAG = "CreateAccountViewModel" + + fun factory( + initialCreateProfileUIState: CreateProfileUIState + ): ViewModelProvider.Factory = viewModelFactory { + initializer { + CreateProfileViewModel( + initialCreateProfileUIState + ) + } + } + } + + private val logger = Logger.withTag(TAG) + + val isActionPending: MutableState = mutableStateOf(false) + + var createProfileUIState: MutableState = mutableStateOf( + initialCreateProfileUIState + ) + + public fun createAccount( + onSuccess: () -> Unit, + onFailure: () -> Unit + ) { + logger.d { "createAccount" } + onFailure.invoke() + } +} \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/view/state/CreateProfileUIState.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/view/state/CreateProfileUIState.kt new file mode 100644 index 00000000..0e00709c --- /dev/null +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/view/state/CreateProfileUIState.kt @@ -0,0 +1,13 @@ +package ac.aux.compose.ui.view.state + +abstract class CreateProfileUIState { + + data object Declaration: CreateProfileUIState() + + data object InputPrompt: CreateProfileUIState() + + data class ConfirmInput( + val name: String, + val bio: String + ) : CreateProfileUIState() +} \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/view/state/form/CreateProfileFormState.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/view/state/form/CreateProfileFormState.kt new file mode 100644 index 00000000..f992aba0 --- /dev/null +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/view/state/form/CreateProfileFormState.kt @@ -0,0 +1,6 @@ +package ac.aux.compose.ui.view.state.form + +data class CreateProfileFormState( + val nameField: TextField = TextField(), + val biographyField: TextField = TextField() +) \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/view/state/form/TextField.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/view/state/form/TextField.kt new file mode 100644 index 00000000..3b48af54 --- /dev/null +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/view/state/form/TextField.kt @@ -0,0 +1,9 @@ +package ac.aux.compose.ui.view.state.form + +import androidx.compose.runtime.MutableState +import androidx.compose.runtime.mutableStateOf + +data class TextField( + val text: MutableState = mutableStateOf(""), + val errorMessage: MutableState = mutableStateOf(null) +) diff --git a/composeApp/src/commonTest/kotlin/ac/aux/compose/ComposeAppCommonTest.kt b/composeApp/src/commonTest/kotlin/ac/aux/compose/ComposeAppCommonTest.kt new file mode 100644 index 00000000..51ac1519 --- /dev/null +++ b/composeApp/src/commonTest/kotlin/ac/aux/compose/ComposeAppCommonTest.kt @@ -0,0 +1,12 @@ +package ac.aux.compose + +import kotlin.test.Test +import kotlin.test.assertEquals + +class ComposeAppCommonTest { + + @Test + fun example() { + assertEquals(3, 1 + 2) + } +} \ No newline at end of file diff --git a/composeApp/src/iosMain/kotlin/ac/aux/compose/MainViewController.kt b/composeApp/src/iosMain/kotlin/ac/aux/compose/MainViewController.kt new file mode 100644 index 00000000..5d9b2ee8 --- /dev/null +++ b/composeApp/src/iosMain/kotlin/ac/aux/compose/MainViewController.kt @@ -0,0 +1,5 @@ +package ac.aux.compose + +import androidx.compose.ui.window.ComposeUIViewController + +fun MainViewController() = ComposeUIViewController { AuxApp() } \ No newline at end of file diff --git a/composeApp/src/iosMain/kotlin/ac/aux/compose/Platform.ios.kt b/composeApp/src/iosMain/kotlin/ac/aux/compose/Platform.ios.kt new file mode 100644 index 00000000..e0e0e1aa --- /dev/null +++ b/composeApp/src/iosMain/kotlin/ac/aux/compose/Platform.ios.kt @@ -0,0 +1,9 @@ +package ac.aux.compose + +import platform.UIKit.UIDevice + +class IOSPlatform: Platform { + override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion +} + +actual fun getPlatform(): Platform = IOSPlatform() \ No newline at end of file diff --git a/composeApp/src/iosMain/kotlin/ac/aux/compose/ui/theme/Theme.ios.kt b/composeApp/src/iosMain/kotlin/ac/aux/compose/ui/theme/Theme.ios.kt new file mode 100644 index 00000000..255b6d60 --- /dev/null +++ b/composeApp/src/iosMain/kotlin/ac/aux/compose/ui/theme/Theme.ios.kt @@ -0,0 +1,17 @@ +package ac.aux.compose.ui.theme + +import androidx.compose.material3.ColorScheme +import androidx.compose.runtime.Composable + +@Composable +actual fun themeColorScheme( + darkTheme: Boolean, + dynamicColor: Boolean, + darkScheme: ColorScheme, + lightScheme: ColorScheme +): ColorScheme { + return when { + darkTheme -> darkScheme + else -> lightScheme + } +} \ No newline at end of file diff --git a/composeApp/src/jvmMain/kotlin/ac/aux/compose/Platform.jvm.kt b/composeApp/src/jvmMain/kotlin/ac/aux/compose/Platform.jvm.kt new file mode 100644 index 00000000..2843dd78 --- /dev/null +++ b/composeApp/src/jvmMain/kotlin/ac/aux/compose/Platform.jvm.kt @@ -0,0 +1,7 @@ +package ac.aux.compose + +class JVMPlatform: Platform { + override val name: String = "Java ${System.getProperty("java.version")}" +} + +actual fun getPlatform(): Platform = JVMPlatform() \ No newline at end of file diff --git a/composeApp/src/jvmMain/kotlin/ac/aux/compose/main.kt b/composeApp/src/jvmMain/kotlin/ac/aux/compose/main.kt new file mode 100644 index 00000000..f678fd73 --- /dev/null +++ b/composeApp/src/jvmMain/kotlin/ac/aux/compose/main.kt @@ -0,0 +1,13 @@ +package ac.aux.compose + +import androidx.compose.ui.window.Window +import androidx.compose.ui.window.application + +fun main() = application { + Window( + onCloseRequest = ::exitApplication, + title = "Aux", + ) { + AuxApp() + } +} \ No newline at end of file diff --git a/composeApp/src/jvmMain/kotlin/ac/aux/compose/ui/theme/Theme.jvm.kt b/composeApp/src/jvmMain/kotlin/ac/aux/compose/ui/theme/Theme.jvm.kt new file mode 100644 index 00000000..255b6d60 --- /dev/null +++ b/composeApp/src/jvmMain/kotlin/ac/aux/compose/ui/theme/Theme.jvm.kt @@ -0,0 +1,17 @@ +package ac.aux.compose.ui.theme + +import androidx.compose.material3.ColorScheme +import androidx.compose.runtime.Composable + +@Composable +actual fun themeColorScheme( + darkTheme: Boolean, + dynamicColor: Boolean, + darkScheme: ColorScheme, + lightScheme: ColorScheme +): ColorScheme { + return when { + darkTheme -> darkScheme + else -> lightScheme + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..6f8e6ea6 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,12 @@ +#Kotlin +kotlin.code.style=official +kotlin.daemon.jvmargs=-Xmx3072M + +#Gradle +org.gradle.jvmargs=-Xmx4096M -Dfile.encoding=UTF-8 +org.gradle.configuration-cache=true +org.gradle.caching=true + +#Android +android.nonTransitiveRClass=true +android.useAndroidX=true \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..9f9cf835 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,53 @@ +[versions] +agp = "8.11.2" +android-compileSdk = "36" +android-minSdk = "24" +android-targetSdk = "36" +androidx-activity = "1.12.2" +androidx-appcompat = "1.7.1" +androidx-core = "1.17.0" +androidx-espresso = "3.7.0" +androidx-lifecycle = "2.9.6" +androidx-testExt = "1.3.0" +composeHotReload = "1.0.0" +composeMultiplatform = "1.10.0" +junit = "4.13.2" +kermit = "2.0.8" +kotlin = "2.3.0" +kotlinx-coroutines = "1.10.2" +material3 = "1.10.0-alpha05" +materialIconsCore = "1.7.3" +materialIconsExtended = "1.7.3" +navigationCompose = "2.9.2" + +[libraries] +kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } +kotlin-testJunit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" } +junit = { module = "junit:junit", version.ref = "junit" } +androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "androidx-core" } +androidx-testExt-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-testExt" } +androidx-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "androidx-espresso" } +androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" } +androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity" } +compose-uiTooling = { module = "org.jetbrains.compose.ui:ui-tooling", version.ref = "composeMultiplatform" } +androidx-lifecycle-viewmodelCompose = { module = "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "androidx-lifecycle" } +androidx-lifecycle-runtimeCompose = { module = "org.jetbrains.androidx.lifecycle:lifecycle-runtime-compose", version.ref = "androidx-lifecycle" } +compose-runtime = { module = "org.jetbrains.compose.runtime:runtime", version.ref = "composeMultiplatform" } +compose-foundation = { module = "org.jetbrains.compose.foundation:foundation", version.ref = "composeMultiplatform" } +compose-material3 = { module = "org.jetbrains.compose.material3:material3", version.ref = "material3" } +compose-material-icons-core = { module = "androidx.compose.material:material-icons-core", version.ref = "materialIconsCore" } +compose-material-icons-extended = { module = "androidx.compose.material:material-icons-extended", version.ref = "materialIconsExtended" } +compose-ui = { module = "org.jetbrains.compose.ui:ui", version.ref = "composeMultiplatform" } +compose-components-resources = { module = "org.jetbrains.compose.components:components-resources", version.ref = "composeMultiplatform" } +compose-uiToolingPreview = { module = "org.jetbrains.compose.ui:ui-tooling-preview", version.ref = "composeMultiplatform" } +kermit = { module = "co.touchlab:kermit", version.ref = "kermit" } +kotlinx-coroutinesSwing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines" } +navigation-compose = { module = "org.jetbrains.androidx.navigation:navigation-compose", version.ref = "navigationCompose" } + +[plugins] +androidApplication = { id = "com.android.application", version.ref = "agp" } +androidLibrary = { id = "com.android.library", version.ref = "agp" } +composeHotReload = { id = "org.jetbrains.compose.hot-reload", version.ref = "composeHotReload" } +composeMultiplatform = { id = "org.jetbrains.compose", version.ref = "composeMultiplatform" } +composeCompiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } +kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..1b33c55b Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..d4081da4 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 00000000..23d15a93 --- /dev/null +++ b/gradlew @@ -0,0 +1,251 @@ +#!/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. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# 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/HEAD/platforms/jvm/plugins-application/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 + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit + +# 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="\\\"\\\"" + + +# 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 + if ! command -v java >/dev/null 2>&1 + then + 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 +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + 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 + + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# 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" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000..db3a6ac2 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,94 @@ +@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 +@rem SPDX-License-Identifier: Apache-2.0 +@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=. +@rem This is normally unused +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. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH= + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +: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 diff --git a/iosApp/Configuration/Config.xcconfig b/iosApp/Configuration/Config.xcconfig new file mode 100644 index 00000000..14dc2278 --- /dev/null +++ b/iosApp/Configuration/Config.xcconfig @@ -0,0 +1,7 @@ +TEAM_ID= + +PRODUCT_NAME=Aux +PRODUCT_BUNDLE_IDENTIFIER=ac.aux.compose.Aux$(TEAM_ID) + +CURRENT_PROJECT_VERSION=1 +MARKETING_VERSION=1.0 \ No newline at end of file diff --git a/iosApp/iosApp.xcodeproj/project.pbxproj b/iosApp/iosApp.xcodeproj/project.pbxproj new file mode 100644 index 00000000..683c17c7 --- /dev/null +++ b/iosApp/iosApp.xcodeproj/project.pbxproj @@ -0,0 +1,373 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXFileReference section */ + 41CB266BF907B985085BE6EC /* Aux.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Aux.app; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ + F152C7DDAA33FF4003F7A0F4 /* Exceptions for "iosApp" folder in "iosApp" target */ = { + isa = PBXFileSystemSynchronizedBuildFileExceptionSet; + membershipExceptions = ( + Info.plist, + ); + target = BED811E0E93AA4C859D6BD5F /* iosApp */; + }; +/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + D0B3F911C995EE3A877DB0C5 /* iosApp */ = { + isa = PBXFileSystemSynchronizedRootGroup; + exceptions = ( + F152C7DDAA33FF4003F7A0F4 /* Exceptions for "iosApp" folder in "iosApp" target */, + ); + path = iosApp; + sourceTree = ""; + }; + 40DD74DD156DA4326F750CBE /* Configuration */ = { + isa = PBXFileSystemSynchronizedRootGroup; + path = Configuration; + sourceTree = ""; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + +/* Begin PBXFrameworksBuildPhase section */ + 1AA34A99963BBC79C8E57AEE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + E28E5948C7A59A192A667773 = { + isa = PBXGroup; + children = ( + 40DD74DD156DA4326F750CBE /* Configuration */, + D0B3F911C995EE3A877DB0C5 /* iosApp */, + ECDAFDDED408A506DEFE0AF1 /* Products */, + ); + sourceTree = ""; + }; + ECDAFDDED408A506DEFE0AF1 /* Products */ = { + isa = PBXGroup; + children = ( + 41CB266BF907B985085BE6EC /* Aux.app */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + BED811E0E93AA4C859D6BD5F /* iosApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = 322375D398FB681FEE495790 /* Build configuration list for PBXNativeTarget "iosApp" */; + buildPhases = ( + A2B5FDB6980F9C7F0F9848DE /* Compile Kotlin Framework */, + 44CB1A00B17EC89B5FF4407C /* Sources */, + 1AA34A99963BBC79C8E57AEE /* Frameworks */, + AF2DE3C5426226B543CC24DC /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + D0B3F911C995EE3A877DB0C5 /* iosApp */, + ); + name = iosApp; + packageProductDependencies = ( + ); + productName = iosApp; + productReference = 41CB266BF907B985085BE6EC /* Aux.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 7B228E3BC6A3A024E46D1BD1 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1620; + LastUpgradeCheck = 1620; + TargetAttributes = { + BED811E0E93AA4C859D6BD5F = { + CreatedOnToolsVersion = 16.2; + }; + }; + }; + buildConfigurationList = 1F53EC4BB2AE3EDCE8CF5ACA /* Build configuration list for PBXProject "iosApp" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = E28E5948C7A59A192A667773; + minimizedProjectReferenceProxies = 1; + preferredProjectObjectVersion = 77; + productRefGroup = ECDAFDDED408A506DEFE0AF1 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + BED811E0E93AA4C859D6BD5F /* iosApp */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + AF2DE3C5426226B543CC24DC /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + A2B5FDB6980F9C7F0F9848DE /* Compile Kotlin Framework */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Compile Kotlin Framework"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "if [ \"YES\" = \"$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED\" ]; then\n echo \"Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \\\"YES\\\"\"\n exit 0\nfi\ncd \"$SRCROOT/..\"\n./gradlew :composeApp:embedAndSignAppleFrameworkForXcode\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 44CB1A00B17EC89B5FF4407C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + FA4EC38CAEB01CF10DE6928B /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReferenceAnchor = 40DD74DD156DA4326F750CBE /* Configuration */; + baseConfigurationReferenceRelativePath = Config.xcconfig; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + 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; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu17; + 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 = 18.2; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 74751B07AD1A4DC5E1F94248 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReferenceAnchor = 40DD74DD156DA4326F750CBE /* Configuration */; + baseConfigurationReferenceRelativePath = Config.xcconfig; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + 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; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu17; + 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 = 18.2; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 7995121203EEDC0E90EF5DAF /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = arm64; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; + DEVELOPMENT_TEAM = "${TEAM_ID}"; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = iosApp/Info.plist; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + E146742224379A9BDC1E24A1 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = arm64; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; + DEVELOPMENT_TEAM = "${TEAM_ID}"; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = iosApp/Info.plist; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1F53EC4BB2AE3EDCE8CF5ACA /* Build configuration list for PBXProject "iosApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FA4EC38CAEB01CF10DE6928B /* Debug */, + 74751B07AD1A4DC5E1F94248 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 322375D398FB681FEE495790 /* Build configuration list for PBXNativeTarget "iosApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7995121203EEDC0E90EF5DAF /* Debug */, + E146742224379A9BDC1E24A1 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 7B228E3BC6A3A024E46D1BD1 /* Project object */; +} \ No newline at end of file diff --git a/iosApp/iosApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/iosApp/iosApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/iosApp/iosApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json b/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 00000000..eb878970 --- /dev/null +++ b/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..4e8d485b --- /dev/null +++ b/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,36 @@ +{ + "images" : [ + { + "filename" : "app-icon-1024.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "tinted" + } + ], + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png b/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png new file mode 100644 index 00000000..53fc536f Binary files /dev/null and b/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png differ diff --git a/iosApp/iosApp/Assets.xcassets/Contents.json b/iosApp/iosApp/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/iosApp/iosApp/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/iosApp/iosApp/ContentView.swift b/iosApp/iosApp/ContentView.swift new file mode 100644 index 00000000..c765ff2a --- /dev/null +++ b/iosApp/iosApp/ContentView.swift @@ -0,0 +1,21 @@ +import UIKit +import SwiftUI +import ComposeApp + +struct ComposeView: UIViewControllerRepresentable { + func makeUIViewController(context: Context) -> UIViewController { + MainViewControllerKt.MainViewController() + } + + func updateUIViewController(_ uiViewController: UIViewController, context: Context) {} +} + +struct ContentView: View { + var body: some View { + ComposeView() + .ignoresSafeArea() + } +} + + + diff --git a/iosApp/iosApp/Info.plist b/iosApp/iosApp/Info.plist new file mode 100644 index 00000000..11845e1d --- /dev/null +++ b/iosApp/iosApp/Info.plist @@ -0,0 +1,8 @@ + + + + + CADisableMinimumFrameDurationOnPhone + + + diff --git a/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json b/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/iosApp/iosApp/iOSApp.swift b/iosApp/iosApp/iOSApp.swift new file mode 100644 index 00000000..d83dca61 --- /dev/null +++ b/iosApp/iosApp/iOSApp.swift @@ -0,0 +1,10 @@ +import SwiftUI + +@main +struct iOSApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000..dc57eea3 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,35 @@ +rootProject.name = "Aux" +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") + +pluginManagement { + repositories { + google { + mavenContent { + includeGroupAndSubgroups("androidx") + includeGroupAndSubgroups("com.android") + includeGroupAndSubgroups("com.google") + } + } + mavenCentral() + gradlePluginPortal() + } +} + +dependencyResolutionManagement { + repositories { + google { + mavenContent { + includeGroupAndSubgroups("androidx") + includeGroupAndSubgroups("com.android") + includeGroupAndSubgroups("com.google") + } + } + mavenCentral() + } +} + +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" +} + +include(":composeApp") \ No newline at end of file