-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for dbus and chrome notifications in mandelboxes (#5304)
* integrate beeep-wrapper builds into cmake/download-binaries * enable throwing notifs on awesomewm using dbus protocols: first step toward linking awesomewm notifs with whist protocol * enable d-bus env variable syncing for notifications to show up in d-bus * fix cmakelists conflict * move to asynchronous event listening with libevent * successfully add multithreaded notification catching * enable packet sending, add client-side interception code * add client-side notif-receiving capability * format notification code, add docstrings * clean up old comments * fix minor bugs regarding beeep download + linking * enable native client-side notification display on mac * fix fatal OOB memory error * remove beeep * add stubs for windows and linux native notifications * prevent notifications from being thrown in the awesome window * fix last-line \n and refactor notifications in client * further reorganization of client-side notification files * fix client-side compilation errors * remove unnecessary bundle hacks * docs for display notifications * update notification docs * further updates to notification docs * clean up dockerfiles/scripts * reorganize notifs docs * fix display notifs * fix dockerfile lint issues * major refactoring of server-side notifications.c/h: use thread_init and thread_destroy, remove need for globals, etc. * further refactoring and documentation of notifications.c * add some docs to notifications.h * log statistics * fix copyright * add more detailed docs to server-side notifs * reduce notif size significantly * remove unistd * fully test local notifs * only import notifications on linux * add windows/macos stubs for notifications - feature only avail on linux * make logging accessible to stub fns * include notifications before the non-linux stubs * fix clang-tidy issues * add comment abt notification size * remove backticks * refactor dbus configurations into an executable * remove unnecessary env variable passing - it's already defined * enable gnome keyring and connect to chrome * add dbus-address to cmdling OPTIONS * remove ifdef linux in main.c via wrapper fn * remove unnecessary event_base typedef * always include notifications.h * fix fatal server-side bash parsing error * improve robustness of bash parsing by bounding substring from left _and_ right * update dbus loading scheme * add comment about display number * fix error introduced by rebase * preliminary implementation: move to WhistServerMessage * resolve various client-side bugs * change name of notif display fn * move display notification to os_utils * refactor server-side notifications API: use notifications handler * return null ptr from windows notif handler * fix docstring param * move windows/linux display notification implementations to os_utils * store thread so whists_wait_thread can be applied upon destroy * move whistnotification definition * change function signature of display notification * fix reference bug * fix C syntax error * fix WhistThread representation error * add trailing newline in osutils * factor notification packaging out * fix -fpermissive errors in server-side notifications * add simple unit tests for packaging and displaying notifications * remove cerr outputs in testing * do not disable notifications * add notifications to testing cmakelists * add null shellcheck source * make package_notifications globally accessible * add whistprivate * import notifications.h, not c * move package notifications to os_utils * remove unused variables * remove deprecateed WhistPrivate construct Co-authored-by: Kevin Meng <[email protected]> Co-authored-by: Kevin Meng <[email protected]>
- Loading branch information
1 parent
a13525c
commit 6f9fb0e
Showing
32 changed files
with
986 additions
and
29 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 |
---|---|---|
|
@@ -8,6 +8,8 @@ node_modules | |
|
||
# VS Code | ||
.vscode/ | ||
# jetbrains | ||
.idea/ | ||
|
||
# testing | ||
coverage | ||
|
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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,42 @@ | ||
/** | ||
* Copyright 2022 Whist Technologies, Inc. | ||
* @file display_notifs_mac.m | ||
* @brief Handles client-side notification display on MacOS | ||
Interfaces with native libraries to display notifications thrown from the server application. | ||
*/ | ||
|
||
/* | ||
============================ | ||
Includes | ||
============================ | ||
*/ | ||
|
||
#import <stdio.h> | ||
#import <Cocoa/Cocoa.h> | ||
#import <UserNotifications/UserNotifications.h> | ||
#import <objc/runtime.h> | ||
|
||
#import <whist/logging/logging.h> | ||
#import <whist/utils/os_utils.h> | ||
|
||
/* | ||
============================ | ||
Public Function Implementations | ||
============================ | ||
*/ | ||
|
||
int display_notification(WhistNotification notif) { | ||
NSUserNotification *n = [[NSUserNotification alloc] init]; | ||
|
||
char *title = notif.title, *msg = notif.message; | ||
LOG_INFO("Trying to display notif on OSX: %s | %s", title, msg); | ||
|
||
n.title = [NSString stringWithUTF8String:title]; | ||
n.informativeText = [NSString stringWithUTF8String:msg]; | ||
|
||
[NSUserNotificationCenter.defaultUserNotificationCenter deliverNotification:n]; | ||
|
||
return 0; | ||
} |
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
Oops, something went wrong.