Skip to content

Commit

Permalink
Merge pull request #69 from abdallahmehiz/temp
Browse files Browse the repository at this point in the history
Migrate the project to Compose Multiplatform
  • Loading branch information
2307vivek authored Jun 17, 2024
2 parents e6e7ee2 + 01a6d3a commit 15571b4
Show file tree
Hide file tree
Showing 69 changed files with 950 additions and 237 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
publish:
name: Release build and publish
runs-on: ubuntu-latest
runs-on: macos-13
steps:
- name: Check out code
uses: actions/checkout@v2
Expand All @@ -18,6 +18,11 @@ jobs:
distribution: adopt
java-version: 17

- name: Set up XCode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "15.2.0"

# Builds the release artifacts of the library
- name: Release build
run: ./gradlew :seeker:assembleRelease
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
.externalNativeBuild
.cxx
local.properties
.idea
.idea
.kotlin
66 changes: 0 additions & 66 deletions app/build.gradle

This file was deleted.

153 changes: 153 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
import org.jetbrains.compose.desktop.application.dsl.TargetFormat

plugins {
id("com.android.application")
kotlin("multiplatform")
kotlin("plugin.compose")
id("org.jetbrains.compose")
}


// https://github.com/JetBrains/compose-multiplatform/issues/3123#issuecomment-1647435023
val osName = System.getProperty("os.name")
val targetOs = when {
osName == "Mac OS X" -> "macos"
osName.startsWith("Win") -> "windows"
osName.startsWith("Linux") -> "linux"
else -> error("Unsupported OS: $osName")
}

val targetArch = when (val osArch = System.getProperty("os.arch")) {
"x86_64", "amd64" -> "x64"
"aarch64" -> "arm64"
else -> error("Unsupported arch: $osArch")
}

val version = "0.8.8" // or any more recent version
val target = "${targetOs}-${targetArch}"

android {
namespace = "dev.vivvvek.seekerdemo"
compileSdk = 34

sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")

defaultConfig {
applicationId = "dev.vivvvek.seekerdemo"
minSdk = 21
targetSdk = 34
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.2"
}
packagingOptions {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

kotlin {
androidTarget()

jvm()

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64(),
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "app"
isStatic = true
}
}

sourceSets {
val commonMain by getting
commonMain.dependencies {
implementation(project(":seeker"))

implementation(compose.material)
implementation(compose.ui)
implementation(compose.components.resources)
implementation(compose.runtime)
implementation("org.jetbrains.androidx.navigation:navigation-compose:2.7.0-alpha07")
implementation("androidx.lifecycle:lifecycle-viewmodel:2.8.0")
}
androidMain {
dependsOn(commonMain)
dependencies {
implementation("androidx.activity:activity-compose:1.7.2")
implementation("androidx.compose.material:material:1.5.1")
implementation(compose.preview)
}
}
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by creating {
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
}
iosMain.dependsOn(commonMain)

val jvmMain by getting
jvmMain.dependencies {
implementation("org.jetbrains.skiko:skiko-awt-runtime-$target:$version")
implementation("androidx.collection:collection:1.4.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-swing:1.8.1")
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.8.0")
implementation(compose.desktop.currentOs)
}
jvmMain.dependsOn(commonMain)
}
}

val compose_ui_version: String by extra

dependencies {
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidTestImplementation("androidx.compose.ui:ui-test-junit4:$compose_ui_version")
debugImplementation("androidx.compose.ui:ui-tooling:$compose_ui_version")
debugImplementation("androidx.compose.ui:ui-test-manifest:$compose_ui_version")
}

compose.desktop {
application {
mainClass = "dev.vivvvek.seekerdemo.MainKt"

nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "dev.vivvvek.seekerdemo"
packageVersion = "1.0.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
android:theme="@style/Theme.Seeker"
tools:targetApi="31">
<activity
android:name="dev.vivvvek.seekerdemo.MainActivity"
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Seeker">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package dev.vivvvek.seekerdemo.ui

import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import dev.vivvvek.seekerdemo.ui.theme.SeekerTheme
import dev.vivvvek.seekerdemo.NowPlayingScreen

@Preview(showBackground = true)
@Composable
fun PreView() {
SeekerTheme {
NowPlayingScreen()
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFF" android:pathData="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFF" android:pathData="M8.12,9.29L12,13.17l3.88,-3.88c0.39,-0.39 1.02,-0.39 1.41,0 0.39,0.39 0.39,1.02 0,1.41l-4.59,4.59c-0.39,0.39 -1.02,0.39 -1.41,0L6.7,10.7c-0.39,-0.39 -0.39,-1.02 0,-1.41 0.39,-0.38 1.03,-0.39 1.42,0z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFF" android:pathData="M8,19c1.1,0 2,-0.9 2,-2L10,7c0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2v10c0,1.1 0.9,2 2,2zM14,7v10c0,1.1 0.9,2 2,2s2,-0.9 2,-2L18,7c0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M8,6.82v10.36c0,0.79 0.87,1.27 1.54,0.84l8.14,-5.18c0.62,-0.39 0.62,-1.29 0,-1.69L9.54,5.98C8.87,5.55 8,6.03 8,6.82z"/>
<path android:fillColor="#FFF" android:pathData="M8,6.82v10.36c0,0.79 0.87,1.27 1.54,0.84l8.14,-5.18c0.62,-0.39 0.62,-1.29 0,-1.69L9.54,5.98C8.87,5.55 8,6.03 8,6.82z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFF" android:pathData="M7.58,16.89l5.77,-4.07c0.56,-0.4 0.56,-1.24 0,-1.63L7.58,7.11C6.91,6.65 6,7.12 6,7.93v8.14c0,0.81 0.91,1.28 1.58,0.82zM16,7v10c0,0.55 0.45,1 1,1s1,-0.45 1,-1V7c0,-0.55 -0.45,-1 -1,-1s-1,0.45 -1,1z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFF" android:pathData="M7,6c0.55,0 1,0.45 1,1v10c0,0.55 -0.45,1 -1,1s-1,-0.45 -1,-1L6,7c0,-0.55 0.45,-1 1,-1zM10.66,12.82l5.77,4.07c0.66,0.47 1.58,-0.01 1.58,-0.82L18.01,7.93c0,-0.81 -0.91,-1.28 -1.58,-0.82l-5.77,4.07c-0.57,0.4 -0.57,1.24 0,1.64z"/>
</vector>
Loading

0 comments on commit 15571b4

Please sign in to comment.