The admin variable is in sign in screen . If Admin sign in admin variable is true or if user sign in ,admin variable is false. And after sign in we navigate to menu screen. In menu screen we check admin value. If true create job, create new user button’s visible are true , if not these button’s visible are false . But when I run and test . The value is correct but the menu screen is not. All button are shown. What can I do?
How do you set that a user is admin or a regular user, in the first place ?
Let me tell you how i solved this admin/regular user issue. On my RealTime Database, one of the fields is “admin_value”, that takes user
s e-mail value. So when program starts, it checks if e-mail used to login exists in that field, so app will recognize it as admin. If it doesnt exists, user is just a regular one. This cant be stored only on a local stored var, as anyone can clear apps cache and admin status will be lost.
Screen shows only duplicates same thing. Not seeing any difference between “starts” and “opens” screens. When “screen starts” supposed to do some actions only the first time when screen is shown. “Open screens” does the actions everytime user navigate to that screen.
I have the same need in my app, to do something one time only when i navigate to a screen, so i put in “screen starts”, but to do many other actions everytime when i navigate to that screen, except those actions already done when screen started for the first time.
The problem is that for the first time when screen starts, both actions will take place.
So i used a variable to not mess up actions, and let it in order.
initialize logical_var to true
when screen starts
logical_var set to false
when screen opens
repeat while logical_var
wait 0.001 s
This way, “open screens” actions will wait until all actions from “start screen” will execute first
logical_var will be set to false, and will remain this way for the whole time from now on, so will not interfere with next screen opens furthermore.