酷狗概念版 v2.5.5版本的 MD5 值为:782d327088fca4e58310f35a56f41319

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


package com.kugou.android.app.home.channel.detailpage.studyroom.protocol;

import android.support.v4.app.NotificationCompat;
import c.a.a.i;
import c.t;
import com.google.gson.Gson;
import com.kugou.android.app.flag.bean.FlagInfo;
import com.kugou.android.app.home.channel.entity.CommonResponse;
import com.kugou.android.app.home.channel.entity.chatroom.StudyRoomInfo;
import com.kugou.android.app.home.channel.f.c;
import com.kugou.android.app.home.channel.protocol.bi;
import com.kugou.common.network.w;
import com.kugou.common.utils.as;
import d.ab;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import kotlin.Metadata;
import kotlin.Pair;
import org.jetbrains.annotations.NotNull;
import org.json.JSONArray;
import org.json.JSONObject;
import rx.e;

@Metadata(bv = {1, 0, 3}, d1 = {"\u00006\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\bÆ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J$\u0010\u0003\u001a \u0012\u001c\u0012\u001a\u0012\u0016\u0012\u0014\u0012\u0004\u0012\u00020\u0007\u0012\n\u0012\b\u0012\u0004\u0012\u00020\t0\b0\u00060\u00050\u0004J\u0018\u0010\n\u001a\b\u0012\u0004\u0012\u00020\t0\b2\b\u0010\u000b\u001a\u0004\u0018\u00010\fH\u0002J.\u0010\r\u001a \u0012\u001c\u0012\u001a\u0012\u0016\u0012\u0014\u0012\u0004\u0012\u00020\u0007\u0012\n\u0012\b\u0012\u0004\u0012\u00020\t0\b0\u00060\u00050\u00042\u0006\u0010\u000e\u001a\u00020\u000fH\u0002¨\u0006\u0010"}, d2 = {"Lcom/kugou/android/app/home/channel/detailpage/studyroom/protocol/GetCurrentStudyInfoProtocol;", "", "()V", "get", "Lrx/Observable;", "Lcom/kugou/android/app/home/channel/entity/CommonResponse;", "Lkotlin/Pair;", "Lcom/kugou/android/app/home/channel/entity/chatroom/StudyRoomInfo;", "", "Lcom/kugou/android/app/flag/bean/FlagInfo;", "getFlagInfos", "data", "Lorg/json/JSONObject;", "parseBody", "responseBody", "Lokhttp3/ResponseBody;", "androidkugou_release"}, k = 1, mv = {1, 1, 15})
public final class GetCurrentStudyInfoProtocol {

    public static final GetCurrentStudyInfoProtocol f11031a = new GetCurrentStudyInfoProtocol();

    private GetCurrentStudyInfoProtocol() {
    }

    @NotNull
    public final e<CommonResponse<Pair<StudyRoomInfo, List<FlagInfo>>>> a() {
        bi biVar = (bi) new t.a().b("GetCurrentStudyInfoProtocol").a(i.a()).a(w.a(com.kugou.android.app.a.a.BJ, "https://youth.kugou.com/v1/study/get_user_current_study_info")).a(c.b.a.a.a()).a().b().a(bi.class);
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        w.b(linkedHashMap, "");
        e c2 = biVar.b(linkedHashMap).c(a.f11032a);
        kotlin.jvm.internal.i.a((Object) c2, "viewInterface.get2(map)\n…onseBody)\n             })");
        return c2;
    }

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000$\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0000\u001a \u0012\u001c\u0012\u001a\u0012\u0016\u0012\u0014\u0012\u0004\u0012\u00020\u0004\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00060\u00050\u00030\u00020\u00012\u000e\u0010\u0007\u001a\n \t*\u0004\u0018\u00010\b0\bH\n¢\u0006\u0002\b\n"}, d2 = {"<anonymous>", "Lrx/Observable;", "Lcom/kugou/android/app/home/channel/entity/CommonResponse;", "Lkotlin/Pair;", "Lcom/kugou/android/app/home/channel/entity/chatroom/StudyRoomInfo;", "", "Lcom/kugou/android/app/flag/bean/FlagInfo;", "responseBody", "Lokhttp3/ResponseBody;", "kotlin.jvm.PlatformType", NotificationCompat.CATEGORY_CALL}, k = 3, mv = {1, 1, 15})
    static final class a<T, R> implements rx.b.e<ab, e<CommonResponse<Pair<? extends StudyRoomInfo, ? extends List<? extends FlagInfo>>>>> {

        public static final a f11032a = new a();

        a() {
        }

        @Override
        @NotNull
        public final e<CommonResponse<Pair<StudyRoomInfo, List<FlagInfo>>>> call(ab abVar) {
            GetCurrentStudyInfoProtocol getCurrentStudyInfoProtocol = GetCurrentStudyInfoProtocol.f11031a;
            kotlin.jvm.internal.i.a((Object) abVar, "responseBody");
            return getCurrentStudyInfoProtocol.a(abVar);
        }
    }

    public final e<CommonResponse<Pair<StudyRoomInfo, List<FlagInfo>>>> a(ab abVar) {
        try {
            CommonResponse commonResponse = new CommonResponse(0, 0, null, false, null, 31, null);
            String f = abVar.f();
            as.f("lzq-young", f);
            JSONObject jSONObject = new JSONObject(f);
            commonResponse.a(jSONObject.getInt("status"));
            commonResponse.b(jSONObject.getInt("error_code"));
            String string = jSONObject.getString("error_msg");
            kotlin.jvm.internal.i.a((Object) string, "jsonObject.getString(\"error_msg\")");
            commonResponse.a(string);
            JSONObject optJSONObject = jSONObject.optJSONObject("data");
            if (optJSONObject != null) {
                StudyRoomInfo studyRoomInfo = (StudyRoomInfo) new Gson().fromJson(optJSONObject.toString(), StudyRoomInfo.class);
                List<FlagInfo> a2 = f11031a.a(optJSONObject);
                kotlin.jvm.internal.i.a((Object) studyRoomInfo, "first");
                commonResponse.a((CommonResponse) new Pair(studyRoomInfo, a2));
            }
            e<CommonResponse<Pair<StudyRoomInfo, List<FlagInfo>>>> a3 = e.a(commonResponse);
            kotlin.jvm.internal.i.a((Object) a3, "Observable.just(response)");
            return a3;
        } catch (Exception unused) {
            e<CommonResponse<Pair<StudyRoomInfo, List<FlagInfo>>>> a4 = e.a((Throwable) new c(null));
            kotlin.jvm.internal.i.a((Object) a4, "Observable.error<CommonR…nnelParseException(null))");
            return a4;
        }
    }

    private final List<FlagInfo> a(JSONObject jSONObject) {
        JSONArray optJSONArray = jSONObject != null ? jSONObject.optJSONArray("flag_list") : null;
        ArrayList arrayList = new ArrayList();
        if (optJSONArray != null) {
            int length = optJSONArray.length();
            for (int i = 0; i < length; i++) {
                JSONObject jSONObject2 = optJSONArray.getJSONObject(i);
                kotlin.jvm.internal.i.a((Object) jSONObject2, "getJSONObject(index)");
                arrayList.add(FlagInfo.f8972a.a(jSONObject2));
            }
        }
        return arrayList;
    }
}