-
-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make notifications list an application.
No dedicated button to show notification, instead swipe left to right on watchface.
- Loading branch information
Showing
5 changed files
with
58 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
FILE(GLOB app_sources *.c) | ||
target_sources(app PRIVATE ${app_sources}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include <notification/notification_ui.h> | ||
#include <application_manager.h> | ||
#include <zephyr/kernel.h> | ||
#include <zephyr/init.h> | ||
#include <notification_manager.h> | ||
|
||
// Functions needed for all applications | ||
static void notification_app_start(lv_obj_t *root, lv_group_t *group); | ||
static void notification_app_stop(void); | ||
|
||
static application_t app = { | ||
.name = "Notification", | ||
.hidden = true, | ||
.start_func = notification_app_start, | ||
.stop_func = notification_app_stop | ||
}; | ||
|
||
static void on_notification_page_notification_close(uint32_t not_id) | ||
{ | ||
// TODO send to phone that the notification was read. | ||
notification_manager_remove(not_id); | ||
} | ||
|
||
|
||
static void notification_app_start(lv_obj_t *root, lv_group_t *group) | ||
{ | ||
int num_unread; | ||
not_mngr_notification_t notifications[NOTIFICATION_MANAGER_MAX_STORED]; | ||
|
||
notification_manager_get_all(notifications, &num_unread); | ||
notifications_page_init(on_notification_page_notification_close); | ||
notifications_page_create(notifications, num_unread, group); | ||
} | ||
|
||
static void notification_app_stop(void) | ||
{ | ||
notifications_page_close(); | ||
} | ||
|
||
static int notification_app_add(void) | ||
{ | ||
application_manager_add_application(&app); | ||
|
||
return 0; | ||
} | ||
|
||
SYS_INIT(notification_app_add, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 4 additions & 5 deletions
9
app/src/ui/notifications_page.h → ...plications/notification/notification_ui.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
#ifndef __NOTIFICATIONS_PAGE_H | ||
#define __NOTIFICATIONS_PAGE_H | ||
#ifndef __NOTIFICATION_UI_H | ||
#define __NOTIFICATION_UI_H | ||
|
||
#include <inttypes.h> | ||
#include <notification_manager.h> | ||
#include <lvgl.h> | ||
|
||
typedef void(*on_notification_page_closed_cb_t)(void); | ||
typedef void(*on_notification_remove_cb_t)(uint32_t id); | ||
|
||
void notifications_page_init(on_notification_page_closed_cb_t closed_cb, on_notification_remove_cb_t not_removed_cb); | ||
void notifications_page_init(on_notification_remove_cb_t not_removed_cb); | ||
|
||
void notifications_page_create(not_mngr_notification_t *notifications, uint8_t num_notifications, | ||
lv_group_t *input_group); | ||
|
||
void notifications_page_close(void); | ||
#endif // __NOTIFICATIONS_PAGE_H | ||
#endif // __NOTIFICATION_UI_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters