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
015da5c3
Commit
015da5c3
authored
Oct 20, 2017
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add aliases for Pair types
parent
b9893560
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
PushManager.kt
app/src/main/java/chat/rocket/android/push/PushManager.kt
+6
-5
No files found.
app/src/main/java/chat/rocket/android/push/PushManager.kt
View file @
015da5c3
...
...
@@ -39,7 +39,8 @@ import java.util.*
import
java.util.concurrent.atomic.AtomicInteger
import
kotlin.collections.HashMap
typealias
HostIdAndMessageCountTuple
=
Pair
<
Int
,
AtomicInteger
>
typealias
TupleRoomUser
=
Pair
<
Room
,
User
>
typealias
TupleIntAtomicInt
=
Pair
<
Int
,
AtomicInteger
>
object
PushManager
{
const
val
REPLY_LABEL
=
"REPLY"
...
...
@@ -49,7 +50,7 @@ object PushManager {
private
val
messageStack
=
SparseArray
<
ArrayList
<
CharSequence
>>()
// Notifications received from the same server are grouped in a single bundled notification.
// This map associates a host to a group id.
private
val
groupMap
=
HashMap
<
String
,
HostIdAndMessageCountTuple
<
Int
,
AtomicInteger
>
>()
private
val
groupMap
=
HashMap
<
String
,
TupleIntAtomicInt
>()
private
val
randomizer
=
Random
()
/**
...
...
@@ -117,7 +118,7 @@ object PushManager {
private
fun
bundleNotificationsToHost
(
host
:
String
)
{
val
size
=
groupMap
.
size
if
(
groupMap
.
get
(
host
)
==
null
)
{
groupMap
.
put
(
host
,
HostIdAndMessageCountTuple
(
size
+
1
,
AtomicInteger
(
0
)))
groupMap
.
put
(
host
,
TupleIntAtomicInt
(
size
+
1
,
AtomicInteger
(
0
)))
}
}
...
...
@@ -489,10 +490,10 @@ object PushManager {
.
firstElement
()
.
toSingle
()
val
roomUserTuple
:
Single
<
HostIdAndMessageCountTuple
<
Room
,
User
>
>
=
Single
.
zip
(
val
roomUserTuple
:
Single
<
TupleRoomUser
>
=
Single
.
zip
(
singleRoom
,
singleUser
,
BiFunction
{
room
,
user
->
HostIdAndMessageCountTuple
(
room
,
user
)
})
BiFunction
{
room
,
user
->
TupleRoomUser
(
room
,
user
)
})
roomUserTuple
.
flatMap
{
tuple
->
messageInteractor
.
send
(
tuple
.
first
,
tuple
.
second
,
message
as
String
)
}
.
subscribeOn
(
AndroidSchedulers
.
from
(
BackgroundLooper
.
get
()))
...
...
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