Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Vu Minh Hoang
    @vuminhhoang
    Did you resolve problem?
    Aditya Chaturvedi
    @apexkid
    No
    Vu Minh Hoang
    @vuminhhoang
    I am not really know what do you want . Basically, you get the Single<String> then want to send this String to api2 for posrting api ?
    Is that right ?
    Aditya Chaturvedi
    @apexkid
    Correct
    Vu Minh Hoang
    @vuminhhoang
    Okay
    Firstly,You have to get a String
    api.getToken().blockingGet()
    It will returning the String for you
    Next,
    Aditya Chaturvedi
    @apexkid
    I can do single.subscribe( r -> completableAPi(r).subscribe ... ) but the code will be messy. I want to chain operations the way i mentioned in the SO
    Vu Minh Hoang
    @vuminhhoang
    pass the value to post api
    Aditya Chaturvedi
    @apexkid
    This is android so cannot do blocking calls.
    Vu Minh Hoang
    @vuminhhoang
    You can
    api2.saveToken(token = {api1.getToken().blockingget})
    Aditya Chaturvedi
    @apexkid
    ok let me try this
    Vu Minh Hoang
    @vuminhhoang
    Using lambda in this case
    Aditya Chaturvedi
    @apexkid
    Not working. The subscription itself is not getting triggered.
    completableAPI(singleAPI.blockingGet()).subscribeOn(..).observeOn(..).subcribe(...)
    Vu Minh Hoang
    @vuminhhoang
    wait
    Aditya Chaturvedi
    @apexkid
    When i do singleAPI.map(result -> completableAPI(result) it returns me a Single<Completable>. My usecase is that i just want to return a Completable on which i can subscribe.
    If i do Completable.fromSingle(...single<completable> here...) then it the completable call is ignored.
    and if i do singleAPi.flatmapCompletable(result -> completableAPI(result)), I am able to get an object of type Completable but the inner call happens on the main thread even if i do subscribeOn(Schedulers.io()).
    Too many things that i am confused with here.
    hayaticakici
    @hayaticakici
    test
    Vu Minh Hoang
    @vuminhhoang
    still there ?
    I just tried
    it worked !
    Aditya Chaturvedi
    @apexkid
    @vuminhhoang Can you share code snippet on gist?
    Ignacio Baca Moreno-Torres
    @ibaca
    OMG hehe please try not to block and never ever subribe inside a subscription :astonished:
    As you said, you can chain the calls, for example using flatMap
    Aditya Chaturvedi
    @apexkid
    @ibaca Sounds weird to be as well. Whats the point of Rx if we have to block. :|
    That's true but i am not able to translate the Single<Completable> to Completable
    Ignacio Baca Moreno-Torres
    @ibaca
    What is the single and what is the Completable?
    In the app domain (ex a user get and a archive post)
    Aditya Chaturvedi
    @apexkid
    @ibaca Will it be possible to take a look at the stackoverflow link i shared? I have written in detail there. You will get entire context of the problem
    Ignacio Baca Moreno-Torres
    @ibaca
    Oh hehe OK
    Aditya Chaturvedi
    @apexkid
    Thanks! :)
    Ignacio Baca Moreno-Torres
    @ibaca
    uhm but you have already solved the chain problem
    Aditya Chaturvedi
    @apexkid
    It is not working.
    Ignacio Baca Moreno-Torres
    @ibaca
    yep, this is another problem, try to add the .subscribeOn(io()) in the save observable too
    it depends on how those methods are implemented (getToken and saveTokenToBackend)
    Aditya Chaturvedi
    @apexkid
    both methods are Retrofit api call
    Ignacio Baca Moreno-Torres
    @ibaca
    and the RxThreadCallAdapter should not handle this for you?
    are you configured that correctly?
    Aditya Chaturvedi
    @apexkid
    yes its working when i call it individually
    but not when i chain it
    Ignacio Baca Moreno-Torres
    @ibaca
    then just repeat the subscribeOn just after the api call
    Aditya Chaturvedi
    @apexkid
    brb
    Ignacio Baca Moreno-Torres
    @ibaca
    look like the API call apply the observeOn automattically (I think, not sure…)