diff --git a/gradle.properties b/gradle.properties index aa06117..0ed684b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,4 +18,4 @@ kotlin.mpp.enableCInteropCommonization=true #Development development=true -kmpAuthVersion=1.1.0 \ No newline at end of file +kmpAuthVersion=1.2.0 \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6123924..37bdb58 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] -compose = "1.5.4" -compose-plugin = "1.6.0-alpha01" -compose-compiler = "1.5.4" +compose = "1.6.1" +compose-plugin = "1.6.0-rc03" +compose-compiler = "1.5.8" agp = "8.1.3" android-minSdk = "24" android-compileSdk = "34" @@ -14,7 +14,7 @@ androidx-constraintlayout = "2.1.4" androidx-test-junit = "1.1.5" androidx-espresso-core = "3.5.1" androidx-startup-runtime = "1.1.1" -kotlin = "1.9.21" +kotlin = "1.9.22" junit = "4.13.2" koin = "3.5.0" kotlinx-binary-validator = "0.13.2" diff --git a/kmpauth-google/kmpauth_google.podspec b/kmpauth-google/kmpauth_google.podspec index 0057ea0..304045d 100644 --- a/kmpauth-google/kmpauth_google.podspec +++ b/kmpauth-google/kmpauth_google.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = 'kmpauth_google' - spec.version = '1.1.0' + spec.version = '1.2.0' spec.homepage = '' spec.source = { :http=> ''} spec.authors = '' diff --git a/kmpauth-uihelper/src/androidMain/kotlin/com/mmk/kmpauth/uihelper/Platform.kt b/kmpauth-uihelper/src/androidMain/kotlin/com/mmk/kmpauth/uihelper/Platform.kt deleted file mode 100644 index 089258d..0000000 --- a/kmpauth-uihelper/src/androidMain/kotlin/com/mmk/kmpauth/uihelper/Platform.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.mmk.kmpauth.uihelper - -import android.annotation.SuppressLint -import androidx.compose.runtime.Composable -import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.text.font.Font -import androidx.compose.ui.text.font.FontStyle -import androidx.compose.ui.text.font.FontWeight - -@SuppressLint("DiscouragedApi") -@Composable -internal actual fun font(res: String, weight: FontWeight, style: FontStyle): Font { - val context = LocalContext.current - val id = context.resources.getIdentifier(res, "font", context.packageName) - return Font(id, weight, style) -} diff --git a/kmpauth-uihelper/src/commonMain/resources/drawable/ic_apple_logo_black.xml b/kmpauth-uihelper/src/commonMain/composeResources/drawable/ic_apple_logo_black.xml similarity index 100% rename from kmpauth-uihelper/src/commonMain/resources/drawable/ic_apple_logo_black.xml rename to kmpauth-uihelper/src/commonMain/composeResources/drawable/ic_apple_logo_black.xml diff --git a/kmpauth-uihelper/src/commonMain/resources/drawable/ic_apple_logo_white.xml b/kmpauth-uihelper/src/commonMain/composeResources/drawable/ic_apple_logo_white.xml similarity index 100% rename from kmpauth-uihelper/src/commonMain/resources/drawable/ic_apple_logo_white.xml rename to kmpauth-uihelper/src/commonMain/composeResources/drawable/ic_apple_logo_white.xml diff --git a/kmpauth-uihelper/src/commonMain/resources/drawable/ic_google.xml b/kmpauth-uihelper/src/commonMain/composeResources/drawable/ic_google.xml similarity index 100% rename from kmpauth-uihelper/src/commonMain/resources/drawable/ic_google.xml rename to kmpauth-uihelper/src/commonMain/composeResources/drawable/ic_google.xml diff --git a/kmpauth-uihelper/src/commonMain/resources/font/roboto_medium.ttf b/kmpauth-uihelper/src/commonMain/composeResources/font/roboto_medium.ttf similarity index 100% rename from kmpauth-uihelper/src/commonMain/resources/font/roboto_medium.ttf rename to kmpauth-uihelper/src/commonMain/composeResources/font/roboto_medium.ttf diff --git a/kmpauth-uihelper/src/commonMain/kotlin/com/mmk/kmpauth/uihelper/Platform.kt b/kmpauth-uihelper/src/commonMain/kotlin/com/mmk/kmpauth/uihelper/Platform.kt deleted file mode 100644 index b7452e7..0000000 --- a/kmpauth-uihelper/src/commonMain/kotlin/com/mmk/kmpauth/uihelper/Platform.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.mmk.kmpauth.uihelper - -import androidx.compose.runtime.Composable -import androidx.compose.ui.text.font.Font -import androidx.compose.ui.text.font.FontStyle -import androidx.compose.ui.text.font.FontWeight - -@Composable -internal expect fun font(res: String, weight: FontWeight, style: FontStyle): Font \ No newline at end of file diff --git a/kmpauth-uihelper/src/commonMain/kotlin/com/mmk/kmpauth/uihelper/apple/AppleSignInButton.kt b/kmpauth-uihelper/src/commonMain/kotlin/com/mmk/kmpauth/uihelper/apple/AppleSignInButton.kt index d616f88..43bb611 100644 --- a/kmpauth-uihelper/src/commonMain/kotlin/com/mmk/kmpauth/uihelper/apple/AppleSignInButton.kt +++ b/kmpauth-uihelper/src/commonMain/kotlin/com/mmk/kmpauth/uihelper/apple/AppleSignInButton.kt @@ -31,6 +31,9 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.mmk.kmpauth.uihelper.google.GoogleButtonMode import com.mmk.kmpauth.uihelper.theme.Fonts +import io.github.mirzemehdi.`kmpauth-uihelper`.generated.resources.Res +import io.github.mirzemehdi.`kmpauth-uihelper`.generated.resources.ic_apple_logo_black +import io.github.mirzemehdi.`kmpauth-uihelper`.generated.resources.ic_apple_logo_white import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.painterResource import kotlin.math.roundToInt @@ -142,9 +145,9 @@ public fun AppleSignInButton( @Composable private fun AppleIcon(modifier: Modifier = Modifier, mode: AppleButtonMode) { val source = when (mode) { - AppleButtonMode.Black -> "drawable/ic_apple_logo_white.xml" - AppleButtonMode.White -> "drawable/ic_apple_logo_black.xml" - AppleButtonMode.WhiteWithOutline -> "drawable/ic_apple_logo_black.xml" + AppleButtonMode.Black -> Res.drawable.ic_apple_logo_white + AppleButtonMode.White -> Res.drawable.ic_apple_logo_black + AppleButtonMode.WhiteWithOutline -> Res.drawable.ic_apple_logo_black } Image( modifier = modifier, diff --git a/kmpauth-uihelper/src/commonMain/kotlin/com/mmk/kmpauth/uihelper/google/GoogleSignInButton.kt b/kmpauth-uihelper/src/commonMain/kotlin/com/mmk/kmpauth/uihelper/google/GoogleSignInButton.kt index 0ed2669..8527e3e 100644 --- a/kmpauth-uihelper/src/commonMain/kotlin/com/mmk/kmpauth/uihelper/google/GoogleSignInButton.kt +++ b/kmpauth-uihelper/src/commonMain/kotlin/com/mmk/kmpauth/uihelper/google/GoogleSignInButton.kt @@ -23,6 +23,9 @@ import androidx.compose.ui.unit.sp import com.mmk.kmpauth.core.KMPAuthInternalApi import com.mmk.kmpauth.core.di.isAndroidPlatform import com.mmk.kmpauth.uihelper.theme.Fonts +import io.github.mirzemehdi.`kmpauth-uihelper`.generated.resources.Res +import io.github.mirzemehdi.`kmpauth-uihelper`.generated.resources.ic_google +import org.jetbrains.compose.resources.DrawableResource import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.painterResource @@ -111,7 +114,7 @@ public fun GoogleSignInButton( private fun GoogleIcon() { Image( modifier = Modifier.size(20.dp), - painter = painterResource("drawable/ic_google.xml"), + painter = painterResource(Res.drawable.ic_google), contentDescription = "googleIcon" ) } diff --git a/kmpauth-uihelper/src/commonMain/kotlin/com/mmk/kmpauth/uihelper/theme/Typography.kt b/kmpauth-uihelper/src/commonMain/kotlin/com/mmk/kmpauth/uihelper/theme/Typography.kt index 2a86020..6a1d736 100644 --- a/kmpauth-uihelper/src/commonMain/kotlin/com/mmk/kmpauth/uihelper/theme/Typography.kt +++ b/kmpauth-uihelper/src/commonMain/kotlin/com/mmk/kmpauth/uihelper/theme/Typography.kt @@ -4,15 +4,15 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.text.font.FontWeight -import com.mmk.kmpauth.uihelper.font +import io.github.mirzemehdi.`kmpauth-uihelper`.generated.resources.Res +import io.github.mirzemehdi.`kmpauth-uihelper`.generated.resources.roboto_medium +import org.jetbrains.compose.resources.ExperimentalResourceApi +import org.jetbrains.compose.resources.Font internal object Fonts { + @OptIn(ExperimentalResourceApi::class) val robotoFontFamily @Composable get() = FontFamily( - font( - "roboto_medium", - FontWeight.Medium, - FontStyle.Normal - ) + Font(Res.font.roboto_medium, FontWeight.Medium, FontStyle.Normal), ) } \ No newline at end of file diff --git a/kmpauth-uihelper/src/iosMain/kotlin/com/mmk/kmpauth/uihelper/Platform.kt b/kmpauth-uihelper/src/iosMain/kotlin/com/mmk/kmpauth/uihelper/Platform.kt deleted file mode 100644 index 1d12db9..0000000 --- a/kmpauth-uihelper/src/iosMain/kotlin/com/mmk/kmpauth/uihelper/Platform.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.mmk.kmpauth.uihelper - -import androidx.compose.runtime.Composable -import androidx.compose.ui.text.font.Font -import androidx.compose.ui.text.font.FontStyle -import androidx.compose.ui.text.font.FontWeight -import kotlinx.coroutines.runBlocking -import org.jetbrains.compose.resources.ExperimentalResourceApi -import org.jetbrains.compose.resources.resource - -private val cache: MutableMap = mutableMapOf() - -@OptIn(ExperimentalResourceApi::class) -@Composable -internal actual fun font(res: String, weight: FontWeight, style: FontStyle): Font { - return cache.getOrPut(res) { - val byteArray = runBlocking { - resource("font/$res.ttf").readBytes() - } - androidx.compose.ui.text.platform.Font(res, byteArray, weight, style) - } -} \ No newline at end of file