firebase-kotlin-sdk
firebase-kotlin-sdk copied to clipboard
Platform-specific constructors inconsistency
It appears that some actual
classes' constructors are marked as internal
:
https://github.com/GitLiveApp/firebase-kotlin-sdk/blob/be99f63ddee58328f9ca8acc873a82e397c40d5a/firebase-auth/src/androidMain/kotlin/dev/gitlive/firebase/auth/user.kt#L11
https://github.com/GitLiveApp/firebase-kotlin-sdk/blob/be99f63ddee58328f9ca8acc873a82e397c40d5a/firebase-database/src/androidMain/kotlin/dev/gitlive/firebase/database/database.kt#L59
https://github.com/GitLiveApp/firebase-kotlin-sdk/blob/be99f63ddee58328f9ca8acc873a82e397c40d5a/firebase-functions/src/androidMain/kotlin/dev/gitlive/firebase/functions/functions.kt#L28
https://github.com/GitLiveApp/firebase-kotlin-sdk/blob/be99f63ddee58328f9ca8acc873a82e397c40d5a/firebase-functions/src/jsMain/kotlin/dev/gitlive/firebase/functions/functions.kt#L25
while there are others that are effectively public
:
https://github.com/GitLiveApp/firebase-kotlin-sdk/blob/be99f63ddee58328f9ca8acc873a82e397c40d5a/firebase-auth/src/androidMain/kotlin/dev/gitlive/firebase/auth/user.kt#L60
https://github.com/GitLiveApp/firebase-kotlin-sdk/blob/be99f63ddee58328f9ca8acc873a82e397c40d5a/firebase-auth/src/androidMain/kotlin/dev/gitlive/firebase/auth/user.kt#L75
https://github.com/GitLiveApp/firebase-kotlin-sdk/blob/be99f63ddee58328f9ca8acc873a82e397c40d5a/firebase-firestore/src/androidMain/kotlin/dev/gitlive/firebase/firestore/firestore.kt#L40
https://github.com/GitLiveApp/firebase-kotlin-sdk/blob/be99f63ddee58328f9ca8acc873a82e397c40d5a/firebase-storage/src/androidMain/kotlin/dev/gitlive/firebase/storage/storage.kt#L49
Context
I would like to use the constructors to pass in the Android variant while I incrementally migrate my existing codebase to this library, and I noticed this inconsistency while attempting to add a constructor overload that takes in the Android variant:
class MyRepository(
user: FirebaseUser, // Common variant
firestore: FirebaseFirestore // Common variant
) {
constructor(
androidUser: com.google.firebase.auth.FirebaseUser,
androidFirestore: com.google.firebase.firestore.FirebaseFirestore
) : this(user = FirebaseUser(androidUser), firestore = FirebaseFirestore(androidFirestore))
}
The FirebaseUser(androidUser)
constructor usage in MyRepository
's secondary constructor (shown above) results in a "Cannot access '<init>': it is internal in 'FirebaseUser'
" error in the IDE.