Giter Club home page Giter Club logo

plugin.cloudfirestore's People

Contributors

alexandervanmeerten avatar dagobertdev avatar f-miyu avatar tomasszabo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plugin.cloudfirestore's Issues

Subcollections

How to get subcollections from all documents? I'm make a little social app and i need this for get the posts of my friends.
Thanks for read me, have a good day.

firestore: PERMISSION_DENIED: Missing or insufficient permissions

For the permission denied error, I got solution to change rule from false to true as suggested here
https://stackoverflow.com/questions/46590155/firestore-permission-denied-missing-or-insufficient-permissions#comment94809401_46925637

But I want to make it false, then how can we solve this error with this plugin.
I have Email/Password Signin Enable in Firebase (but don't have any server, because I want to use Firebase only as backend), then how can I fix this error without compromising the security.

AppCompat 28.0.0.1 Dependency

We have the need to move the Target Framework for our project to 10.0, which I believe causes a dependency on AppCompat 28.0.0.3. We are currently unable to make the move because of a dependency conflict with Plugin.CloudFirestore, which seems to require 28.0.0.1.

Is there any chance of updating Plugin.CloudFirestore to support 28.0.0.3?

Works on Android but not in iOS

Hello,

Thank you for you library. I'm just trying to make some tests with it. I made a Multiplatform (Android and iOS) project. I just use GetDocumentAsync to read a Firestore database that I have already use in web-app project. I follow your instructions and this works fine with Android.

When I build the iOS project I don't have any error but when I click run the app quit without any message. I put GoogleService-info.plist in the project (and put build action to Bundle Ressource).

Is there anything else to do for iOS implementation ?

Note in both project I use Firebase Analytics. It's work fine so I can say my GoogleService-info.plist is correctly implemented.

My code is very simple

async public void Test()
        {
            Console.WriteLine("Test");
            document = await CrossCloudFirestore.Current
                            .Instance
                            .GetCollection("test")
                            .GetDocument("2019-01-01")
                            .GetDocumentAsync();
        }

        public void TestShow()
        {

            Console.WriteLine("TestShow");

            var modelTest = document.ToObject<ModelTest>();
            Console.WriteLine(modelTest.Name);

        }

and my Model also very simple

public class ModelTest
    {
        public static string CollectionPath = "test";

        [Id]
        public string Id { get; set; }

        public string Name { get; set; }

    }

how to setting timestampsInSnapshots

target OS is iOS.
build and run on simulator.

Executing the following statement
IDocumentSnapshot xxx = await CrossCloudFirestore.Current.Instance.GetDocument(strPath).GetDocumentAsync().ConfigureAwait(false);

simulator is no response...
debug log is
2019-01-16 13:14:43.927856+0900 XXXXXXX.iOS[29560:384941] 5.8.0 - [Firebase/Firestore][I-FST000001] The behavior for system Date objects stored in Firestore is going to change AND YOUR APP MAY BREAK.
To hide this warning and ensure your app does not break, you need to add the following code to your app before calling any other Cloud Firestore methods:

let db = Firestore.firestore()
let settings = db.settings
settings.areTimestampsInSnapshotsEnabled = true
db.settings = settings

With this change, timestamps stored in Cloud Firestore will be read back as Firebase Timestamp objects instead of as system Date objects. So you will also need to update code expecting a Date to instead expect a Timestamp. For example:

// old:
let date: Date = documentSnapshot.get("created_at") as! Date
// new:
let timestamp: Timestamp = documentSnapshot.get("created_at") as! Timestamp
let date: Date = timestamp.dateValue()

Please audit all existi
ng usages of Date when you enable the new behavior. In a future release, the behavior will be changed to the new behavior, so if you do not follow these steps, YOUR APP MAY BREAK.

Android is no problem.

Nothing happening after i through a command

I am using xamarin froms to develop an uber like application. i am using the code from ducumentation to get cdocument.
var document = await CrossCloudFirestore.Current .Instance .GetCollection(Constants.FIREBASE_COLLECTION_USER) .GetDocument(UID) .GetDocumentAsync();

whenever debugger tries to cross this code, nothing happens and the control is lost forever. i am unable to get the data and also unable to touch firestore databse. Please help to resolve.

Java.Util.AbstractMapInvoker is not supported

Hi,
I got this issue recently while invoking listener for a documents collection and calling ToObject() method. The exception details point to a document's Data field.

: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
: Parameter name: Java.Util.AbstractMapInvoker is not supported
: at Plugin.CloudFirestore.FieldValueExtensions.ToFieldValue (Java.Lang.Object fieldValue, System.Type type) [0x006e6] in <765f65ff520546e3840ea02313dc2f05>:0
: at Plugin.CloudFirestore.DocumentMapper.Map[T] (Firebase.Firestore.DocumentSnapshot source, System.Nullable`1[T] serverTimestampBehavior) [0x001a6] in <765f65ff520546e3840ea02313dc2f05>:0
: at Plugin.CloudFirestore.DocumentSnapshotWrapper.ToObject[T] () [0x00000] in <765f65ff520546e3840ea02313dc2f05>:0

Objective c thrown error: UISearchDisplayController is no longer supported, migrate to UISearchController

  • Xcode 11.3 version
  • Xamarin.iOS version: 13.10.0.17 (Visual Studio Community)
  • Xamarin.Firebase.iOS.Auth version: 5.0.4.1
  • Xamarin.Firebase.iOS.CloudFirestore version: 0.13.3
  • Xamarin.Firebase.iOS.Core version: 5.1.8

I have app created using Firebase+Xamarin.iOS, while I'm trying to login in app downloaded through test flight I'm getting this error. Same application works fine in simulator without any issue. Same way if I'm installing app directly from xcode or using Diawi link it works fine.

I'm only not able to login in app downloaded from test flight because of this error. I have not use UIDisplaySearchController anywhere in the app.

P_3

Is there any way to Create a Document with predefined ID

I want to store User Profile Data with the User ID which I created after Facebook authentication.

  1. I logged in into FB through Firebase and and then access the ID.
  2. Using that ID, I want to create a document for the profile.

Using the plugin I can call CreateDocument which works for Auto GUID. Is there any way to provide predefined ID.

App crashes when there are snapshot listeners active and wifi is turned off

I have an application where I set a couple of snapshot listeners.
If the app starts with wifi on, then it appears that the underlying grpc connections trigger a fatal exception when the wifi is turned off.
I've tested this removing the listeners and the error no longer occurs.
Also, if I start the application with wifi off, then I can turn it on and off and there is no crash.

Stack trace (it is misleading, I spent a lot of time until I found that this was caused by the active listeners):

Fatal Exception: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/devtools/build/android/desugar/runtime/ThrowableExtension;
at com.google.common.base.Throwables.getStackTraceAsString(Throwables.java:352)
at io.grpc.Status.toString(Status.java:551)
at java.lang.String.valueOf(String.java:2896)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at io.grpc.ConnectivityStateInfo.toString(ConnectivityStateInfo.java:90)
at java.lang.String.valueOf(String.java:2896)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at io.grpc.internal.InternalSubchannel.gotoState(InternalSubchannel.java:325)
at io.grpc.internal.InternalSubchannel.scheduleBackoff(InternalSubchannel.java:281)
at io.grpc.internal.InternalSubchannel.access$1800(InternalSubchannel.java:62)
at io.grpc.internal.InternalSubchannel$TransportListener.transportShutdown(InternalSubchannel.java:601)
at io.grpc.okhttp.OkHttpClientTransport.startGoAway(OkHttpClientTransport.java:748)
at io.grpc.okhttp.OkHttpClientTransport.onException(OkHttpClientTransport.java:734)
at io.grpc.okhttp.OkHttpClientTransport$2.run(OkHttpClientTransport.java:494)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)

Searching arrays using array_contains Firestore functions

Hello! Great plugin which does 99% of everything I need. I have a question/issue, and was hoping to get some help with this.

I have a collection called "Projects", that contains an array with strings of user_id's that dictate who owns that document. I need to be able to search these arrays like the function "array_contains" that is explained on the website https://firebase.google.com/docs/firestore/query-data/queries.

Is this possible in the current version?
Searching using the .WhereEqualsTo function using an array works, but only on a 100% match, and not for searching for a given value within the array.

`mono.com.google.firebase.firestore.EventListenerImplementor` is generated by more than one managed type

Hi,

after update from version 2.0.0 to latest 3.0.1 I get this build error:

The Java type mono.com.google.firebase.firestore.EventListenerImplementor is generated by more than one managed type. Please change the [Register] attribute so that the same Java type is not emitted.
mono.com.google.firebase.firestore.EventListenerImplementor generated by: Firebase.Firestore.IEventListenerImplementor, FirebaseFirestore.Binding, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
mono.com.google.firebase.firestore.EventListenerImplementor generated by: Firebase.Firestore.IEventListenerImplementor, Xamarin.Firebase.Firestore, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

It was running smoothly before update.

Thanks.

Crash when there is a DateTime property.

I get a crash when I try to add an object with a DateTime property to firestore. (JavaException) My minimal failing example is an otherwise empty class, only one DateTime property.
The crash doesn't happen when the DateTime is marked as ServerTimestamp.

What is really weird is that I already have a class with multiple DateTime properties. One of them is not marked as ServerTimestamp. But this class works just fine. Only when I try adding a second unmarked DateTime, the crash happens.

Failing class:
public class Test { public DateTime DateAndTime { get; set;} }

Used to add to firestore:
var reference = firestore.GetCollection("somecollection").CreateDocument(); await firestore.RunTransactionAsync((transaction) => { transaction.SetData(reference, testClass); });

Firestore PERMISSION_DENIED issue

Hi all. This is essentially a rehash of issue #8 and a continuation of #11.

I am using this Plugin along with the Plugin.FirebaseAuth. Has anyone had any success with applying Firestore rules to requests generated using this plugin?

I create an anonymous user and attempt to read from the Firestore. My rule works with anonymous authentication when using the simulator. The rule is listed below:

match /{collectionName}/{docId} { allow read: if collectionName != 'CollectionName' && request.auth.token.firebase.sign_in_provider == 'anonymous'; }

However outside the simulator it results in the PERMISSION_DENIED exception. Please let me know if you have any advice.

Reactive

Hello,

I was just wondering if anyone could give an example on how to utilize the Subscribe function to a document as a service so that when there's an update on a certain document, the user can get a notification on their device even if the app is closed or in the background.

I saw the description, but it's unclear to me how I would use this as a service and where my code for the documentupdate event would go. :S

How make changes in AndroidManifest.xml ?

Hello, can you explain where to put

    <TargetFrameworkVersion>v9.0</TargetFrameworkVersion>
    <AndroidEnableMultiDex>true</AndroidEnableMultiDex>

in AndroidManifest.xml for now my AndroidManifest.xml looks like this:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
          android:versionCode="1" 
          android:versionName="1.0" 
          package="fr.ilandes.lunargarden">
	<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
	<application android:label="GardeningByTheMoon.Android">
     </application>
	<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>

Cannot initialize CloudFirestore on Android

I have installed Plugin.CloudFirestore and Xamarin.Firebase.Firestore, but I cannot initialize CloudFirestore on Android's mainactivity.cs

Plugin.CloudFirestore.CloudFirestore.Init();

Gives an error saying that CloudFirestore does not exist in Plugin.CloudFirestore

Offline Mode Queries Hang for Minutes

We use Plugin.CloudFirestore extensively throughout our large XF app on both iOS and Android. Overall, we have had great success with the plugin. However, offline mode seems to be badly broken.

  • Queries that take less than a second on WiFi can take several minutes when offline!!
  • These are small queries, less than 25 small documents each.
  • Several queries have the same problem, so it is not just one.
  • The behavior is the same on both iOS and Android.
  • The queries do eventually come back with correct data though!
  • We do not have this problem accessing Firestore from a native app, so we are fairly sure it is plugin related.
  • Plugin.CloudFirestore version 3.1.0
  • XF version 4.7.0

Any ideas? Please help! This is an absolute showstopper for us.

Android Error on GetDocument

var document = await CrossCloudFirestore.Current .Instance .GetCollection(collectionName) .GetDocument(id) .GetDocumentAsync();

The app stops working (Android)

subcollection with mapping little example

Can you please provide a little code snippet in which you show how to
get a document which includes a subcollection and that maps this whole document with subcollection to a related .net class?
Thanks.

Access to documentRef "source" in GetDocument()

The Firestore API allows you to specify a "source" when querying for a document:

documentRef.get({ source: 'server' }) // or 'cache'

We badly need access this to try to address performance issues we're having with offline access. Is that option available, and I'm just not finding it? Or if not, can it be added?

DateTime hour...

I am saving a date, in the database I see the time well, but when I receive the object, the time always arrives 2 hours less, why?

the date and time is saved as UTC+2 in firebase with DateTime.Now

AddSnapshotListener

Hello,

How can I get update of added documents without loading all at once? in this code there are always 3 items in the list Items.

if I manually add a document, there are 4 in my ItemsCollection, but there are always 3 in the list Items, the new one replaces the first one in the list Items.

I have detected that DocumentChangeType.Removed is called, When I just add a document ... I don't understand

CrossCloudFirestore.Current
                     .Instance
                     .GetCollection(Settings.ItemsCollection)
                     .WhereGreaterThanOrEqualsTo("Date", DateTime.Now)
                     .OrderBy("Date", true)
                     .LimitTo(3)
                     .AddSnapshotListener((snapshot, error) =>
                     {
                         if (snapshot != null)
                         {
                             foreach (var documentChange in snapshot.DocumentChanges)
                             {
                                 Item item;
                                 switch (documentChange.Type)
                                 {
                                     case DocumentChangeType.Added:
                                          item = documentChange.Document.ToObject<Item>();
                                          Items.Add(item);
                                         break;
                                     case DocumentChangeType.Modified:
                                         break;
                                     case DocumentChangeType.Removed:
                                         item = documentChange.Document.ToObject<Item>();
                                         var removeItem = Items.FirstOrDefault(f => f.Id == item.Id);
                                         if (removeItem != null)
                                         {
                                             Items.Remove(removeItem);
                                         }
                                         break;
                                 }
                             }
                         }
                     });

How to unsubscribe a listener?

In Firebase documentation is like this:

FirestoreChangeListener listener = query.Listen(snapshot =>
{
foreach (DocumentChange change in snapshot.Changes)
{
if (change.ChangeType.ToString() == "Added")
{
Console.WriteLine("New city: {0}", change.Document.Id);
}
else if (change.ChangeType.ToString() == "Modified")
{
Console.WriteLine("Modified city: {0}", change.Document.Id);
}
else if (change.ChangeType.ToString() == "Removed")
{
Console.WriteLine("Removed city: {0}", change.Document.Id);
}
}
});

await listener.StopAsync();

But i don´t know how to do this with this pluguin!, help please

Support ability to map property names to camelCase

It's typical to serialize to/from a database object that uses camelCase field names rather than the C# convention of PascalCase.

The MapTo attribute allows us override to specify a camelCase version eg.

[MapTo("phoneNumber")]
public string PhoneNumber { get; set; }, 

However, this is unnecessarily fragile, since a change of C# property name has to be updated in the attribute also.

An improvement to this would be a MapTo attribute parameter such as:

[MapTo(CamelCase=true)]
public string PhoneNumber { get; set; }, 

Or alternatively perhaps a global setting similar to the JsonSerializerSettings that allows a global preference for camelCase property mappings.

Thanks for a great library!

Multiple assemblies error when rebuilding solution

I get the following error when I try to build my solution

Severity Code Description Project File Line Suppression State
Error CS1703 Multiple assemblies with equivalent identity have been imported: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll' and 'C:\Users\2083.nuget\packages\plugin.cloudfirestore\1.1.1\lib\netstandard2.0\mscorlib.dll'. Remove one of the duplicate references. XX.Android C:\Users\2083\Desktop\XX-App\XX\XX.Android\CSC 1 Active

IOS not compiling in Xamarin forms VS2019 - Error running winiosterminal

Hi there - Thanks for your plugin. It works great on Android but IOS gives me this build time error:

Error running winiosterminal: 'An error occurred while signing the application 'shorter.iOS.app'. Details: Object reference not set to an instance of an object.'. Command: 'sign -i="C:\Users\kakem\AppData\Local\Temp\Xamarin\HotRestart\Bundles\16.6.000.1061\086f9a9d9762fe2a7d857a29e674c755\shorter.iOS.app" -p="C:\Users\kakem\AppData\Local\Xamarin\iOS\Provisioning\Profiles\f8519916-5f0a-4c20-aae3-a6e0b9cef4ff.mobileprovision" -c="C:\Users\kakem\AppData\Local\Xamarin\iOS\Provisioning\Certificates\66E93DF4FBBADE59.p12" -pk="CFBundleIdentifier" -pv="com.kakeandy.shorter" -w="b7de5d8d-97a7-4d6d-b03c-62d4cade3121"' shorter.iOS C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Local.targets 300

Any idea ?

I'm on VS2019 16.6.2 - Have a paid for apple dev account. The app works fine when I uninstall your plugin

How to convert a reference

I´m having an issue converting a reference to another document.

This is my Database.
image

image

Code:
image

When trying to iterate through the documents I´m getting this error message.

Object of type 'Plugin.CloudFirestore.DocumentReferenceWrapper' cannot be converted to type 'Namespace.OtherObject

FirebaseOptions.getProjectId() cannot be null

This simple add function - I suddenly get FirebaseOptions.getProjectId() cannot be null erro

await CrossCloudFirestore.Current
                         .Instance
                         .GetCollection("Users")
                         .AddDocumentAsync(new Users
                         {
                             email = "this my mail 1",
                             password = "***",
                             userType = "gayan"
                         });

How to get the auto generated FirebaseID

How do I get the randomly generated ID when creating a document with auto generated id?

Or rather, is there a way to generate the random id manually before adding or setting a document?

Offline SetDataAsync Hangs

When offline, calling await IDocumentReference.SetDataAync() or UpdateDataAsync() hangs indefinitely. However, upon force quitting the app and relaunching, we see that the data did actually get persisted.

Are we doing something wrong here? It is mission critical that our app support offline mode. Thanks in advance.

Not able to initialize on android project.

I'm using 1.2.3 because it seems that the initialization method is missing on 2.0.

This is what my OnCreated looks like:

            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            Plugin.CloudFirestore.CloudFirestore.Init(Application.Context);

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);

            LoadApplication(new App());

And the error at the CloudFirestore.Init line:

Java.Lang.NullPointerException: 'Attempt to read from field 'java.lang.String com.google.firebase.FirebaseOptions.applicationId' on a null object reference'

I have Xamarin.Firebase.Firestore and this nuget on the android project and this nuget on my core project. Thanks!

Enums support

Hi. Thanks for the plugin! It seems that the plugin doesn't have support for serializing and deserializing of Enums. It would be great to have this implemented.

WhereArrayContainsAny

Hi, first thanks for the awsome library.
do you mention to add the support for WhereArrayContainsAny?

Stream Realtime

Hi! Great work with your package, I can publish, get, delete and update from my app to my database, but I have a great question how can I stream my database to a Listview in xamarin forms, it has been a bit complicated for me and so far I have not succeeded, I would like you to guide me with a quick example. Thanks for reading, good day!

Error On Android

I have followed the tutorial and added 'CloudFirestore.Init(Application.Context);' in MainActivity. However, when I run I get the following error:

Unhandled Exception:

Java.Lang.NullPointerException: Attempt to read from field 'java.lang.String com.google.firebase.FirebaseOptions.zzehy' on a null object reference

Any ideas what is causing this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.