Add constant for NO_AUTO_DELETE_TIMER, address review comments.

This commit is contained in:
akwizgran
2020-11-19 15:58:33 +00:00
committed by Torsten Grote
parent b10ca5b77f
commit 113120b3ab
13 changed files with 75 additions and 32 deletions

View File

@@ -138,7 +138,7 @@ import static org.briarproject.briar.android.util.UiUtils.observeOnce;
import static org.briarproject.briar.android.view.AuthorView.setAvatar;
import static org.briarproject.briar.api.messaging.MessagingConstants.MAX_ATTACHMENTS_PER_MESSAGE;
import static org.briarproject.briar.api.messaging.MessagingConstants.MAX_PRIVATE_MESSAGE_TEXT_LENGTH;
import static org.briarproject.briar.api.messaging.PrivateMessageFormat.TEXT;
import static org.briarproject.briar.api.messaging.PrivateMessageFormat.TEXT_ONLY;
@MethodsNotNullByDefault
@ParametersNotNullByDefault
@@ -270,7 +270,7 @@ public class ConversationActivity extends BriarActivity
sendController = new TextAttachmentController(textInputView,
imagePreview, this, viewModel);
observeOnce(viewModel.getPrivateMessageFormat(), this, format -> {
if (format != null && format != TEXT) {
if (format != TEXT_ONLY) {
// TODO: remove cast when removing feature flag
((TextAttachmentController) sendController)
.setImagesSupported();

View File

@@ -58,13 +58,14 @@ import static androidx.lifecycle.Transformations.map;
import static java.util.Objects.requireNonNull;
import static java.util.logging.Level.WARNING;
import static java.util.logging.Logger.getLogger;
import static org.briarproject.bramble.api.autodelete.AutoDeleteConstants.NO_AUTO_DELETE_TIMER;
import static org.briarproject.bramble.util.LogUtils.logDuration;
import static org.briarproject.bramble.util.LogUtils.logException;
import static org.briarproject.bramble.util.LogUtils.now;
import static org.briarproject.briar.android.settings.SettingsFragment.SETTINGS_NAMESPACE;
import static org.briarproject.briar.android.util.UiUtils.observeForeverOnce;
import static org.briarproject.briar.api.messaging.PrivateMessageFormat.TEXT;
import static org.briarproject.briar.api.messaging.PrivateMessageFormat.TEXT_IMAGES;
import static org.briarproject.briar.api.messaging.PrivateMessageFormat.TEXT_ONLY;
@NotNullByDefault
public class ConversationViewModel extends DbViewModel
@@ -287,7 +288,7 @@ public class ConversationViewModel extends DbViewModel
// we only show one onboarding dialog at a time
Settings settings = settingsManager.getSettings(SETTINGS_NAMESPACE);
if (format != TEXT &&
if (format != TEXT_ONLY &&
settings.getBoolean(SHOW_ONBOARDING_IMAGE, true)) {
onOnboardingShown(SHOW_ONBOARDING_IMAGE);
showImageOnboarding.postEvent(true);
@@ -311,7 +312,7 @@ public class ConversationViewModel extends DbViewModel
PrivateMessageFormat format) {
try {
PrivateMessage pm;
if (format == TEXT) {
if (format == TEXT_ONLY) {
pm = privateMessageFactory.createLegacyPrivateMessage(
groupId, timestamp, requireNonNull(text));
} else if (format == TEXT_IMAGES) {
@@ -320,7 +321,7 @@ public class ConversationViewModel extends DbViewModel
} else {
// TODO: Look up auto-delete timer
pm = privateMessageFactory.createPrivateMessage(groupId,
timestamp, text, headers, -1);
timestamp, text, headers, NO_AUTO_DELETE_TIMER);
}
storeMessage(pm);
} catch (FormatException e) {