-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from mirzemehdi/js_support
Js support (only target with dummy class and methods)
- Loading branch information
Showing
11 changed files
with
136 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,11 @@ kotlin { | |
} | ||
} | ||
|
||
js(IR) { | ||
nodejs() | ||
browser() | ||
binaries.library() | ||
} | ||
jvm() | ||
iosX64() | ||
iosArm64() | ||
|
9 changes: 9 additions & 0 deletions
9
kmpauth-core/src/jsMain/kotlin/com/mmk/kmpauth/core/di/PlatformModule.js.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,11 @@ kotlin { | |
} | ||
} | ||
} | ||
js(IR) { | ||
nodejs() | ||
browser() | ||
binaries.library() | ||
} | ||
jvm() | ||
|
||
iosX64() | ||
|
32 changes: 32 additions & 0 deletions
32
...th-firebase/src/jsMain/kotlin/com/mmk/kmpauth/firebase/apple/AppleButtonUiContainer.js.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
) { | ||
} |
38 changes: 38 additions & 0 deletions
38
kmpauth-firebase/src/jsMain/kotlin/com/mmk/kmpauth/firebase/oauth/OAuthContainer.js.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
kmpauth-google/src/jsMain/kotlin/com/mmk/kmpauth/google/GoogleAuthProviderImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
kmpauth-google/src/jsMain/kotlin/com/mmk/kmpauth/google/GoogleAuthUiProviderImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
kmpauth-google/src/jsMain/kotlin/com/mmk/kmpauth/google/di/GoogleAuthModule.js.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters