package com.veyndan.redditclient.post.media.mutator;

import com.veyndan.redditclient.api.reddit.model.PostHint;
import com.veyndan.redditclient.post.media.model.Text;
import com.veyndan.redditclient.post.model.Post;

import rx.Observable;

final class TextMutatorFactory implements MutatorFactory {

    static TextMutatorFactory create() {
        return new TextMutatorFactory();
    }

    private TextMutatorFactory() {
    }

    @Override
    public Observable<Post> mutate(final Post post) {
        return Observable.just(post)
                .filter(post1 -> post1.getPostHint().equals(PostHint.SELF))
                .map(post1 -> {
                    post1.setMediaObservable(Observable.just(new Text(post1.getBodyHtml())));
                    return post1;
                });
    }
}

@@ -47,16 +47,48 @@
 tator;%0A%0A
+import android.text.TextUtils;%0A%0A
 import c
@@ -636,16 +636,83 @@
 nt.SELF)
+ &&%0A                        !TextUtils.isEmpty(post1.getBodyHtml())
 )%0A      

Make self posts without text bodies to not have any media adapter delegate