Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Js support (only target with dummy class and methods) #38

Merged
merged 3 commits into from
Jul 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\=

#Compose
org.jetbrains.compose.experimental.uikit.enabled=true
org.jetbrains.compose.experimental.wasm.enabled=true
org.jetbrains.compose.experimental.jscanvas.enabled=true

#Android
android.useAndroidX=true
Expand Down
5 changes: 5 additions & 0 deletions kmpauth-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ kotlin {
}
}

js(IR) {
nodejs()
browser()
binaries.library()
}
jvm()
iosX64()
iosArm64()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.mmk.kmpauth.core.di

import com.mmk.kmpauth.core.KMPAuthInternalApi
import org.koin.core.module.Module
import org.koin.dsl.module

@KMPAuthInternalApi
public actual fun isAndroidPlatform(): Boolean = false
internal actual val platformModule: Module = module { }
5 changes: 5 additions & 0 deletions kmpauth-firebase/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ kotlin {
}
}
}
js(IR) {
nodejs()
browser()
binaries.library()
}
jvm()

iosX64()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.mmk.kmpauth.firebase.apple

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.mmk.kmpauth.core.UiContainerScope
import dev.gitlive.firebase.auth.FirebaseUser

/**
* AppleButton Ui Container Composable that handles all sign-in functionality for Apple.
* Child of this Composable can be any view or Composable function.
* You need to call [UiContainerScope.onClick] function on your child view's click function.
*
* [onResult] callback will return [Result] with [FirebaseUser] type.
* @param requestScopes list of request scopes type of [AppleSignInRequestScope].
* Example Usage:
* ```
* //Apple Sign-In with Custom Button and authentication with Firebase
* AppleButtonUiContainer(onResult = onFirebaseResult) {
* Button(onClick = { this.onClick() }) { Text("Apple Sign-In (Custom Design)") }
* }
*
* ```
*
*/
@Composable
public actual fun AppleButtonUiContainer(
modifier: Modifier,
requestScopes: List<AppleSignInRequestScope>,
onResult: (Result<FirebaseUser?>) -> Unit,
content: @Composable UiContainerScope.() -> Unit
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.mmk.kmpauth.firebase.oauth

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.mmk.kmpauth.core.UiContainerScope
import dev.gitlive.firebase.auth.FirebaseUser
import dev.gitlive.firebase.auth.OAuthProvider

/**
* OAuth Ui Container Composable that handles all sign-in functionality for given provider.
* Child of this Composable can be any view or Composable function.
* You need to call [UiContainerScope.onClick] function on your child view's click function.
*
* [onResult] callback will return [Result] with [FirebaseUser] type.
* @param oAuthProvider [OAuthProvider] class object.
*
* Example Usage:
* ```
*
* OAuthContainer(onResult = onFirebaseResult) {
* Button(onClick = { this.onClick() }) { Text("Github Sign-In (Custom Design)") }
* }
* val oAuthProvider = OAuthProvider(provider = "github.com")
* OAuthContainer(modifier = modifier, oAuthProvider = oAuthProvider,onResult = onFirebaseResult){
* Button(onClick = { this.onClick() }) { Text("Github Sign-In (Custom Design)") }
* }
*
* ```
*
*/
@Composable
public actual fun OAuthContainer(
modifier: Modifier,
oAuthProvider: OAuthProvider,
onResult: (Result<FirebaseUser?>) -> Unit,
content: @Composable UiContainerScope.() -> Unit
) {
}
6 changes: 5 additions & 1 deletion kmpauth-google/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ kotlin {
}
}
}
js(IR) {
nodejs()
browser()
binaries.library()
}
jvm()

iosX64()
iosArm64()
iosSimulatorArm64()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.mmk.kmpauth.google

import androidx.compose.runtime.Composable

internal class GoogleAuthProviderImpl : GoogleAuthProvider {

@Composable
override fun getUiProvider(): GoogleAuthUiProvider {
TODO("Not yet implemented")
}

override suspend fun signOut() {
TODO("Not yet implemented")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.mmk.kmpauth.google

internal class GoogleAuthUiProviderImpl : GoogleAuthUiProvider {
override suspend fun signIn(): GoogleUser? {
TODO("Not yet implemented")
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.mmk.kmpauth.google.di

import com.mmk.kmpauth.google.GoogleAuthProvider
import com.mmk.kmpauth.google.GoogleAuthProviderImpl
import org.koin.core.module.Module
import org.koin.core.module.dsl.factoryOf
import org.koin.dsl.bind
import org.koin.dsl.module

internal actual val googleAuthPlatformModule: Module = module {
factoryOf(::GoogleAuthProviderImpl) bind GoogleAuthProvider::class
}
7 changes: 5 additions & 2 deletions kmpauth-uihelper/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ kotlin {
}
}
}
js(IR) {
nodejs()
browser()
binaries.library()
}
jvm()


iosX64()
iosArm64()
iosSimulatorArm64()
Expand Down