Skip to content

Commit 281b865

Browse files
authored
commented firebase notification code (PalisadoesFoundation#1503)
* commented firebase notification code, and removed Firebase related installation and configuration instructions * removed all references of firebase * removed firebase-admin package
1 parent 0937b7a commit 281b865

16 files changed

+22
-1635
lines changed

.env.sample

-23
Original file line numberDiff line numberDiff line change
@@ -50,29 +50,6 @@ SMTP_PORT=
5050
SMTP_SSL_TLS=
5151

5252

53-
# androidFirebaseOptions
54-
# These environment variables are used for configuring notification service
55-
# on android devices.
56-
57-
apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
58-
appId=1:XXXXXXXXXXXX:android:XXXXXXXXXXXXXXXXXXXXXX
59-
messagingSenderId=XXXXXXXXXXXX
60-
projectId=appname-XXXXXX
61-
storageBucket=appname-XXXXXX.appspot.com
62-
63-
64-
# iosFirebaseOptions
65-
# These environment variables are used for configuring notification service
66-
# on iOS devices.
67-
68-
iOSapiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
69-
iOSappId=1:XXXXXXXXXXXX:ios:XXXXXXXXXXXXXXXXXXXXXX
70-
iOSmessagingSenderId=XXXXXXXXXXXX
71-
iOSprojectId=appame-XXXXXX
72-
iOSstorageBucket=appame-XXXXXX.appspot.com
73-
iosClientId=XXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.apps.googleusercontent.com
74-
iosBundleId=com.appname.app
75-
7653
# Email for the first user who will be super admin
7754
# The user with the email address set with this parameter will automatically be elevated to Super Admin status on registration.
7855
#

INSTALLATION.md

-85
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ This document provides instructions on how to set up and start a running instanc
4040
- [Setting up Logger configurations _(optional)_](#setting-up-logger-configurations-optional)
4141
- [Setting up COLORIZE_LOGS in .env file](#setting-up-colorize_logs-in-env-file)
4242
- [Setting up LOG_LEVEL in .env file](#setting-up-log_level-in-env-file)
43-
- [Configuring Google Firebase](#configuring-google-firebase)
44-
- [Generate Firebase Keys for the Talawa Notification Service](#generate-firebase-keys-for-the-talawa-notification-service)
45-
- [(Mobile Developers Only) Applying the Firebase Keys to the Talawa Mobile App](#mobile-developers-only-applying-the-firebase-keys-to-the-talawa-mobile-app)
4643
- [Importing Sample Database](#importing-sample-database)
4744
- [Syntax:](#syntax)
4845
- [Examples:](#examples)
@@ -529,88 +526,6 @@ There are different logging levels that can be configured by setting this parame
529526
<br><br>
530527
For our application, the most appropriate setting is `LOG_LEVEL = info` since most of information logged on the console are error messages, warnings or info texts.
531528
532-
## Configuring Google Firebase
533-
534-
You need to have a `google` account to follow the following steps.
535-
536-
<br/>
537-
538-
### Generate Firebase Keys for the Talawa Notification Service
539-
540-
We use firebase for mobile app notifications. To configure the notification service create a new firebase project and follow these steps:-
541-
542-
1. Create a new Firebase project for Talawa-API
543-
1. When created you will automatically enter the project's console area
544-
1. Click on the settings icon beside the `Project Overview` heading
545-
1. Click on `Project Settings`
546-
1. Click on the `Service Accounts` tab
547-
1. Click on the `Node.js` radio button
548-
1. Click on `Generate New Private Key` button
549-
1. Confirm by clicking on `Generate Key`. This will automatically download the private keys in your browser.
550-
1. Securely store the `JSON` file containing the private key. These will be used in the next section.
551-
552-
### (Mobile Developers Only) Applying the Firebase Keys to the Talawa Mobile App
553-
554-
The key generated in the previous step is in a format suitable for use in a mobile app. We need to convert it for use by the API. This will require you to do some work in the talawa repository to do the necessary conversion. The resulting output will be stored in a `lib/firebase_options.dart` file. Some of the contents of this file will then need to be added to the API's `.env` file. Here we go.
555-
556-
1. Clone the talawa mobile app in a separate directory that is not under your Talawa-API directory.
557-
1. Enter that directory as you will need to edit files there
558-
1. Run the following commands to set the key in the environment variable for your respective operating system:
559-
560-
1. `Linux/macOS:`
561-
562-
export GOOGLE_APPLICATION_CREDENTIALS="/PATH/TO/JSON/FILE/filename.json"
563-
564-
1. `Windows:`
565-
566-
$env:GOOGLE_APPLICATION_CREDENTIALS="C:\PATH\TO\JSON\FILE\filename.json"
567-
568-
1. Install the [Firebase CLI](https://firebase.google.com/docs/cli#install_the_firebase_cli).
569-
1. Save the original copy the `lib/firebase_options.dart` file as it will be modified.
570-
1. Run the following commands in the project directory of talawa mobile app:
571-
572-
firebase login
573-
574-
dart pub global activate flutterfire_cli
575-
576-
1. Run any commands about exporting variables from the previous `dart` command.
577-
1. Run the following command to configure the application for Firebase
578-
`flutterfire configure`
579-
1. Select the project you created in the firebase console.
580-
1. Add `iOS` and `android` platforms to the project.
581-
1. Overwrite the `firebase_options.dart` file if asked so.
582-
1. The command will generate keys for the `iOS` and `android` platforms respectively and place them in the `firebase_options.dart` file.
583-
1. Edit the `firebase_options.dart` file.
584-
1. Add the parameters in the `static const FirebaseOptions android = FirebaseOptions` section of the `firebase_options.dart` file to the Talawa API `.env` file under the `androidFirebaseOptions` heading.
585-
586-
1. Replace any parameters that are already there in that section.
587-
1. Remove any trailing commas on the lines you have added.
588-
1. Remove any leading spaces on the lines you have added.
589-
1. The final result in the `.env` file should look like this
590-
591-
apiKey: '9f6297b283db701dab7766c993c48b',
592-
appId: '1:261699118608:android:366ff7dbdfba5c5a9e8392',
593-
messagingSenderId: '261699118608',
594-
projectId: 'talawa-thingy',
595-
storageBucket: 'talawa-thingy.appspot.com',
596-
597-
1. Add the parameters in the `static const FirebaseOptions ios = FirebaseOptions` section of the `firebase_options.dart` file to the Talawa API `.env` file under the `iosFirebaseOptions` heading. Replace any paramters that are already there.
598-
599-
1. Replace any parameters that are already there in that section.
600-
1. Remove any trailing commas on the lines you have added.
601-
1. Remove any leading spaces on the lines you have added.
602-
1. The final result in the `.env` file should look like this
603-
604-
apiKey: 'c2d283aa45f4e858c9cbfe32c58c67',
605-
appId: '1:261699118608:ios:1babbb3c07b8461ebdcb2',
606-
messagingSenderId: '261699118608',
607-
projectId: 'talawa-thingy',
608-
storageBucket: 'talawa-thingy.appspot.com',
609-
iosClientId: '261699118608-d519b739e43c6214374c0da62feaef.apps.googleusercontent.com',
610-
iosBundleId: 'com.example.talawa',
611-
612-
1. Undo the changes made to the `firebase_options.dart` file by overwriting it with the version you saved at the beginning of this section.
613-
614529
# Importing Sample Database
615530
616531
Talawa API contains a sample database importing function which can be used to import sample database.

0 commit comments

Comments
 (0)