firebase-rest-api icon indicating copy to clipboard operation
firebase-rest-api copied to clipboard

[Bug]: Android APP crashes.

Open AlejandroPG10 opened this issue 1 year ago • 30 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Environment

-   OS: 
-   Python:3.10

What happened?

I was recommended to use this library because of pyrebase4 failures. The app (made with kivymd) is now running well in the computer as I did with pyrebase.

Now the problem is that probably I'm not using the correct requirements. So that makes the app crash on the mobile.

Please need to clarify which are the correct requirements for buildozer that I have to use for firebase-api-rest.

These are the ones that are not running well for me:

requirements = python3,kivy==2.1.0,kivymd==1.1.1,kivygradient,firebase-admin,firebase-rest-api,grpcio,grpcio-status,pkce,proto-plus,cachecontrol,msgpack,requests,certifi,charset-normalizer,idna,urllib3,google-api-core,google-auth,cachetools,pyasn1-modules,pyasn1,rsa,pyasn1,googleapis-common-protos,protobuf,google-api-python-client,google-auth-httplib2,httplib2,pyparsing,uritemplate,google-cloud-firestore,google-cloud-core,proto-plus,google-cloud-storage,google-resumable-media,google-crc32c

Any help please?

Code Snippet

import firebase
from kivymd.app import MDApp

class MyFireBase():
    def __init__(self):
        self.logged_mail = None
    def login_app(self, mail, password):

        config = {
            "apiKey": "**********************************",
            "authDomain": "********************************",
            "databaseURL": "***************************",
            "storageBucket": "***************************",
            "projectId": "********************"}

        firebase_1 = firebase.initialize_app(config)
        db = firebase_1.database()
        users = db.child("Accesos").get()
        for user in users.each():
            if str(user.val()["password"]) == password and str(user.val()["mail"]) == mail:
                self.logged_mail = mail #Guardamos el mail que ha entrado
                MDApp.get_running_app().change_screen("home_screen")
                break
        else:
            MDApp.get_running_app().root.ids['login_screen'].ids['invalid'].text = 'Incorrect user or password'

    def change_password(self,new_password):
        if self.logged_mail is not None:
            config = {
                "apiKey": "*************************************",
                "authDomain": "********************************",
                "databaseURL": "************************************",
                "storageBucket": "****************************************",
                "projectId": "***********************************"}
            firebase_1 = firebase.initialize_app(config)
            db = firebase_1.database()
            users = db.child("Accesos").get()

            for user in users.each():
                if str(user.val()["mail"]) == self.logged_mail:
                    user_id = user.key() #Sacas el padre de mail para después cambiar la password
                    db.child("Accesos").child(user_id).update({"password": new_password})
                    break

This is the code I'm using with firebase-rest-api

Relevant log output

No response

Anything else?

No response

AlejandroPG10 avatar May 20 '23 17:05 AlejandroPG10