74 lines
3 KiB
Java
74 lines
3 KiB
Java
package com.discord.utilities;
|
|
|
|
import android.content.Context;
|
|
import android.content.pm.ShortcutInfo;
|
|
import android.content.pm.ShortcutManager;
|
|
import androidx.core.content.pm.ShortcutManagerCompat;
|
|
import com.discord.api.channel.Channel;
|
|
import d0.t.n;
|
|
import d0.z.d.m;
|
|
import d0.z.d.o;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function1;
|
|
/* compiled from: ShareUtils.kt */
|
|
public final class ShareUtils$updateDirectShareTargets$7 extends o implements Function1<Map<Long, ? extends Channel>, Unit> {
|
|
public final /* synthetic */ Context $context;
|
|
public final /* synthetic */ ShortcutManager $shortcutManager;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public ShareUtils$updateDirectShareTargets$7(ShortcutManager shortcutManager, Context context) {
|
|
super(1);
|
|
this.$shortcutManager = shortcutManager;
|
|
this.$context = context;
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public /* bridge */ /* synthetic */ Unit invoke(Map<Long, ? extends Channel> map) {
|
|
invoke((Map<Long, Channel>) map);
|
|
return Unit.a;
|
|
}
|
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:23:0x004c A[SYNTHETIC] */
|
|
/* JADX WARNING: Removed duplicated region for block: B:26:0x0018 A[SYNTHETIC] */
|
|
public final void invoke(Map<Long, Channel> map) {
|
|
List<ShortcutInfo> list;
|
|
boolean z2;
|
|
ShortcutManager shortcutManager = this.$shortcutManager;
|
|
if (shortcutManager == null || (list = shortcutManager.getDynamicShortcuts()) == null) {
|
|
list = n.emptyList();
|
|
}
|
|
ArrayList<ShortcutInfo> arrayList = new ArrayList();
|
|
for (Object obj : list) {
|
|
ShortcutInfo shortcutInfo = (ShortcutInfo) obj;
|
|
m.checkNotNullExpressionValue(shortcutInfo, "it");
|
|
if (shortcutInfo.isPinned()) {
|
|
String id2 = shortcutInfo.getId();
|
|
m.checkNotNullExpressionValue(id2, "it.id");
|
|
if (!map.containsKey(Long.valueOf(Long.parseLong(id2)))) {
|
|
z2 = true;
|
|
if (!z2) {
|
|
arrayList.add(obj);
|
|
}
|
|
}
|
|
}
|
|
z2 = false;
|
|
if (!z2) {
|
|
}
|
|
}
|
|
ArrayList arrayList2 = new ArrayList(d0.t.o.collectionSizeOrDefault(arrayList, 10));
|
|
for (ShortcutInfo shortcutInfo2 : arrayList) {
|
|
m.checkNotNullExpressionValue(shortcutInfo2, "it");
|
|
arrayList2.add(shortcutInfo2.getId());
|
|
}
|
|
ShortcutManagerCompat.removeDynamicShortcuts(this.$context, arrayList2);
|
|
ShortcutManager shortcutManager2 = this.$shortcutManager;
|
|
if (shortcutManager2 != null) {
|
|
shortcutManager2.disableShortcuts(arrayList2);
|
|
}
|
|
}
|
|
}
|