Add feature flag for private message deletion.

This commit is contained in:
akwizgran
2019-10-09 16:22:04 +01:00
parent a23e0699d8
commit 249b85cd26
6 changed files with 19 additions and 0 deletions

View File

@@ -8,4 +8,6 @@ public interface FeatureFlags {
boolean shouldEnableImageAttachments(); boolean shouldEnableImageAttachments();
boolean shouldEnableRemoteContacts(); boolean shouldEnableRemoteContacts();
boolean shouldEnablePrivateMessageDeletion();
} }

View File

@@ -29,6 +29,11 @@ public class BrambleCoreIntegrationTestModule {
public boolean shouldEnableRemoteContacts() { public boolean shouldEnableRemoteContacts() {
return true; return true;
} }
@Override
public boolean shouldEnablePrivateMessageDeletion() {
return true;
}
}; };
} }
} }

View File

@@ -246,6 +246,11 @@ public class AppModule {
public boolean shouldEnableRemoteContacts() { public boolean shouldEnableRemoteContacts() {
return IS_DEBUG_BUILD; return IS_DEBUG_BUILD;
} }
@Override
public boolean shouldEnablePrivateMessageDeletion() {
return IS_DEBUG_BUILD;
}
}; };
} }
} }

View File

@@ -356,6 +356,11 @@ public class ConversationActivity extends BriarActivity
MenuInflater inflater = getMenuInflater(); MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.conversation_actions, menu); inflater.inflate(R.menu.conversation_actions, menu);
// Hide private message deletion action if feature is not enabled
if (!featureFlags.shouldEnablePrivateMessageDeletion()) {
menu.removeItem(R.id.action_delete_all_messages);
}
// enable introduction action if available // enable introduction action if available
observeOnce(viewModel.showIntroductionAction(), this, enable -> { observeOnce(viewModel.showIntroductionAction(), this, enable -> {
if (enable != null && enable) { if (enable != null && enable) {

View File

@@ -99,5 +99,6 @@ internal class HeadlessModule(private val appDir: File) {
internal fun provideFeatureFlags() = object : FeatureFlags { internal fun provideFeatureFlags() = object : FeatureFlags {
override fun shouldEnableImageAttachments() = false override fun shouldEnableImageAttachments() = false
override fun shouldEnableRemoteContacts() = true override fun shouldEnableRemoteContacts() = true
override fun shouldEnablePrivateMessageDeletion() = true
} }
} }

View File

@@ -66,5 +66,6 @@ internal class HeadlessTestModule(private val appDir: File) {
internal fun provideFeatureFlags() = object : FeatureFlags { internal fun provideFeatureFlags() = object : FeatureFlags {
override fun shouldEnableImageAttachments() = false override fun shouldEnableImageAttachments() = false
override fun shouldEnableRemoteContacts() = true override fun shouldEnableRemoteContacts() = true
override fun shouldEnablePrivateMessageDeletion() = true
} }
} }