mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-20 00:24:43 +02:00
Integrate allowMessageDetailsShare
This commit is contained in:
@@ -2578,31 +2578,34 @@
|
||||
|
||||
}]];
|
||||
|
||||
[currentAlert addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"room_event_action_share", @"Vector", nil)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
|
||||
if (weakSelf)
|
||||
{
|
||||
typeof(self) self = weakSelf;
|
||||
|
||||
[self cancelEventSelection];
|
||||
|
||||
NSArray *activityItems = @[selectedComponent.textMessage];
|
||||
|
||||
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
|
||||
|
||||
if (activityViewController)
|
||||
{
|
||||
activityViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
|
||||
activityViewController.popoverPresentationController.sourceView = roomBubbleTableViewCell;
|
||||
activityViewController.popoverPresentationController.sourceRect = roomBubbleTableViewCell.bounds;
|
||||
|
||||
[self presentViewController:activityViewController animated:YES completion:nil];
|
||||
}
|
||||
}
|
||||
|
||||
}]];
|
||||
if (RiotSettings.shared.allowMessageDetailsShare)
|
||||
{
|
||||
[currentAlert addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"room_event_action_share", @"Vector", nil)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
|
||||
if (weakSelf)
|
||||
{
|
||||
typeof(self) self = weakSelf;
|
||||
|
||||
[self cancelEventSelection];
|
||||
|
||||
NSArray *activityItems = @[selectedComponent.textMessage];
|
||||
|
||||
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
|
||||
|
||||
if (activityViewController)
|
||||
{
|
||||
activityViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
|
||||
activityViewController.popoverPresentationController.sourceView = roomBubbleTableViewCell;
|
||||
activityViewController.popoverPresentationController.sourceRect = roomBubbleTableViewCell.bounds;
|
||||
|
||||
[self presentViewController:activityViewController animated:YES completion:nil];
|
||||
}
|
||||
}
|
||||
|
||||
}]];
|
||||
}
|
||||
}
|
||||
else // Add action for attachment
|
||||
{
|
||||
@@ -2688,42 +2691,45 @@
|
||||
|
||||
if (attachment.type != MXKAttachmentTypeSticker)
|
||||
{
|
||||
[currentAlert addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"room_event_action_share", @"Vector", nil)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
|
||||
if (weakSelf)
|
||||
{
|
||||
typeof(self) self = weakSelf;
|
||||
|
||||
[self cancelEventSelection];
|
||||
|
||||
[attachment prepareShare:^(NSURL *fileURL) {
|
||||
|
||||
__strong __typeof(weakSelf)self = weakSelf;
|
||||
self->documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:fileURL];
|
||||
[self->documentInteractionController setDelegate:self];
|
||||
self->currentSharedAttachment = attachment;
|
||||
|
||||
if (![self->documentInteractionController presentOptionsMenuFromRect:self.view.frame inView:self.view animated:YES])
|
||||
{
|
||||
self->documentInteractionController = nil;
|
||||
[attachment onShareEnded];
|
||||
self->currentSharedAttachment = nil;
|
||||
}
|
||||
|
||||
} failure:^(NSError *error) {
|
||||
|
||||
//Alert user
|
||||
[[AppDelegate theDelegate] showErrorAsAlert:error];
|
||||
|
||||
}];
|
||||
|
||||
// Start animation in case of download during attachment preparing
|
||||
[roomBubbleTableViewCell startProgressUI];
|
||||
}
|
||||
|
||||
}]];
|
||||
if (RiotSettings.shared.allowMessageDetailsShare)
|
||||
{
|
||||
[currentAlert addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"room_event_action_share", @"Vector", nil)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
|
||||
if (weakSelf)
|
||||
{
|
||||
typeof(self) self = weakSelf;
|
||||
|
||||
[self cancelEventSelection];
|
||||
|
||||
[attachment prepareShare:^(NSURL *fileURL) {
|
||||
|
||||
__strong __typeof(weakSelf)self = weakSelf;
|
||||
self->documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:fileURL];
|
||||
[self->documentInteractionController setDelegate:self];
|
||||
self->currentSharedAttachment = attachment;
|
||||
|
||||
if (![self->documentInteractionController presentOptionsMenuFromRect:self.view.frame inView:self.view animated:YES])
|
||||
{
|
||||
self->documentInteractionController = nil;
|
||||
[attachment onShareEnded];
|
||||
self->currentSharedAttachment = nil;
|
||||
}
|
||||
|
||||
} failure:^(NSError *error) {
|
||||
|
||||
//Alert user
|
||||
[[AppDelegate theDelegate] showErrorAsAlert:error];
|
||||
|
||||
}];
|
||||
|
||||
// Start animation in case of download during attachment preparing
|
||||
[roomBubbleTableViewCell startProgressUI];
|
||||
}
|
||||
|
||||
}]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user