Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
KDE Connect Android
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
30
Merge Requests
30
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Network
KDE Connect Android
Commits
132e4e7e
Commit
132e4e7e
authored
Jun 04, 2019
by
Nicolas Fella
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor extractRepliableNotification
parent
4cdda3f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
21 deletions
+22
-21
src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java
...nect/Plugins/NotificationsPlugin/NotificationsPlugin.java
+22
-21
No files found.
src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java
View file @
132e4e7e
...
...
@@ -242,9 +242,10 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
np
.
set
(
"isClearable"
,
statusBarNotification
.
isClearable
());
np
.
set
(
"appName"
,
appName
==
null
?
packageName
:
appName
);
np
.
set
(
"time"
,
Long
.
toString
(
statusBarNotification
.
getPostTime
()));
if
(!
appDatabase
.
getPrivacy
(
packageName
,
AppDatabase
.
PrivacyOptions
.
BLOCK_CONTENTS
))
{
RepliableNotification
rn
=
extractRepliableNotification
(
statusBarNotification
);
if
(
rn
.
pendingIntent
!=
null
)
{
if
(
rn
!=
null
)
{
np
.
set
(
"requestReplyId"
,
rn
.
id
);
pendingIntents
.
put
(
rn
.
id
,
rn
);
}
...
...
@@ -441,31 +442,31 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
pendingIntents
.
remove
(
id
);
}
@Nullable
private
RepliableNotification
extractRepliableNotification
(
StatusBarNotification
statusBarNotification
)
{
RepliableNotification
repliableNotification
=
new
RepliableNotification
();
if
(
statusBarNotification
!=
null
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
try
{
if
(
statusBarNotification
.
getNotification
().
actions
!=
null
)
{
for
(
Notification
.
Action
act
:
statusBarNotification
.
getNotification
().
actions
)
{
if
(
act
!=
null
&&
act
.
getRemoteInputs
()
!=
null
)
{
// Is a reply
repliableNotification
.
remoteInputs
.
addAll
(
Arrays
.
asList
(
act
.
getRemoteInputs
()));
repliableNotification
.
pendingIntent
=
act
.
actionIntent
;
break
;
}
}
repliableNotification
.
packageName
=
statusBarNotification
.
getPackageName
(
);
repliableNotification
.
tag
=
statusBarNotification
.
getTag
();
//TODO find how to pass Tag with sending PendingIntent, might fix Hangout problem
}
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG
,
"problem extracting notification wear for "
+
statusBarNotification
.
getNotification
().
tickerText
,
e
);
}
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
return
null
;
}
if
(
statusBarNotification
.
getNotification
().
actions
==
null
)
{
return
null
;
}
for
(
Notification
.
Action
act
:
statusBarNotification
.
getNotification
().
actions
)
{
if
(
act
!=
null
&&
act
.
getRemoteInputs
()
!=
null
)
{
// Is a reply
RepliableNotification
repliableNotification
=
new
RepliableNotification
();
repliableNotification
.
remoteInputs
.
addAll
(
Arrays
.
asList
(
act
.
getRemoteInputs
())
);
repliableNotification
.
pendingIntent
=
act
.
actionIntent
;
repliableNotification
.
packageName
=
statusBarNotification
.
getPackageName
();
repliableNotification
.
tag
=
statusBarNotification
.
getTag
();
//TODO find how to pass Tag with sending PendingIntent, might fix Hangout problem
return
repliableNotification
;
}
}
return
repliableNotification
;
return
null
;
}
private
static
String
extractStringFromExtra
(
Bundle
extras
,
String
key
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment