// Path: flowr/src/main/java/com/fueled/flowr/FragmentsResultPublisher.java
// public interface FragmentsResultPublisher {
// 
//     void publishResult(ResultResponse resultResponse);
// }
// 
// Path: flowr/src/main/java/com/fueled/flowr/ResultResponse.java
// public class ResultResponse {
// 
//     public String fragmentId;
//     public int requestCode;
//     public int resultCode;
//     public Bundle data;
// }


import com.fueled.flowr.FragmentsResultPublisher;
import com.fueled.flowr.ResultResponse;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Predicate;
import io.reactivex.subjects.PublishSubject;
package com.fueled.flowr.sample.core;



/**
 * Created by hussein@fueled.com on 13/02/2017.
 * Copyright (c) 2017 Fueled. All rights reserved.
 */
public class FragmentResultPublisherImpl implements FragmentsResultPublisher {

    private static FragmentResultPublisherImpl instance;

    private PublishSubject<ResultResponse> publishSubject;

    private FragmentResultPublisherImpl() {
        publishSubject = PublishSubject.create();
    }

    @Override
    public void publishResult(ResultResponse resultResponse) {
        publishSubject.onNext(resultResponse);
    }

// Path: flowr/src/main/java/com/fueled/flowr/FragmentsResultPublisher.java
// public interface FragmentsResultPublisher {
// 
//     void publishResult(ResultResponse resultResponse);
// }
// 
// Path: flowr/src/main/java/com/fueled/flowr/ResultResponse.java
// public class ResultResponse {
// 
//     public String fragmentId;
//     public int requestCode;
//     public int resultCode;
//     public Bundle data;
// }


// Path: sample/src/main/java/com/fueled/flowr/sample/core/FragmentResultPublisherImpl.java
import com.fueled.flowr.FragmentsResultPublisher;
import com.fueled.flowr.ResultResponse;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Predicate;
import io.reactivex.subjects.PublishSubject;

package com.fueled.flowr.sample.core;



/**
 * Created by hussein@fueled.com on 13/02/2017.
 * Copyright (c) 2017 Fueled. All rights reserved.
 */
public class FragmentResultPublisherImpl implements FragmentsResultPublisher {

    private static FragmentResultPublisherImpl instance;

    private PublishSubject<ResultResponse> publishSubject;

    private FragmentResultPublisherImpl() {
        publishSubject = PublishSubject.create();
    }

    @Override
    public void publishResult(ResultResponse resultResponse) {
        publishSubject.onNext(resultResponse);
    }

    public Disposable observeResultsForFragment(final String fragmentId, Consumer<ResultResponse> consumer) {