GithubHelp home page GithubHelp logo

Cloud Storage about qtfirebase HOT 5 CLOSED

shariatraad avatar shariatraad commented on July 28, 2024
Cloud Storage

from qtfirebase.

Comments (5)

shariatraad avatar shariatraad commented on July 28, 2024 1

A simple way to use Qtfirebase Real-time data base is this

  1. Add a child named "tests" to your Database/Data in firebase consul.

  2. Change your Database/Rules (Json file) in your firebase consul to :

{
  /* Visit https://firebase.google.com/docs/database/security to learn more about security rules. */
  "rules": {
    ".read": true,
    ".write": true
  }
}
  1. In your .h file include:
    QAndroidJniEnvironment *_jniEnv;
    ::firebase::App* _app;
    ::firebase::ModuleInitializer _initializer;
    QAndroidJniObject _jniObj;
    firebase::database::Database *database;
  1. In your .cpp file include:
    _jniEnv = new QAndroidJniEnvironment();
    QAndroidJniObject jniObject = QtAndroid::androidActivity();
    ::firebase::App *instance = ::firebase::App::GetInstance();

    if (instance) {
        qDebug() << "instance already exists";
        _app = instance;
    } else {
        qDebug() << "Creating instance";
        jniObject = QtAndroid::androidActivity();
        _app = ::firebase::App::Create(*_jniEnv, jniObject.object<jobject>());
    }
    database=firebase::database::Database::GetInstance(_app);
    firebase::database::DatabaseReference dbref = database->GetReferenceFromUrl("Enter Your Real-time Database URL Here");

    dbref.Child("tests").SetValue(Add Your Custom Value Here);

from qtfirebase.

larpon avatar larpon commented on July 28, 2024 1

Hi! Thanks for your interest!

Is QtFirebase Cloud Storage still unavailable for c++?

Yes, I'm currently unaware of the status. Maybe @Furkanzmc can give you more information on the status. If it's abandoned you're welcome to contribute an implementation!

And I also noticed that real-time database is partially available. What functions are still not accessible?

Correct. It need to be expanded further to cover the complete API. Pull requests are welcome!
A quick grep through the code base for db:: (namespace db = ::firebase::database). Reveals this list of calls used:

qtfirebasedatabase.cpp
26:        m_db = db::Database::GetInstance(qFirebase->firebaseApp());

qtfirebasedatabase.h
67:    firebase::database::Database* m_db;
192:    firebase::database::DatabaseReference m_dbRef;

qtfirebasedatabase.cpp
10:    , m_db(nullptr)
26:        m_db = db::Database::GetInstance(qFirebase->firebaseApp());
230:            m_dbRef = qFirebaseDatabase->m_db->GetReference().GetRoot();
234:            m_dbRef = qFirebaseDatabase->m_db->GetReference().GetRoot().Child(path.toUtf8().constData());
244:        m_pushChildKey = m_dbRef.PushChild().key();
255:        firebase::Future<void> future = m_dbRef.RemoveValue();
268:            m_dbRef = m_dbRef.Child(m_pushChildKey.toUtf8().constData());
270:        firebase::Future<void> future = m_dbRef.SetValue(QtFirebaseService::fromQtVariant(value));
289:            firebase::Future<firebase::database::DataSnapshot> future = m_dbRef.GetValue();
302:    firebase::Future<void> future = qFirebaseDatabase->m_db->GetReference().UpdateChildren(vfb);
385:        m_query.setQuery(m_dbRef.OrderByKey());
392:        m_query.setQuery(m_dbRef.OrderByValue());
399:        m_query.setQuery(m_dbRef.OrderByChild(path.toUtf8().constData()));
406:        m_query.setQuery(m_dbRef.OrderByPriority());
413:        m_query.setQuery(m_dbRef.StartAt(QtFirebaseService::fromQtVariant(order_value)));
421:        m_query.setQuery(m_dbRef.StartAt(QtFirebaseService::fromQtVariant(order_value), child_key.toUtf8().constData()));
428:        m_query.setQuery(m_dbRef.EndAt(QtFirebaseService::fromQtVariant(order_value)));
435:        m_query.setQuery(m_dbRef.EndAt(QtFirebaseService::fromQtVariant(order_value), child_key.toUtf8().constData()));
442:        m_query.setQuery(m_dbRef.EqualTo(QtFirebaseService::fromQtVariant(order_value)));
449:        m_query.setQuery(m_dbRef.EqualTo(QtFirebaseService::fromQtVariant(order_value), child_key.toUtf8().constData()));
456:        m_query.setQuery(m_dbRef.LimitToFirst(limit));
463:                m_query.setQuery(m_dbRef.LimitToLast(limit));

So the API calls not available, are the ones missing from this list plus what's not present in qtfirebasedatabase.h.
I remember another issue where some of the missing functionality at the time was also mentioned.
So you'll have to do some investigation to find out the exact missing calls I guess.

Thanks for the quick example - much obliged!

(But I still wonder if there is a way to use Qtfirebase Cloud Storage ...)

There is only a way to use Cloud Storage through QtFirebase if someone contributes a wrap of storage.h - It looks pretty straight forward at first glance. I would be very cool to have it contributed!
... Untill then you're stuck with using it straight from the Firebase C++ SDK as provided by Google

from qtfirebase.

shariatraad avatar shariatraad commented on July 28, 2024 1

@larpon Hello Larpon.
Thank you so much for your time and the detailed answer. It is all clear now! :) If I come up with a wrapper or find something helpful I will share it with you.
The example I provided is the most basic one just to make sure if you are successfully connected to the database. Thought it might be helpful for some beginners.

from qtfirebase.

larpon avatar larpon commented on July 28, 2024 1

@shariatraad no problem - thanks for showing your interest in the project!
People tend to contribute just wrappers for what they need on a per project basis - so that's why some of the larger components are missing features. So we expand only when people need the functionality - and are kind enough to contribute code back :)

from qtfirebase.

shariatraad avatar shariatraad commented on July 28, 2024

(But I still wonder if there is a way to use Qtfirebase Cloud Storage and what functions are unavailable for Real-time Database)

from qtfirebase.

Related Issues (20)

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.