Skip to content

Commit db3144c

Browse files
committed
main: one notification per notification category
Notifications store the title and the message in the same array, separated by a `\0`. Add the notification category as title to the notifications. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vitae aliquet nec ullamcorper sit amet. Id aliquet risus feugiat in ante metus dictum at. Ut porttitor leo a diam sollicitudin. Ultrices tincidunt arcu non sodales neque sodales ut etiam sit. Pellentesque dignissim enim sit amet. Urna nec tincidunt praesent semper feugiat nibh sed pulvinar proin. Tellus id interdum velit laoreet id donec ultrices tincidunt. Viverra maecenas accumsan lacus vel facilisis volutpat est velit egestas. Volutpat consequat mauris nunc congue.
1 parent d548c71 commit db3144c

1 file changed

Lines changed: 39 additions & 5 deletions

File tree

main.cpp

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,14 +376,48 @@ class Framework {
376376
SDL_RenderPresent(renderer);
377377
}
378378

379+
// prepared notficitions, one per message category
380+
const std::vector<std::string> notification_messages {
381+
"category:\nUnknown",
382+
"Lorem ipsum\ndolor sit amet,\nconsectetur adipiscing elit,\n",
383+
"SimpleAlert",
384+
"sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
385+
"Email:",
386+
"Vitae aliquet nec ullamcorper sit amet.",
387+
"News:",
388+
"Id\naliquet\nrisus\nfeugiat\nin\nante\nmetus\ndictum\nat.",
389+
"IncomingCall:",
390+
"Ut porttitor leo a diam sollicitudin.",
391+
"MissedCall:",
392+
"Ultrices tincidunt arcu non sodales neque sodales ut etiam sit.",
393+
"Sms:",
394+
"Pellentesque dignissim enim sit amet.",
395+
"VoiceMail:",
396+
"Urna nec tincidunt praesent semper feugiat nibh sed pulvinar proin.",
397+
"Schedule:",
398+
"Tellus id interdum velit laoreet id donec ultrices tincidunt.",
399+
"HighProriotyAlert:",
400+
"Viverra maecenas accumsan lacus vel facilisis volutpat est velit egestas.",
401+
"InstantMessage:",
402+
"Volutpat consequat mauris nunc congue.",
403+
};
404+
size_t notification_idx = 0; // which message to send next
379405
void send_notification() {
380406
Pinetime::Controllers::NotificationManager::Notification notif;
381-
const std::string message("Lorem Ipsum");
382-
std::copy(message.begin(), message.end(), notif.message.data());
383-
notif.message[message.size() - 1] = '\0';
384-
notif.size = message.size();
385-
notif.category = Pinetime::Controllers::NotificationManager::Categories::SimpleAlert;
407+
const std::string &title = notification_messages.at(notification_idx*2);
408+
const std::string &message = notification_messages.at(notification_idx*2+1);
409+
std::copy(title.begin(), title.end(), notif.message.data());
410+
notif.message[title.size()] = '\0'; // title and message is \0 separated
411+
std::copy(message.begin(), message.end(), notif.message.data()+title.size()+1);
412+
notif.message[title.size() + 1 + message.size()] = '\0'; // zero terminate the message
413+
notif.size = title.size() + 1 + message.size();
414+
notif.category = static_cast<Pinetime::Controllers::NotificationManager::Categories>(notification_idx % 11);
386415
notificationManager.Push(std::move(notif));
416+
// send next message the next time
417+
notification_idx++;
418+
if (notification_idx >= notification_messages.size()) {
419+
notification_idx = 0;
420+
}
387421
}
388422

389423
// can't use SDL_PollEvent, as those are fed to lvgl

0 commit comments

Comments
 (0)