// Path: AuthProject/app/src/main/java/com/zhy/authproject/data/remote/model/ActivityInfo.java
// public class ActivityInfo {
// }
// 
// Path: AuthProject/app/src/main/java/com/zhy/authproject/data/remote/model/BaseResponseFunc.java
// public class BaseResponseFunc<T> implements Func1<BaseResponse<T>, Observable<T>> {
// 
// 
//     @Override
//     public Observable<T> call(BaseResponse<T> tBaseResponse) {
//         //遇到非200错误统一处理,将BaseResponse转换成您想要的对象
//         if (tBaseResponse.getStatus_code() != 200) {
//             return Observable.error(new Throwable(tBaseResponse.getStatus_msg()));
//         }else{
//             return Observable.just(tBaseResponse.getData());
//         }
//     }
// }
// 
// Path: AuthProject/app/src/main/java/com/zhy/authproject/data/remote/model/CommonInfo.java
// public class CommonInfo {
// }
// 
// Path: AuthProject/app/src/main/java/com/zhy/authproject/data/remote/model/User.java
// public class User {
// }


import android.app.Application;
import android.content.Context;
import com.zhy.authproject.data.remote.model.ActivityInfo;
import com.zhy.authproject.data.remote.model.BaseResponseFunc;
import com.zhy.authproject.data.remote.model.CommonInfo;
import com.zhy.authproject.data.remote.model.User;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
package com.zhy.authproject.data.remote;




/**
 * Created by zhanghaoye on 10/24/16.
 */

public class ApiManager {
    private final ApiService apiService;

    private final Application application;

    public ApiManager(ApiService apiService, Application application) {
        this.apiService = apiService;
        this.application = application;
    }

    //登录
    public void login(Context context,String username, String password, SimpleCallback<User> simpleCallback,boolean isShow){
        apiService.login(username,password)
                .flatMap(new BaseResponseFunc<User>())
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new ExceptionSubscriber<User>(simpleCallback,application,context,isShow));
    }

   //获取活动列表
    public void getActivities(Context context,String id,String user_id,String access_token,SimpleCallback<ActivityInfo> simpleCallback){
        apiService.getActivityInfo(id,user_id,access_token)
// Path: AuthProject/app/src/main/java/com/zhy/authproject/data/remote/model/ActivityInfo.java
// public class ActivityInfo {
// }
// 
// Path: AuthProject/app/src/main/java/com/zhy/authproject/data/remote/model/BaseResponseFunc.java
// public class BaseResponseFunc<T> implements Func1<BaseResponse<T>, Observable<T>> {
// 
// 
//     @Override
//     public Observable<T> call(BaseResponse<T> tBaseResponse) {
//         //遇到非200错误统一处理,将BaseResponse转换成您想要的对象
//         if (tBaseResponse.getStatus_code() != 200) {
//             return Observable.error(new Throwable(tBaseResponse.getStatus_msg()));
//         }else{
//             return Observable.just(tBaseResponse.getData());
//         }
//     }
// }
// 
// Path: AuthProject/app/src/main/java/com/zhy/authproject/data/remote/model/CommonInfo.java
// public class CommonInfo {
// }
// 
// Path: AuthProject/app/src/main/java/com/zhy/authproject/data/remote/model/User.java
// public class User {
// }


// Path: AuthProject/app/src/main/java/com/zhy/authproject/data/remote/ApiManager.java
import android.app.Application;
import android.content.Context;
import com.zhy.authproject.data.remote.model.ActivityInfo;
import com.zhy.authproject.data.remote.model.BaseResponseFunc;
import com.zhy.authproject.data.remote.model.CommonInfo;
import com.zhy.authproject.data.remote.model.User;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

package com.zhy.authproject.data.remote;




/**
 * Created by zhanghaoye on 10/24/16.
 */

public class ApiManager {
    private final ApiService apiService;

    private final Application application;

    public ApiManager(ApiService apiService, Application application) {
        this.apiService = apiService;
        this.application = application;
    }

    //登录
    public void login(Context context,String username, String password, SimpleCallback<User> simpleCallback,boolean isShow){
        apiService.login(username,password)
                .flatMap(new BaseResponseFunc<User>())
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new ExceptionSubscriber<User>(simpleCallback,application,context,isShow));
    }

   //获取活动列表
    public void getActivities(Context context,String id,String user_id,String access_token,SimpleCallback<ActivityInfo> simpleCallback){
        apiService.getActivityInfo(id,user_id,access_token)
                .flatMap(new BaseResponseFunc<ActivityInfo>())