Enable view-once send support.

This commit is contained in:
Greyson Parrelli 2020-01-02 11:02:15 -05:00 committed by Alan Evans
parent 02006e3ff5
commit 3b5e444e76
2 changed files with 3 additions and 11 deletions

View file

@ -188,11 +188,7 @@ class MediaSendViewModel extends ViewModel {
buttonState = (recipient != null) ? ButtonState.SEND : ButtonState.CONTINUE;
if (viewOnceState == ViewOnceState.GONE && viewOnceSupported()) {
if (FeatureFlags.VIEW_ONCE_SENDING) {
viewOnceState = TextSecurePreferences.isRevealableMessageEnabled(application) ? ViewOnceState.ENABLED : ViewOnceState.DISABLED;
} else {
viewOnceState = ViewOnceState.GONE;
}
} else if (!viewOnceSupported()) {
viewOnceState = ViewOnceState.GONE;
}
@ -452,7 +448,7 @@ class MediaSendViewModel extends ViewModel {
}
boolean isViewOnce() {
return FeatureFlags.VIEW_ONCE_SENDING && viewOnceState == ViewOnceState.ENABLED;
return viewOnceState == ViewOnceState.ENABLED;
}
@NonNull MediaConstraints getMediaConstraints() {
@ -477,13 +473,12 @@ class MediaSendViewModel extends ViewModel {
}
private HudState buildHudState() {
ViewOnceState updatedViewOnceState = FeatureFlags.VIEW_ONCE_SENDING ? viewOnceState : ViewOnceState.GONE;
List<Media> selectedMedia = getSelectedMediaOrDefault();
int selectionCount = selectedMedia.size();
ButtonState updatedButtonState = buttonState == ButtonState.COUNT && selectionCount == 0 ? ButtonState.GONE : buttonState;
boolean updatedCaptionVisible = captionVisible && (selectedMedia.size() > 1 || (selectedMedia.size() > 0 && selectedMedia.get(0).getCaption().isPresent()));
return new HudState(hudVisible, composeVisible, updatedCaptionVisible, selectionCount, updatedButtonState, railState, updatedViewOnceState);
return new HudState(hudVisible, composeVisible, updatedCaptionVisible, selectionCount, updatedButtonState, railState, viewOnceState);
}
private void clearPersistedMedia() {

View file

@ -5,9 +5,6 @@ package org.thoughtcrime.securesms.util;
* After a feature has been launched, the flag should be removed.
*/
public class FeatureFlags {
/** Send support for view-once media. */
public static final boolean VIEW_ONCE_SENDING = false;
/** UUID-related stuff that shouldn't be activated until the user-facing launch. */
public static final boolean UUIDS = false;