TobiasBuchholz / Plugin.Firebase

Wrapper around the native Android and iOS Firebase Xamarin SDKs
MIT License
220 stars 49 forks source link

Proposal : lazy google/facebook auth #122

Closed tranb3r closed 1 year ago

tranb3r commented 1 year ago

In this PR, Google and Facebook auth providers are now Lazy. The goal is to avoid initializing Google/Facebook when the app uses only Firebase Auth.

This is only a proposal. Another solution could be to add flags to CrossFirebaseSettings (useGoogleAuth, useFacebookAuth). What do you think?

TobiasBuchholz commented 1 year ago

Yeah, good idea, makes sense to me. I think using additional flags in the CrossFirebaseSettings would be the way to go because otherwise the GoogleAuth and FacebookAuth classes would get initialized when trying to sign out.

But this probably doesn't solve the size problem caused by the facebook sdk right? Did you check that already?

tranb3r commented 1 year ago

Yeah, good idea, makes sense to me. I think using additional flags in the CrossFirebaseSettings would be the way to go because otherwise the GoogleAuth and FacebookAuth classes would get initialized when trying to sign out.

The SignOut thing isn't that big an issue, since a user almost never sign out. So I still think this is a quick optim. Even if adding flags would be a cleaner solution.

But this probably doesn't solve the size problem caused by the facebook sdk right? Did you check that already?

No, it won't solve the facebook sdk size problem. Actually, the facebook lib is embedded as soon as you add a reference to it, and the linker never gets rid of it, even if there is no code at all calling the lib.