hansemannn / titanium-firebase-database

Use the Firebase Realtime Database SDK in Axway Titanium 🚀
Other
7 stars 5 forks source link

feat(android): initial Android version #8

Closed m1ga closed 1 year ago

m1ga commented 2 years ago

This is just a very basic start!

FirebaseDatabase:

DatabaseReference:

Firestore Databse:

firebase.database-android-1.0.0.zip

m1ga commented 2 years ago

able to push data with auto id now! Example works now on Android, although it complains on iOS that FirebaseDatabase.getReference() is not allowed without an argument.

Screenshot_20220217_125028

hansemannn commented 2 years ago

@m1ga iOS requires an object with at least one of these keys:

  NSString *identifier = [arguments objectForKey:@"identifier"];
  NSString *path = [arguments objectForKey:@"path"];
  NSString *url = [arguments objectForKey:@"url"];
  NSArray *observableEvents = [arguments objectForKey:@"observableEvents"];
hansemannn commented 2 years ago

Fixed as part of https://github.com/hansemannn/titanium-firebase-database/commit/3c98b589ddb099d070d0c8338b996bef13eb7469

m1ga commented 2 years ago

@hansemannn nice :+1: will test that later

m1ga commented 2 years ago
hansemannn commented 2 years ago

@m1ga Anything I should change / add on iOS as well?

m1ga commented 2 years ago

At the moment I try to match the iOS version. Still have to find my way around it to see what url/path does and where I need to store what :smile: It's working but I need to check if both plugins store it in the same places

hansemannn commented 2 years ago

@m1ga Is this ready for review? I am adding Firestore as well, so I found this one

m1ga commented 2 years ago

oh, have to test that again. It worked but I'm not sure if it stored the data the same way as iOS did.

m1ga commented 2 years ago

updated the library and fixed some issues I had with having new "child in child" items all the time.

Only did some smaller tests and the data is there Screenshot_20220923_151721 I'm getting live updates/events and can add, update and delete items.

So if you have some test case I would love to get some feedback if the structure is right at the end

m1ga commented 1 year ago

Since I had to use it with Firestore Database today:

FirebaseDatabase.queryFirestore({
    collection: "collection",
    // document: "documentId"  // only one document - otherwise whole collection
});

FirebaseDatabase.addEventListener("query", function(e) {
    console.log(e.data);
});

will return an array of id: "", data: "..." where data is a JSON string.

firebase.database-android-1.0.0.zip

no other options yet, but reading works. Keep it in this module (since it is just called database) or should we create a firestore-database spin-off?

hansemannn commented 1 year ago

Let's start with this one and iterate from there :)