package com.discord.stores; import com.discord.app.AppLog; import com.discord.stores.updates.ObservationDeck; import com.discord.utilities.logging.Logger; import d0.t.r; import d0.z.d.m; import java.util.HashSet; import java.util.Set; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.reflect.KProperty; /* compiled from: StoreV2.kt */ public abstract class StoreV2 extends Store implements DispatchHandler, ObservationDeck.UpdateSource { private final Set updateSources = new HashSet(); /* compiled from: StoreV2.kt */ public static final class MarkChangedDelegate { private final ObservationDeck.UpdateSource overrideUpdateSource; private T value; public MarkChangedDelegate(T t, ObservationDeck.UpdateSource updateSource) { this.value = t; this.overrideUpdateSource = updateSource; } /* JADX INFO: this call moved to the top of the method (can break code semantics) */ public /* synthetic */ MarkChangedDelegate(Object obj, ObservationDeck.UpdateSource updateSource, int i, DefaultConstructorMarker defaultConstructorMarker) { this(obj, (i & 2) != 0 ? null : updateSource); } public final T getValue(StoreV2 storeV2, KProperty kProperty) { m.checkNotNullParameter(kProperty, "property"); return this.value; } public final void setValue(StoreV2 storeV2, KProperty kProperty, T t) { m.checkNotNullParameter(kProperty, "property"); if (!m.areEqual(this.value, t)) { this.value = t; ObservationDeck.UpdateSource updateSource = this.overrideUpdateSource; if (updateSource != null) { if (storeV2 != null) { storeV2.markChanged(updateSource); } } else if (storeV2 != null) { storeV2.markChanged(); } } } } private final void assertStoreThread() { Thread currentThread = Thread.currentThread(); m.checkNotNullExpressionValue(currentThread, "Thread.currentThread()"); if (currentThread.getId() != StoreStream.Companion.getSTORE_THREAD_ID()) { Logger.e$default(AppLog.g, "markChanged() should be run from the Store Dispatcher", new IllegalStateException("Dispatch not run on store thread"), null, 4, null); } } public final Set getUpdateSources() { return this.updateSources; } public final void markChanged() { assertStoreThread(); this.updateSources.add(this); } public final void markChanged(ObservationDeck.UpdateSource... updateSourceArr) { m.checkNotNullParameter(updateSourceArr, "updates"); assertStoreThread(); markChanged(); r.addAll(this.updateSources, updateSourceArr); } public final void markUnchanged(ObservationDeck.UpdateSource updateSource) { m.checkNotNullParameter(updateSource, "updateSource"); assertStoreThread(); this.updateSources.remove(updateSource); } @Override // com.discord.stores.DispatchHandler public void onDispatchEnded() { this.updateSources.clear(); } public void snapshotData() { } }