package com.parse;

import com.parse.ParseQuery;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import p137.C2742;
import p137.InterfaceC2741;

/* JADX INFO: loaded from: classes.dex */
@ParseClassName("_EventuallyPin")
public class EventuallyPin extends ParseObject {
    public EventuallyPin() {
        super("_EventuallyPin");
    }

    public static C2742<List<EventuallyPin>> findAllPinned(Collection<String> collection) {
        ParseQuery parseQuery = new ParseQuery(EventuallyPin.class);
        parseQuery.fromPin("_eventuallyPin");
        parseQuery.ignoreACLs();
        ParseQuery.State.Builder<T> builder = parseQuery.builder;
        builder.order.clear();
        builder.order.add("time");
        if (collection != null) {
            ParseQuery.State.Builder<T> builder2 = parseQuery.builder;
            ParseQuery.KeyConstraints keyConstraints = null;
            if (builder2 == 0) {
                throw null;
            }
            Collection collectionUnmodifiableCollection = Collections.unmodifiableCollection(collection);
            if (builder2.where.containsKey("uuid")) {
                Object obj = builder2.where.get("uuid");
                if (obj instanceof ParseQuery.KeyConstraints) {
                    keyConstraints = (ParseQuery.KeyConstraints) obj;
                }
            }
            if (keyConstraints == null) {
                keyConstraints = new ParseQuery.KeyConstraints();
            }
            keyConstraints.put("$nin", collectionUnmodifiableCollection);
            builder2.where.put("uuid", keyConstraints);
        }
        return parseQuery.findInBackground().m4817(new InterfaceC2741<List<EventuallyPin>, C2742<List<EventuallyPin>>>() { // from class: com.parse.EventuallyPin.2
            @Override // p137.InterfaceC2741
            public C2742<List<EventuallyPin>> then(C2742<List<EventuallyPin>> c2742) {
                final List<EventuallyPin> listM4812 = c2742.m4812();
                ArrayList arrayList = new ArrayList();
                Iterator<EventuallyPin> it = listM4812.iterator();
                while (true) {
                    if (!it.hasNext()) {
                        return C2742.m4801((Collection<? extends C2742<?>>) arrayList).m4815(new InterfaceC2741<Void, C2742<List<EventuallyPin>>>(this) { // from class: com.parse.EventuallyPin.2.1
                            @Override // p137.InterfaceC2741
                            public C2742<List<EventuallyPin>> then(C2742<Void> c27422) {
                                return C2742.m4805(listM4812);
                            }
                        }, C2742.f8455, null);
                    }
                    Object obj2 = it.next().get("object");
                    ParseObject parseObject = obj2 instanceof ParseObject ? (ParseObject) obj2 : null;
                    if (parseObject != null) {
                        arrayList.add(parseObject.fetchFromLocalDatastoreAsync().m4821());
                    }
                }
            }
        }, C2742.f8455);
    }

    @Override // com.parse.ParseObject
    public boolean needsDefaultACL() {
        return false;
    }
}
