feature flag approval sending

pull/2/head
Michael Kirk 6 years ago
parent bc4260b444
commit b7989e9384

@ -1861,6 +1861,7 @@ class MediaMessageTextToolbar: UIView, UITextViewDelegate {
public func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { public func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
if !FeatureFlags.sendingMediaWithOversizeText {
let existingText: String = textView.text ?? "" let existingText: String = textView.text ?? ""
let proposedText: String = (existingText as NSString).replacingCharacters(in: range, with: text) let proposedText: String = (existingText as NSString).replacingCharacters(in: range, with: text)
@ -1903,6 +1904,7 @@ class MediaMessageTextToolbar: UIView, UITextViewDelegate {
return false return false
} }
}
// Though we can wrap the text, we don't want to encourage multline captions, plus a "done" button // Though we can wrap the text, we don't want to encourage multline captions, plus a "done" button
// allows the user to get the keyboard out of the way while in the attachment approval view. // allows the user to get the keyboard out of the way while in the attachment approval view.

@ -113,7 +113,15 @@ NS_ASSUME_NONNULL_BEGIN
if ([fullMessageText lengthOfBytesUsingEncoding:NSUTF8StringEncoding] < kOversizeTextMessageSizeThreshold) { if ([fullMessageText lengthOfBytesUsingEncoding:NSUTF8StringEncoding] < kOversizeTextMessageSizeThreshold) {
truncatedText = fullMessageText; truncatedText = fullMessageText;
} else { } else {
if (SSKFeatureFlags.sendingMediaWithOversizeText) {
truncatedText = [fullMessageText ows_truncatedToByteCount:kOversizeTextMessageSizeThreshold]; truncatedText = [fullMessageText ows_truncatedToByteCount:kOversizeTextMessageSizeThreshold];
} else {
// Legacy iOS clients already support receiving long text, but they assume _any_ body
// text is the _full_ body text. So until we consider "rollout" complete, we maintain
// the legacy sending behavior, which does not include the truncated text in the
// websocket proto.
truncatedText = nil;
}
DataSource *_Nullable dataSource = [DataSourceValue dataSourceWithOversizeText:fullMessageText]; DataSource *_Nullable dataSource = [DataSourceValue dataSourceWithOversizeText:fullMessageText];
if (dataSource) { if (dataSource) {
SignalAttachment *oversizeTextAttachment = SignalAttachment *oversizeTextAttachment =

@ -0,0 +1,22 @@
//
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
//
import Foundation
/// By centralizing feature flags here and documenting their rollout plan, it's easier to review
/// which feature flags are in play.
@objc(SSKFeatureFlags)
public class FeatureFlags: NSObject {
/// iOS has long supported sending oversized text as a sidecar attachment. The other clients
/// simply displayed it as a text attachment. As part of the new cross-client long-text feature,
/// we want to be able to display long text with attachments as well. Existing iOS clients
/// won't properly display this, so we'll need to wait a while for rollout.
/// The stakes aren't __too__ high, because legacy clients won't lose data - they just won't
/// see the media attached to a long text message until they update their client.
@objc
public static var sendingMediaWithOversizeText: Bool {
return false
}
}
Loading…
Cancel
Save