package com.discord.stores; import com.discord.stores.updates.ObservationDeck; import com.discord.utilities.analytics.AnalyticsTracker; import com.discord.utilities.time.Clock; import com.discord.utilities.time.ClockFactory; import d0.z.d.m; import kotlin.jvm.internal.DefaultConstructorMarker; import rx.Observable; /* compiled from: StoreExpressionSuggestions.kt */ public final class StoreExpressionSuggestions extends StoreV2 { public static final Companion Companion = new Companion(null); public static final long TRACKED_EXPRESSION_SUGGESTIONS_DISPLAYED_THROTTLE_WINDOW = 60000; private final Clock clock; private final Dispatcher dispatcher; private long lastTrackedExpressionSuggestionsDisplayed; private final ObservationDeck observationDeck; private boolean suggestionsEnabled; /* compiled from: StoreExpressionSuggestions.kt */ public static final class Companion { private Companion() { } public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } } public StoreExpressionSuggestions(ObservationDeck observationDeck, Dispatcher dispatcher, Clock clock) { m.checkNotNullParameter(observationDeck, "observationDeck"); m.checkNotNullParameter(dispatcher, "dispatcher"); m.checkNotNullParameter(clock, "clock"); this.observationDeck = observationDeck; this.dispatcher = dispatcher; this.clock = clock; this.suggestionsEnabled = true; } /* JADX INFO: this call moved to the top of the method (can break code semantics) */ public /* synthetic */ StoreExpressionSuggestions(ObservationDeck observationDeck, Dispatcher dispatcher, Clock clock, int i, DefaultConstructorMarker defaultConstructorMarker) { this(observationDeck, dispatcher, (i & 4) != 0 ? ClockFactory.get() : clock); } public static final /* synthetic */ boolean access$getSuggestionsEnabled$p(StoreExpressionSuggestions storeExpressionSuggestions) { return storeExpressionSuggestions.suggestionsEnabled; } public static final /* synthetic */ void access$setSuggestionsEnabled$p(StoreExpressionSuggestions storeExpressionSuggestions, boolean z2) { storeExpressionSuggestions.suggestionsEnabled = z2; } @StoreThread public final void handleChannelSelected() { this.suggestionsEnabled = true; markChanged(); } public final Observable observeSuggestionsEnabled() { Observable r = ObservationDeck.connectRx$default(this.observationDeck, new ObservationDeck.UpdateSource[]{this}, false, null, null, new StoreExpressionSuggestions$observeSuggestionsEnabled$1(this), 14, null).r(); m.checkNotNullExpressionValue(r, "observationDeck.connectR… }.distinctUntilChanged()"); return r; } public final void setExpressionSuggestionsEnabled(boolean z2) { this.dispatcher.schedule(new StoreExpressionSuggestions$setExpressionSuggestionsEnabled$1(this, z2)); } public final void trackExpressionSuggestionsDisplayed() { long currentTimeMillis = this.clock.currentTimeMillis(); if (this.lastTrackedExpressionSuggestionsDisplayed + 60000 <= currentTimeMillis) { this.lastTrackedExpressionSuggestionsDisplayed = currentTimeMillis; AnalyticsTracker.INSTANCE.expressionSuggestionsDisplayed(); } } }