From 87490e19d1b0f194f7851873743b53465912f7e6 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 29 Mar 2024 08:45:56 +0700 Subject: [PATCH] Fix custom token auth issue #14. --- examples/Messaging/Send/Send.ino | 19 ++++++++++++++++++- library.json | 2 +- library.properties | 2 +- src/FirebaseClient.h | 6 +++--- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/examples/Messaging/Send/Send.ino b/examples/Messaging/Send/Send.ino index 199ffcbc..42caf6ac 100644 --- a/examples/Messaging/Send/Send.ino +++ b/examples/Messaging/Send/Send.ino @@ -307,7 +307,24 @@ void loop() msg.data(data); - msg.notification(notification); + Messages::AndroidConfig androidConfig; + + // Priority of a message to send to Android devices. + // https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#androidmessagepriority + androidConfig.priority(Messages::AndroidMessagePriority::_HIGH); + + Messages::AndroidNotification androidNotification; + + // Set the relative priority for this notification. + // Priority is an indication of how much of the user's attention should be consumed by this notification. + // Low-priority notifications may be hidden from the user in certain situations, + // while the user might be interrupted for a higher-priority notification. + // https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#NotificationPriority + androidNotification.notification_priority(Messages::NotificationPriority::PRIORITY_HIGH); + + androidConfig.notification(androidNotification); + + msg.android(androidConfig); // You can set the content of msg object directly with msg.setContent("your content") diff --git a/library.json b/library.json index 87583b31..a9c05109 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "FirebaseClient", - "version": "1.0.4", + "version": "1.0.5", "keywords": "communication, REST, esp32, esp8266, arduino", "description": "Async Firebase Client library for Arduino.", "repository": { diff --git a/library.properties b/library.properties index cd76692b..68b69198 100644 --- a/library.properties +++ b/library.properties @@ -1,6 +1,6 @@ name=FirebaseClient -version=1.0.4 +version=1.0.5 author=Mobizt diff --git a/src/FirebaseClient.h b/src/FirebaseClient.h index d5ba211d..cdfada12 100644 --- a/src/FirebaseClient.h +++ b/src/FirebaseClient.h @@ -1,5 +1,5 @@ /** - * Created March 27, 2024 + * Created March 29, 2024 * * The MIT License (MIT) * Copyright (c) 2024 K. Suwatchai (Mobizt) @@ -30,7 +30,7 @@ #undef FIREBASE_CLIENT_VERSION #endif -#define FIREBASE_CLIENT_VERSION "1.0.4" +#define FIREBASE_CLIENT_VERSION "1.0.5" #include #include "./core/FirebaseApp.h" @@ -179,7 +179,7 @@ namespace firebase if (app.auth_data.user_auth.custom_token.val[cust_tk_ns::token][i] == '.') token_part++; - if (token_part == 3) + if (token_part == 2) app.auth_data.app_token.val[app_tk_ns::token] = app.auth_data.user_auth.custom_token.val[cust_tk_ns::token]; else // not a valid custom token, treat as a refresh token app.auth_data.app_token.val[app_tk_ns::refresh] = app.auth_data.user_auth.custom_token.val[cust_tk_ns::token];