Merge pull request #265 from vector-im/vector_225

#225: Ability to copy message permalinks
This commit is contained in:
manuroe 2016-04-26 19:21:12 +02:00
commit 00268e0193
2 changed files with 19 additions and 1 deletions

View file

@ -143,6 +143,7 @@
"room_event_action_copy" = "Copy";
"room_event_action_share" = "Share";
"room_event_action_redact" = "Redact";
"room_event_action_permalink" = "Permalink";
"room_event_action_save" = "Save";
"room_event_action_resend" = "Resend";
"room_event_action_delete" = "Delete";

View file

@ -1309,8 +1309,25 @@
}];
}];
[self.currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_permalink", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) {
__strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf cancelEventSelection];
// Create a permalink that is common to all Vector.im clients
// FIXME: When available, use the prod Vector web app URL
NSString *webAppUrl = [[NSUserDefaults standardUserDefaults] objectForKey:@"webAppUrlDev"];
NSString *permalink = [NSString stringWithFormat:@"%@/#/room/%@/%@",
webAppUrl,
selectedEvent.roomId,
selectedEvent.eventId];
[[UIPasteboard generalPasteboard] setString:permalink];
}];
}
self.currentAlert.cancelButtonIndex = [self.currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"cancel", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) {
__strong __typeof(weakSelf)strongSelf = weakSelf;