Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33311564
D5263.1768811971.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D5263.1768811971.diff
View Options
diff --git a/services/tunnelbroker/rust-lib/src/lib.rs b/services/tunnelbroker/rust-lib/src/lib.rs
--- a/services/tunnelbroker/rust-lib/src/lib.rs
+++ b/services/tunnelbroker/rust-lib/src/lib.rs
@@ -8,18 +8,21 @@
#[cxx::bridge]
mod ffi {
+ #[namespace = "rust::notifications"]
#[cxx_name = "apnsReturnStatus"]
enum apns_status {
Ok,
Unregistered,
BadDeviceToken,
}
+ #[namespace = "rust::notifications"]
#[cxx_name = "fcmReturnStatus"]
enum fcm_status {
Ok,
InvalidRegistration,
NotRegistered,
}
+ #[namespace = "rust::notifications"]
extern "Rust" {
#[cxx_name = "sendNotifToAPNS"]
fn send_notif_to_apns(
diff --git a/services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp b/services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
--- a/services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
+++ b/services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp
@@ -170,16 +170,19 @@
const std::string notificationMessageTitle = "New message";
const std::string notificationMessageText = "You have a new message";
if (deviceOs == "iOS" && !notifyToken.empty()) {
- const apnsReturnStatus apnsResult = sendNotifToAPNS(
- config::ConfigManager::getInstance().getParameter(
- config::ConfigManager::OPTION_NOTIFS_APNS_P12_CERT_PATH),
- config::ConfigManager::getInstance().getParameter(
- config::ConfigManager::OPTION_NOTIFS_APNS_P12_CERT_PASSWORD),
- notifyToken,
- config::ConfigManager::getInstance().getParameter(
- config::ConfigManager::OPTION_NOTIFS_APNS_TOPIC),
- notificationMessageText,
- false);
+ typedef rust::notifications::apnsReturnStatus apnsReturnStatus;
+ const apnsReturnStatus apnsResult =
+ rust::notifications::sendNotifToAPNS(
+ config::ConfigManager::getInstance().getParameter(
+ config::ConfigManager::OPTION_NOTIFS_APNS_P12_CERT_PATH),
+ config::ConfigManager::getInstance().getParameter(
+ config::ConfigManager::
+ OPTION_NOTIFS_APNS_P12_CERT_PASSWORD),
+ notifyToken,
+ config::ConfigManager::getInstance().getParameter(
+ config::ConfigManager::OPTION_NOTIFS_APNS_TOPIC),
+ notificationMessageText,
+ false);
if ((apnsResult == apnsReturnStatus::Unregistered ||
apnsResult == apnsReturnStatus::BadDeviceToken) &&
!database::DatabaseManager::getInstance()
@@ -189,7 +192,8 @@
"Can't clear the device token in database");
}
} else if (deviceOs == "Android" && !notifyToken.empty()) {
- const fcmReturnStatus fcmResult = sendNotifToFCM(
+ typedef rust::notifications::fcmReturnStatus fcmReturnStatus;
+ const fcmReturnStatus fcmResult = rust::notifications::sendNotifToFCM(
config::ConfigManager::getInstance().getParameter(
config::ConfigManager::OPTION_NOTIFS_FCM_SERVER_KEY),
notifyToken,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 19, 8:39 AM (20 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5954652
Default Alt Text
D5263.1768811971.diff (3 KB)
Attached To
Mode
D5263: [services] Tunnelbroker - Using `rust::notifications` namespace for calling Rust from C++
Attached
Detach File
Event Timeline
Log In to Comment