Skip to content
Open
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
12 changes: 6 additions & 6 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,14 +636,14 @@ class Framework {
};
size_t notification_idx = 0; // which message to send next
void send_notification() {
Pinetime::Controllers::NotificationManager::Notification notif;
const std::string &title = notification_messages.at(notification_idx*2);
const std::string &message = notification_messages.at(notification_idx*2+1);
std::copy(title.begin(), title.end(), notif.message.data());
notif.message[title.size()] = '\0'; // title and message is \0 separated
std::copy(message.begin(), message.end(), notif.message.data()+title.size()+1);
notif.message[title.size() + 1 + message.size()] = '\0'; // zero terminate the message
notif.size = title.size() + 1 + message.size();
char messagedata[title.size() + 1 + message.size() + 1];
std::copy(title.begin(), title.end(), messagedata);
messagedata[title.size()] = '\0'; // title and message is \0 separated
std::copy(message.begin(), message.end(), messagedata+title.size()+1);
messagedata[title.size() + 1 + message.size()] = '\0'; // zero terminate the message
Pinetime::Controllers::NotificationManager::Notification notif(messagedata, title.size() + 1 + message.size() + 1);
notif.category = static_cast<Pinetime::Controllers::NotificationManager::Categories>(notification_idx % 11);
notificationManager.Push(std::move(notif));
// send next message the next time
Expand Down