Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
a821fddb
Commit
a821fddb
authored
Oct 24, 2017
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove logs
parent
6c62d59b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
24 deletions
+15
-24
PushManager.kt
app/src/main/java/chat/rocket/android/push/PushManager.kt
+15
-24
No files found.
app/src/main/java/chat/rocket/android/push/PushManager.kt
View file @
a821fddb
...
...
@@ -93,12 +93,9 @@ object PushManager {
fun
clearNotificationsByNotificationId
(
notificationId
:
Int
)
{
if
(
hostToPushMessageList
.
isNotEmpty
())
{
for
(
entry
in
hostToPushMessageList
.
entries
)
{
println
(
"state: ${entry.value.size} -> ${entry.value}"
)
println
(
"Removing from ${entry.key}"
)
entry
.
value
.
removeAll
{
it
.
notificationId
.
toInt
()
==
notificationId
}
println
(
"state: ${entry.value.size} -> ${entry.value}"
)
}
}
}
...
...
@@ -356,7 +353,8 @@ object PushManager {
val
inbox
=
Notification
.
InboxStyle
()
val
userMessages
=
pushMessageList
.
filter
{
it
.
notificationId
==
lastPushMessage
.
notificationId
}
it
.
notificationId
==
lastPushMessage
.
notificationId
}
val
count
=
pushMessageList
.
filter
{
it
.
title
==
title
...
...
@@ -476,14 +474,14 @@ object PushManager {
}
private
data class
PushMessage
(
val
title
:
String
,
val
message
:
String
,
val
image
:
String
?,
val
ejson
:
String
,
val
count
:
String
,
val
notificationId
:
String
,
val
summaryText
:
String
,
val
style
:
String
)
:
Serializable
{
val
title
:
String
,
val
message
:
String
,
val
image
:
String
?,
val
ejson
:
String
,
val
count
:
String
,
val
notificationId
:
String
,
val
summaryText
:
String
,
val
style
:
String
)
:
Serializable
{
val
host
:
String
val
rid
:
String
val
type
:
String
...
...
@@ -581,15 +579,8 @@ object PushManager {
return
remoteInput
?.
getCharSequence
(
REMOTE_INPUT_REPLY
)
}
private
fun
inspect
(
variable
:
String
,
value
:
CharSequence
)
{
println
(
"$variable = ${value}"
)
}
// Just kept for reference. We should use this on rewrite with job schedulers
private
fun
sendMessage
(
hostname
:
String
,
message
:
CharSequence
,
roomId
:
String
)
{
inspect
(
"hostname"
,
hostname
)
inspect
(
"message"
,
message
)
inspect
(
"roomId"
,
roomId
)
val
roomRepository
=
RealmRoomRepository
(
hostname
)
val
userRepository
=
RealmUserRepository
(
hostname
)
val
messageRepository
=
RealmMessageRepository
(
hostname
)
...
...
@@ -616,11 +607,11 @@ object PushManager {
.
subscribeOn
(
AndroidSchedulers
.
from
(
BackgroundLooper
.
get
()))
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
({
success
->
// Empty
},
{
throwable
->
throwable
.
printStackTrace
()
Logger
.
report
(
throwable
)
})
// Empty
},
{
throwable
->
throwable
.
printStackTrace
()
Logger
.
report
(
throwable
)
})
}
}
}
\ No newline at end of file
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