Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename FMC to FCM in example #151

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dart/send_push_notification/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
A Dart Cloud Function that send push notification using FCM to particular user.

* Make sure that you are integrated FCM into your app (Web/Android/Apple/Flutter)
* Generate needed `FMC_SERVER_KEY` env variable
* Generate needed `FCM_SERVER_KEY` env variable

### Hot to get FCM Server Key

Expand Down Expand Up @@ -50,7 +50,7 @@ _Example output 2:_

List of environment variables used by this cloud function:

* **FMC_SERVER_KEY** - Server Key for FCM settings
* **FCM_SERVER_KEY** - Server Key for FCM settings

## 🚀 Deployment

Expand Down Expand Up @@ -82,7 +82,7 @@ runtime [README](https://github.com/open-runtimes/open-runtimes/tree/main/runtim
4. Execute function:

```shell
curl http://localhost:3000/ -d '{"variables":{"FMC_SERVER_KEY":"YOUR_FMC_SERVER_KEY"},"payload":"{\"user_token\":\"USER_FCM_TOKEN\"}"}' -H "X-Internal-Challenge: secret-key" -H "Content-Type: application/json"
curl http://localhost:3000/ -d '{"variables":{"FCM_SERVER_KEY":"YOUR_FCM_SERVER_KEY"},"payload":"{\"user_token\":\"USER_FCM_TOKEN\"}"}' -H "X-Internal-Challenge: secret-key" -H "Content-Type: application/json"
```

## 📝 Notes
Expand Down
4 changes: 2 additions & 2 deletions dart/send_push_notification/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void returnFailure(final res, final String message) {
}

bool checkEnvVariables(final req, final res) {
if (req.variables['FMC_SERVER_KEY'] == null) {
if (req.variables['FCM_SERVER_KEY'] == null) {
returnFailure(res, "Some Environment variables are not set");
return false;
}
Expand All @@ -37,7 +37,7 @@ Future<void> start(final req, final res) async {
if (!checkEnvVariables(req, res)) {
return;
}
final String serverKey = req.variables['FMC_SERVER_KEY'];
final String serverKey = req.variables['FCM_SERVER_KEY'];

final payload = jsonDecode(req.payload == '' ? '{}' : req.payload);
if (!checkPayload(payload, res)) {
Expand Down