2021-06-27 20:44:35 +00:00
|
|
|
package com.discord.widgets.changelog;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.text.format.DateFormat;
|
|
|
|
import android.view.View;
|
|
|
|
import android.widget.VideoView;
|
|
|
|
import androidx.fragment.app.Fragment;
|
|
|
|
import c.a.d.l;
|
|
|
|
import c.d.b.a.a;
|
|
|
|
import c.f.g.a.a.b;
|
|
|
|
import c.f.g.a.a.d;
|
|
|
|
import com.discord.app.AppFragment;
|
|
|
|
import com.discord.databinding.WidgetChangeLogBinding;
|
|
|
|
import com.discord.stores.StoreStream;
|
|
|
|
import com.discord.utilities.analytics.AnalyticsTracker;
|
|
|
|
import com.discord.utilities.time.ClockFactory;
|
|
|
|
import com.discord.utilities.view.extensions.ViewExtensions;
|
|
|
|
import com.discord.utilities.view.text.LinkifiedTextView;
|
|
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
|
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
|
|
|
import com.facebook.drawee.controller.AbstractDraweeController;
|
|
|
|
import com.facebook.drawee.view.SimpleDraweeView;
|
|
|
|
import d0.g0.t;
|
|
|
|
import d0.t.h0;
|
|
|
|
import d0.z.d.m;
|
|
|
|
import java.text.ParseException;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
|
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
|
|
import kotlin.reflect.KProperty;
|
|
|
|
/* compiled from: WidgetChangeLog.kt */
|
|
|
|
public final class WidgetChangeLog extends AppFragment {
|
|
|
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.W(WidgetChangeLog.class, "binding", "getBinding()Lcom/discord/databinding/WidgetChangeLogBinding;", 0)};
|
|
|
|
public static final Companion Companion = new Companion(null);
|
|
|
|
private static final String INTENT_EXTRA_BODY = "INTENT_EXTRA_BODY";
|
|
|
|
private static final String INTENT_EXTRA_REVISION = "INTENT_EXTRA_REVISION";
|
|
|
|
private static final String INTENT_EXTRA_VERSION = "INTENT_EXTRA_VERSION";
|
|
|
|
private static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
|
|
|
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding(this, WidgetChangeLog$binding$2.INSTANCE, new WidgetChangeLog$binding$3(this));
|
|
|
|
private int maxScrolledPercent;
|
|
|
|
private long openedTimestamp;
|
|
|
|
private final WidgetChangeLog$thumbnailControllerListener$1 thumbnailControllerListener = new WidgetChangeLog$thumbnailControllerListener$1(this);
|
|
|
|
private AbstractDraweeController<Object, Object> thumbnailDraweeController;
|
|
|
|
|
|
|
|
/* compiled from: WidgetChangeLog.kt */
|
|
|
|
public static final class Companion {
|
|
|
|
private Companion() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this();
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void launch(Context context, String str, String str2, String str3, String str4) {
|
|
|
|
m.checkNotNullParameter(context, "context");
|
|
|
|
m.checkNotNullParameter(str, "version");
|
|
|
|
m.checkNotNullParameter(str2, "revision");
|
|
|
|
m.checkNotNullParameter(str3, "video");
|
|
|
|
m.checkNotNullParameter(str4, "body");
|
|
|
|
Bundle bundle = new Bundle();
|
|
|
|
bundle.putString("INTENT_EXTRA_VERSION", str);
|
|
|
|
bundle.putString("INTENT_EXTRA_REVISION", str2);
|
|
|
|
bundle.putString("INTENT_EXTRA_VIDEO", str3);
|
|
|
|
bundle.putString("INTENT_EXTRA_BODY", str4);
|
|
|
|
l.d(context, WidgetChangeLog.class, new Intent().putExtras(bundle));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public WidgetChangeLog() {
|
2021-07-13 20:23:20 +00:00
|
|
|
super(2131558868);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ WidgetChangeLogBinding access$getBinding$p(WidgetChangeLog widgetChangeLog) {
|
|
|
|
return widgetChangeLog.getBinding();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ int access$getMaxScrolledPercent$p(WidgetChangeLog widgetChangeLog) {
|
|
|
|
return widgetChangeLog.maxScrolledPercent;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$hideVideoOverlay(WidgetChangeLog widgetChangeLog) {
|
|
|
|
widgetChangeLog.hideVideoOverlay();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$onViewBindingDestroy(WidgetChangeLog widgetChangeLog, WidgetChangeLogBinding widgetChangeLogBinding) {
|
|
|
|
widgetChangeLog.onViewBindingDestroy(widgetChangeLogBinding);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$setMaxScrolledPercent$p(WidgetChangeLog widgetChangeLog, int i) {
|
|
|
|
widgetChangeLog.maxScrolledPercent = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$showVideoOverlay(WidgetChangeLog widgetChangeLog) {
|
|
|
|
widgetChangeLog.showVideoOverlay();
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void configureFooter() {
|
|
|
|
getBinding().g.setOnClickListener(new WidgetChangeLog$configureFooter$1(this));
|
2021-07-13 20:23:20 +00:00
|
|
|
getBinding().f1690c.setOnClickListener(new WidgetChangeLog$configureFooter$2(this));
|
2021-06-27 20:44:35 +00:00
|
|
|
getBinding().d.setOnClickListener(new WidgetChangeLog$configureFooter$3(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void configureMedia(String str) {
|
|
|
|
boolean endsWith$default = t.endsWith$default(str, ".mp4", false, 2, null);
|
|
|
|
VideoView videoView = getBinding().h;
|
|
|
|
m.checkNotNullExpressionValue(videoView, "binding.changeLogVideo");
|
|
|
|
int i = 8;
|
|
|
|
videoView.setVisibility(endsWith$default ? 0 : 8);
|
|
|
|
SimpleDraweeView simpleDraweeView = getBinding().i;
|
|
|
|
m.checkNotNullExpressionValue(simpleDraweeView, "binding.changeLogVideoOverlay");
|
|
|
|
if (endsWith$default) {
|
|
|
|
i = 0;
|
|
|
|
}
|
|
|
|
simpleDraweeView.setVisibility(i);
|
|
|
|
if (!endsWith$default) {
|
|
|
|
SimpleDraweeView simpleDraweeView2 = getBinding().f;
|
|
|
|
m.checkNotNullExpressionValue(simpleDraweeView2, "binding.changeLogThumbnail");
|
|
|
|
simpleDraweeView2.setVisibility(0);
|
|
|
|
d a = b.a();
|
|
|
|
SimpleDraweeView simpleDraweeView3 = getBinding().f;
|
|
|
|
m.checkNotNullExpressionValue(simpleDraweeView3, "binding.changeLogThumbnail");
|
|
|
|
a.n = simpleDraweeView3.getController();
|
|
|
|
d g = a.g(str);
|
|
|
|
g.m = false;
|
|
|
|
g.k = this.thumbnailControllerListener;
|
|
|
|
this.thumbnailDraweeController = g.a();
|
|
|
|
SimpleDraweeView simpleDraweeView4 = getBinding().f;
|
|
|
|
m.checkNotNullExpressionValue(simpleDraweeView4, "binding.changeLogThumbnail");
|
|
|
|
simpleDraweeView4.setController(this.thumbnailDraweeController);
|
|
|
|
getBinding().f.requestLayout();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
getBinding().h.setVideoPath(str);
|
|
|
|
getBinding().h.setOnCompletionListener(new WidgetChangeLog$configureMedia$1(this));
|
|
|
|
getBinding().h.setOnClickListener(new WidgetChangeLog$configureMedia$2(this));
|
|
|
|
getBinding().h.setOnPreparedListener(new WidgetChangeLog$configureMedia$3(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
private final WidgetChangeLogBinding getBinding() {
|
|
|
|
return (WidgetChangeLogBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final CharSequence getDateString(Context context) {
|
|
|
|
String stringExtra = getMostRecentIntent().getStringExtra("INTENT_EXTRA_VERSION");
|
|
|
|
if (stringExtra == null) {
|
2021-07-13 20:23:20 +00:00
|
|
|
stringExtra = getString(2131887243);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
m.checkNotNullExpressionValue(stringExtra, "mostRecentIntent.getStri…tring.change_log_md_date)");
|
|
|
|
try {
|
|
|
|
Date parse = new SimpleDateFormat("yyyy-MM-dd").parse(stringExtra);
|
|
|
|
if (parse == null) {
|
|
|
|
parse = new Date();
|
|
|
|
}
|
|
|
|
String format = DateFormat.getMediumDateFormat(context).format(parse);
|
|
|
|
m.checkNotNullExpressionValue(format, "DateFormat.getMediumDate…mat(context).format(date)");
|
|
|
|
return format;
|
|
|
|
} catch (ParseException unused) {
|
|
|
|
return stringExtra;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void hideVideoOverlay() {
|
|
|
|
ViewExtensions.fadeOut$default(getBinding().i, 200, WidgetChangeLog$hideVideoOverlay$1.INSTANCE, null, 4, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final void launch(Context context, String str, String str2, String str3, String str4) {
|
|
|
|
Companion.launch(context, str, str2, str3, str4);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void onViewBindingDestroy(WidgetChangeLogBinding widgetChangeLogBinding) {
|
|
|
|
widgetChangeLogBinding.h.setOnPreparedListener(null);
|
|
|
|
widgetChangeLogBinding.h.setOnCompletionListener(null);
|
|
|
|
AbstractDraweeController<Object, Object> abstractDraweeController = this.thumbnailDraweeController;
|
|
|
|
if (abstractDraweeController != null) {
|
|
|
|
abstractDraweeController.A(this.thumbnailControllerListener);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void showVideoOverlay() {
|
|
|
|
ViewExtensions.fadeIn$default(getBinding().i, 200, WidgetChangeLog$showVideoOverlay$1.INSTANCE, WidgetChangeLog$showVideoOverlay$2.INSTANCE, null, 8, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void track(String str, Map<String, ? extends Object> map, boolean z2) {
|
|
|
|
String stringExtra = getMostRecentIntent().getStringExtra("INTENT_EXTRA_VERSION");
|
|
|
|
if (stringExtra == null) {
|
2021-07-13 20:23:20 +00:00
|
|
|
stringExtra = getString(2131887243);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
m.checkNotNullExpressionValue(stringExtra, "mostRecentIntent.getStri…tring.change_log_md_date)");
|
|
|
|
String stringExtra2 = getMostRecentIntent().getStringExtra("INTENT_EXTRA_REVISION");
|
|
|
|
if (stringExtra2 == null) {
|
2021-07-13 20:23:20 +00:00
|
|
|
stringExtra2 = getString(2131887245);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
m.checkNotNullExpressionValue(stringExtra2, "mostRecentIntent.getStri…g.change_log_md_revision)");
|
|
|
|
HashMap hashMap = new HashMap();
|
|
|
|
if (z2) {
|
|
|
|
hashMap.put("seconds_open", Long.valueOf((ClockFactory.get().currentTimeMillis() - this.openedTimestamp) / ((long) 1000)));
|
|
|
|
hashMap.put("max_scrolled_percentage", Integer.valueOf(this.maxScrolledPercent));
|
|
|
|
}
|
|
|
|
AnalyticsTracker.INSTANCE.changeLogEvent(str, stringExtra, stringExtra2, h0.plus(map, hashMap));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.changelog.WidgetChangeLog */
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
|
|
public static /* synthetic */ void track$default(WidgetChangeLog widgetChangeLog, String str, Map map, boolean z2, int i, Object obj) {
|
|
|
|
if ((i & 2) != 0) {
|
|
|
|
map = new HashMap();
|
|
|
|
}
|
|
|
|
if ((i & 4) != 0) {
|
|
|
|
z2 = true;
|
|
|
|
}
|
|
|
|
widgetChangeLog.track(str, map, z2);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // androidx.fragment.app.Fragment
|
|
|
|
public void onDestroy() {
|
|
|
|
String stringExtra = getMostRecentIntent().getStringExtra("INTENT_EXTRA_VERSION");
|
|
|
|
if (stringExtra == null) {
|
2021-07-13 20:23:20 +00:00
|
|
|
stringExtra = getString(2131887243);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
m.checkNotNullExpressionValue(stringExtra, "mostRecentIntent.getStri…tring.change_log_md_date)");
|
|
|
|
StoreStream.Companion.getChangeLog().markSeen(stringExtra);
|
|
|
|
track$default(this, "change_log_closed", null, false, 6, null);
|
|
|
|
super.onDestroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.app.AppFragment, androidx.fragment.app.Fragment
|
|
|
|
public void onPause() {
|
|
|
|
VideoView videoView = getBinding().h;
|
|
|
|
m.checkNotNullExpressionValue(videoView, "binding.changeLogVideo");
|
|
|
|
if (videoView.isPlaying()) {
|
|
|
|
getBinding().h.pause();
|
|
|
|
}
|
|
|
|
super.onPause();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
|
|
public void onViewBound(View view) {
|
|
|
|
m.checkNotNullParameter(view, "view");
|
|
|
|
super.onViewBound(view);
|
|
|
|
this.openedTimestamp = ClockFactory.get().currentTimeMillis();
|
|
|
|
track$default(this, "change_log_opened", null, false, 2, null);
|
|
|
|
AppFragment.setActionBarDisplayHomeAsUpEnabled$default(this, false, 1, null);
|
2021-07-13 20:23:20 +00:00
|
|
|
setActionBarTitle(2131894850);
|
2021-06-27 20:44:35 +00:00
|
|
|
setActionBarSubtitle(getDateString(requireContext()));
|
|
|
|
String stringExtra = getMostRecentIntent().getStringExtra("INTENT_EXTRA_BODY");
|
|
|
|
if (stringExtra == null) {
|
2021-07-13 20:23:20 +00:00
|
|
|
stringExtra = getString(2131887242);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
m.checkNotNullExpressionValue(stringExtra, "mostRecentIntent.getStri…tring.change_log_md_body)");
|
|
|
|
LinkifiedTextView linkifiedTextView = getBinding().b;
|
|
|
|
m.checkNotNullExpressionValue(linkifiedTextView, "binding.changeLogBody");
|
|
|
|
linkifiedTextView.setText(ChangeLogParser.parse$default(ChangeLogParser.INSTANCE, requireContext(), stringExtra, false, new WidgetChangeLog$onViewBound$1(this), 4, null));
|
|
|
|
String stringExtra2 = getMostRecentIntent().getStringExtra("INTENT_EXTRA_VIDEO");
|
|
|
|
if (stringExtra2 == null) {
|
2021-07-13 20:23:20 +00:00
|
|
|
stringExtra2 = getString(2131887246);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
m.checkNotNullExpressionValue(stringExtra2, "mostRecentIntent.getStri…ring.change_log_md_video)");
|
|
|
|
configureMedia(stringExtra2);
|
|
|
|
configureFooter();
|
|
|
|
getBinding().e.setOnScrollChangeListener(new WidgetChangeLog$onViewBound$2(this));
|
|
|
|
}
|
|
|
|
}
|