Best maintenance strategy for native Auth providers (e.g. Facebook) #105
-
|
Hi @AdamEssenmacher , Following your recent PR for Plugin.Firebase v4, I followed your advice below:
Hence, I implemented my own native wrapper abstractions for iOS (
After I did the plumbing into my app, everything finally worked well... but I noticed this warning which scared me a bit: If I got it well, this may be because Do you think this can be the root cause of my warning? And this is intentional to keep this cc: @vhugogarcia , @Digifais who recently discussed in this repo and that I consider potential active contributors. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
|
Also, I would like to target recent SDK version for Google Sign In ( I would need soon to progress on this and I'm bit mixed between:
Any advice would be appreciated here, but if you prefer, we could also start private chats on this or possibly have a call if better? (Which can be difficult as this is extra activity for you, and it is actually same situation for me) In case you'd like to reach out, please check my profile. As usual, thanks for your support! |
Beta Was this translation helpful? Give feedback.
-
|
First, kudos on getting this far—especially on both platforms. If you do get this working, I’m confident others would be interested in using your implementation as a reference. We could certainly update the README to link to a public repo if you’re willing to share one. Regarding your immediate problem: your analysis is correct. It may appear to work just fine, but that’s a dangerous warning to ignore. What you’ve run into is a problem as old as Xamarin itself (even predating Forms): packaging and distributing native platform dependencies. The Core Problem (by Analogy)Consider a regular Android: When the Model WorksNow consider a If you inspect [Xamarin.GooglePlayServices.Base](https://www.nuget.org/packages/Xamarin.GooglePlayServices.Base), you’ll see that it is a shared dependency of things like Google Maps and Firebase Messaging. It also pulls in common AndroidX libraries that MAUI itself depends on. This works because Microsoft publishes and maintains 1:1 mirror artifacts for nearly all common Google and AndroidX native libraries. Each native Maven artifact maps cleanly to a NuGet package, and dependency resolution behaves predictably. Android: When the Model BreaksNow imagine you want to add support for [Facebook Login](https://mvnrepository.com/artifact/com.facebook.android/facebook-login/18.1.3/dependencies). Microsoft used to publish 1:1 binding packages for the Facebook Android SDK, but those were eventually abandoned. So if you’re creating a binding package for Facebook Login today, you must ensure that its native dependencies—namely The most straightforward way to do this (and what most developers do) is to add the native Now imagine a different developer publishes a binding package for [Facebook Share](https://mvnrepository.com/artifact/com.facebook.android/facebook-share/18.1.3/dependencies), which also depends on The “Right” Solution (That We Don’t Have)The correct architectural solution is to publish canonical, shared NuGet packages for common dependencies:
Then higher-level packages like The problem is that we don’t have a canonical source for these packages. Outside of the AndroidX / Google ecosystem that Microsoft maintains, most Maven artifacts have no official NuGet equivalents. As a result, authors of native binding packages are forced into one of two choices:
iOS: Same Problem, Plus Two MoreOn iOS, we have the same core problem—but with two additional complications. 1. No Microsoft-Maintained Bindings AnymoreMicrosoft no longer maintains binding packages for Google or Firebase iOS dependencies. This is precisely why the 2. No 1:1 Mapping (Historically)Even when Microsoft did maintain these bindings, they did not follow a 1:1 native artifact → NuGet package model. Instead, they bundled every potentially shared Google dependency into a single “dependency soup” package called: Google Maps, Sign-In, MLKit, and others each needed some of these dependencies, so they all took a dependency on Where
|
Beta Was this translation helpful? Give feedback.
-
Slim bindings just don't really provide any benefits for general-purpose bindings like those provided in this repo. Mapping nearly 100% of the native API surfaces is the goal, and we want the C# API to match as closely as possible so that native API documentation doesn't need to be augmented. If we were to switch to a 'slim' biding approach with these two things in mind, we'd end up doing a lot of the same work with extra steps in between. Also, 'slim bindings' do nothing to address the complexities of dependency management.
I'm not sure I understand your question entirely. If the dependency you need is packed into the 'dependency soup' artifact (Firebase.Core), then yes, it would be difficult to manage the version of that dependency that you get, because you would need to know which version was packed into each version of Firebase.Core. However, for dependencies which I've been able to split out of Firebase.Core (like PromisesObjC, which contains FBLPromises), they are published to NuGet with version numbers that are prefixed by their native library versions, so you can constrain or pick compatible versions as needed. Further, as far as Google Sign In is concerned, these dependencies have been cleanly separated from Firebase.Core for quite a while now, so you shouldn't have to worry about this at all. Or maybe I misunderstood this question. |
Beta Was this translation helpful? Give feedback.
First, kudos on getting this far—especially on both platforms. If you do get this working, I’m confident others would be interested in using your implementation as a reference. We could certainly update the README to link to a public repo if you’re willing to share one.
Regarding your immediate problem: your analysis is correct. It may appear to work just fine, but that’s a dangerous warning to ignore.
What you’ve run into is a problem as old as Xamarin itself (even predating Forms): packaging and distributing native platform dependencies.
The Core Problem (by Analogy)
Consider a regular
.net10project that needsSystem.Text.Json. You could grabSystem.Text.Json.dlland reference it dire…