remove channel discovery from Google Play build flavor

This commit is contained in:
Daniel Gultsch 2023-08-08 10:39:36 +02:00
parent 7a9f18f223
commit b4a07d0093
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2
3 changed files with 15 additions and 1 deletions

View file

@ -1,6 +1,7 @@
package eu.siacs.conversations.services; package eu.siacs.conversations.services;
import android.content.Intent; import android.content.Intent;
import android.os.Build;
import eu.siacs.conversations.BuildConfig; import eu.siacs.conversations.BuildConfig;
@ -25,6 +26,10 @@ public abstract class AbstractQuickConversationsService {
return "conversations".equals(BuildConfig.FLAVOR_mode); return "conversations".equals(BuildConfig.FLAVOR_mode);
} }
public static boolean isPlayStoreFlavor() {
return "playstore".equals(BuildConfig.FLAVOR_distribution);
}
public abstract void signalAccountStateChange(); public abstract void signalAccountStateChange();
public abstract boolean isSynchronizing(); public abstract boolean isSynchronizing();

View file

@ -134,6 +134,7 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
changeOmemoSettingSummary(); changeOmemoSettingSummary();
if (QuickConversationsService.isQuicksy() if (QuickConversationsService.isQuicksy()
|| QuickConversationsService.isPlayStoreFlavor()
|| Strings.isNullOrEmpty(Config.CHANNEL_DISCOVERY)) { || Strings.isNullOrEmpty(Config.CHANNEL_DISCOVERY)) {
final PreferenceCategory groupChats = final PreferenceCategory groupChats =
(PreferenceCategory) mSettingsFragment.findPreference("group_chats"); (PreferenceCategory) mSettingsFragment.findPreference("group_chats");

View file

@ -323,7 +323,11 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
} }
switch (actionItem.getId()) { switch (actionItem.getId()) {
case R.id.discover_public_channels: 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; break;
case R.id.join_public_channel: case R.id.join_public_channel:
showJoinConferenceDialog(prefilled); showJoinConferenceDialog(prefilled);
@ -349,6 +353,9 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
final Menu menu = popupMenu.getMenu(); final Menu menu = popupMenu.getMenu();
for (int i = 0; i < menu.size(); i++) { for (int i = 0; i < menu.size(); i++) {
final MenuItem menuItem = menu.getItem(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()) final SpeedDialActionItem actionItem = new SpeedDialActionItem.Builder(menuItem.getItemId(), menuItem.getIcon())
.setLabel(menuItem.getTitle() != null ? menuItem.getTitle().toString() : null) .setLabel(menuItem.getTitle() != null ? menuItem.getTitle().toString() : null)
.setFabImageTintColor(ContextCompat.getColor(this, R.color.white)) .setFabImageTintColor(ContextCompat.getColor(this, R.color.white))
@ -800,6 +807,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
@Override @Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (grantResults.length > 0) if (grantResults.length > 0)
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
ScanActivity.onRequestPermissionResult(this, requestCode, grantResults); ScanActivity.onRequestPermissionResult(this, requestCode, grantResults);