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
e0bc873d
Commit
e0bc873d
authored
Jan 23, 2017
by
Yusuke Iwaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove DDPClient#isConnected because it is just useless!!
parent
6597044b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1 addition
and
26 deletions
+1
-26
DDPClient.java
...-ddp/src/main/java/chat/rocket/android_ddp/DDPClient.java
+0
-4
DDPClientImpl.java
.../src/main/java/chat/rocket/android_ddp/DDPClientImpl.java
+0
-4
RxWebSocket.java
...src/main/java/chat/rocket/android_ddp/rx/RxWebSocket.java
+0
-10
DDPClientWrapper.java
...c/main/java/chat/rocket/android/api/DDPClientWrapper.java
+0
-7
RocketChatWebSocketThread.java
...hat/rocket/android/service/RocketChatWebSocketThread.java
+1
-1
No files found.
android-ddp/src/main/java/chat/rocket/android_ddp/DDPClient.java
View file @
e0bc873d
...
@@ -61,10 +61,6 @@ public class DDPClient {
...
@@ -61,10 +61,6 @@ public class DDPClient {
return
impl
.
getOnCloseCallback
();
return
impl
.
getOnCloseCallback
();
}
}
public
boolean
isConnected
()
{
return
impl
.
isConnected
();
}
public
void
close
()
{
public
void
close
()
{
impl
.
close
(
1000
,
"closed by DDPClient#close()"
);
impl
.
close
(
1000
,
"closed by DDPClient#close()"
);
}
}
...
...
android-ddp/src/main/java/chat/rocket/android_ddp/DDPClientImpl.java
View file @
e0bc873d
...
@@ -96,10 +96,6 @@ public class DDPClientImpl {
...
@@ -96,10 +96,6 @@ public class DDPClientImpl {
}
}
}
}
public
boolean
isConnected
()
{
return
websocket
!=
null
&&
websocket
.
isConnected
();
}
public
void
ping
(
final
TaskCompletionSource
<
DDPClientCallback
.
Ping
>
task
,
public
void
ping
(
final
TaskCompletionSource
<
DDPClientCallback
.
Ping
>
task
,
@Nullable
final
String
id
)
{
@Nullable
final
String
id
)
{
...
...
android-ddp/src/main/java/chat/rocket/android_ddp/rx/RxWebSocket.java
View file @
e0bc873d
...
@@ -15,11 +15,9 @@ import rx.observables.ConnectableObservable;
...
@@ -15,11 +15,9 @@ import rx.observables.ConnectableObservable;
public
class
RxWebSocket
{
public
class
RxWebSocket
{
private
OkHttpClient
httpClient
;
private
OkHttpClient
httpClient
;
private
WebSocket
webSocket
;
private
WebSocket
webSocket
;
private
boolean
isConnected
;
public
RxWebSocket
(
OkHttpClient
client
)
{
public
RxWebSocket
(
OkHttpClient
client
)
{
httpClient
=
client
;
httpClient
=
client
;
isConnected
=
false
;
}
}
public
ConnectableObservable
<
RxWebSocketCallback
.
Base
>
connect
(
String
url
)
{
public
ConnectableObservable
<
RxWebSocketCallback
.
Base
>
connect
(
String
url
)
{
...
@@ -31,7 +29,6 @@ public class RxWebSocket {
...
@@ -31,7 +29,6 @@ public class RxWebSocket {
httpClient
.
newWebSocket
(
request
,
new
WebSocketListener
()
{
httpClient
.
newWebSocket
(
request
,
new
WebSocketListener
()
{
@Override
@Override
public
void
onOpen
(
WebSocket
webSocket
,
Response
response
)
{
public
void
onOpen
(
WebSocket
webSocket
,
Response
response
)
{
isConnected
=
true
;
RxWebSocket
.
this
.
webSocket
=
webSocket
;
RxWebSocket
.
this
.
webSocket
=
webSocket
;
subscriber
.
onNext
(
new
RxWebSocketCallback
.
Open
(
RxWebSocket
.
this
.
webSocket
,
response
));
subscriber
.
onNext
(
new
RxWebSocketCallback
.
Open
(
RxWebSocket
.
this
.
webSocket
,
response
));
}
}
...
@@ -39,7 +36,6 @@ public class RxWebSocket {
...
@@ -39,7 +36,6 @@ public class RxWebSocket {
@Override
@Override
public
void
onFailure
(
WebSocket
webSocket
,
Throwable
err
,
Response
response
)
{
public
void
onFailure
(
WebSocket
webSocket
,
Throwable
err
,
Response
response
)
{
try
{
try
{
isConnected
=
false
;
subscriber
.
onError
(
new
RxWebSocketCallback
.
Failure
(
webSocket
,
err
,
response
));
subscriber
.
onError
(
new
RxWebSocketCallback
.
Failure
(
webSocket
,
err
,
response
));
}
catch
(
OnErrorNotImplementedException
ex
)
{
}
catch
(
OnErrorNotImplementedException
ex
)
{
RCLog
.
w
(
ex
,
"OnErrorNotImplementedException ignored"
);
RCLog
.
w
(
ex
,
"OnErrorNotImplementedException ignored"
);
...
@@ -48,13 +44,11 @@ public class RxWebSocket {
...
@@ -48,13 +44,11 @@ public class RxWebSocket {
@Override
@Override
public
void
onMessage
(
WebSocket
webSocket
,
String
text
)
{
public
void
onMessage
(
WebSocket
webSocket
,
String
text
)
{
isConnected
=
true
;
subscriber
.
onNext
(
new
RxWebSocketCallback
.
Message
(
webSocket
,
text
));
subscriber
.
onNext
(
new
RxWebSocketCallback
.
Message
(
webSocket
,
text
));
}
}
@Override
@Override
public
void
onClosed
(
WebSocket
webSocket
,
int
code
,
String
reason
)
{
public
void
onClosed
(
WebSocket
webSocket
,
int
code
,
String
reason
)
{
isConnected
=
false
;
subscriber
.
onNext
(
new
RxWebSocketCallback
.
Close
(
webSocket
,
code
,
reason
));
subscriber
.
onNext
(
new
RxWebSocketCallback
.
Close
(
webSocket
,
code
,
reason
));
subscriber
.
onCompleted
();
subscriber
.
onCompleted
();
}
}
...
@@ -67,10 +61,6 @@ public class RxWebSocket {
...
@@ -67,10 +61,6 @@ public class RxWebSocket {
return
webSocket
.
send
(
message
);
return
webSocket
.
send
(
message
);
}
}
public
boolean
isConnected
()
{
return
isConnected
;
}
public
boolean
close
(
int
code
,
String
reason
)
throws
IOException
{
public
boolean
close
(
int
code
,
String
reason
)
throws
IOException
{
return
webSocket
.
close
(
code
,
reason
);
return
webSocket
.
close
(
code
,
reason
);
}
}
...
...
app/src/main/java/chat/rocket/android/api/DDPClientWrapper.java
View file @
e0bc873d
...
@@ -42,13 +42,6 @@ public class DDPClientWrapper {
...
@@ -42,13 +42,6 @@ public class DDPClientWrapper {
return
ddpClient
.
connect
(
protocol
+
hostname
+
"/websocket"
,
session
);
return
ddpClient
.
connect
(
protocol
+
hostname
+
"/websocket"
,
session
);
}
}
/**
* Returns whether DDP client is connected to WebSocket server.
*/
public
boolean
isConnected
()
{
return
ddpClient
.
isConnected
();
}
/**
/**
* close connection.
* close connection.
*/
*/
...
...
app/src/main/java/chat/rocket/android/service/RocketChatWebSocketThread.java
View file @
e0bc873d
...
@@ -179,7 +179,7 @@ public class RocketChatWebSocketThread extends HandlerThread {
...
@@ -179,7 +179,7 @@ public class RocketChatWebSocketThread extends HandlerThread {
}
}
private
Single
<
Boolean
>
checkIfConnectionAlive
()
{
private
Single
<
Boolean
>
checkIfConnectionAlive
()
{
if
(
ddpClient
==
null
||
!
ddpClient
.
isConnected
()
)
{
if
(
ddpClient
==
null
)
{
return
Single
.
just
(
false
);
return
Single
.
just
(
false
);
}
}
...
...
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