diff --git a/src/main/java/eu/siacs/conversations/services/AbstractQuickConversationsService.java b/src/main/java/eu/siacs/conversations/services/AbstractQuickConversationsService.java index d05e40ae8..5d6f8eee5 100644 --- a/src/main/java/eu/siacs/conversations/services/AbstractQuickConversationsService.java +++ b/src/main/java/eu/siacs/conversations/services/AbstractQuickConversationsService.java @@ -1,6 +1,7 @@ package eu.siacs.conversations.services; import android.content.Intent; +import android.os.Build; import eu.siacs.conversations.BuildConfig; @@ -25,6 +26,10 @@ public abstract class AbstractQuickConversationsService { return "conversations".equals(BuildConfig.FLAVOR_mode); } + public static boolean isPlayStoreFlavor() { + return "playstore".equals(BuildConfig.FLAVOR_distribution); + } + public abstract void signalAccountStateChange(); public abstract boolean isSynchronizing(); diff --git a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java index 021fc5fad..b9eaf32af 100644 --- a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java @@ -134,6 +134,7 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference changeOmemoSettingSummary(); if (QuickConversationsService.isQuicksy() + || QuickConversationsService.isPlayStoreFlavor() || Strings.isNullOrEmpty(Config.CHANNEL_DISCOVERY)) { final PreferenceCategory groupChats = (PreferenceCategory) mSettingsFragment.findPreference("group_chats"); diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java index a2d0b484c..09bc1e839 100644 --- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java @@ -323,7 +323,11 @@ public class StartConversationActivity extends XmppActivity implements XmppConne } switch (actionItem.getId()) { case R.id.discover_public_channels: - startActivity(new Intent(this, ChannelDiscoveryActivity.class)); + if (QuickConversationsService.isPlayStoreFlavor()) { + throw new IllegalStateException("Channel discovery is not available on Google Play flavor"); + } else { + startActivity(new Intent(this, ChannelDiscoveryActivity.class)); + } break; case R.id.join_public_channel: showJoinConferenceDialog(prefilled); @@ -349,6 +353,9 @@ public class StartConversationActivity extends XmppActivity implements XmppConne final Menu menu = popupMenu.getMenu(); for (int i = 0; i < menu.size(); i++) { final MenuItem menuItem = menu.getItem(i); + if (QuickConversationsService.isPlayStoreFlavor() && menuItem.getItemId() == R.id.discover_public_channels) { + continue; + } final SpeedDialActionItem actionItem = new SpeedDialActionItem.Builder(menuItem.getItemId(), menuItem.getIcon()) .setLabel(menuItem.getTitle() != null ? menuItem.getTitle().toString() : null) .setFabImageTintColor(ContextCompat.getColor(this, R.color.white)) @@ -800,6 +807,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (grantResults.length > 0) if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { ScanActivity.onRequestPermissionResult(this, requestCode, grantResults);