Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to RxJava 3 #722

Closed
wants to merge 12 commits into from
Closed

Migrate to RxJava 3 #722

wants to merge 12 commits into from

Conversation

z3ntu
Copy link

@z3ntu z3ntu commented Sep 15, 2020

Based on test/rxjava3 branch with updated imports & dependency updates for rxjava3.

As far as I can tell, all the tests are succeeding.

What's missing:

  • Some test files still contain "old imports" as function names, e.g. NotificationAndIndicationManagerTest.groovy
  • Some doc strings still have the old imports, e.g. BleAlreadyConnectedException.java

Fixes #690

@CLAassistant
Copy link

CLAassistant commented Sep 15, 2020

CLA assistant check
All committers have signed the CLA.

@dariuszseweryn
Copy link
Owner

Thanks for helping with the work. Unfortunately I cannot accept this PR until you will sign the CLA.

If you would have time to fix imports, docs and change package name to rxandroidble3 it would be awesome.

@z3ntu
Copy link
Author

z3ntu commented Sep 24, 2020

@dariuszseweryn I'm struggling at the moment to build the library to my local maven repository. Generally gradle rxandroidble:install mockrxandroidble:install dagger-library-shadow:install seems to work but the resulting pom at ~/.m2/repository/com/polidea/rxandroidble2/rxandroidble/1.11.1-SNAPSHOT/rxandroidble-1.11.1-SNAPSHOT.pom is missing all dependency information for some reason which I haven't figured out why. Any idea?

edit: I've manually edited the pom to include the dependency information but this is less than optimal

@z3ntu
Copy link
Author

z3ntu commented Oct 13, 2020

@dariuszseweryn ping?

@vanwesm
Copy link

vanwesm commented Feb 15, 2021

Any news here ? because RxJava2 will soon be not supported anymore : https://github.com/ReactiveX/RxJava#version-2x

@z3ntu
Copy link
Author

z3ntu commented Feb 15, 2021

I've noticed when using the lib built on jitpack.io (and manually adding back the dependencies, see my comments above) this:

Somehow some desugaring component doesn't translate one static interface
call correctly which makes the app crash at runtime.

Reproducible with deleting the app apk, ./gradlew assemblePreview
and install that apk.

When decompiling it (e.g. with apktool) use this command to view if the
error exists:
grep -r "fromAction(Lio/reactivex/rxjava3/functions/Action;)Lio/reactivex/rxjava3/disposables/Disposable"

Stacktrace:

Caused by: java.lang.NoSuchMethodError: No static method fromAction(Lio/reactivex/rxjava3/functions/Action;)Lio/reactivex/rxjava3/disposables/Disposable; in class Lio/reactivex/rxjava3/disposables/Disposable; or its super classes (declaration of 'io.reactivex.rxjava3.disposables.Disposable' appears in /data/app/com.foobar-e0ZfYg8uIR-IlNp1hDAV2Q==/base.apk!classes4.dex)
    at com.polidea.rxandroidble3.internal.serialization.ClientOperationQueueImpl$2.subscribe(ClientOperationQueueImpl.java:66)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableCreate.subscribeActual(ObservableCreate.java:40)
    at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13127)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableUnsubscribeOn.subscribeActual(ObservableUnsubscribeOn.java:32)
    at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13127)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:33)
    at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13127)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableDoOnEach.subscribeActual(ObservableDoOnEach.java:42)
    at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13127)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableFlatMap$MergeObserver.subscribeInner(ObservableFlatMap.java:162)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableFlatMap$MergeObserver.onNext(ObservableFlatMap.java:136)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableFromArray$FromArrayDisposable.run(ObservableFromArray.java:109)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableFromArray.subscribeActual(ObservableFromArray.java:38)
    at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13127)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableFlatMap.subscribeActual(ObservableFlatMap.java:53)
    at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13127)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableDefer.subscribeActual(ObservableDefer.java:40)
    at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13127)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableFilter.subscribeActual(ObservableFilter.java:30)
    at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13127)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableDoOnEach.subscribeActual(ObservableDoOnEach.java:42)
    at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13127)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableRetryWhen$RepeatWhenObserver.subscribeNext(ObservableRetryWhen.java:151)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableRetryWhen.subscribeActual(ObservableRetryWhen.java:60)
    at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13127)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableOnErrorNext.subscribeActual(ObservableOnErrorNext.java:36)
    at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13127)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableSwitchMap$SwitchMapObserver.onNext(ObservableSwitchMap.java:127)
    at io.reactivex.rxjava3.internal.observers.DisposableLambdaObserver.onNext(DisposableLambdaObserver.java:58)
    at io.reactivex.rxjava3.internal.observers.DisposableLambdaObserver.onNext(DisposableLambdaObserver.java:58)
    at io.reactivex.rxjava3.internal.util.NotificationLite.accept(NotificationLite.java:246)
    at io.reactivex.rxjava3.subjects.BehaviorSubject$BehaviorDisposable.test(BehaviorSubject.java:507)
    at io.reactivex.rxjava3.subjects.BehaviorSubject$BehaviorDisposable.emitNext(BehaviorSubject.java:502)
    at io.reactivex.rxjava3.subjects.BehaviorSubject.onNext(BehaviorSubject.java:253)
    at com.foobar.bluetooth.RxBleScanner$1.accept(RxBleScanner.kt:97)
    at com.foobar.bluetooth.RxBleScanner$1.accept(RxBleScanner.kt:57)
    at io.reactivex.rxjava3.internal.observers.LambdaObserver.onNext(LambdaObserver.java:63)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableConcatMap$ConcatMapDelayErrorObserver$DelayErrorInnerObserver.onNext(ObservableConcatMap.java:498)
    at io.reactivex.rxjava3.internal.operators.mixed.SingleFlatMapObservable$FlatMapObserver.onNext(SingleFlatMapObservable.java:69)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableDistinctUntilChanged$DistinctUntilChangedObserver.onNext(ObservableDistinctUntilChanged.java:85)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableSwitchMap$SwitchMapObserver.drain(ObservableSwitchMap.java:277)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableSwitchMap$SwitchMapInnerObserver.onNext(ObservableSwitchMap.java:355)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:63)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableUnsubscribeOn$UnsubscribeObserver.onNext(ObservableUnsubscribeOn.java:60)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableSubscribeOn$SubscribeOnObserver.onNext(ObservableSubscribeOn.java:58)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableDistinctUntilChanged$DistinctUntilChangedObserver.onNext(ObservableDistinctUntilChanged.java:85)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableCreate$CreateEmitter.onNext(ObservableCreate.java:66)
    at com.polidea.rxandroidble3.internal.util.LocationServicesOkObservableApi23Factory$1.subscribe(LocationServicesOkObservableApi23Factory.java:42)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableCreate.subscribeActual(ObservableCreate.java:40)
    at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13127)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableDistinctUntilChanged.subscribeActual(ObservableDistinctUntilChanged.java:35)
    at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13127)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
    at io.reactivex.rxjava3.internal.schedulers.TrampolineScheduler.scheduleDirect(TrampolineScheduler.java:51)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableSubscribeOn.subscribeActual(ObservableSubscribeOn.java:36)
    at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13127)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableUnsubscribeOn.subscribeActual(ObservableUnsubscribeOn.java:32)
    at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13127)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:33)
    at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13127)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableSwitchMap$SwitchMapObserver.onNext(ObservableSwitchMap.java:127)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableConcatMap$ConcatMapDelayErrorObserver.drain(ObservableConcatMap.java:462)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableConcatMap$ConcatMapDelayErrorObserver.onSubscribe(ObservableConcatMap.java:328)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableFromArray.subscribeActual(ObservableFromArray.java:32)
    at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13127)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableConcatMap.subscribeActual(ObservableConcatMap.java:54)
    at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13127)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableSwitchMap.subscribeActual(ObservableSwitchMap.java:51)
    at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13127)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableDistinctUntilChanged.subscribeActual(ObservableDistinctUntilChanged.java:35)
    at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13127)
    at io.reactivex.rxjava3.internal.operators.mixed.SingleFlatMapObservable$FlatMapObserver.onSuccess(SingleFlatMapObservable.java:110)
    at io.reactivex.rxjava3.internal.operators.single.SingleMap$MapSingleObserver.onSuccess(SingleMap.java:65)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableCountSingle$CountObserver.onComplete(ObservableCountSingle.java:82)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableTakeWhile$TakeWhileObserver.onNext(ObservableTakeWhile.java:84)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableInterval$IntervalObserver.run(ObservableInterval.java:82)
    at io.reactivex.rxjava3.internal.schedulers.ScheduledDirectPeriodicTask.run(ScheduledDirectPeriodicTask.java:38)
	... 6 more

@z3ntu
Copy link
Author

z3ntu commented Apr 1, 2021

The previous comment seems to be caused by https://issuetracker.google.com/issues/183632445 , workaround there is to put android.enableDexingArtifactTransform=false into your gradle.properties

@z3ntu
Copy link
Author

z3ntu commented May 6, 2021

FYI I'll probably only be able to work on this until the end of May, after that somebody else will have to complete the PR.

@Drjacky
Copy link

Drjacky commented Jun 28, 2021

@z3ntu @dariuszseweryn Any update on this PR? 🙏🏼

@Drjacky
Copy link

Drjacky commented Jul 3, 2021

@z3ntu I wanted to continue your PR but, I get this:

ERROR: Permission to z3ntu/RxAndroidBle.git denied to Drjacky.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

seems you need to check something like

Allow edits from maintainers.

@z3ntu
Copy link
Author

z3ntu commented Jul 4, 2021

@Drjacky You're not maintainer which is why you don't have permission to push. The checkbox was on. I've given you direct access now though.

Feel free to rebase and fix up the rest etc. I've kept the last couple of commits un-squashed on purpose to allow to reproduce them in case upstream changes (which it did again as you can see). When it's getting close to be merged (maybe this will happen at some point..?) then just squash them together but please keep me as author. Good luck :)

@Drjacky
Copy link

Drjacky commented Jul 5, 2021

@dariuszseweryn Please check Readme file to see if you're happy with ### Gradle and ### Maven sections as they're still pointing to .rxandroidble2.

Also, in gradle.properties:

GROUP=com.polidea.rxandroidble3
VERSION_NAME=1.12.2

Let me know if you want me to change them to something.

@Drjacky
Copy link

Drjacky commented Jul 21, 2021

@dariuszseweryn @z3ntu Anything else we need to do to have this PR to be merged?

dariuszseweryn and others added 12 commits September 7, 2021 11:39
According to the below link some test assertions are now not available. Made substitute extensions.
ReactiveX/RxJava#6526
RxJava 3 removes quite a lot of TestObserver’s functions. This commit re-adds them as extensions for kotlin sample tests purposes.
git grep io.reactivex | grep -v rxjava3
find . -name rxandroidble2 | rev | cut -c2- | rev | xargs -I % mv "%2" "%3"
git grep -l rxandroidble2 | xargs sed -i 's|rxandroidble2|rxandroidble3|g'
@Drjacky
Copy link

Drjacky commented Sep 7, 2021

I've resolved the conflicts.
@z3ntu @dariuszseweryn Please check the PR if applicable. 🙏🏼

@MarekMacko
Copy link

MarekMacko commented Dec 15, 2021

@dariuszseweryn Is there any plan to update this amazing library with RxJava 3? I'm really looking forward to it 🔥

@nateridderman
Copy link
Contributor

https://twitter.com/DSeweryn/status/1369016230095511554

@dariuszseweryn
Copy link
Owner

I have still this in plans. I am currently working on merging #770 which should unlock me a bit but I must keep the ability to release the library

@teddyvn
Copy link

teddyvn commented Dec 20, 2021

Waiting for this PR merging. Thanks

@nrbrook
Copy link
Contributor

nrbrook commented Mar 29, 2022

I decided to fork this repository due to lack of activity. I have merged this PR (and others) and released as io.nrbtech.rxandroidble:rxandroidble:2.0.0 on Maven Central, repository here: https://github.com/NRB-Tech/RxAndroidBle

@dariuszseweryn
Copy link
Owner

dariuszseweryn commented Jun 13, 2022

After merging #793 RxJava 3 based dependency is now on Maven Central under com.polidea.rxandroidble3:rxandroidble:1.15.0. I am sorry for such a long wait and would like to thank you all for the support. RxJava 2 based dependency is still supported for the time being under the usual com.polidea.rxandroidble2:rxandroidble:1.15.0. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RxJava 3.x support
9 participants