Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a569bd7
[issue-59] - migrando para kmp
rviannaoliveira Aug 6, 2025
e023f77
[issue-59] - migrando para kmp
rviannaoliveira Aug 6, 2025
67bba4c
[issue-59] - migrando para kmp
rviannaoliveira Aug 6, 2025
34c53fe
[issue-59] - migrando para kmp
rviannaoliveira Aug 6, 2025
ce50ce5
[issue-59] - migrando para kmp
rviannaoliveira Aug 7, 2025
d1c3173
[issue-59] - migrando para kmp
rviannaoliveira Aug 7, 2025
d067576
[issue-59] - migrando para kmp
rviannaoliveira Aug 7, 2025
35dbe81
[issue-59] - convert to kmp
rviannaoliveira Sep 30, 2025
2af435e
[issue-59] - migrando para kmp
rviannaoliveira Oct 22, 2025
58ed247
[issue-59] - migrando para kmp ios
rviannaoliveira Oct 23, 2025
9eecd2c
[issue-59] - create sample
rviannaoliveira Nov 2, 2025
cc794b9
[issue-59] - gitignore
rviannaoliveira Nov 4, 2025
77eb732
[issue-59] - gitignore
rviannaoliveira Nov 4, 2025
9ed4611
[issue-59] - remove code
rviannaoliveira Nov 4, 2025
5f38893
[issue-59] - jvm 21
rviannaoliveira Nov 6, 2025
72693e3
[issue-59] - adjust to java 17
rviannaoliveira Nov 13, 2025
00b060d
[issue-59] - works
rviannaoliveira Nov 13, 2025
b64b79a
[issue-59] - works
rviannaoliveira Nov 13, 2025
a78c8b5
[issue-59] - update doc kmp
rviannaoliveira Nov 13, 2025
39c3127
Duplicate app-sample-cmp based on KMP-Sample
gabrielbmoro Nov 14, 2025
25d4980
Create iosApp for android_kmp
gabrielbmoro Nov 14, 2025
641513f
Fixing color issue
gabrielbmoro Nov 14, 2025
7c77a4f
Update JVM to 21 - GitHub Action
gabrielbmoro Nov 14, 2025
1389e23
Create a new action specific for setup java
gabrielbmoro Nov 14, 2025
4ddec28
Merge branch 'main' into issue-59/convert-to-kmp
gabrielbmoro Nov 14, 2025
03eab76
[issue-59] - update CI
rviannaoliveira Nov 17, 2025
40f947e
[issue-59] - update CI
rviannaoliveira Nov 17, 2025
973a03d
[issue-59] - update CI
rviannaoliveira Nov 17, 2025
294929d
[issue-59] - update CI
rviannaoliveira Nov 17, 2025
069aa86
[issue-59] - works xml
rviannaoliveira Nov 18, 2025
06716ba
[issue-59] - update CI
rviannaoliveira Nov 18, 2025
cb9d06c
[issue-59] - works xml
rviannaoliveira Nov 19, 2025
a6264a6
[issue-59] - doc
rviannaoliveira Nov 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/actions/java/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: "Java setup"
description: "Setup Java"

runs:
using: "composite"
steps:
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"
cache: gradle
16 changes: 6 additions & 10 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ jobs:
- name: Check out code
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
- uses: actions/checkout@v4
- name: Setup Java
uses: ./.github/actions/java

- name: Set up Android SDK
uses: android-actions/setup-android@v2
Expand All @@ -40,11 +38,9 @@ jobs:
- name: Check out code
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
- uses: actions/checkout@v4
- name: Setup Java
uses: ./.github/actions/java

- name: Run Unit Tests
run: ./gradlew testDebugUnitTest --no-daemon
Expand Down
31 changes: 27 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ jobs:
echo "ORG_GRADLE_PROJECT_signingInMemoryKey: $ORG_GRADLE_PROJECT_signingInMemoryKey"
echo "ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: $ORG_GRADLE_PROJECT_signingInMemoryKeyPassword"
echo "ORG_GRADLE_PROJECT_signingInMemoryKeyId: $ORG_GRADLE_PROJECT_signingInMemoryKeyId"
./gradlew publish --no-daemon
./gradlew \
:craftd-core:publishAllPublicationsToMavenCentralRepository \
:craftd-compose:publishAllPublicationsToMavenCentralRepository \
:craftd-xml:publish \
--no-daemon
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALUSERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALPASSWORD }}
Expand All @@ -34,6 +38,27 @@ jobs:
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEY }}
working-directory: android_kmp

tag:
name: Update tags per module
runs-on: ubuntu-latest
needs: publish

strategy:
matrix:
module:
- name: craftd-core
prefix: kmp
- name: craftd-compose
prefix: kmp
- name: craftd-xml
prefix: android

steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
Expand All @@ -47,6 +72,4 @@ jobs:
bundle install --jobs 4 --retry 3

- name: Update tag
run: bundle exec fastlane update_tag
env:
PREFIX: "android"
run: PREFIX=${{ matrix.module.prefix }} bundle exec fastlane update_tag
72 changes: 10 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ Take a look at [CraftD: Server Driven UI for All Platforms](https://medium.com/c
## Features
### 🔗 Compatibility

| Tech | Support |
|---------------------------------|:--------------------:|
| View System - Android | ✅ **Supported** |
| Jetpack Compose - Android | ✅ **Supported** |
| Widget - Flutter | ✅ **Supported** |
| SwiftUi - iOS | ✅ **Supported** |
| Jetpack Compose - Multiplatform | ⚒️ **In Progress** |
| Tech | Support |
|---------------------------------|:-------------------:|
| View System - Android | ✅ **Supported** |
| Jetpack Compose - Android | ✅ **Supported** |
| Widget - Flutter | ✅ **Supported** |
| SwiftUi - iOS | ✅ **Supported** |
| Jetpack Compose - Multiplatform | ✅ **Supported** |

### Components that already exist in the library

Expand All @@ -34,65 +34,13 @@ Take a look at [CraftD: Server Driven UI for All Platforms](https://medium.com/c
| Text | X | X | X | X |
| CheckBox | X | - | - | X |

### Create your custom component( android compose example )

```kotlin
@JsonIgnoreProperties(ignoreUnknown = true)
@Immutable
@Stable
data class CheckBoxProperties(
@JsonProperty("text") val text: String? = null,
... rest of your properties
)

```

#### Add your Component json object in Dymanic.json
```json
{
"key": "CraftDCheckBox",
"value": {
... place your properties
}
}

```

#### Create your Component
```kotlin
@Composable
fun CraftDCheckBox(
checkboxProperties: CheckBoxProperties,
modifier: Modifier = Modifier,
onChecked: (Boolean) -> Unit
) {
... place your code
}
```

#### Create your Component Builder
```kotlin
class CraftDCheckBoxBuilder(
override val key: String = CraftDComponentKey.CHECK_BOX_COMPONENT.key
) :
CraftDBuilder {
@Composable
override fun craft(model: SimpleProperties, listener: CraftDViewListener) {
val checkBoxProperties = model.value.convertToVO<CheckBoxProperties>()
CraftDCheckBox(checkBoxProperties) {
checkBoxProperties.actionProperties?.let { listener.invoke(it) }
}
}
}
```

More details check our [documentation](https://codandotv.gitbook.io/craftd)


### Samples
| [Android Compose](https://github.com/CodandoTV/CraftD/tree/main/android_kmp/app-sample/src/main/java/com/github/codandotv/craftd/app_sample/presentation/compose) | [Android View System](https://github.com/CodandoTV/CraftD/tree/main/android_kmp/app-sample/src/main/java/com/github/codandotv/craftd/app_sample/presentation/xml) | [iOS SwiftUI](https://github.com/CodandoTV/CraftD/tree/main/ios/sample/CraftDSample) | [Flutter](https://github.com/CodandoTV/CraftD/tree/main/flutter/sample/lib) |
|----------|----------|----------|----------|
| <img src="https://github.com/CodandoTV/CraftD/assets/7690931/aa31d0a2-a998-402c-b2c2-4de5088ee30f" width="200" height="400" /> | <img src="https://github.com/CodandoTV/CraftD/assets/7690931/aa31d0a2-a998-402c-b2c2-4de5088ee30f" width="200" height="400" /> | <img src="https://github.com/user-attachments/assets/c8c653b2-1289-4437-85f2-f940d5135f27" width="200" height="400" /> | <img src="https://github.com/CodandoTV/CraftD/assets/7690931/dfabfda7-6501-4763-b040-3ee9fbf2a2be" width="200" height="400" /> |
| [Android Compose / Compose MultiPlatform](https://github.com/CodandoTV/CraftD/tree/main/android_kmp/app-sample/src/main/java/com/github/codandotv/craftd/app_sample/presentation/compose) | [Android View System](https://github.com/CodandoTV/CraftD/tree/main/android_kmp/app-sample/src/main/java/com/github/codandotv/craftd/app_sample/presentation/xml) | [iOS SwiftUI](https://github.com/CodandoTV/CraftD/tree/main/ios/sample/CraftDSample) | [Flutter](https://github.com/CodandoTV/CraftD/tree/main/flutter/sample/lib) |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|----------|----------|
| <img src="https://github.com/CodandoTV/CraftD/assets/7690931/aa31d0a2-a998-402c-b2c2-4de5088ee30f" width="200" height="400" /> | <img src="https://github.com/CodandoTV/CraftD/assets/7690931/aa31d0a2-a998-402c-b2c2-4de5088ee30f" width="200" height="400" /> | <img src="https://github.com/user-attachments/assets/c8c653b2-1289-4437-85f2-f940d5135f27" width="200" height="400" /> | <img src="https://github.com/CodandoTV/CraftD/assets/7690931/dfabfda7-6501-4763-b040-3ee9fbf2a2be" width="200" height="400" /> |


### Credits
Expand Down
139 changes: 139 additions & 0 deletions android_kmp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# =========================================
# Kotlin Multiplatform / Compose Multiplatform
# =========================================

# Build system
/build/
.gradle/
local.properties
!gradle/wrapper/gradle-wrapper.jar
.gradle-cache/
.gradle/
.gradle.kts.cached
.gradle/configuration-cache/
.kotlinc/
.kotlin

# IDEs
.idea/
*.iml
*.ipr
*.iws
.vscode/
*.sw?
*.swo
*.orig

# Kotlin/Java
out/
bin/
classes/
*.class
*.log
*.tmp
*.lock
*.hprof

# Compose Multiplatform generated resources
composeApp/build/
composeApp/.kotlin/
composeApp/.compose-cache/
composeApp/.cache/
composeApp/compose-resources/

# KMP common artifacts
common/build/
shared/build/
**/build/
**/.kotlin/
**/.kotlin-js-store/
**/.gradle/
**/.idea_modules/

# Android
captures/
*.apk
*.ap_
*.aab
*.dex
*.class
*.keystore
*.jks
*.so
*.aar
*.iml
**/local.properties
**/generated/
**/outputs/
**/reports/
**/release/
**/debug/

# iOS
xcuserdata/
DerivedData/
build/XCFrameworks/
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
*.xcworkspace/
!*.xcworkspace/contents.xcworkspacedata
Pods/
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
.DS_Store

# Native (K/N)
.konan/
**/bin/
**/obj/
**/native/

# Packaging / Distribution
*.zip
*.tar
*.tar.gz
*.tgz
*.jar
*.war
*.ear
*.klib
*.xcframework
*.framework

# Temporary files
*.tmp
*.bak
*.orig
*.swp
*.swo
*.rej
*.sublime-workspace
*.sublime-project

# Environment / Credentials
.env
.env.*
*.key
*.pem
*.p12
*.keystore
*.jks
secrets.properties
signing.properties

# OS files
.DS_Store
Thumbs.db
ehthumbs.db
Desktop.ini

# =========================================
# Optional: ignore intermediate build logic
# =========================================
build-logic/.gradle/
build-logic/build/
gradle.properties
19 changes: 19 additions & 0 deletions android_kmp/KMP-Sample/.gitignore
Original file line number Diff line number Diff line change
@@ -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/
35 changes: 35 additions & 0 deletions android_kmp/KMP-Sample/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
This is a Kotlin Multiplatform project targeting Android, iOS.

* [/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 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)…
7 changes: 7 additions & 0 deletions android_kmp/KMP-Sample/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.composeMultiplatform) apply false
alias(libs.plugins.composeCompiler) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
}
Loading
Loading