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

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


package com.kugou.android.app.flag.protocol;

import android.support.v4.app.NotificationCompat;
import c.a.a.i;
import c.t;
import com.kugou.android.app.flag.bean.FlagInfo;
import com.kugou.android.app.flag.bean.FlagInfoWrapper;
import com.kugou.android.app.flag.bean.FlagTitle;
import com.kugou.android.app.home.channel.f.c;
import com.kugou.android.app.home.channel.protocol.bi;
import com.kugou.android.topic2.detail.base.CommonListResponse;
import com.kugou.android.topic2.submit.special.expandableList.ExpandableItemEntity;
import com.kugou.common.network.w;
import d.ab;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import kotlin.Metadata;
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\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\bÆ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J*\u0010\u0003\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00060\u00050\u00042\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\fJ4\u0010\r\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00060\u00050\u00042\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\u000e\u001a\u00020\u000f2\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\u0010\u001a\u00020\nH\u0002¨\u0006\u0011"}, d2 = {"Lcom/kugou/android/app/flag/protocol/GetUserFlagsProtocol;", "", "()V", "getFlagList", "Lrx/Observable;", "Lcom/kugou/android/topic2/detail/base/CommonListResponse;", "Lcom/kugou/android/topic2/submit/special/expandableList/ExpandableItemEntity;", "userId", "", "page", "", "isHide", "", "parseBody", "responseBody", "Lokhttp3/ResponseBody;", "curPage", "androidkugou_release"}, k = 1, mv = {1, 1, 15})
public final class GetUserFlagsProtocol {

    public static final GetUserFlagsProtocol f9010a = new GetUserFlagsProtocol();

    private GetUserFlagsProtocol() {
    }

    @NotNull
    public final e<CommonListResponse<ExpandableItemEntity>> a(long j, int i, boolean z) {
        bi biVar = (bi) new t.a().b("GetMyFlagListProtocol").a(i.a()).a(w.a(com.kugou.android.app.a.a.yf, "https://youth.kugou.com/v1/flag/my_flag")).a(c.b.a.a.a()).a().b().a(bi.class);
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        linkedHashMap.put("page", String.valueOf(i));
        linkedHashMap.put("pagesize", String.valueOf(20));
        linkedHashMap.put("is_hide", z ? "1" : "0");
        if (com.kugou.common.environment.a.Y() != j) {
            linkedHashMap.put("looker", String.valueOf(j));
        }
        w.b(linkedHashMap, "");
        e c2 = biVar.b(linkedHashMap).c(new a(j, z, i));
        kotlin.jvm.internal.i.a((Object) c2, "viewInterface.get2(map)\n…Hide,page)\n            })");
        return c2;
    }

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0018\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0000\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00030\u00020\u00012\u000e\u0010\u0004\u001a\n \u0006*\u0004\u0018\u00010\u00050\u0005H\n¢\u0006\u0002\b\u0007"}, d2 = {"<anonymous>", "Lrx/Observable;", "Lcom/kugou/android/topic2/detail/base/CommonListResponse;", "Lcom/kugou/android/topic2/submit/special/expandableList/ExpandableItemEntity;", "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<CommonListResponse<ExpandableItemEntity>>> {

        final long f9011a;

        final boolean f9012b;

        final int f9013c;

        a(long j, boolean z, int i) {
            this.f9011a = j;
            this.f9012b = z;
            this.f9013c = i;
        }

        @Override
        @NotNull
        public final e<CommonListResponse<ExpandableItemEntity>> call(ab abVar) {
            GetUserFlagsProtocol getUserFlagsProtocol = GetUserFlagsProtocol.f9010a;
            long j = this.f9011a;
            kotlin.jvm.internal.i.a((Object) abVar, "responseBody");
            return getUserFlagsProtocol.a(j, abVar, this.f9012b, this.f9013c);
        }
    }

    public final e<CommonListResponse<ExpandableItemEntity>> a(long j, ab abVar, boolean z, int i) {
        int i2;
        int i3;
        try {
            CommonListResponse commonListResponse = new CommonListResponse(0, null, 0, 0, null, 31, null);
            JSONObject jSONObject = new JSONObject(abVar.f());
            commonListResponse.a(jSONObject.getInt("status"));
            commonListResponse.b(jSONObject.getInt("error_code"));
            commonListResponse.a(jSONObject.getString("error_msg"));
            JSONObject optJSONObject = jSONObject.optJSONObject("data");
            JSONArray optJSONArray = optJSONObject != null ? optJSONObject.optJSONArray("list") : null;
            ArrayList arrayList = new ArrayList();
            boolean z2 = true;
            if (i != 1 || z) {
                i2 = -1;
                i3 = -1;
            } else {
                int optInt = optJSONObject != null ? optJSONObject.optInt("max_flag_times_flag") : -1;
                i3 = optJSONObject != null ? optJSONObject.optInt("max_duration_flag") : -1;
                int i4 = optInt;
                i2 = optJSONObject != null ? optJSONObject.optInt("max_like_num_flag") : -1;
                r6 = i4;
            }
            if (optJSONArray != null) {
                int length = optJSONArray.length();
                for (int i5 = 0; i5 < length; i5++) {
                    JSONObject jSONObject2 = optJSONArray.getJSONObject(i5);
                    kotlin.jvm.internal.i.a((Object) jSONObject2, "getJSONObject(index)");
                    FlagInfo a2 = FlagInfo.f8972a.a(jSONObject2);
                    if (a2.getId() == r6) {
                        a2.f(true);
                    }
                    if (a2.getId() == i3) {
                        a2.d(true);
                    }
                    if (a2.getId() == i2) {
                        a2.e(true);
                    }
                    a2.a(z);
                    arrayList.add(new FlagInfoWrapper(a2));
                }
            }
            if (z && i == 1 && arrayList.size() > 0) {
                if (com.kugou.common.environment.a.Y() != j) {
                    z2 = false;
                }
                arrayList.add(0, new FlagTitle("隐藏的FLAG", z2));
            }
            commonListResponse.a((List) arrayList);
            if (optJSONObject != null) {
                commonListResponse.e(optJSONObject.optInt("is_end"));
                commonListResponse.g(optJSONObject.optInt("total"));
            }
            e<CommonListResponse<ExpandableItemEntity>> a3 = e.a(commonListResponse);
            kotlin.jvm.internal.i.a((Object) a3, "Observable.just(response)");
            return a3;
        } catch (Exception unused) {
            e<CommonListResponse<ExpandableItemEntity>> a4 = e.a((Throwable) new c(null));
            kotlin.jvm.internal.i.a((Object) a4, "Observable.error<CommonL…nnelParseException(null))");
            return a4;
        }
    }
}