2021-06-27 20:44:35 +00:00
package com.discord.widgets.chat.input ;
import android.content.Context ;
import com.discord.app.AppLog ;
import com.discord.utilities.analytics.AnalyticsTracker ;
import com.discord.utilities.attachments.AttachmentUtilsKt ;
import com.lytefast.flexinput.adapters.AttachmentPreviewAdapter ;
import com.lytefast.flexinput.model.Attachment ;
import com.lytefast.flexinput.utils.SelectionAggregator ;
import com.lytefast.flexinput.utils.SelectionCoordinator ;
import d0.z.d.m ;
import d0.z.d.o ;
import kotlin.jvm.functions.Function1 ;
/* compiled from: WidgetChatInputAttachments.kt */
public final class WidgetChatInputAttachments$createPreviewAdapter$1 extends o implements Function1 < AttachmentPreviewAdapter < T > , SelectionAggregator < T > > {
public final /* synthetic */ Context $context ;
public final /* synthetic */ WidgetChatInputAttachments this $0 ;
/* compiled from: WidgetChatInputAttachments.kt */
/* renamed from: com.discord.widgets.chat.input.WidgetChatInputAttachments$createPreviewAdapter$1$1 reason: invalid class name */
public static final class AnonymousClass1 extends SelectionAggregator < T > {
public final /* synthetic */ AttachmentPreviewAdapter $previewAdapter ;
public final /* synthetic */ WidgetChatInputAttachments$createPreviewAdapter$1 this $0 ;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public AnonymousClass1 ( WidgetChatInputAttachments$createPreviewAdapter$1 widgetChatInputAttachments$createPreviewAdapter$1 , AttachmentPreviewAdapter attachmentPreviewAdapter , AttachmentPreviewAdapter attachmentPreviewAdapter2 ) {
super ( attachmentPreviewAdapter2 , null , null , null , 14 , null ) ;
this . this$0 = widgetChatInputAttachments$createPreviewAdapter$1 ;
this . $previewAdapter = attachmentPreviewAdapter ;
}
public static final /* synthetic */ void access$track ( AnonymousClass1 r0 , Attachment attachment ) {
r0 . track ( attachment ) ;
}
private final void track ( T t ) {
String source = t instanceof SourcedAttachment ? t . getSource ( ) : " media_picker " ;
try {
int size = WidgetChatInputAttachments . access$getFlexInputFragment$p ( this . this$0 . this$0 ) . b ( ) . getSize ( ) ;
Context context = this . this$0 . $context ;
AnalyticsTracker . addAttachment ( source , AttachmentUtilsKt . getMimeType ( t , context ! = null ? context . getContentResolver ( ) : null ) , size ) ;
} catch ( Throwable th ) {
AppLog . g . i ( " Analytic error on attachment update " , th ) ;
}
}
/* JADX DEBUG: Multi-variable search result rejected for r0v1, resolved type: com.lytefast.flexinput.utils.SelectionCoordinator$ItemSelectionListener<? super I> */
/* JADX WARN: Multi-variable type inference failed */
@Override // com.lytefast.flexinput.utils.SelectionAggregator
public void registerSelectionCoordinatorInternal ( SelectionCoordinator < T , ? > selectionCoordinator ) {
m . checkNotNullParameter ( selectionCoordinator , " selectionCoordinator " ) ;
super . registerSelectionCoordinatorInternal ( selectionCoordinator ) ;
2021-07-04 15:26:29 +00:00
WidgetChatInputAttachments$createPreviewAdapter$1$1$registerSelectionCoordinatorInternal$1 widgetChatInputAttachments$createPreviewAdapter$1$1$registerSelectionCoordinatorInternal$1 = new WidgetChatInputAttachments$createPreviewAdapter$1$1$registerSelectionCoordinatorInternal$1 ( this , selectionCoordinator . f2389c ) ;
2021-06-27 20:44:35 +00:00
m . checkNotNullParameter ( widgetChatInputAttachments$createPreviewAdapter$1$1$registerSelectionCoordinatorInternal$1 , " <set-?> " ) ;
2021-07-04 15:26:29 +00:00
selectionCoordinator . f2389c = widgetChatInputAttachments$createPreviewAdapter$1$1$registerSelectionCoordinatorInternal$1 ;
2021-06-27 20:44:35 +00:00
}
}
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public WidgetChatInputAttachments$createPreviewAdapter$1 ( WidgetChatInputAttachments widgetChatInputAttachments , Context context ) {
super ( 1 ) ;
this . this$0 = widgetChatInputAttachments ;
this . $context = context ;
}
public final SelectionAggregator < T > invoke ( AttachmentPreviewAdapter < T > attachmentPreviewAdapter ) {
m . checkNotNullParameter ( attachmentPreviewAdapter , " previewAdapter " ) ;
return new AnonymousClass1 ( this , attachmentPreviewAdapter , attachmentPreviewAdapter ) ;
}
}