package com.joker.fourfun.presenter;

import com.joker.fourfun.base.BaseMvpPresenter;
import com.joker.fourfun.model.Zhihu;
import com.joker.fourfun.net.HttpResultFun;
import com.joker.fourfun.net.UserService;
import com.joker.fourfun.presenter.contract.SplashContract;
import com.joker.fourfun.utils.RetrofitUtil;
import com.joker.fourfun.utils.RxUtil;
import com.orhanobut.logger.Logger;

import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;

import javax.inject.Inject;


/**
 * Created by joker on 2016/11/27.
 */

public class SplashPresenter extends BaseMvpPresenter<SplashContract.View> implements SplashContract
        .Presenter {
    private RetrofitUtil mRetrofit;

    @Inject
    public SplashPresenter(RetrofitUtil retrofitUtil) {
        mRetrofit = retrofitUtil;
    }

    @Override
    public void getZhihuPic() {
        UserService userService = mRetrofit.create(UserService.class);
        userService
                .ZhihuPic()
                .map(new HttpResultFun<Zhihu>())
                .compose(RxUtil.<Zhihu>rxSchedulerTransformer())
                .subscribe(new Subscriber<Zhihu>() {
                    @Override
                    public void onSubscribe(Subscription s) {
                        s.request(Long.MAX_VALUE);
                    }

                    @Override
                    public void onNext(Zhihu zhihu) {
                        mView.showZhihuPic(zhihu.getImg());
                    }

                    @Override
                    public void onError(Throwable t) {
                        Logger.e(t, t.getMessage());
                        mView.showError("似乎有点问题哦");
                    }

                    @Override
                    public void onComplete() {
                    }
                });
    }
}

@@ -465,16 +465,40 @@
 ption;%0A%0A
+import java.util.List;%0A%0A
 import j
@@ -517,16 +517,16 @@
 Inject;%0A
-
 %0A%0A/**%0A *
@@ -985,17 +985,17 @@
        .
-Z
+z
 hihuPic(
@@ -1035,22 +1035,28 @@
 sultFun%3C
+List%3C
 Zhihu%3E
+%3E
 ())%0A    
@@ -1084,22 +1084,28 @@
 RxUtil.%3C
+List%3C
 Zhihu%3E
+%3E
 rxSchedu
@@ -1164,22 +1164,28 @@
 scriber%3C
+List%3C
 Zhihu%3E
+%3E
 () %7B%0A   
@@ -1416,21 +1416,27 @@
  onNext(
+List%3C
 Zhihu
+%3E
  zhihu) 
@@ -1486,16 +1486,23 @@
 c(zhihu.
+get(0).
 getImg()

update the method name