Skip to content

Commit 23109a6

Browse files
author
Victor
committed
Don't modify scheduler observable for RxGcm.Notifications.currentToken method.
1 parent d17f7b9 commit 23109a6

File tree

3 files changed

+3
-17
lines changed

3 files changed

+3
-17
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Add RxGcm dependency and Google Services plugin to project level build.gradle.
1515
apply plugin: 'com.google.gms.google-services'
1616
1717
dependencies {
18-
compile 'com.github.VictorAlbertos:RxGcm:0.2.8'
18+
compile 'com.github.VictorAlbertos:RxGcm:0.2.9'
1919
compile 'io.reactivex:rxjava:1.1.5'
2020
}
2121
```
@@ -198,7 +198,7 @@ public class RxSampleApp extends Application {
198198
RxGgm asks to Google for a token. But if the token is already cached, the observable will complete without emitting the item.
199199

200200
### Threading
201-
RxGcm uses internally [RxAndroid](https://github.com/ReactiveX/RxAndroid). Thanks to this, each observable created by RxGcm observes on the Main Thread and subscribe on an IO thread.
201+
`RxGcm.register` method uses internally [RxAndroid](https://github.com/ReactiveX/RxAndroid). Thanks to this, the observable provided observes on the Main Thread and subscribes on an IO thread.
202202
This means you do not need to worry about threading and sync. But if you need to change this behaviour, you can do it easily setting in which scheduler the observable needs to observe and subscribe.
203203

204204
## Examples

rx_gcm/src/main/java/rx_gcm/internal/RxGcm.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,7 @@ public void call(Subscriber<? super String> subscriber) {
123123
}
124124
subscriber.onCompleted();
125125
}
126-
}).subscribeOn(Schedulers.io())
127-
.observeOn(mainThreadScheduler)
128-
.retryWhen(new RetryWithDelay(3, 2000));
126+
});
129127
}
130128

131129
/**

rx_gcm/src/test/java/rx_gcm/internal/RxGcmTest.java

-12
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,6 @@ public class RxGcmTest {
111111
subscriberMock.assertNoErrors();
112112
}
113113

114-
@Test public void When_Call_Current_Token_And_There_Is_No_Token_Emit_Error_But_Try_3_Times() {
115-
when(persistenceMock.getToken(applicationMock)).thenReturn(null);
116-
117-
TestSubscriber<String> subscriberMock = new TestSubscriber<>();
118-
RxGcm.Notifications.currentToken().subscribe(subscriberMock);
119-
subscriberMock.awaitTerminalEvent();
120-
121-
subscriberMock.assertError(RuntimeException.class);
122-
subscriberMock.assertValueCount(0);
123-
verify(persistenceMock, times(3)).getToken(applicationMock);
124-
}
125-
126114
@Test public void When_Call_On_Token_Refresh_Emit_Properly_Item() throws Exception {
127115
TestSubscriber<TokenUpdate> subscriberMock = GcmRefreshTokenReceiverMock.initSubscriber();
128116
when(persistenceMock.getClassNameGcmRefreshTokenReceiver(applicationMock)).thenReturn(GcmRefreshTokenReceiverMock.class.getName());

0 commit comments

Comments
 (0)