Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outdated Readme? #84

Closed
luistrivelatto opened this issue Mar 12, 2022 · 12 comments
Closed

Outdated Readme? #84

luistrivelatto opened this issue Mar 12, 2022 · 12 comments

Comments

@luistrivelatto
Copy link

luistrivelatto commented Mar 12, 2022

First of all, thanks a lot for doing this! I just wanted to have some offline pure-Dart scripts to do stuff with Firestore, and I was struggling with several other packages until finding this. It's great!

I noticed that the Readme says, under "Limitations" of Firestore:

Collection queries (limit, sort, etc.) are currently not supported.

However, going through the API I see methods like CollectionReference.orderBy, CollectionReference.limit, and others. Are these another thing, or is the Readme outdated?

@RomjanHossain
Copy link

this package is OUTDATED. it was last updated a year ago

@bksubhuti
Copy link

I am very happy that you are maintaining this package. There is no other 5 OS firestore option.
We will probably be adding soon to our app with roughly 3500 users on all 5 OS combine, but 2600 android.
I also noticed that some of the needed functions are not listed..
I tested the first 2 and they worked well.

Future resetPassword(String email) => _authGateway.resetPassword(email);

Future requestEmailVerification({String? langCode}) =>
_userGateway.requestEmailVerification(langCode: langCode);

Future changePassword(String password) =>
_userGateway.changePassword(password);

@cachapa
Copy link
Owner

cachapa commented Aug 8, 2023

Thanks for the comments.

Which functions aren't listed, and where?

@bksubhuti
Copy link

bksubhuti commented Aug 8, 2023

I pasted them in my original message. These functions work with the firedart package but are not documented for the user. I
didn't see that anywhere.

Future resetPassword(String email) 
Future requestEmailVerification({String? langCode})
Future changePassword(String password)

Usage is similar to this.:

      await FirebaseAuth.instance.requestEmailVerification();
      await FirebaseAuth.instance.changePassword(passwordController.text);
      await FirebaseAuth.instance.resetPassword(emailController.text);

Furthermore requestEmailVerification will allow for the opportunity for the user to qualify his email, but controlling what is done by that user is done manually.

Here is some code from a practice file I made.
I can upload most of a sample project with notifiers, if you wish. It is my pleasure to help especially this week when I have more time. Most of it was chatgpt. It was able to navigate based on other knowledges of firebase and I also took a peek at the files as well.

  Future<void> addBookmark(String bookID, String note, int page) async {
    try {
      var auth = FirebaseAuth.instance;
      User user = await auth.getUser();
      debugPrint('User: $user');

      if (user.emailVerified == false) {
        debugPrint('Email not verified!');
        throw Exception('Email not verified!');
      }

      var userBookmarksCollection = Firestore.instance
          .collection('users')
          .document(Prefs.email)
          .collection('bookmarks');

      await userBookmarksCollection.add({
        'bookID': bookID,
        'note': note,
        'page': page,
      });
    } catch (e) {
      debugPrint('Error adding bookmark: $e');
      throw e; // Optionally rethrow to handle the error on the UI side.
    }
  }

@cachapa
Copy link
Owner

cachapa commented Aug 8, 2023

I'm still not clear on what you mean by "not documented for the user".

Those functions are part of the FirebaseAuth API and are visible, also none of the functions in Firedart are explicitly documented (no /// comments above the public methods and fields).

Or do you mean the documentation in https://pub.dev/documentation/firedart/latest
If so, that documentation is generated automatically by pub.dev and I have made no effort to make it clear. It also includes all of the methods and classes generated from the Google's protobuffs, which kind of makes it unusable.

There may be ways to format everything properly, but I haven't made any efforts in that sense. I'd be happy to accept contributions for it, if you'd like the challenge.

@bksubhuti
Copy link

well.. I guess it is my duty to help.. I think that a better and more elaborate example would help out a lot.
I'm not so smart with flutter and now with gpt.. i'm not getting any better. However, I have a gpt plus account and a long running thread with my prototype and sample program.
I can tell it to improve the example program. I will also try to improve the readme file.
Do the example programs need to be a single file? It seems that way in most pub.dev specs.

Perhaps this needs a separate issue or is this it ?
#24
I was wondering if there are any plans for offline cache? This is half the point of using firestore. although it seems that firebase also has cache as well.

I have integrated user sign in and fetching data into my main app but it is still in the testing and prototype stage.
With sign in at the beginning of the app, it seems to be quite fast when a simple sync button is called. Great work!

@cachapa
Copy link
Owner

cachapa commented Aug 9, 2023

I can tell it to improve the example program. I will also try to improve the readme file.

Please do not use AI tools to generate contributions. I don't have a lot of time to dedicate to maintaining this project so changes should be minimal and easy to review.
I also don't trust AI tools to produce robust code on their own.
If you don't feel you're experienced enough with Dart to contribute yet, then it's ok to postpone your contributions to a later time.

Do the example programs need to be a single file? It seems that way in most pub.dev specs.

Ideally yes, so potential users can have a quick reference to the core package functionality.
You can have multiple examples if you want to demonstrate different use cases to avoid making a very complex example, but that's not very common.

Perhaps this needs a separate issue or is this it ?

#24 is about adding Firebase Storage, which is a separate service in the Firebase ecosystem to store files, e.g. images. I actually have working code for that but integrating it into Firedart requires a large effort that I'm not able to invest right now.

I was wondering if there are any plans for offline cache?

I considered it back then, but didn't have a good way to fit it in the existing implementation, as it would mean Firedart would have to take on the responsibility of storing data. It's also hard to do conflict resolution with Firebase, which is required for proper offline data caching.

@bksubhuti
Copy link

I should be able to give basic additional commands in a example file "by hand and in a single file. I will test it. The original working sample yes was done by gpt plus. There is a huge difference between 3.5 and plus account . But I can make a small example now that I understand.
It should have add delete and also this create. I don't have my computer with me right now , but also so of the functions I mentioned above..

For cache..
We write to SQLite db.
I will be at first writing to a db and the manually syncing via sync button. . The original idea was to swap the db with firestore when they choose this mode, but it won't be such a problem.

We appreciate your help and making this library independently. It is really the job of flutter and firebase but this is the way it is. We also use a html core library for multiplatform use.

Our app is a non-commercial Buddhist Text reading app and I'm a monk.

I have a strategy for this my sync by adding fileds
Action
Actiondate
Synchronize (bool)
Deletes will actually be a soft delete.and still exist.

I wonder if there is a better way to have an umbrella sync table. That keeps track of table name primary key and those fields stated above . But for now, I'll integrate into the Bookmarks table directly. The usage is to sync bookmarks and notes into other other devices . We will probably have other tables synced later as well.

Maybe that strategy helps you too.

@cachapa
Copy link
Owner

cachapa commented Aug 9, 2023

Again, please do not use AI tools to contribute to this repository. I'm really pressed for time and do not want to spend it manually reviewing generated code.
I have a responsibility to keep this project's high quality so I'd rather have missing stuff than quick fixes.

If you want to sync a SQL database, then I recommend using crdt_sync instead of Firebase.
It already integrates with Sqlite and PostgresSQL and uses CRDTs for conflict management, which is a much more robust way to synchronize data than the simple timestamps Firebase uses.

What it lacks in relation to Firebase is authentication, but you could still use Firedart for that part.

@bksubhuti
Copy link

okay.. I'm glad you are making a high quality library. I guess I picked the right library to work with.
as for the other one, crdt_sync, it does look interesting. I forwarded it to another developer who does more advanced stuff for us. The main reason firestore is appealing is we don't need to host the server. For now, I think a manual sync will do the work needed. When we start adding other features it will be interesting to explore an automatic system Perhaps the cache will be done later one for that. Surely you are the one who is capable to implement. I feel confident in your abilities by your rejection of my help :).
Again your work is much appreciated. Sorry I was not skilled enough to help.

@cachapa
Copy link
Owner

cachapa commented Aug 9, 2023

I meant to say that the other (big) drawback of crdt_sync is you need to self-host it.
I might implement a hosting service at some point, but for now it has that very high requirement.

In any case, thank you for understanding and I look forward to your contributions when you feel more confident in your skills. Best of luck with your project!

@cachapa
Copy link
Owner

cachapa commented Aug 9, 2023

I created #120 to track the missing documentation, and will close this one because the discussion went completely off track :-)

@cachapa cachapa closed this as completed Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants