I’m having difficulty creating a conditional side menu.
If you are a regular user, you must disable the admin item.
If you are an admin user, you must enable the admin item in the side menu.
How should I proceed?
When screen init you set to get tag list when you are getting the value in listview , you set the firebase get value into a variable but where is the firebase to get value block???
No, I only showed part of my block.
The part where I’m struggling.
This screen is where the registered user with an administrator profile will see a complete list of all registered users.
Here, the ADMIN user will have the power to register new users and delete them.
This whole part is working perfectly.
Welcome. I suggest to split the app into 2 projects.
Separate the routines for each type of user that can access.
And create the 2 apps independent of each other.
Example: Look at this routine to enable the side menu, it won’t exist if you separate the routines into 2 apps.
In future updates in 1 app , will not interfere with the other app (in case of bugs)
Thanks Rogerio.
It’s a much simpler solution. Hadn’t really thought about it.
I will look forward to receiving other suggestions. In case I can’t solve it, I’ll accept your idea.
tks
You have highlighted a block there instead of using another if condition in in the else block just use only the procedure.
I.e If select list item list get global dados user index 4 = admin Then menu admin procedure Else menu user procedure
However you will be getting the value either as admin or user. So if the value is admin let it open admin menu if not let it to open user menu. Just try and let me know it
When user register on your app then simply save a value in firebase that u later can use to differentiate the users as admin or normal users.
And then use a simple if else logic.
If fb admin tag value = true
Then side menu visible
Else side menu disable
I already have in the base the values of the common users or administrator.
In the first screen, the user logs in normally, after he is directed to another screen.
If the user logged in to “admin” then this item should appear:
But after getting tag list , you need to get fb value then only this part will work. If possible show us the fb structure…
Also in oder to make more complex why don’t you make it simple one. . After registration just save the name in a tinydb as admin or user. And in this screen in the screen initial itself just check the tinydb value. If it is admin show admin if not show user
If not you can create another bucket as admin and user after successful login or registration.
Like
(Admin-bucket)
Tag(username) - value (yes)
In this screen just get tag list of the bucket admin and user. If the name existing in either one show the relevant sidemenu
I don’t think that is good idea… you need to check the particular user is admin or user. Suppose if you set across the base mean, app will favour to what you using the search text. It means in the Is in the list if you User , then app will open User panel only because across the base mean user text is present That’s why I am telling this is not good.