Closed robertmaxted closed 7 months ago
Plugin.Firebase
and the plugin from f-miyu have different APIs. You cannot simply swap the packages out--you'll need to rewrite code.
Just two examples I can see off the bat from your code:
1) The Exists
property doesn't exist in this Plugin (checking the Data property for null should suffice)
2) Plugin.Firebase
uses typed DocumentSnapshots (e.g. GetDocumentSnapshotAsync<UserData>()
) rather than ToObject()
to map data to models.
Review the Plugin's documentation here: https://github.com/TobiasBuchholz/Plugin.Firebase/blob/development/docs/firestore.md
Check out the tests for usage examples: https://github.com/TobiasBuchholz/Plugin.Firebase/blob/master/tests/Plugin.Firebase.IntegrationTests/Firestore/FirestoreFixture.cs
If you're still having an issue, a specific error message or exception would be helpful.
Ohhh that's awesome, thanks @AdamEssenmacher I didn't realise that GetDocumentSnapshotAsync
Yeah, this doc doesn't really tell much about the usage of the package - https://github.com/TobiasBuchholz/Plugin.Firebase/blob/development/docs/firestore.md
This is incredibly helpful - https://github.com/TobiasBuchholz/Plugin.Firebase/blob/master/tests/Plugin.Firebase.IntegrationTests/Firestore/FirestoreFixture.cs
Thanks @AdamEssenmacher Really appreciate it!
Hi @TobiasBuchholz ,
Firstly thank you for creating this package!
I am during the process of migrating to .NET MAUI from Xamarin.forms due to (May 2024).. I was previously using Plugin.CloudFirestore by f-miyu. (https://github.com/f-miyu/Plugin.CloudFirestore).
var doc = await CrossCloudFirestore.Current .Instance .Collection("users") .Document(CrossFirebaseAuth.Current.Instance.CurrentUser.Uid) .GetAsync();
if (doc.Exists) { var userData = doc.ToObject();
}
Here is what I am trying to achieve using the Plugin.Firebase.Firestore package..
if (CrossFirebaseAuth.Current.CurrentUser == null) { Console.WriteLine("CurrentUser is null - issue with Firebase token..."); Preferences.Remove("MyFirebaseRefreshToken"); return null; } else {
Please help. I am truly at a loss with this. Thank you in advance for any help or advice you can provide..
@TobiasBuchholz @vhugogarcia @Gekidoku @AdamEssenmacher