Firebase Collections
As you have know there are multiple collection has been used in firebase. Let's see what is the use of the collection and how it added
Note: If any error occur in app check in firebase if missing any below
Required config is
missing if not then check there field and datatype and key word same to same
as given in document
There are 14 collections created in the firebase
- admin
- config -> {usageControls, userAppSettings, agoraToken}
- users - [Auto generate]
- calls - [Auto generate]
- groups - [Auto generate]
- messages - [Auto generate]
- broadcast - [Auto generate]
- wallpaper
- report - [Auto generate]
- languages
Let see detail about all the collections.
NOTE :
In above collection list [Auto generate] means this collections are
generate in firebase whenever any first user enter any data
. For other collections need to add manually in firebase. See the below 2
options for add collection data in firebase.
There are 2 ways to import Data in Firebase
- By Import Json which we have provided
- Collection Data add manually
By Import Json which we have provided :- OPTION 1
NOTE :
Before import json in firestore database remember to Configure or create.
See the Firebase Rules for create Firestore
Database and how to give
permission
in firebase.
Also you can check below video for how to import json in firebase:
VIDEO URL :
https://youtu.be/Jd0sW8Wrc5Y?si=AxC6BmWBFwZfZU4a
- Firstly download our chatify.json and keep it in one folder or desktop
- Now go to your Firebase project, On left hand side panel click on setting
icon. On click Setting button pop open open. In that click on Project
Settings
- Now go to Service accounts
-
Now click on button Generate new private key
-
After click on button on pop-up appear int that click on Generate
key
-
After click on Generate
key your json will be download copy that json and paste in the
folder where you have kept chatify.json
If you kept chatify.json in desktop and keep downloaded json in desktop and rename that json file - Now open terminal or command prompt go to the path you have kept both json For example : c:\desktop\
-
Now Copy below command in that remeber to change your rename json name
Example :npx -p node-firestore-import-export firestore-import -a [your rename file name].json -b chatify.json
npx -p node-firestore-import-export firestore-import -a chatapp.json -b chatify.json - After enter above command confirmation for import will be ask just type "y" and enter it
Collection Data add manually :- OPTION 2
1. admin:
- For Admin access you need to add credentials for login in firebase we have create 2 login credentials. You can create as per you requirement.
- In Project (admin@gmail.com, Admin1234) credentials are for all the users with this credentials they can't access in live you can remove this condition from project which is admin project -> lib -> controllers -> auth_controllers -> phone_controller.dart
- There are 2 field in admin config, copy and paste one by one in firebase
and create
collection
in your project
No. Fields -> datatype 1. userName -> string -> Your email for admin login 2. password -> string -> Your password for admin login - You admin config look like this :
- Further more detail you can see in Admin Panel Setup
2. config:
In config collection there are 3 more documents
- usageControls
- userAppSettings
- agoraToken
- usageControls
usageControls for controlles your whole app for accessing limited data like if you want hide or enter limited media sharing etc.
No. Fields -> datatype statusDeleteTime -> string -> /// set your status delete time; allowCreatingBroadcast -> bool -> /// If you want to create brodcast just give true else false in value; allowCreatingGroup -> bool -> /// If you want to create group just give true else false in value; allowCreatingStatus -> bool -> /// If you want to create status just give true else false in value; allowUserSignup -> bool -> /// If you want to Users to Sign up just give true else false in value; callsAllowed -> bool -> /// If you want to Users can call just give true else false in value; existenceUsers -> bool -> /// If you want to add existence user just give true else false in value; mediaSendAllowed -> bool -> /// If you want to Users can send media just give true else false in value; showLogoutButton -> bool -> /// If you want to show logout button just give true else false in value ; textMessageAllowed -> bool -> /// If you want to user can text message just give true else false in value; broadCastMembersLimit -> number -> /// set your brodcast mamber limit; groupMembersLimit -> number -> /// set your group mamber limit; maxFileSize -> number -> /// set your maximum file size share limit; maxFilesMultiShare -> number -> /// set your maximum multi share file limit; maxContactSelectForward -> number -> /// set your maximum selected contects forward limit;
- userAppSettings
userAppSettings for change some ID's like banner Ad Id etc.
No. Fields -> datatype allowUserBlock -> bool -> /// If you want user can block other user you just give true else false in value; approvalMessage -> string -> /// Add your custom message for user user approvalNeeded -> bool -> /// If approval needed from admin you just give true else false in value; bannerAndroidId -> string -> /// Your android banner Ad Id; bannerIOSId -> string -> /// Your banner IOS Ad Id facebookAddAndroidId -> string -> /// Your facebook android Ad Id facebookAddIOSId -> string -> /// Your facebook IOS Ad Id firebaseServerToken -> string -> /// Your Firebase server token for send notification; gifAPI -> string -> /// Your Gif Api Key; isAdmobEnable -> bool -> /// If approval needed from admin you just give true else false in value; isGoogleAdEnable -> bool -> /// If you want user can show Ads just give true else false in value; isMaintenanceMode -> bool -> /// If you want user can show Maintenance Mode just give true else false in value; maintenanceMessage -> string -> /// Your Maintenance Message; rateApp -> string -> /// Your App Id; rateAppIos -> string -> /// Your IOS App Id;
- agoraToken
Add your Agora token for Audio and Video call
No. Field -> datatype agoraToken -> string -> /// Your agora token; agoraAppId -> string -> /// Your agora App id; appCertificate -> string -> /// Your agora Primary App Certificate;
3. users:
- Your all app users will show in users collections
4. calls:
- Your all users Calls list show in your calls collections
5. groups:
- Your app users created group list
6. messages:
- Your app users all chat Messages list
7. broadcast:
- Your app users created broadcasts list
8. wallpaper:
- Wallpapers are listed in the app from firebase. If you want to set background Image in chats you can set from list which shows in background in Single chat and Group chat. You need to add background Image from admin panel compulsory
- If you want see how to add wallpaper then go to Wallpaper
tab
9. languages:
- Languages are listed in the app from firebase. If you want to set default Language in app you can set in firebase in default_language collection
- If you want see how to add Language then go to Change or Add Language
tab