Merge pull request #3750 from vector-im/configurable_media_copy_paste

Make Media Copy/Paste Configurable
This commit is contained in:
ismailgulek 2020-10-14 17:17:27 +03:00 committed by GitHub
commit 134917b929
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 0 deletions

View file

@ -7,6 +7,7 @@ Changes to be released in next version
🙌 Improvements
* Device verification: Do not check for existing key backup after SSSS & Cross-Signing reset.
* Cross-signing: Detect when cross-signing keys have been changed.
* Make copying & pasting media configurable.
🐛 Bugfix
*

View file

@ -216,6 +216,8 @@ final class BuildSettings: NSObject {
static let messageDetailsAllowPermalink: Bool = true
static let messageDetailsAllowViewSource: Bool = true
static let messageDetailsAllowSave: Bool = true
static let messageDetailsAllowCopyMedia: Bool = true
static let messageDetailsAllowPasteMedia: Bool = true
// MARK: - HTTP
/// Additional HTTP headers will be sent by all requests. Not recommended to use request-specific headers, like `Authorization`.

View file

@ -43,6 +43,8 @@ class CommonConfiguration: NSObject, Configurable {
settings.messageDetailsAllowSharing = BuildSettings.messageDetailsAllowShare
settings.messageDetailsAllowSaving = BuildSettings.messageDetailsAllowSave
settings.messageDetailsAllowCopyingMedia = BuildSettings.messageDetailsAllowCopyMedia
settings.messageDetailsAllowPastingMedia = BuildSettings.messageDetailsAllowPasteMedia
MXKContactManager.shared().allowLocalContactsAccess = BuildSettings.allowLocalContactsAccess
}

View file

@ -5209,6 +5209,11 @@
BOOL isCopyActionEnabled = !attachment || attachment.type != MXKAttachmentTypeSticker;
if (attachment && !BuildSettings.messageDetailsAllowCopyMedia)
{
isCopyActionEnabled = NO;
}
if (isCopyActionEnabled)
{
switch (event.eventType) {