Skip to content

Commit

Permalink
Inline the scheduled message feature flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
greyson-signal committed Feb 14, 2023
1 parent dc4eb79 commit ca8755c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 31 deletions.
Expand Up @@ -2082,26 +2082,24 @@ private void initializeViews(View view) {
attachButton.setOnClickListener(new AttachButtonListener());
attachButton.setOnLongClickListener(new AttachButtonLongClickListener());
sendButton.setOnClickListener(sendButtonListener);
if (FeatureFlags.scheduledMessageSends()) {
sendButton.setScheduledSendListener(new SendButton.ScheduledSendListener() {
@Override
public void onSendScheduled() {
ScheduleMessageContextMenu.show(sendButton, (ViewGroup) requireView(), time -> {
if (time == -1) {
ScheduleMessageTimePickerBottomSheet.showSchedule(getChildFragmentManager());
} else {
sendMessage(null, time);
}
return Unit.INSTANCE;
});
}
sendButton.setScheduledSendListener(new SendButton.ScheduledSendListener() {
@Override
public void onSendScheduled() {
ScheduleMessageContextMenu.show(sendButton, (ViewGroup) requireView(), time -> {
if (time == -1) {
ScheduleMessageTimePickerBottomSheet.showSchedule(getChildFragmentManager());
} else {
sendMessage(null, time);
}
return Unit.INSTANCE;
});
}

@Override
public boolean canSchedule() {
return !(inputPanel.isRecordingInLockedMode() || draftViewModel.getVoiceNoteDraft() != null);
}
});
}
@Override
public boolean canSchedule() {
return !(inputPanel.isRecordingInLockedMode() || draftViewModel.getVoiceNoteDraft() != null);
}
});
sendButton.setEnabled(true);
sendButton.addOnSelectionChangedListener((newMessageSendType, manuallySelected) -> {
if (getContext() == null) {
Expand Down
Expand Up @@ -47,7 +47,6 @@ import org.thoughtcrime.securesms.mms.SentMediaQuality
import org.thoughtcrime.securesms.permissions.Permissions
import org.thoughtcrime.securesms.recipients.Recipient
import org.thoughtcrime.securesms.scribbles.ImageEditorFragment
import org.thoughtcrime.securesms.util.FeatureFlags
import org.thoughtcrime.securesms.util.LifecycleDisposable
import org.thoughtcrime.securesms.util.MediaUtil
import org.thoughtcrime.securesms.util.SystemWindowInsetsSetter
Expand Down Expand Up @@ -219,7 +218,7 @@ class MediaReviewFragment : Fragment(R.layout.v2_media_review_fragment), Schedul
performSend()
}
}
if (FeatureFlags.scheduledMessageSends() && !sharedViewModel.isStory()) {
if (!sharedViewModel.isStory()) {
sendButton.setOnLongClickListener {
ScheduleMessageContextMenu.show(it, (requireView() as ViewGroup)) { time: Long ->
if (time == -1L) {
Expand Down
Expand Up @@ -105,7 +105,6 @@ public final class FeatureFlags {
private static final String PAYPAL_ONE_TIME_DONATIONS = "android.oneTimePayPalDonations.2";
private static final String PAYPAL_RECURRING_DONATIONS = "android.recurringPayPalDonations.3";
private static final String TEXT_FORMATTING = "android.textFormatting";
private static final String SCHEDULED_MESSAGE_SENDS = "android.scheduledMessageSends.2";

/**
* We will only store remote values for flags in this set. If you want a flag to be controllable
Expand Down Expand Up @@ -161,8 +160,7 @@ public final class FeatureFlags {
CHAT_FILTERS,
PAYPAL_ONE_TIME_DONATIONS,
PAYPAL_RECURRING_DONATIONS,
TEXT_FORMATTING,
SCHEDULED_MESSAGE_SENDS
TEXT_FORMATTING
);

@VisibleForTesting
Expand Down Expand Up @@ -576,13 +574,6 @@ public static boolean textFormatting() {
return getBoolean(TEXT_FORMATTING, false);
}

/**
* Whether or not we allow the user to schedule message sends. This takes over the entry point for SMS message sends
*/
public static boolean scheduledMessageSends() {
return getBoolean(SCHEDULED_MESSAGE_SENDS, false);
}

/** Only for rendering debug info. */
public static synchronized @NonNull Map<String, Object> getMemoryValues() {
return new TreeMap<>(REMOTE_VALUES);
Expand Down

0 comments on commit ca8755c

Please sign in to comment.