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

Refactor Firebase JS externals using Web v9 modular SDK #319

Merged
merged 34 commits into from
Sep 2, 2023

Conversation

shepeliev
Copy link
Contributor

@shepeliev shepeliev commented Jun 10, 2022

At the moment, despite the SDK is packaged with Web v9 Firebase libs we are using compat modules. The goal of this PR is to get rid legacy firebase externals in favor of modular SDK.

fixes #236
fixes #241
fixes #315
fixes #316

@shepeliev shepeliev changed the title Refactor Firebase external using Web v9 modular SDK Refactor Firebase JS externals using Web v9 modular SDK Jun 10, 2022
@nbransby
Copy link
Member

A lot of these changes look like just formatting? Makes it tricky to review - could you split the formatting / changes into separate commits so we can review this PR?

@shepeliev shepeliev marked this pull request as ready for review June 14, 2022 06:39
@shepeliev shepeliev marked this pull request as draft June 14, 2022 07:10
@shepeliev shepeliev marked this pull request as ready for review June 14, 2022 07:52
@MinmoTech
Copy link

I pulled this PR and it does indeed solve my issue #315 .
So while I haven't thoroughly looked through the code this looks good to me @nbransby

@MinmoTech
Copy link

@shepeliev I've found one potential issue but i'm not sure if it's caused by your PR or was there before:
As soon as I try to use Firebase.auth I get the following error:

> Task :compileDevelopmentExecutableKotlinJs FAILED
e: Module "dev.gitlive:firebase-auth" has a reference to symbol dev.gitlive.firebase.auth/FirebaseUser.displayName.<get-displayName>|-7122534302014937473[1]. Neither the module itself nor its dependencies contain such declaration.

This could happen if the required dependency is missing in the project. Or if there is a dependency of "dev.gitlive:firebase-auth" that has adifferent version in the project than the version that "dev.gitlive:firebase-auth" was initially compiled with. Please check that the projectconfiguration is correct and has consistent versions of all required dependencies.

The list of "dev.gitlive:firebase-auth" dependencies that may lead to conflicts:
1. "kotlin" (a library with unknown version)
2. "dev.gitlive:firebase-app" (a library with unknown version)
3. "dev.gitlive:firebase-common" (a library with unknown version)
4. "org.jetbrains.kotlinx:atomicfu" (a library with unknown version)
5. "org.jetbrains.kotlinx:kotlinx-coroutines-core" (a library with unknown version)
6. "org.jetbrains.kotlinx:kotlinx-serialization-core" (a library with unknown version)

@shepeliev
Copy link
Contributor Author

@MinmoTech thanks for the comment. The PR is not a cause for this error. The reason is the bug in IR compiler: KT-48836. You can find a workaround here.

@MinmoTech
Copy link

Sorry for the ping and thanks for the help!

@shubhamsinghshubham777
Copy link

Is this thread dead? It would really help if someone could review and approve this PR.

@Reedyuk
Copy link
Collaborator

Reedyuk commented Apr 5, 2023

can you rebase and then i can have another look at it

@shubhamsinghshubham777
Copy link

@shepeliev Have you tried using signInWithPopup with GoogleAuthProvider with this implementation? For me, it throws the following error: Error (auth/argument-error)

@shepeliev
Copy link
Contributor Author

@shepeliev Have you tried using signInWithPopup with GoogleAuthProvider with this implementation? For me, it throws the following error: Error (auth/argument-error)

Oh, looks like I didn't migrate that API to externals. Thanks for highlighting. I'll try to add it this weekend.

@shepeliev shepeliev marked this pull request as draft April 6, 2023 16:21
@shepeliev shepeliev marked this pull request as ready for review April 6, 2023 21:34
@Reedyuk
Copy link
Collaborator

Reedyuk commented Apr 9, 2023

can you resolve the conflicts please

# Conflicts:
#	.github/workflows/pull_request.yml
#	firebase-common/src/jsMain/kotlin/dev/gitlive/firebase/externals.kt
#	firebase-database/src/commonTest/kotlin/dev/gitlive/firebase/database/database.kt
#	firebase-database/src/jsMain/kotlin/dev/gitlive/firebase/database/database.kt
#	firebase-firestore/src/jsMain/kotlin/dev/gitlive/firebase/firestore/firestore.kt
import kotlin.random.Random
import kotlin.test.*

expect val emulatorHost: String
expect val context: Any
expect fun runTest(test: suspend () -> Unit)
expect fun runTest(test: suspend () -> Unit): TestResult
Copy link
Contributor Author

@shepeliev shepeliev Apr 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are using kotlinx-coroutines-test the result of runTest must be immediately returned from each test in JS.

@shepeliev
Copy link
Contributor Author

can you resolve the conflicts please

@Reedyuk done

Copy link
Collaborator

@Reedyuk Reedyuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but due to the sheer amount of changes, i would expect @nbransby to give it the approval.

@shubhamsinghshubham777
Copy link

@nbransby Could you please have a look at this? It's been a while.

@nbransby
Copy link
Member

Although your effort is highly appreciated, the secret to getting timely approval on PRs is to produce small ones, this is huge and makes reviewers lose the will to live!

A quick scan it looks good but also seems there's a fair few changes in there which are unrelated to the subject of the PR, can you highlight these and explain the rational?

@shepeliev
Copy link
Contributor Author

Although your effort is highly appreciated, the secret to getting timely approval on PRs is to produce small ones, this is huge and makes reviewers lose the will to live!

Yeap, you're might right there are some more changes than it would be wanted. However, I don't think it would make sence to migrate from Firbase JS v8 to v9 module by module in separate PRs just for reducing their size.

A quick scan it looks good but also seems there's a fair few changes in there which are unrelated to the subject of the PR, can you highlight these and explain the rational?

All of those changes are related to the PR subject exepting couple of lines that fix tests in JS. I've drop a comment earlier:
https://github.com/GitLiveApp/firebase-kotlin-sdk/pull/319/files#r1161516897

It's required as at the moment JS tests are broken in the master branch and test nothing at all despite all of them are green.

# Conflicts:
#	firebase-auth/src/jsMain/kotlin/dev/gitlive/firebase/auth/user.kt
#	firebase-common/src/jsMain/kotlin/dev/gitlive/firebase/externals.kt
#	firebase-common/src/jsMain/kotlin/dev/gitlive/firebase/externals2.kt
#	firebase-database/src/jsMain/kotlin/dev/gitlive/firebase/database/database.kt
#	firebase-firestore/src/jsMain/kotlin/dev/gitlive/firebase/firestore/firestore.kt
#	firebase-functions/src/commonMain/kotlin/dev/gitlive/firebase/functions/functions.kt
#	firebase-functions/src/jsMain/kotlin/dev/gitlive/firebase/functions/functions.kt
@nbransby nbransby merged commit b29db6f into GitLiveApp:master Sep 2, 2023
1 check passed
@shepeliev shepeliev deleted the refactor-web-version-9 branch September 3, 2023 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants