Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nheko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
nheko
Commits
0b9bbd39
Verified
Commit
0b9bbd39
authored
1 year ago
by
Nicolas Werner
Browse files
Options
Downloads
Patches
Plain Diff
Enable sending notifications via the systemNotification signal on macOS
parent
43df8f35
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/notifications/Manager.h
+4
-3
4 additions, 3 deletions
src/notifications/Manager.h
src/notifications/ManagerMac.cpp
+32
-32
32 additions, 32 deletions
src/notifications/ManagerMac.cpp
src/notifications/ManagerMac.mm
+0
-8
0 additions, 8 deletions
src/notifications/ManagerMac.mm
with
36 additions
and
43 deletions
src/notifications/Manager.h
+
4
−
3
View file @
0b9bbd39
...
...
@@ -81,11 +81,12 @@ private:
const
QString
&
subtitle
,
const
QString
&
informativeText
,
const
QString
&
bodyImagePath
,
const
QString
&
respondStr
,
const
QString
&
sendStr
,
const
QString
&
placeholder
,
const
bool
playSound
);
QString
respondStr
;
QString
sendStr
;
QString
placeholder
;
public:
static
void
attachToMacNotifCenter
();
#endif
...
...
This diff is collapsed.
Click to expand it.
src/notifications/ManagerMac.cpp
+
32
−
32
View file @
0b9bbd39
...
...
@@ -22,6 +22,35 @@ formatNotification(const mtx::responses::Notification ¬ification)
return
utils
::
stripReplyFallbacks
(
notification
.
event
,
{},
{}).
quoted_body
;
}
NotificationsManager
::
NotificationsManager
(
QObject
*
parent
)
:
QObject
(
parent
)
{
// Putting these here to pass along since I'm not sure how
// our translate step interacts with .mm files
respondStr
=
QObject
::
tr
(
"Respond"
);
sendStr
=
QObject
::
tr
(
"Send"
);
placeholder
=
QObject
::
tr
(
"Write a message..."
);
connect
(
this
,
&
NotificationsManager
::
systemPostNotificationCb
,
this
,
[
this
](
const
QString
&
room_id
,
const
QString
&
event_id
,
const
QString
&
roomName
,
const
QString
&
text
,
const
QImage
&
)
{
objCxxPostNotification
(
roomName
,
room_id
,
event_id
,
text
,
/*const QString &informativeText*/
""
,
""
,
true
);
},
Qt
::
QueuedConnection
);
}
void
NotificationsManager
::
postNotification
(
const
mtx
::
responses
::
Notification
&
notification
,
const
QImage
&
icon
)
...
...
@@ -40,12 +69,6 @@ NotificationsManager::postNotification(const mtx::responses::Notification ¬if
&
notification
.
event
)
!=
nullptr
;
const
auto
isReply
=
utils
::
isReply
(
notification
.
event
);
// Putting these here to pass along since I'm not sure how
// our translate step interacts with .mm files
const
auto
respondStr
=
QObject
::
tr
(
"Respond"
);
const
auto
sendStr
=
QObject
::
tr
(
"Send"
);
const
auto
placeholder
=
QObject
::
tr
(
"Write a message..."
);
auto
playSound
=
false
;
if
(
std
::
find
(
notification
.
actions
.
begin
(),
...
...
@@ -59,16 +82,7 @@ NotificationsManager::postNotification(const mtx::responses::Notification ¬if
const
QString
messageInfo
=
(
isReply
?
tr
(
"%1 replied with an encrypted message"
)
:
tr
(
"%1 sent an encrypted message"
))
.
arg
(
sender
);
objCxxPostNotification
(
room_name
,
room_id
,
event_id
,
messageInfo
,
""
,
""
,
respondStr
,
sendStr
,
placeholder
,
playSound
);
objCxxPostNotification
(
room_name
,
room_id
,
event_id
,
messageInfo
,
""
,
""
,
playSound
);
}
else
{
const
QString
messageInfo
=
(
isReply
?
tr
(
"%1 replied to a message"
)
:
tr
(
"%1 sent a message"
)).
arg
(
sender
);
...
...
@@ -76,25 +90,14 @@ NotificationsManager::postNotification(const mtx::responses::Notification ¬if
MxcImageProvider
::
download
(
QString
::
fromStdString
(
mtx
::
accessors
::
url
(
notification
.
event
)).
remove
(
"mxc://"
),
QSize
(
200
,
80
),
[
this
,
notification
,
room_name
,
room_id
,
event_id
,
messageInfo
,
respondStr
,
sendStr
,
placeholder
,
playSound
](
QString
,
QSize
,
QImage
,
QString
imgPath
)
{
[
this
,
notification
,
room_name
,
room_id
,
event_id
,
messageInfo
,
playSound
](
QString
,
QSize
,
QImage
,
QString
imgPath
)
{
objCxxPostNotification
(
room_name
,
room_id
,
event_id
,
messageInfo
,
formatNotification
(
notification
),
imgPath
,
respondStr
,
sendStr
,
placeholder
,
playSound
);
});
else
...
...
@@ -104,9 +107,6 @@ NotificationsManager::postNotification(const mtx::responses::Notification ¬if
messageInfo
,
formatNotification
(
notification
),
""
,
respondStr
,
sendStr
,
placeholder
,
playSound
);
}
}
This diff is collapsed.
Click to expand it.
src/notifications/ManagerMac.mm
+
0
−
8
View file @
0b9bbd39
...
...
@@ -61,11 +61,6 @@
}
@end
NotificationsManager
::
NotificationsManager
(
QObject
*
parent
)
:
QObject
(
parent
)
{
}
void
NotificationsManager
::
objCxxPostNotification
(
const
QString
&
room_name
,
const
QString
&
room_id
,
...
...
@@ -73,9 +68,6 @@ void NotificationsManager::objCxxPostNotification(
const
QString
&
subtitle
,
const
QString
&
informativeText
,
const
QString
&
bodyImagePath
,
const
QString
&
respondStr
,
const
QString
&
sendStr
,
const
QString
&
placeholder
,
const
bool
enableSound
)
{
// Request permissions for alerts (the generic type of notification), sound playback,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment