diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 591e03a..d534dd3 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -3,22 +3,50 @@ name: CI
on:
push:
branches: [ "main" ]
+ tags: [ "v*" ]
pull_request:
branches: [ "main" ]
-
workflow_dispatch:
jobs:
build:
+ name: Build
+ runs-on: macos-26
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Set up JDK 17
+ uses: actions/setup-java@v4
+ with:
+ java-version: '17'
+ distribution: 'temurin'
+
+ - name: Setup Gradle
+ uses: gradle/actions/setup-gradle@v4
+
+ - name: Build
+ run: ./gradlew build
+
+ publish:
+ name: Publish
+ needs: build
+ if: startsWith(github.ref, 'refs/tags/v')
+ runs-on: macos-26
environment: S
- name: Build & Publish
- runs-on: macos-13
steps:
- - uses: actions/checkout@v3
- - name: Gradlew - Build & Publish
+ - uses: actions/checkout@v4
+
+ - name: Set up JDK 17
+ uses: actions/setup-java@v4
+ with:
+ java-version: '17'
+ distribution: 'temurin'
+
+ - name: Setup Gradle
+ uses: gradle/actions/setup-gradle@v4
+
+ - name: Publish
env:
USERNAME: ${{ secrets.USERNAME }}
API_KEY: ${{ secrets.API_KEY }}
- run: |
- ./gradlew build --no-daemon
- ./gradlew publish --no-daemon
+ run: ./gradlew publish
diff --git a/README.md b/README.md
index 492650c..86c4b4a 100644
--- a/README.md
+++ b/README.md
@@ -37,7 +37,7 @@ dependencyResolutionManagement {
kotlin {
sourceSets {
commonMain.dependencies {
- implementation("dev.onexeor.kdownloader:shared:0.0.6")
+ implementation("dev.onexeor.kdownloader:shared:0.1.0")
}
}
}
diff --git a/build.gradle.kts b/build.gradle.kts
index 4a600e3..07a28a1 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,6 +1,7 @@
plugins {
- //trick: for the same plugin versions in all sub-modules
+ alias(libs.plugins.androidApplication).apply(false)
alias(libs.plugins.androidLibrary).apply(false)
alias(libs.plugins.kotlinMultiplatform).apply(false)
- id("org.jetbrains.kotlin.android") version "1.9.21" apply false
+ alias(libs.plugins.kotlinAndroid).apply(false)
+ alias(libs.plugins.composeCompiler).apply(false)
}
diff --git a/example/.gitignore b/example/.gitignore
new file mode 100644
index 0000000..e510fa9
--- /dev/null
+++ b/example/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+.idea
+.DS_Store
+build
+captures
+.externalNativeBuild
+.cxx
+local.properties
+xcuserdata
\ No newline at end of file
diff --git a/example/androidApp/build.gradle.kts b/example/androidApp/build.gradle.kts
new file mode 100644
index 0000000..c3d7978
--- /dev/null
+++ b/example/androidApp/build.gradle.kts
@@ -0,0 +1,50 @@
+plugins {
+ alias(libs.plugins.androidApplication)
+ alias(libs.plugins.kotlinAndroid)
+ alias(libs.plugins.composeCompiler)
+}
+
+android {
+ namespace = "dev.onexeor.example.android"
+ compileSdk = 35
+ defaultConfig {
+ applicationId = "dev.onexeor.example.android"
+ minSdk = 24
+ targetSdk = 35
+ versionCode = 1
+ versionName = "1.0"
+ }
+ buildFeatures {
+ compose = true
+ }
+ packaging {
+ resources {
+ excludes += "/META-INF/{AL2.0,LGPL2.1}"
+ }
+ }
+ buildTypes {
+ getByName("release") {
+ isMinifyEnabled = false
+ }
+ }
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_17
+ targetCompatibility = JavaVersion.VERSION_17
+ }
+}
+
+kotlin {
+ compilerOptions {
+ jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17)
+ }
+}
+
+dependencies {
+ implementation(projects.example.shared)
+ implementation(platform(libs.compose.bom))
+ implementation(libs.compose.ui)
+ implementation(libs.compose.ui.tooling.preview)
+ implementation(libs.compose.material3)
+ implementation(libs.androidx.activity.compose)
+ debugImplementation(libs.compose.ui.tooling)
+}
diff --git a/example/androidApp/src/main/AndroidManifest.xml b/example/androidApp/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..22d1fac
--- /dev/null
+++ b/example/androidApp/src/main/AndroidManifest.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/example/androidApp/src/main/java/dev/onexeor/example/android/MainActivity.kt b/example/androidApp/src/main/java/dev/onexeor/example/android/MainActivity.kt
new file mode 100644
index 0000000..9a6deec
--- /dev/null
+++ b/example/androidApp/src/main/java/dev/onexeor/example/android/MainActivity.kt
@@ -0,0 +1,40 @@
+package dev.onexeor.example.android
+
+import android.os.Bundle
+import androidx.activity.ComponentActivity
+import androidx.activity.compose.setContent
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.material3.*
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.tooling.preview.Preview
+import dev.onexeor.example.Greeting
+
+class MainActivity : ComponentActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContent {
+ MyApplicationTheme {
+ Surface(
+ modifier = Modifier.fillMaxSize(),
+ color = MaterialTheme.colorScheme.background
+ ) {
+ GreetingView(Greeting().greet())
+ }
+ }
+ }
+ }
+}
+
+@Composable
+fun GreetingView(text: String) {
+ Text(text = text)
+}
+
+@Preview
+@Composable
+fun DefaultPreview() {
+ MyApplicationTheme {
+ GreetingView("Hello, Android!")
+ }
+}
diff --git a/example/androidApp/src/main/java/dev/onexeor/example/android/MyApplicationTheme.kt b/example/androidApp/src/main/java/dev/onexeor/example/android/MyApplicationTheme.kt
new file mode 100644
index 0000000..5b524e6
--- /dev/null
+++ b/example/androidApp/src/main/java/dev/onexeor/example/android/MyApplicationTheme.kt
@@ -0,0 +1,55 @@
+package dev.onexeor.example.android
+
+import androidx.compose.foundation.isSystemInDarkTheme
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Shapes
+import androidx.compose.material3.Typography
+import androidx.compose.material3.darkColorScheme
+import androidx.compose.material3.lightColorScheme
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.graphics.Color
+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.dp
+import androidx.compose.ui.unit.sp
+
+@Composable
+fun MyApplicationTheme(
+ darkTheme: Boolean = isSystemInDarkTheme(),
+ content: @Composable () -> Unit
+) {
+ val colors = if (darkTheme) {
+ darkColorScheme(
+ primary = Color(0xFFBB86FC),
+ secondary = Color(0xFF03DAC5),
+ tertiary = Color(0xFF3700B3)
+ )
+ } else {
+ lightColorScheme(
+ primary = Color(0xFF6200EE),
+ secondary = Color(0xFF03DAC5),
+ tertiary = Color(0xFF3700B3)
+ )
+ }
+ val typography = Typography(
+ bodyMedium = TextStyle(
+ fontFamily = FontFamily.Default,
+ fontWeight = FontWeight.Normal,
+ fontSize = 16.sp
+ )
+ )
+ val shapes = Shapes(
+ small = RoundedCornerShape(4.dp),
+ medium = RoundedCornerShape(4.dp),
+ large = RoundedCornerShape(0.dp)
+ )
+
+ MaterialTheme(
+ colorScheme = colors,
+ typography = typography,
+ shapes = shapes,
+ content = content
+ )
+}
diff --git a/example/androidApp/src/main/res/values/styles.xml b/example/androidApp/src/main/res/values/styles.xml
new file mode 100644
index 0000000..6b4fa3d
--- /dev/null
+++ b/example/androidApp/src/main/res/values/styles.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/example/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json b/example/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json
new file mode 100644
index 0000000..ee7e3ca
--- /dev/null
+++ b/example/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json
@@ -0,0 +1,11 @@
+{
+ "colors" : [
+ {
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
\ No newline at end of file
diff --git a/example/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/example/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 0000000..fb88a39
--- /dev/null
+++ b/example/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,98 @@
+{
+ "images" : [
+ {
+ "idiom" : "iphone",
+ "scale" : "2x",
+ "size" : "20x20"
+ },
+ {
+ "idiom" : "iphone",
+ "scale" : "3x",
+ "size" : "20x20"
+ },
+ {
+ "idiom" : "iphone",
+ "scale" : "2x",
+ "size" : "29x29"
+ },
+ {
+ "idiom" : "iphone",
+ "scale" : "3x",
+ "size" : "29x29"
+ },
+ {
+ "idiom" : "iphone",
+ "scale" : "2x",
+ "size" : "40x40"
+ },
+ {
+ "idiom" : "iphone",
+ "scale" : "3x",
+ "size" : "40x40"
+ },
+ {
+ "idiom" : "iphone",
+ "scale" : "2x",
+ "size" : "60x60"
+ },
+ {
+ "idiom" : "iphone",
+ "scale" : "3x",
+ "size" : "60x60"
+ },
+ {
+ "idiom" : "ipad",
+ "scale" : "1x",
+ "size" : "20x20"
+ },
+ {
+ "idiom" : "ipad",
+ "scale" : "2x",
+ "size" : "20x20"
+ },
+ {
+ "idiom" : "ipad",
+ "scale" : "1x",
+ "size" : "29x29"
+ },
+ {
+ "idiom" : "ipad",
+ "scale" : "2x",
+ "size" : "29x29"
+ },
+ {
+ "idiom" : "ipad",
+ "scale" : "1x",
+ "size" : "40x40"
+ },
+ {
+ "idiom" : "ipad",
+ "scale" : "2x",
+ "size" : "40x40"
+ },
+ {
+ "idiom" : "ipad",
+ "scale" : "1x",
+ "size" : "76x76"
+ },
+ {
+ "idiom" : "ipad",
+ "scale" : "2x",
+ "size" : "76x76"
+ },
+ {
+ "idiom" : "ipad",
+ "scale" : "2x",
+ "size" : "83.5x83.5"
+ },
+ {
+ "idiom" : "ios-marketing",
+ "scale" : "1x",
+ "size" : "1024x1024"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
\ No newline at end of file
diff --git a/example/iosApp/iosApp/Assets.xcassets/Contents.json b/example/iosApp/iosApp/Assets.xcassets/Contents.json
new file mode 100644
index 0000000..4aa7c53
--- /dev/null
+++ b/example/iosApp/iosApp/Assets.xcassets/Contents.json
@@ -0,0 +1,6 @@
+{
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
\ No newline at end of file
diff --git a/example/iosApp/iosApp/ContentView.swift b/example/iosApp/iosApp/ContentView.swift
new file mode 100644
index 0000000..6a15a09
--- /dev/null
+++ b/example/iosApp/iosApp/ContentView.swift
@@ -0,0 +1,16 @@
+import SwiftUI
+import shared
+
+struct ContentView: View {
+ let greet = Greeting().greet()
+
+ var body: some View {
+ Text(greet)
+ }
+}
+
+struct ContentView_Previews: PreviewProvider {
+ static var previews: some View {
+ ContentView()
+ }
+}
\ No newline at end of file
diff --git a/example/iosApp/iosApp/Info.plist b/example/iosApp/iosApp/Info.plist
new file mode 100644
index 0000000..8044709
--- /dev/null
+++ b/example/iosApp/iosApp/Info.plist
@@ -0,0 +1,48 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ $(DEVELOPMENT_LANGUAGE)
+ CFBundleExecutable
+ $(EXECUTABLE_NAME)
+ CFBundleIdentifier
+ $(PRODUCT_BUNDLE_IDENTIFIER)
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ $(PRODUCT_NAME)
+ CFBundlePackageType
+ $(PRODUCT_BUNDLE_PACKAGE_TYPE)
+ CFBundleShortVersionString
+ 1.0
+ CFBundleVersion
+ 1
+ LSRequiresIPhoneOS
+
+ UIApplicationSceneManifest
+
+ UIApplicationSupportsMultipleScenes
+
+
+ UIRequiredDeviceCapabilities
+
+ armv7
+
+ UISupportedInterfaceOrientations
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UISupportedInterfaceOrientations~ipad
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UILaunchScreen
+
+
+
\ No newline at end of file
diff --git a/example/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json b/example/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json
new file mode 100644
index 0000000..4aa7c53
--- /dev/null
+++ b/example/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json
@@ -0,0 +1,6 @@
+{
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
\ No newline at end of file
diff --git a/example/iosApp/iosApp/iOSApp.swift b/example/iosApp/iosApp/iOSApp.swift
new file mode 100644
index 0000000..0648e86
--- /dev/null
+++ b/example/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/example/shared/build.gradle.kts b/example/shared/build.gradle.kts
new file mode 100644
index 0000000..19c2f10
--- /dev/null
+++ b/example/shared/build.gradle.kts
@@ -0,0 +1,47 @@
+plugins {
+ alias(libs.plugins.kotlinMultiplatform)
+ alias(libs.plugins.androidLibrary)
+}
+
+kotlin {
+ androidTarget {
+ compilations.all {
+ compileTaskProvider.configure {
+ compilerOptions {
+ jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17)
+ }
+ }
+ }
+ }
+
+ listOf(
+ iosX64(),
+ iosArm64(),
+ iosSimulatorArm64()
+ ).forEach {
+ it.binaries.framework {
+ baseName = "shared"
+ isStatic = true
+ }
+ }
+
+ sourceSets {
+ commonMain.dependencies {
+ }
+ commonTest.dependencies {
+ implementation(libs.kotlin.test)
+ }
+ }
+}
+
+android {
+ namespace = "dev.onexeor.example"
+ compileSdk = 35
+ defaultConfig {
+ minSdk = 24
+ }
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_17
+ targetCompatibility = JavaVersion.VERSION_17
+ }
+}
diff --git a/example/shared/src/androidMain/kotlin/dev/onexeor/example/Platform.android.kt b/example/shared/src/androidMain/kotlin/dev/onexeor/example/Platform.android.kt
new file mode 100644
index 0000000..6ccaa2d
--- /dev/null
+++ b/example/shared/src/androidMain/kotlin/dev/onexeor/example/Platform.android.kt
@@ -0,0 +1,7 @@
+package dev.onexeor.example
+
+class AndroidPlatform : Platform {
+ override val name: String = "Android ${android.os.Build.VERSION.SDK_INT}"
+}
+
+actual fun getPlatform(): Platform = AndroidPlatform()
\ No newline at end of file
diff --git a/example/shared/src/commonMain/kotlin/dev/onexeor/example/Greeting.kt b/example/shared/src/commonMain/kotlin/dev/onexeor/example/Greeting.kt
new file mode 100644
index 0000000..ff74699
--- /dev/null
+++ b/example/shared/src/commonMain/kotlin/dev/onexeor/example/Greeting.kt
@@ -0,0 +1,9 @@
+package dev.onexeor.example
+
+class Greeting {
+ private val platform: Platform = getPlatform()
+
+ fun greet(): String {
+ return "Hello, ${platform.name}!"
+ }
+}
\ No newline at end of file
diff --git a/example/shared/src/commonMain/kotlin/dev/onexeor/example/Platform.kt b/example/shared/src/commonMain/kotlin/dev/onexeor/example/Platform.kt
new file mode 100644
index 0000000..a82e0df
--- /dev/null
+++ b/example/shared/src/commonMain/kotlin/dev/onexeor/example/Platform.kt
@@ -0,0 +1,7 @@
+package dev.onexeor.example
+
+interface Platform {
+ val name: String
+}
+
+expect fun getPlatform(): Platform
\ No newline at end of file
diff --git a/example/shared/src/iosMain/kotlin/dev/onexeor/example/Platform.ios.kt b/example/shared/src/iosMain/kotlin/dev/onexeor/example/Platform.ios.kt
new file mode 100644
index 0000000..60dfa34
--- /dev/null
+++ b/example/shared/src/iosMain/kotlin/dev/onexeor/example/Platform.ios.kt
@@ -0,0 +1,9 @@
+package dev.onexeor.example
+
+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/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 8ed7695..8b59506 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -1,21 +1,20 @@
[versions]
-agp = "8.1.4"
-coreKtx = "1.12.0"
-kotlin = "1.9.20"
-compose = "1.5.4"
-compose-compiler = "1.5.4"
-compose-material3 = "1.1.2"
-androidx-activityCompose = "1.8.0"
+agp = "8.7.3"
+kotlin = "2.3.0"
+coreKtx = "1.15.0"
+composeBom = "2024.12.01"
+androidx-activityCompose = "1.9.3"
[libraries]
androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" }
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
-compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" }
-compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" }
-compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" }
-compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose" }
-compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "compose-material3" }
+compose-bom = { module = "androidx.compose:compose-bom", version.ref = "composeBom" }
+compose-ui = { module = "androidx.compose.ui:ui" }
+compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
+compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" }
+compose-foundation = { module = "androidx.compose.foundation:foundation" }
+compose-material3 = { module = "androidx.compose.material3:material3" }
[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
@@ -23,3 +22,4 @@ androidLibrary = { id = "com.android.library", version.ref = "agp" }
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlinCocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }
+composeCompiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 748faf2..81aa1c0 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Thu Dec 07 08:48:13 CET 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 66cef2d..567acc6 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -15,4 +15,6 @@ dependencyResolutionManagement {
}
rootProject.name = "KDownloader"
-include(":shared")
\ No newline at end of file
+include(":shared")
+include(":example:androidApp")
+include(":example:shared")
\ No newline at end of file
diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts
index 5129b1c..13ff118 100644
--- a/shared/build.gradle.kts
+++ b/shared/build.gradle.kts
@@ -1,5 +1,3 @@
-import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
-
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
@@ -7,14 +5,16 @@ plugins {
}
group = "dev.onexeor.kdownloader"
-version = "0.0.6"
+version = "0.1.0"
kotlin {
androidTarget {
publishLibraryVariants("release", "debug")
compilations.all {
- kotlinOptions {
- jvmTarget = "1.8"
+ compileTaskProvider.configure {
+ compilerOptions {
+ jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17)
+ }
}
}
}
@@ -34,48 +34,32 @@ kotlin {
commonMain.dependencies {
}
}
-
- publishing()
}
android {
namespace = group.toString()
- compileSdk = 34
+ compileSdk = 35
defaultConfig {
minSdk = 24
- targetSdk = 34
+ }
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_17
+ targetCompatibility = JavaVersion.VERSION_17
}
}
+
dependencies {
implementation(libs.androidx.core.ktx)
}
-fun KotlinMultiplatformExtension.publishing() {
- val publicationsFromMainHost = listOf(
- iosX64(),
- iosArm64(),
- iosSimulatorArm64(),
- androidTarget()
- ).map { it.name } + "kotlinMultiplatform"
-
- publishing {
- publications {
- matching { it.name in publicationsFromMainHost }.all {
- val targetPublication = this@all
- tasks.withType()
- .matching { it.publication == targetPublication }
- .configureEach { onlyIf { findProperty("isMainHost") == "true" } }
- }
- }
-
- repositories {
- maven {
- name = "KDownloader"
- url = uri("https://maven.pkg.github.com/OneXeor/KDownloader")
- credentials {
- username = System.getenv("USERNAME")
- password = System.getenv("API_KEY")
- }
+publishing {
+ repositories {
+ maven {
+ name = "KDownloader"
+ url = uri("https://maven.pkg.github.com/OneXeor/KDownloader")
+ credentials {
+ username = System.getenv("USERNAME")
+ password = System.getenv("API_KEY")
}
}
}
diff --git a/shared/src/iosMain/kotlin/dev/onexeor/kdownloader/KDownloader.kt b/shared/src/iosMain/kotlin/dev/onexeor/kdownloader/KDownloader.kt
index 0862d89..a497f07 100644
--- a/shared/src/iosMain/kotlin/dev/onexeor/kdownloader/KDownloader.kt
+++ b/shared/src/iosMain/kotlin/dev/onexeor/kdownloader/KDownloader.kt
@@ -2,9 +2,9 @@
package dev.onexeor.kdownloader
-import kotlin.system.getTimeMillis
import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.ObjCObjectVar
+import platform.posix.time
import kotlinx.cinterop.alloc
import kotlinx.cinterop.memScoped
import kotlinx.cinterop.ptr
@@ -104,7 +104,7 @@ actual class KDownloader {
url = NSURL(string = url),
completionHandler = ::complete
)
- val id = getTimeMillis()
+ val id = time(null) * 1000
tasks[id] = downloadTask
downloadTask.resume()