Admin Setup
Note: As some of the app data are manage from firebase so we provide admin
panel for easy management rather then go to firebase again and again and do
changes or for searching
In Admin Panel we provide you to manage users list, Subscription User list, Characters dynamic, Subscription list, Category hide show managemnet, onboard screen and most important general config setting like credentials, logo.
Note: For config collection and plans you have to add data manually in
firebase.
For config
see the steps in Firebase Rules and for
plans
see the Add Subscription
If you want to create new project run the following command to make one:
flutter create
If you haven't installed it, be sure to install it first.
If you want to change in Chatify admin you can do change and apply your firebase credentials in index.html and in main.dart
Follow below steps for firbase admin setup
1. Setup Firebase
- Login into current Firebase Account.
- Select Chatify App
-
In Project Setting, scroll down and click Add App.
- One pop up will appear, in that select html tag (>) option.
- Now enter your app name
- Now check on checkbox for the web hosting and provide hosting name (web name)
and click
on Register app button
- Now select Use a
<script> tag and copy code in your admin project inside
web/index.html
- Now initalize firebase in main.dart
- Add Data according to your requirement.
Note: or access your data in admin panel also upload your image you need
to give
permission
to Firestore database for data, get update and Storage for Images
Upload. For
that see
the Firebase Rules
2. Add Admin credentials for Login
- Before using app you need to add Admin credentials for Login.
- Go to firebase console https://console.firebase.google.com/
- Select Project, after that on left handel menu click Firestore Database
- Now click on Start Collection one pop-up will appear give collection name
admin
- After that click on Auto-ID
- Add All below field in firebase
No. Fields -> datatype 1. userName -> string -> Your email for admin login 2. password -> string -> Your password for admin login
- You can add multiple admin credentials in this by adding as above fields
Note: If you want to create a user for testing purposes, add (userName: admin@gmail,password : Admim1234) credentials in firebase. Follow STEPS 2 for add credentialsNote: If you want to create a user for testing purposes, add (userName: admin@gmail,password : Admim1234) credentials in firebase. Follow STEPS 2 for add credentials - Your firestore database look like below
Note: Remember to add all collection in firebase like users, config,
characters,
etc.. as per your requirement you can remove the page and
controller
3. Install the firebase-tools CLI
- 🏃♀Skip this step if you already have firebase-tools installed.
- If you do not have npm, you must install that first.
-
☝️Note: If you are not sure whether npm is installed on your machine, run $ npm
-v , and
see if it lists a version number. If it does, then you already have npm.
- Installing npm on windows.
- Installing npm on linux.
- Installing npm on mac.
- Or download it directly from Node.js.
- Once npm is installed, run the following command to install the firebase-tools:
npm install -g firebase-toolsIf you haven't installed it, be sure to install it first.
- firebase-tools is now installed!
4. Initialize Firebase hosting for your Flutter project
- Open a terminal and navigate to the root directory for your Flutter app and run
this
command
to login:
firebase loginIf you haven't installed it, be sure to install it first.
- ☝️Note: If you are already logged in and want to re-login as different account,
first
logout
with:
firebase logoutIf you haven't installed it, be sure to install it first.
-
Follow the command prompt and the link in your browser. Accept the permissions
by
clicking
Ok. When you return to your terminal you should see that you are now logged
in:
- Next, run this command from the root directory of your Flutter app to initialize
your
Firebase project:
firebase initIf you haven't installed it, be sure to install it first.
- Use the arrow keys to navigate the cursor to Hosting and hit the spacebar to
select it,
then
press enter. Now you will see this screen:
- Select Use an existing project by pressing Enter. Use the arrow keys to
select
the
project
you made in step 1.
- Build your app for web:
flutter build webIf you haven't installed it, be sure to install it first.
- Next, write build/web as the public directory and press enter, then enter n (for no) to select the single page app option
- Next, write y (for yes) to Configure as a single-page app (rewrite all urls to /index.html)? option
- Next, write n (for no) to deploy with Github option
- Next, write y (for yes) to overwrite 404.html option, If this option show
- Next, write y (for yes) to overwrite index.html option
- ☝️Note: After this step, 2 new files are created (.firebaserc and firebase.json) in your root directory. Check and make sure they are there. If not, check for errors in the firebase init step and retry.
- Again Build your app for web:
flutter build webIf you haven't installed it, be sure to install it first.
- This builds the necessary files in
/build/web. - Finally, run:
firebase deployIf you haven't installed it, be sure to install it first.
- The hosting files are uploaded and hosted at your Firebase URL. You can follow the link in your terminal to your Flutter web project!