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
bcfb862d
Commit
bcfb862d
authored
Jan 25, 2017
by
Yusuke Iwaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove RxHelper#lazy. Use Single#defer instead.
parent
bf3519a5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
13 deletions
+6
-13
RxHelper.java
app/src/main/java/chat/rocket/android/helper/RxHelper.java
+0
-6
ConnectivityManagerImpl.java
.../chat/rocket/android/service/ConnectivityManagerImpl.java
+4
-4
RocketChatService.java
...n/java/chat/rocket/android/service/RocketChatService.java
+2
-3
No files found.
app/src/main/java/chat/rocket/android/helper/RxHelper.java
View file @
bcfb862d
...
...
@@ -2,8 +2,6 @@ package chat.rocket.android.helper;
import
java.util.concurrent.TimeUnit
;
import
rx.Observable
;
import
rx.Single
;
import
rx.functions.Func0
;
import
rx.functions.Func1
;
/**
...
...
@@ -16,8 +14,4 @@ public class RxHelper {
.
zipWith
(
Observable
.
range
(
0
,
maxRetryCount
),
(
error
,
retryCount
)
->
retryCount
)
.
flatMap
(
retryCount
->
Observable
.
timer
(
base
*
(
long
)
Math
.
pow
(
2
,
retryCount
),
unit
));
}
public
static
<
T
>
Single
<
T
>
lazy
(
Func0
<
Single
<
T
>>
func
)
{
return
Single
.
just
(
true
).
flatMap
(
_junk
->
func
.
call
());
}
}
app/src/main/java/chat/rocket/android/service/ConnectivityManagerImpl.java
View file @
bcfb862d
...
...
@@ -136,7 +136,7 @@ import rx.subjects.PublishSubject;
}
private
Single
<
Boolean
>
connectToServerIfNeeded
(
String
hostname
)
{
return
RxHelper
.
lazy
(()
->
{
return
Single
.
defer
(()
->
{
final
int
connectivity
=
serverConnectivityList
.
get
(
hostname
);
if
(
connectivity
==
ServerConnectivity
.
STATE_CONNECTED
)
{
return
Single
.
just
(
true
);
...
...
@@ -158,7 +158,7 @@ import rx.subjects.PublishSubject;
}
private
Single
<
Boolean
>
disconnectFromServerIfNeeded
(
String
hostname
)
{
return
RxHelper
.
lazy
(()
->
{
return
Single
.
defer
(()
->
{
final
int
connectivity
=
serverConnectivityList
.
get
(
hostname
);
if
(
connectivity
==
ServerConnectivity
.
STATE_DISCONNECTED
)
{
return
Single
.
just
(
true
);
...
...
@@ -199,7 +199,7 @@ import rx.subjects.PublishSubject;
}
private
Single
<
Boolean
>
connectToServer
(
String
hostname
)
{
return
RxHelper
.
lazy
(()
->
{
return
Single
.
defer
(()
->
{
if
(!
serverConnectivityList
.
containsKey
(
hostname
))
{
return
Single
.
error
(
new
IllegalArgumentException
(
"hostname not found"
));
}
...
...
@@ -214,7 +214,7 @@ import rx.subjects.PublishSubject;
}
private
Single
<
Boolean
>
disconnectFromServer
(
String
hostname
)
{
return
RxHelper
.
lazy
(()
->
{
return
Single
.
defer
(()
->
{
if
(!
serverConnectivityList
.
containsKey
(
hostname
))
{
return
Single
.
error
(
new
IllegalArgumentException
(
"hostname not found"
));
}
...
...
app/src/main/java/chat/rocket/android/service/RocketChatService.java
View file @
bcfb862d
...
...
@@ -10,7 +10,6 @@ import android.support.annotation.Nullable;
import
java.util.HashMap
;
import
java.util.concurrent.TimeUnit
;
import
chat.rocket.android.helper.RxHelper
;
import
hugo.weaving.DebugLog
;
import
rx.Observable
;
import
rx.Single
;
...
...
@@ -74,7 +73,7 @@ public class RocketChatService extends Service implements ConnectivityServiceInt
@Override
public
Single
<
Boolean
>
disconnectFromServer
(
String
hostname
)
{
//called via binder.
return
RxHelper
.
lazy
(()
->
{
return
Single
.
defer
(()
->
{
if
(!
webSocketThreads
.
containsKey
(
hostname
))
{
return
Single
.
just
(
true
);
}
...
...
@@ -91,7 +90,7 @@ public class RocketChatService extends Service implements ConnectivityServiceInt
@DebugLog
private
Single
<
RocketChatWebSocketThread
>
getOrCreateWebSocketThread
(
String
hostname
)
{
return
RxHelper
.
lazy
(()
->
{
return
Single
.
defer
(()
->
{
if
(
webSocketThreads
.
containsKey
(
hostname
))
{
RocketChatWebSocketThread
thread
=
webSocketThreads
.
get
(
hostname
);
if
(
thread
!=
null
)
{
...
...
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