749 lines
29 KiB
Java
749 lines
29 KiB
Java
package com.discord.widgets.bugreports;
|
|
|
|
import android.content.Context;
|
|
import android.net.Uri;
|
|
import androidx.annotation.MainThread;
|
|
import c.d.b.a.a;
|
|
import com.discord.api.bugreport.BugReportConfig;
|
|
import com.discord.api.bugreport.Feature;
|
|
import com.discord.api.sticker.Sticker;
|
|
import com.discord.app.AppViewModel;
|
|
import com.discord.models.domain.ModelAuditLogEntry;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.stores.utilities.Loading;
|
|
import com.discord.stores.utilities.RestCallState;
|
|
import com.discord.stores.utilities.RestCallStateKt;
|
|
import com.discord.utilities.error.Error;
|
|
import com.discord.utilities.rest.RestAPI;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.utilities.stickers.StickerUtils;
|
|
import d0.c0.c;
|
|
import d0.d0.f;
|
|
import d0.g0.w;
|
|
import d0.t.m;
|
|
import d0.t.n;
|
|
import d0.t.u;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.List;
|
|
import java.util.concurrent.TimeUnit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import okhttp3.MultipartBody;
|
|
import okhttp3.RequestBody;
|
|
import rx.Observable;
|
|
import rx.subjects.PublishSubject;
|
|
/* compiled from: BugReportViewModel.kt */
|
|
public final class BugReportViewModel extends AppViewModel<ViewState> {
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final List<Feature> genericFeatureAreas = m.listOf(new Feature("General", "Android", null));
|
|
private static final List<Sticker> sendingStickers;
|
|
private static final List<Sticker> successStickers;
|
|
private RestCallState<BugReportConfig> bugReportConfig;
|
|
private final PublishSubject<Event> eventSubject;
|
|
private Feature feature;
|
|
private String featureSearchQuery;
|
|
private Integer priority;
|
|
private String reportDescription;
|
|
private String reportName;
|
|
private final RestAPI restApi;
|
|
private final String screenshotName;
|
|
private final Uri screenshotUri;
|
|
private final Sticker sendingSticker;
|
|
private final int stickerCharacterIndex;
|
|
private boolean stickersPrefetched;
|
|
private final Sticker successSticker;
|
|
private boolean useScreenshot;
|
|
|
|
/* compiled from: BugReportViewModel.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public final List<Feature> getGenericFeatureAreas() {
|
|
return BugReportViewModel.access$getGenericFeatureAreas$cp();
|
|
}
|
|
|
|
public final List<Sticker> getSendingStickers() {
|
|
return BugReportViewModel.access$getSendingStickers$cp();
|
|
}
|
|
|
|
public final List<Sticker> getSuccessStickers() {
|
|
return BugReportViewModel.access$getSuccessStickers$cp();
|
|
}
|
|
}
|
|
|
|
/* compiled from: BugReportViewModel.kt */
|
|
public static abstract class Event {
|
|
|
|
/* compiled from: BugReportViewModel.kt */
|
|
public static final class CloseReport extends Event {
|
|
public static final CloseReport INSTANCE = new CloseReport();
|
|
|
|
private CloseReport() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
private Event() {
|
|
}
|
|
|
|
public /* synthetic */ Event(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
/* compiled from: BugReportViewModel.kt */
|
|
public static abstract class ViewState {
|
|
|
|
/* compiled from: BugReportViewModel.kt */
|
|
public static final class Report extends ViewState {
|
|
private final Error error;
|
|
private final Feature feature;
|
|
private final Integer priority;
|
|
private final String reportDescription;
|
|
private final String reportName;
|
|
private final Uri screenshotUri;
|
|
private final boolean useScreenshot;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public Report(Uri uri, String str, String str2, Integer num, Feature feature, boolean z2, Error error) {
|
|
super(null);
|
|
d0.z.d.m.checkNotNullParameter(uri, "screenshotUri");
|
|
this.screenshotUri = uri;
|
|
this.reportName = str;
|
|
this.reportDescription = str2;
|
|
this.priority = num;
|
|
this.feature = feature;
|
|
this.useScreenshot = z2;
|
|
this.error = error;
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public /* synthetic */ Report(Uri uri, String str, String str2, Integer num, Feature feature, boolean z2, Error error, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(uri, str, str2, num, feature, (i & 32) != 0 ? true : z2, (i & 64) != 0 ? null : error);
|
|
}
|
|
|
|
public static /* synthetic */ Report copy$default(Report report, Uri uri, String str, String str2, Integer num, Feature feature, boolean z2, Error error, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
uri = report.screenshotUri;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
str = report.reportName;
|
|
}
|
|
if ((i & 4) != 0) {
|
|
str2 = report.reportDescription;
|
|
}
|
|
if ((i & 8) != 0) {
|
|
num = report.priority;
|
|
}
|
|
if ((i & 16) != 0) {
|
|
feature = report.feature;
|
|
}
|
|
if ((i & 32) != 0) {
|
|
z2 = report.useScreenshot;
|
|
}
|
|
if ((i & 64) != 0) {
|
|
error = report.error;
|
|
}
|
|
return report.copy(uri, str, str2, num, feature, z2, error);
|
|
}
|
|
|
|
public final Uri component1() {
|
|
return this.screenshotUri;
|
|
}
|
|
|
|
public final String component2() {
|
|
return this.reportName;
|
|
}
|
|
|
|
public final String component3() {
|
|
return this.reportDescription;
|
|
}
|
|
|
|
public final Integer component4() {
|
|
return this.priority;
|
|
}
|
|
|
|
public final Feature component5() {
|
|
return this.feature;
|
|
}
|
|
|
|
public final boolean component6() {
|
|
return this.useScreenshot;
|
|
}
|
|
|
|
public final Error component7() {
|
|
return this.error;
|
|
}
|
|
|
|
public final Report copy(Uri uri, String str, String str2, Integer num, Feature feature, boolean z2, Error error) {
|
|
d0.z.d.m.checkNotNullParameter(uri, "screenshotUri");
|
|
return new Report(uri, str, str2, num, feature, z2, error);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof Report)) {
|
|
return false;
|
|
}
|
|
Report report = (Report) obj;
|
|
return d0.z.d.m.areEqual(this.screenshotUri, report.screenshotUri) && d0.z.d.m.areEqual(this.reportName, report.reportName) && d0.z.d.m.areEqual(this.reportDescription, report.reportDescription) && d0.z.d.m.areEqual(this.priority, report.priority) && d0.z.d.m.areEqual(this.feature, report.feature) && this.useScreenshot == report.useScreenshot && d0.z.d.m.areEqual(this.error, report.error);
|
|
}
|
|
|
|
public final Error getError() {
|
|
return this.error;
|
|
}
|
|
|
|
public final Feature getFeature() {
|
|
return this.feature;
|
|
}
|
|
|
|
public final Integer getPriority() {
|
|
return this.priority;
|
|
}
|
|
|
|
public final String getReportDescription() {
|
|
return this.reportDescription;
|
|
}
|
|
|
|
public final String getReportName() {
|
|
return this.reportName;
|
|
}
|
|
|
|
public final Uri getScreenshotUri() {
|
|
return this.screenshotUri;
|
|
}
|
|
|
|
public final boolean getUseScreenshot() {
|
|
return this.useScreenshot;
|
|
}
|
|
|
|
public int hashCode() {
|
|
Uri uri = this.screenshotUri;
|
|
int i = 0;
|
|
int hashCode = (uri != null ? uri.hashCode() : 0) * 31;
|
|
String str = this.reportName;
|
|
int hashCode2 = (hashCode + (str != null ? str.hashCode() : 0)) * 31;
|
|
String str2 = this.reportDescription;
|
|
int hashCode3 = (hashCode2 + (str2 != null ? str2.hashCode() : 0)) * 31;
|
|
Integer num = this.priority;
|
|
int hashCode4 = (hashCode3 + (num != null ? num.hashCode() : 0)) * 31;
|
|
Feature feature = this.feature;
|
|
int hashCode5 = (hashCode4 + (feature != null ? feature.hashCode() : 0)) * 31;
|
|
boolean z2 = this.useScreenshot;
|
|
if (z2) {
|
|
z2 = true;
|
|
}
|
|
int i2 = z2 ? 1 : 0;
|
|
int i3 = z2 ? 1 : 0;
|
|
int i4 = z2 ? 1 : 0;
|
|
int i5 = (hashCode5 + i2) * 31;
|
|
Error error = this.error;
|
|
if (error != null) {
|
|
i = error.hashCode();
|
|
}
|
|
return i5 + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder P = a.P("Report(screenshotUri=");
|
|
P.append(this.screenshotUri);
|
|
P.append(", reportName=");
|
|
P.append(this.reportName);
|
|
P.append(", reportDescription=");
|
|
P.append(this.reportDescription);
|
|
P.append(", priority=");
|
|
P.append(this.priority);
|
|
P.append(", feature=");
|
|
P.append(this.feature);
|
|
P.append(", useScreenshot=");
|
|
P.append(this.useScreenshot);
|
|
P.append(", error=");
|
|
P.append(this.error);
|
|
P.append(")");
|
|
return P.toString();
|
|
}
|
|
}
|
|
|
|
/* compiled from: BugReportViewModel.kt */
|
|
public static final class SelectFeature extends ViewState {
|
|
private final List<Feature> features;
|
|
private final boolean loadingFeatures;
|
|
private final String query;
|
|
|
|
public SelectFeature() {
|
|
this(null, false, null, 7, null);
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public SelectFeature(String str, boolean z2, List<Feature> list) {
|
|
super(null);
|
|
d0.z.d.m.checkNotNullParameter(list, "features");
|
|
this.query = str;
|
|
this.loadingFeatures = z2;
|
|
this.features = list;
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public /* synthetic */ SelectFeature(String str, boolean z2, List list, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this((i & 1) != 0 ? null : str, (i & 2) != 0 ? true : z2, (i & 4) != 0 ? n.emptyList() : list);
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.bugreports.BugReportViewModel$ViewState$SelectFeature */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static /* synthetic */ SelectFeature copy$default(SelectFeature selectFeature, String str, boolean z2, List list, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
str = selectFeature.query;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
z2 = selectFeature.loadingFeatures;
|
|
}
|
|
if ((i & 4) != 0) {
|
|
list = selectFeature.features;
|
|
}
|
|
return selectFeature.copy(str, z2, list);
|
|
}
|
|
|
|
public final String component1() {
|
|
return this.query;
|
|
}
|
|
|
|
public final boolean component2() {
|
|
return this.loadingFeatures;
|
|
}
|
|
|
|
public final List<Feature> component3() {
|
|
return this.features;
|
|
}
|
|
|
|
public final SelectFeature copy(String str, boolean z2, List<Feature> list) {
|
|
d0.z.d.m.checkNotNullParameter(list, "features");
|
|
return new SelectFeature(str, z2, list);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof SelectFeature)) {
|
|
return false;
|
|
}
|
|
SelectFeature selectFeature = (SelectFeature) obj;
|
|
return d0.z.d.m.areEqual(this.query, selectFeature.query) && this.loadingFeatures == selectFeature.loadingFeatures && d0.z.d.m.areEqual(this.features, selectFeature.features);
|
|
}
|
|
|
|
public final List<Feature> getFeatures() {
|
|
return this.features;
|
|
}
|
|
|
|
public final boolean getLoadingFeatures() {
|
|
return this.loadingFeatures;
|
|
}
|
|
|
|
public final String getQuery() {
|
|
return this.query;
|
|
}
|
|
|
|
public int hashCode() {
|
|
String str = this.query;
|
|
int i = 0;
|
|
int hashCode = (str != null ? str.hashCode() : 0) * 31;
|
|
boolean z2 = this.loadingFeatures;
|
|
if (z2) {
|
|
z2 = true;
|
|
}
|
|
int i2 = z2 ? 1 : 0;
|
|
int i3 = z2 ? 1 : 0;
|
|
int i4 = z2 ? 1 : 0;
|
|
int i5 = (hashCode + i2) * 31;
|
|
List<Feature> list = this.features;
|
|
if (list != null) {
|
|
i = list.hashCode();
|
|
}
|
|
return i5 + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder P = a.P("SelectFeature(query=");
|
|
P.append(this.query);
|
|
P.append(", loadingFeatures=");
|
|
P.append(this.loadingFeatures);
|
|
P.append(", features=");
|
|
return a.J(P, this.features, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: BugReportViewModel.kt */
|
|
public static final class Sending extends ViewState {
|
|
private final Sticker sendingSticker;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public Sending(Sticker sticker) {
|
|
super(null);
|
|
d0.z.d.m.checkNotNullParameter(sticker, "sendingSticker");
|
|
this.sendingSticker = sticker;
|
|
}
|
|
|
|
public static /* synthetic */ Sending copy$default(Sending sending, Sticker sticker, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
sticker = sending.sendingSticker;
|
|
}
|
|
return sending.copy(sticker);
|
|
}
|
|
|
|
public final Sticker component1() {
|
|
return this.sendingSticker;
|
|
}
|
|
|
|
public final Sending copy(Sticker sticker) {
|
|
d0.z.d.m.checkNotNullParameter(sticker, "sendingSticker");
|
|
return new Sending(sticker);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this != obj) {
|
|
return (obj instanceof Sending) && d0.z.d.m.areEqual(this.sendingSticker, ((Sending) obj).sendingSticker);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public final Sticker getSendingSticker() {
|
|
return this.sendingSticker;
|
|
}
|
|
|
|
public int hashCode() {
|
|
Sticker sticker = this.sendingSticker;
|
|
if (sticker != null) {
|
|
return sticker.hashCode();
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder P = a.P("Sending(sendingSticker=");
|
|
P.append(this.sendingSticker);
|
|
P.append(")");
|
|
return P.toString();
|
|
}
|
|
}
|
|
|
|
/* compiled from: BugReportViewModel.kt */
|
|
public static final class Success extends ViewState {
|
|
private final Sticker successSticker;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public Success(Sticker sticker) {
|
|
super(null);
|
|
d0.z.d.m.checkNotNullParameter(sticker, "successSticker");
|
|
this.successSticker = sticker;
|
|
}
|
|
|
|
public static /* synthetic */ Success copy$default(Success success, Sticker sticker, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
sticker = success.successSticker;
|
|
}
|
|
return success.copy(sticker);
|
|
}
|
|
|
|
public final Sticker component1() {
|
|
return this.successSticker;
|
|
}
|
|
|
|
public final Success copy(Sticker sticker) {
|
|
d0.z.d.m.checkNotNullParameter(sticker, "successSticker");
|
|
return new Success(sticker);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this != obj) {
|
|
return (obj instanceof Success) && d0.z.d.m.areEqual(this.successSticker, ((Success) obj).successSticker);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public final Sticker getSuccessSticker() {
|
|
return this.successSticker;
|
|
}
|
|
|
|
public int hashCode() {
|
|
Sticker sticker = this.successSticker;
|
|
if (sticker != null) {
|
|
return sticker.hashCode();
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder P = a.P("Success(successSticker=");
|
|
P.append(this.successSticker);
|
|
P.append(")");
|
|
return P.toString();
|
|
}
|
|
}
|
|
|
|
private ViewState() {
|
|
}
|
|
|
|
public /* synthetic */ ViewState(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
static {
|
|
StoreStream.Companion companion = StoreStream.Companion;
|
|
sendingStickers = n.listOfNotNull((Object[]) new Sticker[]{companion.getStickers().getStickers().get(754107634172297306L), companion.getStickers().getStickers().get(751606719611928586L), companion.getStickers().getStickers().get(749049128012742676L), companion.getStickers().getStickers().get(761114619137359892L), companion.getStickers().getStickers().get(783788733987815434L)});
|
|
successStickers = n.listOfNotNull((Object[]) new Sticker[]{companion.getStickers().getStickers().get(754109076933443614L), companion.getStickers().getStickers().get(751606065447305216L), companion.getStickers().getStickers().get(749053689419006003L), companion.getStickers().getStickers().get(761108384010862602L), companion.getStickers().getStickers().get(783794979704537108L)});
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public BugReportViewModel(Uri uri, String str, RestAPI restAPI) {
|
|
super(null, 1, null);
|
|
d0.z.d.m.checkNotNullParameter(uri, "screenshotUri");
|
|
d0.z.d.m.checkNotNullParameter(restAPI, "restApi");
|
|
this.screenshotUri = uri;
|
|
this.screenshotName = str;
|
|
this.restApi = restAPI;
|
|
List<Sticker> list = sendingStickers;
|
|
int random = f.random(n.getIndices(list), c.b);
|
|
this.stickerCharacterIndex = random;
|
|
this.sendingSticker = list.get(random);
|
|
this.successSticker = successStickers.get(random);
|
|
this.useScreenshot = true;
|
|
this.eventSubject = PublishSubject.j0();
|
|
loadFeatures();
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public /* synthetic */ BugReportViewModel(Uri uri, String str, RestAPI restAPI, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(uri, str, (i & 4) != 0 ? RestAPI.Companion.getApi() : restAPI);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$dismissAfterDelay(BugReportViewModel bugReportViewModel) {
|
|
bugReportViewModel.dismissAfterDelay();
|
|
}
|
|
|
|
public static final /* synthetic */ RestCallState access$getBugReportConfig$p(BugReportViewModel bugReportViewModel) {
|
|
return bugReportViewModel.bugReportConfig;
|
|
}
|
|
|
|
public static final /* synthetic */ PublishSubject access$getEventSubject$p(BugReportViewModel bugReportViewModel) {
|
|
return bugReportViewModel.eventSubject;
|
|
}
|
|
|
|
public static final /* synthetic */ List access$getGenericFeatureAreas$cp() {
|
|
return genericFeatureAreas;
|
|
}
|
|
|
|
public static final /* synthetic */ List access$getSendingStickers$cp() {
|
|
return sendingStickers;
|
|
}
|
|
|
|
public static final /* synthetic */ List access$getSuccessStickers$cp() {
|
|
return successStickers;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setBugReportConfig$p(BugReportViewModel bugReportViewModel, RestCallState restCallState) {
|
|
bugReportViewModel.bugReportConfig = restCallState;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$updateViewState(BugReportViewModel bugReportViewModel, ViewState viewState) {
|
|
bugReportViewModel.updateViewState(viewState);
|
|
}
|
|
|
|
private final void dismissAfterDelay() {
|
|
Observable<Long> c02 = Observable.c0(1500, TimeUnit.MILLISECONDS);
|
|
d0.z.d.m.checkNotNullExpressionValue(c02, "Observable.timer(1500, TimeUnit.MILLISECONDS)");
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(c02, this, null, 2, null), BugReportViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new BugReportViewModel$dismissAfterDelay$1(this), 62, (Object) null);
|
|
}
|
|
|
|
private final List<Feature> filterFeatures(String str) {
|
|
BugReportConfig invoke;
|
|
RestCallState<BugReportConfig> restCallState = this.bugReportConfig;
|
|
List<Feature> a = (restCallState == null || (invoke = restCallState.invoke()) == null) ? null : invoke.a();
|
|
if (a == null) {
|
|
a = n.emptyList();
|
|
}
|
|
List<Feature> plus = u.plus((Collection) a, (Iterable) genericFeatureAreas);
|
|
if (str == null) {
|
|
return plus;
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
for (Object obj : plus) {
|
|
Feature feature = (Feature) obj;
|
|
boolean z2 = true;
|
|
if (!w.contains((CharSequence) feature.b(), (CharSequence) str, true) && !w.contains((CharSequence) feature.c(), (CharSequence) str, true)) {
|
|
z2 = false;
|
|
}
|
|
if (z2) {
|
|
arrayList.add(obj);
|
|
}
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
public static /* synthetic */ void showReport$default(BugReportViewModel bugReportViewModel, Error error, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
error = null;
|
|
}
|
|
bugReportViewModel.showReport(error);
|
|
}
|
|
|
|
/* renamed from: filterFeatures reason: collision with other method in class */
|
|
public final void m17filterFeatures(String str) {
|
|
d0.z.d.m.checkNotNullParameter(str, "it");
|
|
this.featureSearchQuery = str;
|
|
showFeatureAreas();
|
|
}
|
|
|
|
public final Feature getFeature() {
|
|
return this.feature;
|
|
}
|
|
|
|
public final Integer getPriority() {
|
|
return this.priority;
|
|
}
|
|
|
|
public final String getReportDescription() {
|
|
return this.reportDescription;
|
|
}
|
|
|
|
public final String getReportName() {
|
|
return this.reportName;
|
|
}
|
|
|
|
public final RestAPI getRestApi() {
|
|
return this.restApi;
|
|
}
|
|
|
|
public final String getScreenshotName() {
|
|
return this.screenshotName;
|
|
}
|
|
|
|
public final Uri getScreenshotUri() {
|
|
return this.screenshotUri;
|
|
}
|
|
|
|
public final Sticker getSendingSticker() {
|
|
return this.sendingSticker;
|
|
}
|
|
|
|
public final boolean getStickersPrefetched() {
|
|
return this.stickersPrefetched;
|
|
}
|
|
|
|
public final Sticker getSuccessSticker() {
|
|
return this.successSticker;
|
|
}
|
|
|
|
public final boolean getUseScreenshot() {
|
|
return this.useScreenshot;
|
|
}
|
|
|
|
public final void loadFeatures() {
|
|
RestCallStateKt.executeRequest(this.restApi.getBugReportConfig(), new BugReportViewModel$loadFeatures$1(this));
|
|
}
|
|
|
|
public final Observable<Event> observeEvents() {
|
|
PublishSubject<Event> publishSubject = this.eventSubject;
|
|
d0.z.d.m.checkNotNullExpressionValue(publishSubject, "eventSubject");
|
|
return publishSubject;
|
|
}
|
|
|
|
public final void prefetchStickers(Context context) {
|
|
d0.z.d.m.checkNotNullParameter(context, "context");
|
|
if (!this.stickersPrefetched) {
|
|
StickerUtils stickerUtils = StickerUtils.INSTANCE;
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.restSubscribeOn$default(stickerUtils.fetchSticker(context, this.sendingSticker), false, 1, null), BugReportViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, BugReportViewModel$prefetchStickers$1.INSTANCE, 62, (Object) null);
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.restSubscribeOn$default(stickerUtils.fetchSticker(context, this.successSticker), false, 1, null), BugReportViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, BugReportViewModel$prefetchStickers$2.INSTANCE, 62, (Object) null);
|
|
this.stickersPrefetched = true;
|
|
}
|
|
}
|
|
|
|
public final void selectFeatureArea(Feature feature) {
|
|
this.feature = feature;
|
|
showReport$default(this, null, 1, null);
|
|
}
|
|
|
|
@MainThread
|
|
public final void sendReport(RequestBody requestBody) {
|
|
Integer num;
|
|
String str = this.reportName;
|
|
if (str != null && (num = this.priority) != null) {
|
|
int intValue = num.intValue();
|
|
MultipartBody.Part b = requestBody != null ? MultipartBody.Part.b("screenshot", this.screenshotName, requestBody) : null;
|
|
updateViewState(new ViewState.Sending(this.sendingSticker));
|
|
RestAPI restAPI = this.restApi;
|
|
String str2 = this.reportDescription;
|
|
Feature feature = this.feature;
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui(ObservableExtensionsKt.restSubscribeOn$default(restAPI.sendBugReport(str, str2, intValue, feature != null ? feature.a() : null, b), false, 1, null)), BugReportViewModel.class, (Context) null, (Function1) null, new BugReportViewModel$sendReport$2(this), (Function0) null, (Function0) null, new BugReportViewModel$sendReport$1(this), 54, (Object) null);
|
|
}
|
|
}
|
|
|
|
public final void setFeature(Feature feature) {
|
|
this.feature = feature;
|
|
}
|
|
|
|
public final void setPriority(Integer num) {
|
|
this.priority = num;
|
|
}
|
|
|
|
public final void setReportDescription(String str) {
|
|
this.reportDescription = str;
|
|
}
|
|
|
|
public final void setReportName(String str) {
|
|
this.reportName = str;
|
|
}
|
|
|
|
public final void setStickersPrefetched(boolean z2) {
|
|
this.stickersPrefetched = z2;
|
|
}
|
|
|
|
public final void setUseScreenshot(boolean z2) {
|
|
this.useScreenshot = z2;
|
|
}
|
|
|
|
public final void showFeatureAreas() {
|
|
String str = this.featureSearchQuery;
|
|
updateViewState(new ViewState.SelectFeature(str, this.bugReportConfig instanceof Loading, u.sortedWith(filterFeatures(str), new BugReportViewModel$showFeatureAreas$$inlined$sortedBy$1())));
|
|
}
|
|
|
|
public final void showReport(Error error) {
|
|
updateViewState(new ViewState.Report(this.screenshotUri, this.reportName, this.reportDescription, this.priority, this.feature, this.useScreenshot, error));
|
|
}
|
|
|
|
@MainThread
|
|
public final void updatePriority(int i) {
|
|
this.priority = Integer.valueOf(i);
|
|
showReport$default(this, null, 1, null);
|
|
}
|
|
|
|
@MainThread
|
|
public final void updateReportDescription(String str) {
|
|
d0.z.d.m.checkNotNullParameter(str, ModelAuditLogEntry.CHANGE_KEY_DESCRIPTION);
|
|
this.reportDescription = str;
|
|
showReport$default(this, null, 1, null);
|
|
}
|
|
|
|
@MainThread
|
|
public final void updateReportName(String str) {
|
|
d0.z.d.m.checkNotNullParameter(str, ModelAuditLogEntry.CHANGE_KEY_NAME);
|
|
this.reportName = str;
|
|
showReport$default(this, null, 1, null);
|
|
}
|
|
|
|
@MainThread
|
|
public final void useScreenshot(boolean z2) {
|
|
this.useScreenshot = z2;
|
|
showReport$default(this, null, 1, null);
|
|
}
|
|
}
|