diff --git a/.github/workflows/android_build.yaml b/.github/workflows/android_build.yaml deleted file mode 100644 index f7fffab..0000000 --- a/.github/workflows/android_build.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: Sample Build CI -on: - pull_request: - branches: [ main ] - -jobs: - sample-debug-build: - runs-on: macos-latest - steps: - # Code checkout - - name: Checkout code - id: checkout_code - uses: actions/checkout@v4 - - # Setup Android and Gradle - - name: Job set up - uses: ./.github/workflows/composite - - # Generate debug build - - name: Build Android app - id: generate_debug_build - if: always() - run: ./gradlew assembleDebug --stacktrace --info \ No newline at end of file diff --git a/.github/workflows/android_tests.yaml b/.github/workflows/android_tests.yaml deleted file mode 100644 index 07a20b3..0000000 --- a/.github/workflows/android_tests.yaml +++ /dev/null @@ -1,34 +0,0 @@ -name: JetLime Tests CI -on: - pull_request: - branches: [ main ] - -jobs: - run-library-tests: - runs-on: macos-latest - steps: - # Code checkout - - name: Checkout code - id: checkout_code - uses: actions/checkout@v4 - - # Setup Android and Gradle - - name: Job set up - uses: ./.github/workflows/composite - - # Run UI Tests in library - - name: Run Android Instrumented Tests - uses: reactivecircus/android-emulator-runner@v2 - id: run_library_ui_tests - with: - api-level: 29 - script: ./gradlew :jetlime:connectedCheck - - # Upload reports to artifact - - name: Upload Android Tests Report - if: always() - uses: actions/upload-artifact@v4 - with: - path: | - jetlime/build/reports/tests/testDebugUnitTest/ - jetlime/build/reports/androidTests/connected/ \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..b341207 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,118 @@ +name: Build + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + types: [ opened, synchronize, reopened, ready_for_review ] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + buildAndroid: + name: Build Android + runs-on: ubuntu-latest + if: github.event.pull_request.draft == false + + steps: + # Code checkout + - name: Checkout code + id: checkout_code + uses: actions/checkout@v4 + + # Setup Java and Gradle + - name: Java and Gradle set up + uses: ./.github/workflows/setup/java-setup + + # Grant execute permission for script + - name: Grant execute permission for script + id: grant_script_permission + shell: bash + run: chmod +x ./scripts/build_android.sh + + # Build and verify Android + - name: Build and verify Android + run: ./scripts/build_android.sh + + buildiOS: + name: Build iOS + runs-on: macos-latest + if: github.event.pull_request.draft == false + + steps: + # Code checkout + - name: Checkout code + id: checkout_code + uses: actions/checkout@v4 + + # Setup Java and Gradle + - name: Java and Gradle set up + uses: ./.github/workflows/setup/java-setup + + # Grant execute permission for script + - name: Grant execute permission for script + id: grant_script_permission + shell: bash + run: chmod +x ./scripts/build_android.sh + + # Setup iOS + - name: iOS set up + uses: ./.github/workflows/setup/ios-setup + + # Build iOS app + - name: Build iOS app + id: build_ios_debug + run: xcodebuild build -workspace sample/iosApp/iosApp.xcworkspace -configuration Debug -scheme iosApp -sdk iphonesimulator -verbose + + buildWeb: + name: Build Web + runs-on: ubuntu-latest + if: github.event.pull_request.draft == false + + steps: + # Code checkout + - name: Checkout code + id: checkout_code + uses: actions/checkout@v4 + + # Setup Java and Gradle + - name: Java and Gradle set up + uses: ./.github/workflows/setup/java-setup + + # Grant execute permission for script + - name: Grant execute permission for script + id: grant_script_permission + shell: bash + run: chmod +x ./scripts/build_web.sh + + # Build and verify Web + - name: Build and verify Web + run: ./scripts/build_web.sh + + buildMacOS: + name: Build MacOS + runs-on: macos-latest + if: github.event.pull_request.draft == false + + steps: + # Code checkout + - name: Checkout code + id: checkout_code + uses: actions/checkout@v4 + + # Setup Java and Gradle + - name: Java and Gradle set up + uses: ./.github/workflows/setup/java-setup + + # Grant execute permission for script + - name: Grant execute permission for script + id: grant_script_permission + shell: bash + run: chmod +x ./scripts/build_macos.sh + + # Build and verify MacOS + - name: Build and verify MacOS + run: ./scripts/build_macos.sh \ No newline at end of file diff --git a/.github/workflows/setup/ios-setup/action.yml b/.github/workflows/setup/ios-setup/action.yml new file mode 100644 index 0000000..94669e0 --- /dev/null +++ b/.github/workflows/setup/ios-setup/action.yml @@ -0,0 +1,18 @@ +name: iOS set up +description: Sets up Kotlin Native and Cocoapods +runs: + using: "composite" + steps: + - shell: bash + run: ./gradlew :sample:composeApp:generateDummyFramework + + - name: Set up cocoapods + uses: maxim-lobanov/setup-cocoapods@v1 + with: + version: latest + + - shell: bash + name: Install Dependencies + run: | + cd sample/iosApp + pod install --verbose \ No newline at end of file diff --git a/.github/workflows/composite/action.yml b/.github/workflows/setup/java-setup/action.yml similarity index 74% rename from .github/workflows/composite/action.yml rename to .github/workflows/setup/java-setup/action.yml index a1d5f20..360e3ac 100644 --- a/.github/workflows/composite/action.yml +++ b/.github/workflows/setup/java-setup/action.yml @@ -1,5 +1,5 @@ -name: Android and Gradle Job Setup -description: Sets up Android and Gradle +name: Java and Gradle Job Setup +description: Sets up Java and Gradle runs: using: "composite" steps: @@ -8,7 +8,7 @@ runs: id: setup_jdk uses: actions/setup-java@v4 with: - distribution: "zulu" + distribution: "corretto" java-version: 17 # Grant execute permission for gradlew @@ -27,4 +27,9 @@ runs: ~/.gradle/wrapper key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} restore-keys: | - ${{ runner.os }}-gradle- \ No newline at end of file + ${{ runner.os }}-gradle- + + # Setup Gradle + - name: Set up Gradle + id: set_up_gradle + uses: gradle/actions/setup-gradle@v4 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 49dbc8f..2c7b2c4 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,12 @@ # Java class files *.class +# Kotlin libraries +.kotlin/ + +app/ +distributions/ + # Generated files bin/ gen/ @@ -41,8 +47,6 @@ captures/ *.iml .idea/ -.kotlin/ - # Keystore files # Uncomment the following lines if you do not want to check your keystore files in. #*.jks diff --git a/README.md b/README.md index e8bd609..3f35d99 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # JetLime 🍋 -> A simple yet highly customizable library for showing a TimeLine interface in Jetpack Compose. +> A simple yet highly customizable library for showing a TimeLine interface in Compose Multiplatform. [![Compose Compiler](https://img.shields.io/badge/Compose%20Compiler-1.5.15-blue?style=for-the-badge&logo=appveyor)](https://developer.android.com/jetpack/androidx/releases/compose) -![Kotlin](https://img.shields.io/badge/Kotlin-1.9.25-blue.svg?color=blue&style=for-the-badge) +![Kotlin](https://img.shields.io/badge/Kotlin-2.0.20-blue.svg?color=blue&style=for-the-badge) [![Maven Central](https://img.shields.io/maven-central/v/io.github.pushpalroy/jetlime?style=for-the-badge&logo=appveyor)](https://search.maven.org/artifact/io.github.pushpalroy/jetlime) ![Stars](https://img.shields.io/github/stars/pushpalroy/jetlime?color=yellowgreen&style=for-the-badge) ![Forks](https://img.shields.io/github/forks/pushpalroy/jetlime?color=yellowgreen&style=for-the-badge) @@ -32,7 +32,7 @@ In `build.gradle` of app module, include the following dependency ```gradle dependencies { - implementation("io.github.pushpalroy:jetlime:2.3.0") + implementation("io.github.pushpalroy:jetlime:3.0.0") } ``` diff --git a/app/.gitignore b/app/.gitignore deleted file mode 100644 index a836f25..0000000 --- a/app/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/build -/keystore/release \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts deleted file mode 100644 index e6035c8..0000000 --- a/app/build.gradle.kts +++ /dev/null @@ -1,96 +0,0 @@ -plugins { - alias(libs.plugins.android.application) - alias(libs.plugins.kotlin.android) -} - -android { - namespace = "com.pushpal.jetlime.sample" - compileSdk = 34 - - defaultConfig { - applicationId = "com.pushpal.jetlime.sample" - minSdk = 21 - targetSdk = 34 - versionCode = 1 - versionName = "1.0" - - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - } - - signingConfigs { - // Uncomment this line if we are generating a release build manually from IDE - // Not needed while build is generated from CI/CD - // maybeCreate("release").apply { - // val keystorePropertiesFile = rootProject.file("keystore_release.properties") - // val keystoreProperties = Properties() - // if (keystorePropertiesFile.exists()) { - // keystoreProperties.load(FileInputStream(keystorePropertiesFile)) - // } - // storeFile = file(path = keystoreProperties["storeFile"] as String) - // storePassword = keystoreProperties["storePassword"] as String - // keyAlias = keystoreProperties["keyAlias"] as String - // keyPassword = keystoreProperties["keyPassword"] as String - // } - } - - buildTypes { - getByName("release") { - isDebuggable = false - isMinifyEnabled = false - isShrinkResources = false - proguardFiles( - getDefaultProguardFile("proguard-android-optimize.txt"), - "proguard-rules.pro", - ) - // signingConfig = signingConfigs.getByName("release") - } - getByName("debug") { - isDebuggable = true - versionNameSuffix = "-debug" - signingConfig = signingConfigs.getByName("debug") - } - } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = "1.8" - } - buildFeatures { - compose = true - } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get() - } -} - -dependencies { - // Local library - implementation(project(":jetlime")) - - // Maven library - For testing - // implementation(libs.jetlime) - - // Compose - // BOM - implementation(platform(libs.androidx.compose.bom)) - implementation(libs.androidx.compose.ui) - implementation(libs.androidx.compose.material3) - implementation(libs.androidx.compose.ui.tooling) - implementation(libs.androidx.compose.ui.tooling.preview) - - // Non Compose - implementation(libs.androidx.activity.compose) - implementation(libs.androidx.lifecycle.compose) - - // Others - implementation(libs.androidx.core.ktx) - implementation(libs.androidx.lifecycle.runtime.ktx) - implementation(libs.kotlinx.collections.immutable) - - // Test - testImplementation(libs.junit) - androidTestImplementation(libs.androidx.junit) - androidTestImplementation(libs.androidx.test.runner) -} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro deleted file mode 100644 index ff59496..0000000 --- a/app/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle.kts. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/main/java/com/pushpal/jetlime/ui/MainActivity.kt b/app/src/main/java/com/pushpal/jetlime/ui/MainActivity.kt deleted file mode 100644 index 04447a4..0000000 --- a/app/src/main/java/com/pushpal/jetlime/ui/MainActivity.kt +++ /dev/null @@ -1,83 +0,0 @@ -/* -* MIT License -* -* Copyright (c) 2024 Pushpal Roy -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all -* copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*/ -package com.pushpal.jetlime.ui - -import android.app.Activity -import android.os.Bundle -import androidx.activity.ComponentActivity -import androidx.activity.compose.setContent -import androidx.compose.runtime.Composable -import androidx.compose.runtime.SideEffect -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue -import androidx.compose.ui.graphics.toArgb -import androidx.compose.ui.platform.LocalView -import androidx.core.view.WindowCompat -import com.pushpal.jetlime.ui.theme.DarkColorPalette -import com.pushpal.jetlime.ui.theme.JetLimeTheme -import com.pushpal.jetlime.ui.theme.LightColorPalette - -class MainActivity : ComponentActivity() { - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - setContent { - var darkTheme by remember { mutableStateOf(true) } - JetLimeTheme(darkTheme = darkTheme) { - UiControllerEffect(darkTheme) - HomeScreen( - isDarkTheme = darkTheme, - onThemeChange = { - darkTheme = it - }, - ) - } - } - } -} - -@Composable -fun UiControllerEffect(isDarkTheme: Boolean) { - val view = LocalView.current - val colors = if (isDarkTheme) { - DarkColorPalette - } else { - LightColorPalette - } - if (!view.isInEditMode) { - SideEffect { - val window = (view.context as Activity).window.apply { - statusBarColor = colors.background.toArgb() - navigationBarColor = colors.background.toArgb() - } - WindowCompat.getInsetsController(window, view).apply { - isAppearanceLightStatusBars = isDarkTheme - isAppearanceLightNavigationBars = isDarkTheme - } - } - } -} diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml deleted file mode 100644 index 5c3bfcd..0000000 --- a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 140f829..0000000 --- a/app/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml deleted file mode 100644 index 03eed25..0000000 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index 03eed25..0000000 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp deleted file mode 100644 index c209e78..0000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp deleted file mode 100644 index b2dfe3d..0000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp deleted file mode 100644 index 4f0f1d6..0000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp deleted file mode 100644 index 62b611d..0000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp deleted file mode 100644 index 948a307..0000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp deleted file mode 100644 index 1b9a695..0000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp deleted file mode 100644 index 28d4b77..0000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9287f50..0000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp deleted file mode 100644 index aa7d642..0000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9126ae3..0000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml deleted file mode 100644 index 09837df..0000000 --- a/app/src/main/res/values/colors.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - #FFBB86FC - #FF6200EE - #FF3700B3 - #FF03DAC5 - #FF018786 - #FF000000 - #FFFFFFFF - \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml deleted file mode 100644 index 5f1ee96..0000000 --- a/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - JetLime Samples - \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml deleted file mode 100644 index 896d996..0000000 --- a/app/src/main/res/values/themes.xml +++ /dev/null @@ -1,4 +0,0 @@ - - -