Inline viewed receipt feature flags.

fork-5.53.8
Greyson Parrelli 2021-06-08 16:10:34 -04:00
rodzic ff1c298817
commit 9b90e371f9
6 zmienionych plików z 19 dodań i 30 usunięć

Wyświetl plik

@ -313,10 +313,7 @@ public class ConversationItemFooter extends LinearLayout {
private void showAudioDurationViews() {
audioSpace.setVisibility(View.VISIBLE);
audioDuration.setVisibility(View.GONE);
if (FeatureFlags.viewedReceipts()) {
revealDot.setVisibility(View.VISIBLE);
}
revealDot.setVisibility(View.VISIBLE);
}
private void hideAudioDurationViews() {

Wyświetl plik

@ -205,8 +205,8 @@ public class VoiceNotePlaybackService extends MediaBrowserServiceCompat {
private void sendViewedReceiptForCurrentWindowIndex() {
if (player.getPlaybackState() == Player.STATE_READY &&
player.getPlayWhenReady() &&
player.getCurrentWindowIndex() != C.INDEX_UNSET &&
FeatureFlags.sendViewedReceipts()) {
player.getCurrentWindowIndex() != C.INDEX_UNSET)
{
final MediaDescriptionCompat descriptionCompat = queueDataAdapter.getMediaDescription(player.getCurrentWindowIndex());

Wyświetl plik

@ -1234,7 +1234,7 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
}
private boolean forceFooter(@NonNull MessageRecord messageRecord) {
return FeatureFlags.viewedReceipts() && hasAudio(messageRecord) && messageRecord.getViewedReceiptCount() == 0;
return hasAudio(messageRecord) && messageRecord.getViewedReceiptCount() == 0;
}
private ConversationItemFooter getActiveFooter(@NonNull MessageRecord messageRecord) {

Wyświetl plik

@ -96,7 +96,15 @@ public class SendViewedReceiptJob extends BaseJob {
throw new NotPushRegisteredException();
}
if (!TextSecurePreferences.isReadReceiptsEnabled(context) || syncTimestamps.isEmpty() || !FeatureFlags.sendViewedReceipts()) return;
if (!TextSecurePreferences.isReadReceiptsEnabled(context)) {
Log.w(TAG, "Read receipts not enabled!");
return;
}
if (syncTimestamps.isEmpty()) {
Log.w(TAG, "No sync timestamps!");
return;
}
if (!RecipientUtil.isMessageRequestAccepted(context, threadId)) {
Log.w(TAG, "Refusing to send receipts to untrusted recipient");

Wyświetl plik

@ -33,14 +33,12 @@ class ViewOnceMessageRepository {
try (MmsDatabase.Reader reader = MmsDatabase.readerFor(mmsDatabase.getMessageCursor(messageId))) {
MmsMessageRecord record = (MmsMessageRecord) reader.getNext();
if (FeatureFlags.sendViewedReceipts()) {
MessageDatabase.MarkedMessageInfo info = mmsDatabase.setIncomingMessageViewed(record.getId());
if (info != null) {
ApplicationDependencies.getJobManager().add(new SendViewedReceiptJob(record.getThreadId(),
info.getSyncMessageId().getRecipientId(),
info.getSyncMessageId().getTimetamp()));
MultiDeviceViewedUpdateJob.enqueue(Collections.singletonList(info.getSyncMessageId()));
}
MessageDatabase.MarkedMessageInfo info = mmsDatabase.setIncomingMessageViewed(record.getId());
if (info != null) {
ApplicationDependencies.getJobManager().add(new SendViewedReceiptJob(record.getThreadId(),
info.getSyncMessageId().getRecipientId(),
info.getSyncMessageId().getTimetamp()));
MultiDeviceViewedUpdateJob.enqueue(Collections.singletonList(info.getSyncMessageId()));
}
callback.onComplete(Optional.fromNullable(record));

Wyświetl plik

@ -60,8 +60,6 @@ public final class FeatureFlags {
private static final String PHONE_NUMBER_PRIVACY_VERSION = "android.phoneNumberPrivacyVersion";
private static final String CLIENT_EXPIRATION = "android.clientExpiration";
public static final String DONATE_MEGAPHONE = "android.donate";
private static final String VIEWED_RECEIPTS = "android.viewed.receipts";
private static final String SEND_VIEWED_RECEIPTS = "android.sendViewedReceipts";
private static final String CUSTOM_VIDEO_MUXER = "android.customVideoMuxer";
private static final String CDS_REFRESH_INTERVAL = "cds.syncInterval.seconds";
private static final String AUTOMATIC_SESSION_RESET = "android.automaticSessionReset.2";
@ -94,8 +92,6 @@ public final class FeatureFlags {
VERIFY_V2,
CLIENT_EXPIRATION,
DONATE_MEGAPHONE,
VIEWED_RECEIPTS,
SEND_VIEWED_RECEIPTS,
CUSTOM_VIDEO_MUXER,
CDS_REFRESH_INTERVAL,
GROUP_NAME_MAX_LENGTH,
@ -276,16 +272,6 @@ public final class FeatureFlags {
return getVersionFlag(PHONE_NUMBER_PRIVACY_VERSION) == VersionFlag.ON;
}
/** Whether the user should display the content revealed dot in voice notes. */
public static boolean viewedReceipts() {
return getBoolean(VIEWED_RECEIPTS, false);
}
/** Whether or not to send viewed receipts. */
public static boolean sendViewedReceipts() {
return getBoolean(SEND_VIEWED_RECEIPTS, false);
}
/** Whether to use the custom streaming muxer or built in android muxer. */
public static boolean useStreamingVideoMuxer() {
return getBoolean(CUSTOM_VIDEO_MUXER, false);