kopia lustrzana https://github.com/ryukoposting/Signal-Android
Inline viewed receipt feature flags.
rodzic
ff1c298817
commit
9b90e371f9
|
@ -313,10 +313,7 @@ public class ConversationItemFooter extends LinearLayout {
|
||||||
private void showAudioDurationViews() {
|
private void showAudioDurationViews() {
|
||||||
audioSpace.setVisibility(View.VISIBLE);
|
audioSpace.setVisibility(View.VISIBLE);
|
||||||
audioDuration.setVisibility(View.GONE);
|
audioDuration.setVisibility(View.GONE);
|
||||||
|
revealDot.setVisibility(View.VISIBLE);
|
||||||
if (FeatureFlags.viewedReceipts()) {
|
|
||||||
revealDot.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hideAudioDurationViews() {
|
private void hideAudioDurationViews() {
|
||||||
|
|
|
@ -205,8 +205,8 @@ public class VoiceNotePlaybackService extends MediaBrowserServiceCompat {
|
||||||
private void sendViewedReceiptForCurrentWindowIndex() {
|
private void sendViewedReceiptForCurrentWindowIndex() {
|
||||||
if (player.getPlaybackState() == Player.STATE_READY &&
|
if (player.getPlaybackState() == Player.STATE_READY &&
|
||||||
player.getPlayWhenReady() &&
|
player.getPlayWhenReady() &&
|
||||||
player.getCurrentWindowIndex() != C.INDEX_UNSET &&
|
player.getCurrentWindowIndex() != C.INDEX_UNSET)
|
||||||
FeatureFlags.sendViewedReceipts()) {
|
{
|
||||||
|
|
||||||
final MediaDescriptionCompat descriptionCompat = queueDataAdapter.getMediaDescription(player.getCurrentWindowIndex());
|
final MediaDescriptionCompat descriptionCompat = queueDataAdapter.getMediaDescription(player.getCurrentWindowIndex());
|
||||||
|
|
||||||
|
|
|
@ -1234,7 +1234,7 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean forceFooter(@NonNull MessageRecord messageRecord) {
|
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) {
|
private ConversationItemFooter getActiveFooter(@NonNull MessageRecord messageRecord) {
|
||||||
|
|
|
@ -96,7 +96,15 @@ public class SendViewedReceiptJob extends BaseJob {
|
||||||
throw new NotPushRegisteredException();
|
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)) {
|
if (!RecipientUtil.isMessageRequestAccepted(context, threadId)) {
|
||||||
Log.w(TAG, "Refusing to send receipts to untrusted recipient");
|
Log.w(TAG, "Refusing to send receipts to untrusted recipient");
|
||||||
|
|
|
@ -33,14 +33,12 @@ class ViewOnceMessageRepository {
|
||||||
try (MmsDatabase.Reader reader = MmsDatabase.readerFor(mmsDatabase.getMessageCursor(messageId))) {
|
try (MmsDatabase.Reader reader = MmsDatabase.readerFor(mmsDatabase.getMessageCursor(messageId))) {
|
||||||
MmsMessageRecord record = (MmsMessageRecord) reader.getNext();
|
MmsMessageRecord record = (MmsMessageRecord) reader.getNext();
|
||||||
|
|
||||||
if (FeatureFlags.sendViewedReceipts()) {
|
MessageDatabase.MarkedMessageInfo info = mmsDatabase.setIncomingMessageViewed(record.getId());
|
||||||
MessageDatabase.MarkedMessageInfo info = mmsDatabase.setIncomingMessageViewed(record.getId());
|
if (info != null) {
|
||||||
if (info != null) {
|
ApplicationDependencies.getJobManager().add(new SendViewedReceiptJob(record.getThreadId(),
|
||||||
ApplicationDependencies.getJobManager().add(new SendViewedReceiptJob(record.getThreadId(),
|
info.getSyncMessageId().getRecipientId(),
|
||||||
info.getSyncMessageId().getRecipientId(),
|
info.getSyncMessageId().getTimetamp()));
|
||||||
info.getSyncMessageId().getTimetamp()));
|
MultiDeviceViewedUpdateJob.enqueue(Collections.singletonList(info.getSyncMessageId()));
|
||||||
MultiDeviceViewedUpdateJob.enqueue(Collections.singletonList(info.getSyncMessageId()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
callback.onComplete(Optional.fromNullable(record));
|
callback.onComplete(Optional.fromNullable(record));
|
||||||
|
|
|
@ -60,8 +60,6 @@ public final class FeatureFlags {
|
||||||
private static final String PHONE_NUMBER_PRIVACY_VERSION = "android.phoneNumberPrivacyVersion";
|
private static final String PHONE_NUMBER_PRIVACY_VERSION = "android.phoneNumberPrivacyVersion";
|
||||||
private static final String CLIENT_EXPIRATION = "android.clientExpiration";
|
private static final String CLIENT_EXPIRATION = "android.clientExpiration";
|
||||||
public static final String DONATE_MEGAPHONE = "android.donate";
|
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 CUSTOM_VIDEO_MUXER = "android.customVideoMuxer";
|
||||||
private static final String CDS_REFRESH_INTERVAL = "cds.syncInterval.seconds";
|
private static final String CDS_REFRESH_INTERVAL = "cds.syncInterval.seconds";
|
||||||
private static final String AUTOMATIC_SESSION_RESET = "android.automaticSessionReset.2";
|
private static final String AUTOMATIC_SESSION_RESET = "android.automaticSessionReset.2";
|
||||||
|
@ -94,8 +92,6 @@ public final class FeatureFlags {
|
||||||
VERIFY_V2,
|
VERIFY_V2,
|
||||||
CLIENT_EXPIRATION,
|
CLIENT_EXPIRATION,
|
||||||
DONATE_MEGAPHONE,
|
DONATE_MEGAPHONE,
|
||||||
VIEWED_RECEIPTS,
|
|
||||||
SEND_VIEWED_RECEIPTS,
|
|
||||||
CUSTOM_VIDEO_MUXER,
|
CUSTOM_VIDEO_MUXER,
|
||||||
CDS_REFRESH_INTERVAL,
|
CDS_REFRESH_INTERVAL,
|
||||||
GROUP_NAME_MAX_LENGTH,
|
GROUP_NAME_MAX_LENGTH,
|
||||||
|
@ -276,16 +272,6 @@ public final class FeatureFlags {
|
||||||
return getVersionFlag(PHONE_NUMBER_PRIVACY_VERSION) == VersionFlag.ON;
|
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. */
|
/** Whether to use the custom streaming muxer or built in android muxer. */
|
||||||
public static boolean useStreamingVideoMuxer() {
|
public static boolean useStreamingVideoMuxer() {
|
||||||
return getBoolean(CUSTOM_VIDEO_MUXER, false);
|
return getBoolean(CUSTOM_VIDEO_MUXER, false);
|
||||||
|
|
Ładowanie…
Reference in New Issue