f-miyu / Plugin.CloudFirestore

MIT License
121 stars 44 forks source link

v4 IDocumenReference.UpdateData?? #65

Open barrysohl opened 3 years ago

barrysohl commented 3 years ago

We are attempting to upgrade to Version 4 and are running into lots of problems. The upgrade notes only list method name changes, but we cannot seem to find IDocumentReference.UpdateData (which was the non-awaitable version in v3) or any equivalent.

Is it no longer an option? I really hope it's still available, because we rely on it heavily to workaround offline performance issues.

f-miyu commented 3 years ago

UpdateData becomes obsoleted from version 4 because you can do the same thing with UpdateAsync. You can substitute UpdateAsync for UpdateData as the following.

UpdateData (v3):

CrossCloudFirestore.Current.Instance
    .GetCollection("collection")
    .GetDocument("document")
    .UpdateData(data, error =>
    {
        if (error != null)
        {
            System.Diagnostics.Debug.WriteLine(error);
            return;
        }

        DoSomething();
    });

UpdateAsync (v4):

CrossCloudFirestore.Current.Instance
    .Collection("collection")
    .Document("document")
    .UpdateAsync(data)
    .ContinueWith(task =>
    {
        if (task.IsFaulted)
        {
            System.Diagnostics.Debug.WriteLine(task.Exception);
            return;
        }

        DoSomething();
    });
barrysohl commented 3 years ago

Thanks for the reply. ContinueWith isn't really helpful for our use case unfortunately. We have certain scenarios where we want to execute a Firestore write and return immediately without awaiting the result and just continue on with the calling code without having to write a separate callback for every write call. Simple "fire and forget" updates.

We can just remove the "await" and ignore the compiler warning. Or I suppose we can use the the discard '_' operator. Or am I missing some other option here? Thanks again.

f-miyu commented 3 years ago

I'm sorry but please use the the discard '_' operator. I think it is better that the the number of methods which we can use is fewer not to be confused about the choice.

_ = CrossCloudFirestore.Current.Instance
    .Collection("collection")
    .Document("document")
    .UpdateAsync(data);
barrysohl commented 3 years ago

That's fine. As long as there is no functional difference, switching to the discard operator is easy enough. Thanks for your time on the plugin, we rely on it heavily!

barrysohl commented 11 months ago

Hello, we have a very large Xamarin Forms app that makes heavy use of your Plugin.CloudFirestore, Plugin.FirebaseAuth, and Plugin.FirebaseStorage projects. They have been a HUGE help for us, and we greatly appreciate your work! We are now in the process of migrating the app to MAUI. Do the plugins work on MAUI? If not, are there any plans to update them?

Thanks in advance for your response! -Barry Sohl

@.*** 714-742-7645

vhugogarcia commented 11 months ago

Hello @barrysohl ,

No, this plugin is not anymore available on MAUI and is still unknown if this project is still active or no. I recommend you to migrate to Plugin.Firebase which offers full MAUI support and it is also awesome!

barrysohl commented 11 months ago

Thanks for your quick reply! We’ll take a look at Plugin.Firebase.

Do you happen to know if that project, or any similar one, works for tvOS? We are also using Visual Studio with .NET 7 to target tvOS and will be accessing our same Cloud Firestore, Firebase Auth, and Storage. If not, do you happen to know anyone that might be willing to work on such a project?

Thanks! -Barry

On Jul 17, 2023, at 1:34 PM, Victor Hugo Garcia Hernandez @.***> wrote:

Hello @barrysohl https://github.com/barrysohl ,

No, this plugin is not anymore available on MAUI and is still unknown if this project is still active or no. I recommend you to migrate to Plugin.Firebase https://github.com/TobiasBuchholz/Plugin.Firebase which offers full MAUI support and it is also awesome!

— Reply to this email directly, view it on GitHub https://github.com/f-miyu/Plugin.CloudFirestore/issues/65#issuecomment-1638832371, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACGYSOHTFMFGFMEXO54FSJDXQWOWVANCNFSM4TP7Y3JA. You are receiving this because you were mentioned.

vhugogarcia commented 11 months ago

Yes, you can create a MAUI class library and reference it to a MAUI project. Plugin.Firebase is really cool because it does not have dependency on .NET MAUI, but .NET 6 and eventually will be migrated to .NET 8. Which actually works on .NET 7 without issues. So, you can use it in any .NET 6+ projects safely 🙂👍🏻

barrysohl commented 11 months ago

Awesome, thanks!

-Barry

On Jul 17, 2023, at 2:10 PM, Victor Hugo Garcia Hernandez @.***> wrote:

Yes, you can create a MAUI class library and reference it to a MAUI project. Plugin.Firebase is really cool because it does not have dependency on .NET MAUI, but .NET 6 and eventually will be migrated to .NET 8. Which actually works on .NET 7 without issues. So, you can use it in any .NET 6+ projects safely 🙂👍🏻

— Reply to this email directly, view it on GitHub https://github.com/f-miyu/Plugin.CloudFirestore/issues/65#issuecomment-1638886953, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACGYSOHV7HKVAM2SAIJYV7LXQWS3HANCNFSM4TP7Y3JA. You are receiving this because you were mentioned.