i自然 v1.5.2版本的 MD5 值为:4186de3133535afd3ad8a76e7e4d0eff

以下内容为反编译后的 LiveModel.java 源代码,内容仅作参考


package com.mnr.app.live.model;

import android.text.TextUtils;
import androidx.lifecycle.MutableLiveData;
import com.mingtai.aliyunplayer.util.database.DatabaseManager;
import com.mnr.app.R;
import com.mnr.app.app.Myapp;
import com.mnr.app.base.model.BaseModel;
import com.mnr.app.bean.BaseBean;
import com.mnr.app.live.bean.Chatbean;
import com.mnr.app.live.bean.LiveContentBean;
import com.mnr.app.live.bean.LiveEvent;
import com.mnr.app.live.bean.LiveTopic;
import com.mnr.app.live.bean.Livebean;
import com.mnr.app.net.BaseObserver;
import com.mnr.app.net.HttpService;
import com.mnr.app.user.bean.LoginBean;
import com.mnr.dependencies.bean.PushMsgBean;
import com.tencent.open.SocialConstants;
import io.reactivex.rxjava3.functions.Function;
import java.util.HashMap;
import java.util.Locale;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.ResponseBody;

@Metadata(d1 = {"\u0000R\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u001e\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u00042\u0006\u0010\u0006\u001a\u00020\u00072\b\b\u0002\u0010\b\u001a\u00020\u0007J\f\u0010\t\u001a\b\u0012\u0004\u0012\u00020\n0\u0004J\u001c\u0010\u000b\u001a\b\u0012\u0004\u0012\u00020\f0\u00042\u0006\u0010\r\u001a\u00020\u000e2\u0006\u0010\u0006\u001a\u00020\u0007J\u001c\u0010\u000f\u001a\b\u0012\u0004\u0012\u00020\u00100\u00042\u0006\u0010\u0006\u001a\u00020\u00072\u0006\u0010\u0011\u001a\u00020\u0007J\u0014\u0010\u0012\u001a\b\u0012\u0004\u0012\u00020\u00130\u00042\u0006\u0010\u0006\u001a\u00020\u0007J\u0014\u0010\u0014\u001a\b\u0012\u0004\u0012\u00020\u00150\u00042\u0006\u0010\u0016\u001a\u00020\u0017J\u001c\u0010\u0018\u001a\b\u0012\u0004\u0012\u00020\u00190\u00042\u0006\u0010\u0006\u001a\u00020\u00072\u0006\u0010\u001a\u001a\u00020\u0017J\u001c\u0010\u001b\u001a\b\u0012\u0004\u0012\u00020\u00190\u00042\u0006\u0010\u0006\u001a\u00020\u00072\u0006\u0010\u001c\u001a\u00020\u0017¨\u0006\u001d"}, d2 = {"Lcom/mnr/app/live/model/LiveModel;", "Lcom/mnr/app/base/model/BaseModel;", "()V", "getChatList", "Landroidx/lifecycle/MutableLiveData;", "Lcom/mnr/app/live/bean/Chatbean;", "id", "", "pageNumber", "getLive", "Lcom/mnr/app/live/bean/Livebean;", "getLiveContent", "Lcom/mnr/app/live/bean/LiveContentBean;", DatabaseManager.SORT, "", "getLiveEvent", "Lcom/mnr/app/live/bean/LiveEvent;", "eventType", "getLiveTopic", "Lcom/mnr/app/live/bean/LiveTopic;", "getPushUrl", "Lcom/mnr/dependencies/bean/PushMsgBean;", "code", "", "postLiveComment", "Lcom/mnr/app/bean/BaseBean;", "content", "setLiveWatcher", "deviceID", "app_release"}, k = 1, mv = {1, 6, 0}, xi = 48)
public final class LiveModel extends BaseModel {
    public final MutableLiveData<Livebean> getLive() {
        final MutableLiveData<Livebean> mutableLiveData = new MutableLiveData<>();
        HashMap hashMap = new HashMap();
        String string = Myapp.INSTANCE.getApp().getResources().getString(R.string.post_sid);
        Intrinsics.checkNotNullExpressionValue(string, "Myapp.app.resources.getString(R.string.post_sid)");
        hashMap.put("sid", string);
        hashMap.put("pageNumber", 0);
        HttpService.INSTANCE.get("https://api.iziran.net/live/getLiveTopics", hashMap).map(new Function() {
            @Override
            public final Object apply(Object obj) {
                Livebean m291getLive$lambda0;
                m291getLive$lambda0 = LiveModel.m291getLive$lambda0(LiveModel.this, (ResponseBody) obj);
                return m291getLive$lambda0;
            }
        }).subscribe(new BaseObserver<Livebean>(this) {
            @Override
            public void onErrorBase(Throwable e) {
            }

            {
                super(this);
            }

            @Override
            public void onNextBase(Livebean t) {
                Intrinsics.checkNotNullParameter(t, "t");
                mutableLiveData.setValue(t);
            }
        });
        return mutableLiveData;
    }

    public static final Livebean m291getLive$lambda0(LiveModel this$0, ResponseBody responseBody) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        return (Livebean) this$0.getGson().fromJson(responseBody.string(), Livebean.class);
    }

    public final MutableLiveData<LiveTopic> getLiveTopic(int id) {
        final MutableLiveData<LiveTopic> mutableLiveData = new MutableLiveData<>();
        HashMap hashMap = new HashMap();
        hashMap.put("id", Integer.valueOf(id));
        HttpService.INSTANCE.get("https://api.iziran.net/live/getLiveTopic", hashMap).map(new Function() {
            @Override
            public final Object apply(Object obj) {
                LiveTopic m294getLiveTopic$lambda1;
                m294getLiveTopic$lambda1 = LiveModel.m294getLiveTopic$lambda1(LiveModel.this, (ResponseBody) obj);
                return m294getLiveTopic$lambda1;
            }
        }).subscribe(new BaseObserver<LiveTopic>(this) {
            {
                super(this);
            }

            @Override
            public void onNextBase(LiveTopic t) {
                Intrinsics.checkNotNullParameter(t, "t");
                mutableLiveData.setValue(t);
            }

            @Override
            public void onErrorBase(Throwable e) {
                LiveTopic liveTopic = new LiveTopic();
                liveTopic.setMsg(e != null ? e.getMessage() : null);
                mutableLiveData.setValue(liveTopic);
            }
        });
        return mutableLiveData;
    }

    public static final LiveTopic m294getLiveTopic$lambda1(LiveModel this$0, ResponseBody responseBody) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        return (LiveTopic) this$0.getGson().fromJson(responseBody.string(), LiveTopic.class);
    }

    public static MutableLiveData getChatList$default(LiveModel liveModel, int i, int i2, int i3, Object obj) {
        if ((i3 & 2) != 0) {
            i2 = 1;
        }
        return liveModel.getChatList(i, i2);
    }

    public final MutableLiveData<Chatbean> getChatList(int id, int pageNumber) {
        final MutableLiveData<Chatbean> mutableLiveData = new MutableLiveData<>();
        HashMap hashMap = new HashMap();
        hashMap.put("id", Integer.valueOf(id));
        hashMap.put("pageNumber", Integer.valueOf(pageNumber));
        HttpService.INSTANCE.get("https://api.iziran.net/live/getLiveComments", hashMap).map(new Function() {
            @Override
            public final Object apply(Object obj) {
                Chatbean m290getChatList$lambda2;
                m290getChatList$lambda2 = LiveModel.m290getChatList$lambda2(LiveModel.this, (ResponseBody) obj);
                return m290getChatList$lambda2;
            }
        }).subscribe(new BaseObserver<Chatbean>(this) {
            @Override
            public void onErrorBase(Throwable e) {
            }

            {
                super(this);
            }

            @Override
            public void onNextBase(Chatbean t) {
                Intrinsics.checkNotNullParameter(t, "t");
                mutableLiveData.setValue(t);
            }
        });
        return mutableLiveData;
    }

    public static final Chatbean m290getChatList$lambda2(LiveModel this$0, ResponseBody responseBody) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        return (Chatbean) this$0.getGson().fromJson(responseBody.string(), Chatbean.class);
    }

    public final MutableLiveData<LiveContentBean> getLiveContent(boolean sort, int id) {
        final MutableLiveData<LiveContentBean> mutableLiveData = new MutableLiveData<>();
        HashMap hashMap = new HashMap();
        hashMap.put("id", Integer.valueOf(id));
        hashMap.put("pageNumber", 0);
        hashMap.put("orderby", sort ? "asc" : SocialConstants.PARAM_APP_DESC);
        HttpService.INSTANCE.get("https://api.iziran.net/live/getLiveContents", hashMap).map(new Function() {
            @Override
            public final Object apply(Object obj) {
                LiveContentBean m292getLiveContent$lambda3;
                m292getLiveContent$lambda3 = LiveModel.m292getLiveContent$lambda3(LiveModel.this, (ResponseBody) obj);
                return m292getLiveContent$lambda3;
            }
        }).subscribe(new BaseObserver<LiveContentBean>(this) {
            @Override
            public void onErrorBase(Throwable e) {
            }

            {
                super(this);
            }

            @Override
            public void onNextBase(LiveContentBean t) {
                Intrinsics.checkNotNullParameter(t, "t");
                mutableLiveData.setValue(t);
            }
        });
        return mutableLiveData;
    }

    public static final LiveContentBean m292getLiveContent$lambda3(LiveModel this$0, ResponseBody responseBody) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        return (LiveContentBean) this$0.getGson().fromJson(responseBody.string(), LiveContentBean.class);
    }

    public final MutableLiveData<LiveEvent> getLiveEvent(int id, int eventType) {
        final MutableLiveData<LiveEvent> mutableLiveData = new MutableLiveData<>();
        HashMap hashMap = new HashMap();
        hashMap.put("id", Integer.valueOf(id));
        hashMap.put("eventType", Integer.valueOf(eventType));
        hashMap.put("count", Integer.valueOf(eventType == 0 ? 0 : 1));
        HttpService.INSTANCE.post("https://api.iziran.net/live/event", hashMap).map(new Function() {
            @Override
            public final Object apply(Object obj) {
                LiveEvent m293getLiveEvent$lambda4;
                m293getLiveEvent$lambda4 = LiveModel.m293getLiveEvent$lambda4(LiveModel.this, (ResponseBody) obj);
                return m293getLiveEvent$lambda4;
            }
        }).subscribe(new BaseObserver<LiveEvent>(this) {
            {
                super(this);
            }

            @Override
            public void onNextBase(LiveEvent t) {
                Intrinsics.checkNotNullParameter(t, "t");
                mutableLiveData.setValue(t);
            }

            @Override
            public void onErrorBase(Throwable e) {
                MutableLiveData<LiveEvent> mutableLiveData2 = mutableLiveData;
                LiveEvent liveEvent = new LiveEvent();
                liveEvent.setSuccess(false);
                String str = null;
                if (TextUtils.isEmpty(e != null ? e.getMessage() : null)) {
                    str = "提交失败!请稍后重试";
                } else if (e != null) {
                    str = e.getMessage();
                }
                liveEvent.setMsg(str);
                mutableLiveData2.setValue(liveEvent);
            }
        });
        return mutableLiveData;
    }

    public static final LiveEvent m293getLiveEvent$lambda4(LiveModel this$0, ResponseBody responseBody) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        return (LiveEvent) this$0.getGson().fromJson(responseBody.string(), LiveEvent.class);
    }

    public final MutableLiveData<BaseBean> postLiveComment(int id, String content) {
        Intrinsics.checkNotNullParameter(content, "content");
        final MutableLiveData<BaseBean> mutableLiveData = new MutableLiveData<>();
        HashMap hashMap = new HashMap();
        hashMap.put("liveID", Integer.valueOf(id));
        hashMap.put("userID", Integer.valueOf(getMUid()));
        LoginBean userInfo = getUserInfo();
        Intrinsics.checkNotNull(userInfo);
        String faceUrl = userInfo.getFaceUrl();
        Intrinsics.checkNotNullExpressionValue(faceUrl, "getUserInfo()!!.faceUrl");
        hashMap.put("userImg", faceUrl);
        LoginBean userInfo2 = getUserInfo();
        Intrinsics.checkNotNull(userInfo2);
        String nickName = userInfo2.getNickName();
        Intrinsics.checkNotNullExpressionValue(nickName, "getUserInfo()!!.nickName");
        hashMap.put("userName", nickName);
        hashMap.put("content", content);
        HttpService.INSTANCE.post("https://api.iziran.net/live/comment", hashMap).map(new Function() {
            @Override
            public final Object apply(Object obj) {
                BaseBean m297postLiveComment$lambda6;
                m297postLiveComment$lambda6 = LiveModel.m297postLiveComment$lambda6(LiveModel.this, (ResponseBody) obj);
                return m297postLiveComment$lambda6;
            }
        }).subscribe(new BaseObserver<BaseBean>(this) {
            {
                super(this);
            }

            @Override
            public void onNextBase(BaseBean t) {
                Intrinsics.checkNotNullParameter(t, "t");
                mutableLiveData.setValue(t);
            }

            @Override
            public void onErrorBase(Throwable e) {
                MutableLiveData<BaseBean> mutableLiveData2 = mutableLiveData;
                BaseBean baseBean = new BaseBean();
                baseBean.setSuccess(false);
                String str = null;
                if (TextUtils.isEmpty(e != null ? e.getMessage() : null)) {
                    str = "提交失败!请稍后重试";
                } else if (e != null) {
                    str = e.getMessage();
                }
                baseBean.setMsg(str);
                mutableLiveData2.setValue(baseBean);
            }
        });
        return mutableLiveData;
    }

    public static final BaseBean m297postLiveComment$lambda6(LiveModel this$0, ResponseBody responseBody) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        return (BaseBean) this$0.getGson().fromJson(responseBody.string(), BaseBean.class);
    }

    public final MutableLiveData<BaseBean> setLiveWatcher(int id, String deviceID) {
        Intrinsics.checkNotNullParameter(deviceID, "deviceID");
        final MutableLiveData<BaseBean> mutableLiveData = new MutableLiveData<>();
        HashMap hashMap = new HashMap();
        hashMap.put("id", Integer.valueOf(id));
        hashMap.put("deviceID", deviceID);
        HttpService.INSTANCE.get("https://api.iziran.net/live/liveWatch?", hashMap).map(new Function() {
            @Override
            public final Object apply(Object obj) {
                BaseBean m298setLiveWatcher$lambda8;
                m298setLiveWatcher$lambda8 = LiveModel.m298setLiveWatcher$lambda8(LiveModel.this, (ResponseBody) obj);
                return m298setLiveWatcher$lambda8;
            }
        }).subscribe(new BaseObserver<BaseBean>(this) {
            {
                super(this);
            }

            @Override
            public void onNextBase(BaseBean t) {
                Intrinsics.checkNotNullParameter(t, "t");
                mutableLiveData.setValue(t);
            }

            @Override
            public void onErrorBase(Throwable e) {
                MutableLiveData<BaseBean> mutableLiveData2 = mutableLiveData;
                BaseBean baseBean = new BaseBean();
                baseBean.setSuccess(false);
                String str = null;
                if (TextUtils.isEmpty(e != null ? e.getMessage() : null)) {
                    str = "";
                } else if (e != null) {
                    str = e.getMessage();
                }
                baseBean.setMsg(str);
                mutableLiveData2.setValue(baseBean);
            }
        });
        return mutableLiveData;
    }

    public static final BaseBean m298setLiveWatcher$lambda8(LiveModel this$0, ResponseBody responseBody) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        return (BaseBean) this$0.getGson().fromJson(responseBody.string(), BaseBean.class);
    }

    public final MutableLiveData<PushMsgBean> getPushUrl(String code) {
        Intrinsics.checkNotNullParameter(code, "code");
        final MutableLiveData<PushMsgBean> mutableLiveData = new MutableLiveData<>();
        HashMap hashMap = new HashMap();
        String lowerCase = code.toLowerCase(Locale.ROOT);
        Intrinsics.checkNotNullExpressionValue(lowerCase, "this as java.lang.String).toLowerCase(Locale.ROOT)");
        hashMap.put("code", lowerCase);
        HttpService.INSTANCE.get("https://api.iziran.net/live/getLiveByCode?", hashMap).map(new Function() {
            @Override
            public final Object apply(Object obj) {
                PushMsgBean m295getPushUrl$lambda10;
                m295getPushUrl$lambda10 = LiveModel.m295getPushUrl$lambda10(LiveModel.this, (ResponseBody) obj);
                return m295getPushUrl$lambda10;
            }
        }).subscribe(new BaseObserver<PushMsgBean>(this) {
            {
                super(this);
            }

            @Override
            public void onNextBase(PushMsgBean t) {
                Intrinsics.checkNotNullParameter(t, "t");
                mutableLiveData.setValue(t);
            }

            @Override
            public void onErrorBase(Throwable e) {
                MutableLiveData<PushMsgBean> mutableLiveData2 = mutableLiveData;
                PushMsgBean pushMsgBean = new PushMsgBean();
                pushMsgBean.setSuccess(false);
                String str = null;
                if (TextUtils.isEmpty(e != null ? e.getMessage() : null)) {
                    str = "";
                } else if (e != null) {
                    str = e.getMessage();
                }
                pushMsgBean.setMsg(str);
                mutableLiveData2.setValue(pushMsgBean);
            }
        });
        return mutableLiveData;
    }

    public static final PushMsgBean m295getPushUrl$lambda10(LiveModel this$0, ResponseBody responseBody) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        return (PushMsgBean) this$0.getGson().fromJson(responseBody.string(), PushMsgBean.class);
    }
}