From 8f6cfe804119e8899be8d8b5cc1de441e4bb5427 Mon Sep 17 00:00:00 2001 From: Juby210 Date: Wed, 29 Sep 2021 09:33:53 +0200 Subject: [PATCH] 94.7 - Beta (94107) --- app/build.gradle | 4 +-- app/src/main/AndroidManifest.xml | 2 +- .../discord/models/member/GuildMember.java | 6 +++-- ...ShareUtils$updateDirectShareTargets$4.java | 3 ++- .../utilities/fcm/NotificationRenderer.java | 11 ++++---- .../features/GrowthTeamFeatures.java | 4 +++ .../images/MGImagesBitmap$getBitmaps$4.java | 2 +- .../utilities/images/MGImagesBitmap.java | 16 +++++++++--- .../WidgetDirectoryChannel$onViewBound$5.java | 16 ++++++------ .../WidgetHome$onViewBoundOrOnResume$8.java | 26 ++++++++++++++++++- .../com/discord/widgets/home/WidgetHome.java | 2 +- .../discord/widgets/roles/RoleIconView.java | 4 +-- .../widgets/settings/WidgetSettings.java | 2 +- app/src/main/res/values/strings.xml | 2 +- 14 files changed, 71 insertions(+), 29 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 0a2461d53e..f1b10bda35 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId 'com.discord' minSdkVersion 21 targetSdkVersion 29 - versionCode 94106 - versionName "94.6 - Beta" + versionCode 94107 + versionName "94.7 - Beta" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9327f5394d..cde47d216a 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ - + diff --git a/app/src/main/java/com/discord/models/member/GuildMember.java b/app/src/main/java/com/discord/models/member/GuildMember.java index d89431bf73..761739869e 100644 --- a/app/src/main/java/com/discord/models/member/GuildMember.java +++ b/app/src/main/java/com/discord/models/member/GuildMember.java @@ -100,8 +100,10 @@ public final class GuildMember { GuildRole guildRole2 = null; for (Long l : list) { long longValue = l.longValue(); - if (!(map == null || (guildRole = map.get(Long.valueOf(longValue))) == null || guildRole.d() == null || !RoleUtils.rankIsHigher(guildRole, guildRole2))) { - guildRole2 = guildRole; + if (!(map == null || (guildRole = map.get(Long.valueOf(longValue))) == null)) { + if (((guildRole.d() == null && guildRole.j() == null) ? false : true) && RoleUtils.rankIsHigher(guildRole, guildRole2)) { + guildRole2 = guildRole; + } } } return guildRole2; diff --git a/app/src/main/java/com/discord/utilities/ShareUtils$updateDirectShareTargets$4.java b/app/src/main/java/com/discord/utilities/ShareUtils$updateDirectShareTargets$4.java index fd1dc4a21c..b6a6acc708 100644 --- a/app/src/main/java/com/discord/utilities/ShareUtils$updateDirectShareTargets$4.java +++ b/app/src/main/java/com/discord/utilities/ShareUtils$updateDirectShareTargets$4.java @@ -1,6 +1,7 @@ package com.discord.utilities; import android.graphics.Bitmap; +import android.os.Build; import com.discord.utilities.images.MGImages; import com.discord.utilities.images.MGImagesBitmap; import d0.o; @@ -39,7 +40,7 @@ public final class ShareUtils$updateDirectShareTargets$4 implements b 24); } } diff --git a/app/src/main/java/com/discord/utilities/fcm/NotificationRenderer.java b/app/src/main/java/com/discord/utilities/fcm/NotificationRenderer.java index 1e4bf86e05..250381e002 100644 --- a/app/src/main/java/com/discord/utilities/fcm/NotificationRenderer.java +++ b/app/src/main/java/com/discord/utilities/fcm/NotificationRenderer.java @@ -128,9 +128,10 @@ public final class NotificationRenderer { contentIntent.setFullScreenIntent(fullScreenIntent, true); contentIntent.setVisibility(1); } + Uri uri = null; if (!extras.isEmpty()) { contentIntent.setNumber(extras.size()); - contentIntent.setStyle(getMessageStyle(context, notificationData, extras, new MGImagesBitmap.CloseableBitmaps(h0.emptyMap()))); + contentIntent.setStyle(getMessageStyle(context, notificationData, extras, new MGImagesBitmap.CloseableBitmaps(h0.emptyMap(), false, 2, null))); } if (notificationData.getShouldUseBigText()) { contentIntent.setStyle(new NotificationCompat.BigTextStyle().bigText(notificationData.getContent(context))); @@ -143,11 +144,11 @@ public final class NotificationRenderer { } Uri notificationSound = notificationData.getNotificationSound(context); if (notificationSound != null) { - if (!(!settingsV2.isDisableSound())) { - notificationSound = null; + if (!settingsV2.isDisableSound()) { + uri = notificationSound; } - if (notificationSound != null) { - contentIntent.setSound(notificationSound).setDefaults(INSTANCE.getNotificationDefaults(settingsV2.isDisableSound(), settingsV2.isDisableVibrate()) & -2); + if (uri != null) { + contentIntent.setSound(uri).setDefaults(INSTANCE.getNotificationDefaults(settingsV2.isDisableSound(), settingsV2.isDisableVibrate()) & -2); } } } diff --git a/app/src/main/java/com/discord/utilities/features/GrowthTeamFeatures.java b/app/src/main/java/com/discord/utilities/features/GrowthTeamFeatures.java index 6c961eb18d..c23313f5b6 100644 --- a/app/src/main/java/com/discord/utilities/features/GrowthTeamFeatures.java +++ b/app/src/main/java/com/discord/utilities/features/GrowthTeamFeatures.java @@ -49,6 +49,10 @@ public final class GrowthTeamFeatures { return isExperimentEnabled$default(this, "2021-06_desktop_school_hubs", 0, 1, null); } + public final boolean isHubNameKillSwitchEnabled() { + return isExperimentEnabled$default(this, "2021-09_hub_name_popup_kill_switch", 0, 1, null); + } + public final boolean isHubOnboardingEnabled() { return isExperimentEnabled$default(this, "2021-08_hubs_in_organic_onboarding", 0, 1, null); } diff --git a/app/src/main/java/com/discord/utilities/images/MGImagesBitmap$getBitmaps$4.java b/app/src/main/java/com/discord/utilities/images/MGImagesBitmap$getBitmaps$4.java index 9b673c3817..3a3027c6e9 100644 --- a/app/src/main/java/com/discord/utilities/images/MGImagesBitmap$getBitmaps$4.java +++ b/app/src/main/java/com/discord/utilities/images/MGImagesBitmap$getBitmaps$4.java @@ -11,6 +11,6 @@ public final class MGImagesBitmap$getBitmaps$4 implements b map) { m.checkNotNullExpressionValue(map, "it"); - return new MGImagesBitmap.CloseableBitmaps(map); + return new MGImagesBitmap.CloseableBitmaps(map, false, 2, null); } } diff --git a/app/src/main/java/com/discord/utilities/images/MGImagesBitmap.java b/app/src/main/java/com/discord/utilities/images/MGImagesBitmap.java index 3bb56e123b..abb3b19a73 100644 --- a/app/src/main/java/com/discord/utilities/images/MGImagesBitmap.java +++ b/app/src/main/java/com/discord/utilities/images/MGImagesBitmap.java @@ -19,6 +19,7 @@ import java.util.Map; import java.util.Set; import java.util.function.BiFunction; import java.util.function.Function; +import kotlin.jvm.internal.DefaultConstructorMarker; import rx.Observable; /* compiled from: MGImagesBitmap.kt */ public final class MGImagesBitmap { @@ -26,11 +27,18 @@ public final class MGImagesBitmap { /* compiled from: MGImagesBitmap.kt */ public static final class CloseableBitmaps implements Map, Closeable, a { + private final boolean recycleBitmaps; private final Map underlyingMap; - public CloseableBitmaps(Map map) { + public CloseableBitmaps(Map map, boolean z2) { m.checkNotNullParameter(map, "underlyingMap"); this.underlyingMap = map; + this.recycleBitmaps = z2; + } + + /* JADX INFO: this call moved to the top of the method (can break code semantics) */ + public /* synthetic */ CloseableBitmaps(Map map, boolean z2, int i, DefaultConstructorMarker defaultConstructorMarker) { + this(map, (i & 2) != 0 ? true : z2); } @Override // java.util.Map @@ -40,8 +48,10 @@ public final class MGImagesBitmap { @Override // java.io.Closeable, java.lang.AutoCloseable public void close() { - for (Map.Entry entry : this.underlyingMap.entrySet()) { - entry.getValue().recycle(); + if (this.recycleBitmaps) { + for (Map.Entry entry : this.underlyingMap.entrySet()) { + entry.getValue().recycle(); + } } } diff --git a/app/src/main/java/com/discord/widgets/directories/WidgetDirectoryChannel$onViewBound$5.java b/app/src/main/java/com/discord/widgets/directories/WidgetDirectoryChannel$onViewBound$5.java index f7841b19f0..4d304c1705 100644 --- a/app/src/main/java/com/discord/widgets/directories/WidgetDirectoryChannel$onViewBound$5.java +++ b/app/src/main/java/com/discord/widgets/directories/WidgetDirectoryChannel$onViewBound$5.java @@ -5,6 +5,7 @@ import c.a.d.j; import com.discord.models.guild.Guild; import com.discord.models.member.GuildMember; import com.discord.stores.StoreStream; +import com.discord.utilities.features.GrowthTeamFeatures; import com.discord.widgets.hubs.HubAddNameArgs; import com.discord.widgets.hubs.WidgetHubAddName; import d0.g0.t; @@ -31,19 +32,18 @@ public final class WidgetDirectoryChannel$onViewBound$5 extends o implements Fun } public final void invoke(long j) { + Guild guild; Context context; StoreStream.Companion companion = StoreStream.Companion; long selectedGuildId = companion.getGuildSelected().getSelectedGuildId(); GuildMember member = companion.getGuilds().getMember(selectedGuildId, companion.getUsers().getMe().getId()); - String nick = member != null ? member.getNick() : null; - if (nick == null) { - nick = ""; - } - Guild guild = companion.getGuilds().getGuild(selectedGuildId); - if (guild != null && (context = this.this$0.getContext()) != null) { + if (member != null && (guild = companion.getGuilds().getGuild(selectedGuildId)) != null && (context = this.this$0.getContext()) != null) { m.checkNotNullExpressionValue(context, "context ?: return@appSubscribe"); - if (selectedGuildId == j && guild.isHub() && t.isBlank(nick) && !companion.getDirectories().getAndSetSeenNamePrompt(selectedGuildId)) { - j.d(context, WidgetHubAddName.class, new HubAddNameArgs(guild.getId())); + if (this.this$0.isVisible() && selectedGuildId == j && guild.isHub()) { + String nick = member.getNick(); + if ((nick == null || t.isBlank(nick)) && !companion.getDirectories().getAndSetSeenNamePrompt(selectedGuildId) && !GrowthTeamFeatures.INSTANCE.isHubNameKillSwitchEnabled()) { + j.d(context, WidgetHubAddName.class, new HubAddNameArgs(guild.getId())); + } } } } diff --git a/app/src/main/java/com/discord/widgets/home/WidgetHome$onViewBoundOrOnResume$8.java b/app/src/main/java/com/discord/widgets/home/WidgetHome$onViewBoundOrOnResume$8.java index 94fd3f4052..6e5d4f27ed 100644 --- a/app/src/main/java/com/discord/widgets/home/WidgetHome$onViewBoundOrOnResume$8.java +++ b/app/src/main/java/com/discord/widgets/home/WidgetHome$onViewBoundOrOnResume$8.java @@ -1,13 +1,37 @@ package com.discord.widgets.home; +import com.discord.models.guild.Guild; import com.discord.stores.StoreNux; +import com.discord.stores.StoreStream; import com.discord.utilities.features.GrowthTeamFeatures; import j0.k.b; +import java.util.Collection; +import java.util.Iterator; /* compiled from: WidgetHome.kt */ public final class WidgetHome$onViewBoundOrOnResume$8 implements b { public static final WidgetHome$onViewBoundOrOnResume$8 INSTANCE = new WidgetHome$onViewBoundOrOnResume$8(); public final Boolean call(StoreNux.NuxState nuxState) { - return Boolean.valueOf(GrowthTeamFeatures.INSTANCE.isHubEmailConnectionEnabled()); + boolean z2; + Collection values = StoreStream.Companion.getGuilds().getGuilds().values(); + boolean z3 = false; + if (!(values instanceof Collection) || !values.isEmpty()) { + Iterator it = values.iterator(); + while (true) { + if (it.hasNext()) { + if (!(!it.next().isHub())) { + z2 = false; + break; + } + } else { + break; + } + } + } + z2 = true; + if (z2 && GrowthTeamFeatures.INSTANCE.isHubEmailConnectionEnabled()) { + z3 = true; + } + return Boolean.valueOf(z3); } } diff --git a/app/src/main/java/com/discord/widgets/home/WidgetHome.java b/app/src/main/java/com/discord/widgets/home/WidgetHome.java index 075b77dea7..31ab112214 100644 --- a/app/src/main/java/com/discord/widgets/home/WidgetHome.java +++ b/app/src/main/java/com/discord/widgets/home/WidgetHome.java @@ -651,7 +651,7 @@ public final class WidgetHome extends AppFragment implements OnTabSelectedListen m.checkNotNullExpressionValue(x3, "StoreStream\n .get… .filter { it.firstOpen }"); ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.takeSingleUntilTimeout$default(x3, 0, false, 1, null), this, null, 2, null), WidgetHome.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetHome$onViewBoundOrOnResume$7(this), 62, (Object) null); Observable x4 = companion.getNux().getNuxState().x(WidgetHome$onViewBoundOrOnResume$8.INSTANCE); - m.checkNotNullExpressionValue(x4, "StoreStream\n .get…mailConnectionEnabled() }"); + m.checkNotNullExpressionValue(x4, "StoreStream\n .get…ectionEnabled()\n }"); ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.takeSingleUntilTimeout$default(x4, 0, false, 1, null), this, null, 2, null), WidgetHome.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetHome$onViewBoundOrOnResume$9(this), 62, (Object) null); Observable x5 = StoreUser.observeMe$default(companion.getUsers(), false, 1, null).x(WidgetHome$onViewBoundOrOnResume$10.INSTANCE); m.checkNotNullExpressionValue(x5, "StoreStream\n .get…hasUnreadUrgentMessages }"); diff --git a/app/src/main/java/com/discord/widgets/roles/RoleIconView.java b/app/src/main/java/com/discord/widgets/roles/RoleIconView.java index ffb612a742..0bb8437df8 100644 --- a/app/src/main/java/com/discord/widgets/roles/RoleIconView.java +++ b/app/src/main/java/com/discord/widgets/roles/RoleIconView.java @@ -76,7 +76,7 @@ public final class RoleIconView extends FrameLayout { private final void showRoleIconToast(Context context, GuildRole guildRole) { ModelEmojiUnicode modelEmojiUnicode; - EmojiNode emojiNode = hasIcon(guildRole) ? new EmojiNode(guildRole.g(), new RoleIconView$showRoleIconToast$1(guildRole), new EmojiNode.EmojiIdAndType.Unicode(""), DimenUtils.dpToPixels(24), DimenUtils.dpToPixels(24)) : (!hasUnicodeEmoji(guildRole) || (modelEmojiUnicode = StoreStream.Companion.getEmojis().getUnicodeEmojisNamesMap().get(guildRole.j())) == null) ? null : EmojiNode.Companion.from(modelEmojiUnicode, DimenUtils.dpToPixels(24)); + EmojiNode emojiNode = hasIcon(guildRole) ? new EmojiNode(guildRole.g(), new RoleIconView$showRoleIconToast$1(guildRole), new EmojiNode.EmojiIdAndType.Unicode(""), DimenUtils.dpToPixels(24), DimenUtils.dpToPixels(24)) : (!hasUnicodeEmoji(guildRole) || (modelEmojiUnicode = StoreStream.Companion.getEmojis().getUnicodeEmojiSurrogateMap().get(guildRole.j())) == null) ? null : EmojiNode.Companion.from(modelEmojiUnicode, DimenUtils.dpToPixels(24)); if (emojiNode != null) { RoleIconView$showRoleIconToast$renderContext$1 roleIconView$showRoleIconToast$renderContext$1 = new RoleIconView$showRoleIconToast$renderContext$1(context); Set singleton = Collections.singleton(emojiNode); @@ -97,7 +97,7 @@ public final class RoleIconView extends FrameLayout { m.checkNotNullExpressionValue(simpleDraweeView, "binding.roleIconIv"); IconUtils.setIcon$default(simpleDraweeView, guildRole, (int) R.dimen.role_icon_size, (MGImages.ChangeDetector) null, 8, (Object) null); } else if (hasUnicodeEmoji(guildRole)) { - ModelEmojiUnicode modelEmojiUnicode = StoreStream.Companion.getEmojis().getUnicodeEmojisNamesMap().get(guildRole.j()); + ModelEmojiUnicode modelEmojiUnicode = StoreStream.Companion.getEmojis().getUnicodeEmojiSurrogateMap().get(guildRole.j()); String imageUri = ModelEmojiUnicode.getImageUri(modelEmojiUnicode != null ? modelEmojiUnicode.getCodePoints() : null, getContext()); SimpleDraweeView simpleDraweeView2 = this.binding.b; m.checkNotNullExpressionValue(simpleDraweeView2, "binding.roleIconIv"); diff --git a/app/src/main/java/com/discord/widgets/settings/WidgetSettings.java b/app/src/main/java/com/discord/widgets/settings/WidgetSettings.java index 3df059f541..13d67a3b59 100644 --- a/app/src/main/java/com/discord/widgets/settings/WidgetSettings.java +++ b/app/src/main/java/com/discord/widgets/settings/WidgetSettings.java @@ -314,7 +314,7 @@ public final class WidgetSettings extends AppFragment implements OnTabSelectedLi TextView textView = binding.f; m.checkNotNullExpressionValue(textView, "appInfoHeader"); String string = getString(R.string.app_information); - textView.setText(string + " - 94.6 - Beta (94106)"); + textView.setText(string + " - 94.7 - Beta (94107)"); binding.A.setOnClickListener(new WidgetSettings$onViewBound$$inlined$with$lambda$3(this)); binding.u.setOnClickListener(WidgetSettings$onViewBound$1$5.INSTANCE); binding.q.setOnClickListener(WidgetSettings$onViewBound$1$6.INSTANCE); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5d635c7105..eb6aa9ba2e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1426,7 +1426,7 @@ Select a color Transparency Use Default - 15b5454eff894039bd9f0c0008c9217e + a40446995ab1449ca3570853cf0e79ff Coming Soon Slash command application {applicationName} {applicationName} application