1919import android .util .Pair ;
2020
2121import com .appunite .detector .SimpleDetector ;
22- import com .appunite .websocket .rx .json .messages .RxJsonEvent ;
23- import com .appunite .websocket .rx .json .messages .RxJsonEventConn ;
24- import com .appunite .websocket .rx .json .messages .RxJsonEventDisconnected ;
25- import com .appunite .websocket .rx .json .messages .RxJsonEventMessage ;
26- import com .appunite .websocket .rx .json .messages .RxJsonEventWrongMessageFormat ;
22+ import com .appunite .websocket .rx .object .messages .RxObjectEvent ;
23+ import com .appunite .websocket .rx .object .messages .RxObjectEventConn ;
24+ import com .appunite .websocket .rx .object .messages .RxObjectEventDisconnected ;
25+ import com .appunite .websocket .rx .object .messages .RxObjectEventMessage ;
26+ import com .appunite .websocket .rx .object .messages .RxObjectEventWrongMessageFormat ;
27+ import com .appunite .websocket .rx .object .messages .RxObjectEventWrongStringMessageFormat ;
2728import com .example .Socket ;
2829import com .example .model .DataMessage ;
2930import com .google .common .collect .ImmutableList ;
@@ -117,9 +118,9 @@ public ImmutableList<AdapterItem> call(ImmutableList<AdapterItem> adapterItems,
117118 .subscribe (addItem );
118119
119120 connected = socket .connectedAndRegistered ()
120- .map (new Func1 <RxJsonEventConn , Boolean >() {
121+ .map (new Func1 <RxObjectEventConn , Boolean >() {
121122 @ Override
122- public Boolean call (RxJsonEventConn rxJsonEventConn ) {
123+ public Boolean call (RxObjectEventConn rxJsonEventConn ) {
123124 return rxJsonEventConn != null ;
124125 }
125126 })
@@ -158,11 +159,11 @@ public String call(Boolean connected) {
158159 };
159160 }
160161
161- private Observable .Operator <Pair <String , String >, RxJsonEvent > liftRxJsonEventToPairMessage () {
162- return new Observable .Operator <Pair <String , String >, RxJsonEvent >() {
162+ private Observable .Operator <Pair <String , String >, RxObjectEvent > liftRxJsonEventToPairMessage () {
163+ return new Observable .Operator <Pair <String , String >, RxObjectEvent >() {
163164 @ Override
164- public Subscriber <? super RxJsonEvent > call (final Subscriber <? super Pair <String , String >> subscriber ) {
165- return new Subscriber <RxJsonEvent >(subscriber ) {
165+ public Subscriber <? super RxObjectEvent > call (final Subscriber <? super Pair <String , String >> subscriber ) {
166+ return new Subscriber <RxObjectEvent >(subscriber ) {
166167 @ Override
167168 public void onCompleted () {
168169 subscriber .onCompleted ();
@@ -174,17 +175,17 @@ public void onError(Throwable e) {
174175 }
175176
176177 @ Override
177- public void onNext (RxJsonEvent rxJsonEvent ) {
178- if (rxJsonEvent instanceof RxJsonEventMessage ) {
179- subscriber .onNext (new Pair <>("message" , ((RxJsonEventMessage ) rxJsonEvent ).message ().toString ()));
180- } else if (rxJsonEvent instanceof RxJsonEventWrongMessageFormat ) {
181- final RxJsonEventWrongMessageFormat wrongMessageFormat = (RxJsonEventWrongMessageFormat ) rxJsonEvent ;
178+ public void onNext (RxObjectEvent rxObjectEvent ) {
179+ if (rxObjectEvent instanceof RxObjectEventMessage ) {
180+ subscriber .onNext (new Pair <>("message" , ((RxObjectEventMessage ) rxObjectEvent ).message ().toString ()));
181+ } else if (rxObjectEvent instanceof RxObjectEventWrongMessageFormat ) {
182+ final RxObjectEventWrongStringMessageFormat wrongMessageFormat = (RxObjectEventWrongStringMessageFormat ) rxObjectEvent ;
182183 //noinspection ThrowableResultOfMethodCallIgnored
183184 subscriber .onNext (new Pair <>("could not parse message" , wrongMessageFormat .message ()
184185 + ", " + wrongMessageFormat .exception ().toString ()));
185- } else if (rxJsonEvent instanceof RxJsonEventDisconnected ) {
186+ } else if (rxObjectEvent instanceof RxObjectEventDisconnected ) {
186187 //noinspection ThrowableResultOfMethodCallIgnored
187- final Exception exception = ((RxJsonEventDisconnected ) rxJsonEvent ).exception ();
188+ final Exception exception = ((RxObjectEventDisconnected ) rxObjectEvent ).exception ();
188189 if (!(exception instanceof InterruptedException )) {
189190 subscriber .onNext (new Pair <>("error" , exception .toString ()));
190191 }
0 commit comments