PhotoRoom v4.8.2版本的 MD5 值为:c40a01bb3380c0f75c0cb6ac6760f295

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


package com.courier.android.repositories;

import androidx.recyclerview.widget.LinearLayoutManager;
import com.courier.android.Courier;
import com.courier.android.models.CourierChannel;
import com.courier.android.models.CourierElement;
import com.courier.android.models.CourierException;
import com.courier.android.models.CourierMessageResponse;
import com.courier.android.models.CourierPushEvent;
import com.courier.android.models.CourierServerError;
import com.courier.android.modules.CoreLoggingKt;
import com.courier.android.utils.ServiceExtensionsKt;
import com.google.gson.Gson;
import com.revenuecat.purchases.common.networking.RCHTTPStatusCodes;
import com.shakebugs.shake.chat.ChatNotification;
import com.shakebugs.shake.form.ShakeTitle;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.Metadata;
import kotlin.collections.q0;
import kotlin.collections.r0;
import kotlin.collections.u;
import kotlin.collections.v;
import kotlin.collections.z;
import kotlin.coroutines.jvm.internal.b;
import kotlin.coroutines.jvm.internal.h;
import kotlin.jvm.internal.o0;
import kotlin.jvm.internal.t;
import ny.q;
import org.json.JSONObject;
import px.f1;
import px.h0;
import px.m0;
import px.n0;
import px.u0;
import ux.d;
import ux.j;
import v30.r;
import v30.s;
import w10.b0;
import w10.c0;
import w10.d0;
import w10.e;
import w10.e0;
import w10.f;
@Metadata(d1 = {"\u0000,\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010 \n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\b\u0000\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\u0014\u0010\u0015JG\u0010\f\u001a\u00020\u00022\u0006\u0010\u0003\u001a\u00020\u00022\f\u0010\u0005\u001a\b\u0012\u0004\u0012\u00020\u00020\u00042\u0006\u0010\u0006\u001a\u00020\u00022\u0006\u0010\u0007\u001a\u00020\u00022\f\u0010\t\u001a\b\u0012\u0004\u0012\u00020\b0\u0004H\u0080@ø\u0001\u0000¢\u0006\u0004\b\n\u0010\u000bJ#\u0010\u0013\u001a\u00020\u00102\u0006\u0010\r\u001a\u00020\u00022\u0006\u0010\u000f\u001a\u00020\u000eH\u0080@ø\u0001\u0000¢\u0006\u0004\b\u0011\u0010\u0012\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006\u0016"}, d2 = {"Lcom/courier/android/repositories/MessagingRepository;", "Lcom/courier/android/repositories/Repository;", "", "authKey", "", "userIds", ShakeTitle.TYPE, "body", "Lcom/courier/android/models/CourierChannel;", "channels", "send$android_release", "(Ljava/lang/String;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Lux/d;)Ljava/lang/Object;", "send", "url", "Lcom/courier/android/models/CourierPushEvent;", "event", "Lpx/f1;", "postTrackingUrl$android_release", "(Ljava/lang/String;Lcom/courier/android/models/CourierPushEvent;Lux/d;)Ljava/lang/Object;", "postTrackingUrl", "<init>", "()V", "android_release"}, k = 1, mv = {1, 7, 1})
public final class MessagingRepository extends Repository {
    @s
    public final Object postTrackingUrl$android_release(@r String str, @r CourierPushEvent courierPushEvent, @r d<? super f1> dVar) {
        Map f11;
        final List e11;
        f11 = q0.f(u0.a("event", courierPushEvent.getValue()));
        String jSONObject = new JSONObject(f11).toString();
        t.h(jSONObject, "JSONObject(\n            …lue)\n        ).toString()");
        final e b11 = getHttp().b(new b0.a().u(str).l(c0.a.n(c0.Companion, jSONObject, null, 1, null)).b());
        e11 = kotlin.collections.t.e(b.d(RCHTTPStatusCodes.SUCCESS));
        final j jVar = new j(vx.b.c(dVar));
        b11.o0(new f() {
            @Override
            public void onFailure(@r e call, @r IOException e12) {
                t.i(call, "call");
                t.i(e12, "e");
                d dVar2 = d.this;
                m0.a aVar = m0.f64687c;
                dVar2.resumeWith(m0.b(n0.a(e12)));
            }

            @Override
            public void onResponse(@r e call, @r d0 response) {
                String prettyJson;
                t.i(call, "call");
                t.i(response, "response");
                Courier.Companion companion = Courier.Companion;
                String str2 = "Empty";
                if (CoreLoggingKt.isDebugging(companion.getShared())) {
                    b0 request = b11.request();
                    companion.log("📡 New Courier API Request");
                    companion.log("URL: " + request.k());
                    companion.log("Method: " + request.h());
                    StringBuilder sb2 = new StringBuilder();
                    sb2.append("Body: ");
                    String prettyJson2 = ServiceExtensionsKt.toPrettyJson(request);
                    if (prettyJson2 == null) {
                        prettyJson2 = "Empty";
                    }
                    sb2.append(prettyJson2);
                    companion.log(sb2.toString());
                }
                Gson gson = new Gson();
                if (!e11.contains(Integer.valueOf(response.h()))) {
                    try {
                        e0 a11 = response.a();
                        CourierException toException = ((CourierServerError) gson.m(a11 != null ? a11.n() : null, CourierServerError.class)).getToException();
                        d dVar2 = d.this;
                        m0.a aVar = m0.f64687c;
                        dVar2.resumeWith(m0.b(n0.a(toException)));
                        return;
                    } catch (Exception e12) {
                        d dVar3 = d.this;
                        m0.a aVar2 = m0.f64687c;
                        dVar3.resumeWith(m0.b(n0.a(e12)));
                        return;
                    }
                }
                e0 a12 = response.a();
                String n11 = a12 != null ? a12.n() : null;
                StringBuilder sb3 = new StringBuilder();
                sb3.append("Response: ");
                if (n11 != null && (prettyJson = ServiceExtensionsKt.toPrettyJson(n11)) != null) {
                    str2 = prettyJson;
                }
                sb3.append(str2);
                companion.log(sb3.toString());
                try {
                    if (!t.d(o0.b(CourierMessageResponse.class), o0.b(Object.class))) {
                        d.this.resumeWith(m0.b(gson.m(n11, CourierMessageResponse.class)));
                        return;
                    }
                    d dVar4 = d.this;
                    m0.a aVar3 = m0.f64687c;
                    dVar4.resumeWith(m0.b(CourierMessageResponse.class.newInstance()));
                } catch (Exception e13) {
                    d dVar5 = d.this;
                    m0.a aVar4 = m0.f64687c;
                    dVar5.resumeWith(m0.b(n0.a(e13)));
                }
            }
        });
        Object a11 = jVar.a();
        if (a11 == vx.b.e()) {
            h.c(dVar);
        }
        return a11 == vx.b.e() ? a11 : f1.f64673a;
    }

    @s
    public final Object send$android_release(@r String str, @r List<String> list, @r String str2, @r String str3, @r List<? extends CourierChannel> list2, @r d<? super String> dVar) {
        MessagingRepository$send$1 messagingRepository$send$1;
        int i11;
        int x11;
        int x12;
        Map l11;
        int x13;
        int x14;
        Map l12;
        int x15;
        int e11;
        int e12;
        Map l13;
        Map f11;
        final List p11;
        Map f12;
        if (dVar instanceof MessagingRepository$send$1) {
            messagingRepository$send$1 = (MessagingRepository$send$1) dVar;
            int i12 = messagingRepository$send$1.label;
            if ((i12 & LinearLayoutManager.INVALID_OFFSET) != 0) {
                messagingRepository$send$1.label = i12 - LinearLayoutManager.INVALID_OFFSET;
                Object obj = messagingRepository$send$1.result;
                Object e13 = vx.b.e();
                i11 = messagingRepository$send$1.label;
                if (i11 != 0) {
                    n0.b(obj);
                    String str4 = getBaseRest() + "/send";
                    h0[] h0VarArr = new h0[5];
                    List<String> list3 = list;
                    x11 = v.x(list3, 10);
                    ArrayList arrayList = new ArrayList(x11);
                    for (String str5 : list3) {
                        f12 = q0.f(u0.a(ChatNotification.USER, str5));
                        arrayList.add(f12);
                    }
                    h0VarArr[0] = u0.a("to", arrayList);
                    h0[] h0VarArr2 = new h0[4];
                    h0VarArr2[0] = u0.a(ShakeTitle.TYPE, str2);
                    h0VarArr2[1] = u0.a("body", str3);
                    h0VarArr2[2] = u0.a("version", "2020-01-01");
                    List<? extends CourierChannel> list4 = list2;
                    ArrayList<CourierElement> arrayList2 = new ArrayList();
                    for (CourierChannel courierChannel : list4) {
                        z.D(arrayList2, courierChannel.getElements());
                    }
                    x12 = v.x(arrayList2, 10);
                    ArrayList arrayList3 = new ArrayList(x12);
                    for (CourierElement courierElement : arrayList2) {
                        arrayList3.add(courierElement.getMap());
                    }
                    h0VarArr2[3] = u0.a("elements", arrayList3);
                    l11 = r0.l(h0VarArr2);
                    h0VarArr[1] = u0.a("content", l11);
                    x13 = v.x(list4, 10);
                    ArrayList<Map> arrayList4 = new ArrayList(x13);
                    for (CourierChannel courierChannel2 : list4) {
                        Map<String, Object> data = courierChannel2.getData();
                        if (data == null) {
                            data = r0.i();
                        }
                        arrayList4.add(data);
                    }
                    LinkedHashMap linkedHashMap = new LinkedHashMap();
                    for (Map map : arrayList4) {
                        for (Map.Entry entry : map.entrySet()) {
                            linkedHashMap.put((String) entry.getKey(), entry.getValue());
                        }
                    }
                    h0VarArr[2] = u0.a("data", linkedHashMap);
                    h0[] h0VarArr3 = new h0[2];
                    h0VarArr3[0] = u0.a("method", "all");
                    x14 = v.x(list4, 10);
                    ArrayList arrayList5 = new ArrayList(x14);
                    for (CourierChannel courierChannel3 : list4) {
                        arrayList5.add(courierChannel3.getKey());
                    }
                    h0VarArr3[1] = u0.a("channels", arrayList5);
                    l12 = r0.l(h0VarArr3);
                    h0VarArr[3] = u0.a("routing", l12);
                    ArrayList<CourierChannel> arrayList6 = new ArrayList();
                    for (Object obj2 : list4) {
                        if (((CourierChannel) obj2).getProviderOverride() != null) {
                            arrayList6.add(obj2);
                        }
                    }
                    x15 = v.x(arrayList6, 10);
                    e11 = q0.e(x15);
                    e12 = q.e(e11, 16);
                    LinkedHashMap linkedHashMap2 = new LinkedHashMap(e12);
                    for (CourierChannel courierChannel4 : arrayList6) {
                        h0 a11 = u0.a(courierChannel4.getKey(), courierChannel4.getProviderOverride());
                        linkedHashMap2.put(a11.c(), a11.d());
                    }
                    h0VarArr[4] = u0.a("providers", linkedHashMap2);
                    l13 = r0.l(h0VarArr);
                    f11 = q0.f(u0.a("message", l13));
                    String jSONObject = new JSONObject(f11).toString();
                    t.h(jSONObject, "JSONObject(\n            …   )\n        ).toString()");
                    final e b11 = getHttp().b(new b0.a().u(str4).a("Authorization", "Bearer " + str).l(c0.a.n(c0.Companion, jSONObject, null, 1, null)).b());
                    p11 = u.p(b.d(RCHTTPStatusCodes.SUCCESS), b.d(202));
                    messagingRepository$send$1.L$0 = b11;
                    messagingRepository$send$1.L$1 = p11;
                    messagingRepository$send$1.label = 1;
                    final j jVar = new j(vx.b.c(messagingRepository$send$1));
                    b11.o0(new f() {
                        @Override
                        public void onFailure(@r e call, @r IOException e14) {
                            t.i(call, "call");
                            t.i(e14, "e");
                            d dVar2 = d.this;
                            m0.a aVar = m0.f64687c;
                            dVar2.resumeWith(m0.b(n0.a(e14)));
                        }

                        @Override
                        public void onResponse(@r e call, @r d0 response) {
                            String prettyJson;
                            t.i(call, "call");
                            t.i(response, "response");
                            Courier.Companion companion = Courier.Companion;
                            String str6 = "Empty";
                            if (CoreLoggingKt.isDebugging(companion.getShared())) {
                                b0 request = b11.request();
                                companion.log("📡 New Courier API Request");
                                companion.log("URL: " + request.k());
                                companion.log("Method: " + request.h());
                                StringBuilder sb2 = new StringBuilder();
                                sb2.append("Body: ");
                                String prettyJson2 = ServiceExtensionsKt.toPrettyJson(request);
                                if (prettyJson2 == null) {
                                    prettyJson2 = "Empty";
                                }
                                sb2.append(prettyJson2);
                                companion.log(sb2.toString());
                            }
                            Gson gson = new Gson();
                            if (!p11.contains(Integer.valueOf(response.h()))) {
                                try {
                                    e0 a12 = response.a();
                                    CourierException toException = ((CourierServerError) gson.m(a12 != null ? a12.n() : null, CourierServerError.class)).getToException();
                                    d dVar2 = d.this;
                                    m0.a aVar = m0.f64687c;
                                    dVar2.resumeWith(m0.b(n0.a(toException)));
                                    return;
                                } catch (Exception e14) {
                                    d dVar3 = d.this;
                                    m0.a aVar2 = m0.f64687c;
                                    dVar3.resumeWith(m0.b(n0.a(e14)));
                                    return;
                                }
                            }
                            e0 a13 = response.a();
                            String n11 = a13 != null ? a13.n() : null;
                            StringBuilder sb3 = new StringBuilder();
                            sb3.append("Response: ");
                            if (n11 != null && (prettyJson = ServiceExtensionsKt.toPrettyJson(n11)) != null) {
                                str6 = prettyJson;
                            }
                            sb3.append(str6);
                            companion.log(sb3.toString());
                            try {
                                if (!t.d(o0.b(CourierMessageResponse.class), o0.b(Object.class))) {
                                    d.this.resumeWith(m0.b(gson.m(n11, CourierMessageResponse.class)));
                                    return;
                                }
                                d dVar4 = d.this;
                                m0.a aVar3 = m0.f64687c;
                                dVar4.resumeWith(m0.b(CourierMessageResponse.class.newInstance()));
                            } catch (Exception e15) {
                                d dVar5 = d.this;
                                m0.a aVar4 = m0.f64687c;
                                dVar5.resumeWith(m0.b(n0.a(e15)));
                            }
                        }
                    });
                    f1 f1Var = f1.f64673a;
                    obj = jVar.a();
                    if (obj == vx.b.e()) {
                        h.c(messagingRepository$send$1);
                    }
                    if (obj == e13) {
                        return e13;
                    }
                } else if (i11 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                } else {
                    List list5 = (List) messagingRepository$send$1.L$1;
                    e eVar = (e) messagingRepository$send$1.L$0;
                    n0.b(obj);
                }
                String requestId = ((CourierMessageResponse) obj).getRequestId();
                Courier.Companion.log("New Courier message sent. View logs here:\nhttps://app.courier.com/logs/messages?message=" + requestId + "\nIf you do not receive this message, you may need to configure the Firebase Cloud Messaging provider. More info:\nhttps://app.courier.com/channels/firebase-fcm");
                return requestId;
            }
        }
        messagingRepository$send$1 = new MessagingRepository$send$1(this, dVar);
        Object obj3 = messagingRepository$send$1.result;
        Object e132 = vx.b.e();
        i11 = messagingRepository$send$1.label;
        if (i11 != 0) {
        }
        String requestId2 = ((CourierMessageResponse) obj3).getRequestId();
        Courier.Companion.log("New Courier message sent. View logs here:\nhttps://app.courier.com/logs/messages?message=" + requestId2 + "\nIf you do not receive this message, you may need to configure the Firebase Cloud Messaging provider. More info:\nhttps://app.courier.com/channels/firebase-fcm");
        return requestId2;
    }
}