diff --git a/Classes/ViewControllers/StoryViewController.h b/Classes/ViewControllers/StoryViewController.h index dc71797..b59acc4 100755 --- a/Classes/ViewControllers/StoryViewController.h +++ b/Classes/ViewControllers/StoryViewController.h @@ -51,6 +51,7 @@ - (void)saveCurrentStory:(id)sender; - (void)saveOnInstapaper:(id)sender; - (void)hideCurrentStory:(id)sender; +- (void)copyURL:(id)sender; - (void)setScore:(int)score; - (void)setNumberOfComments:(unsigned)num; diff --git a/Classes/ViewControllers/StoryViewController.m b/Classes/ViewControllers/StoryViewController.m index 1e3563c..5218a7a 100755 --- a/Classes/ViewControllers/StoryViewController.m +++ b/Classes/ViewControllers/StoryViewController.m @@ -17,7 +17,7 @@ #import #import - +#import @implementation StoryViewController @synthesize story, scoreItem, commentCountItem, segmentedControl, loadingView, toggleButtonItem, webview; @@ -360,7 +360,7 @@ - (IBAction)share:(id)sender delegate:(id )self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil - otherButtonTitles:@"E-mail Link", @"Open Link in Safari", @"Hide on reddit", @"Save on reddit", @"Save on Instapaper", nil]; + otherButtonTitles:@"E-mail Link", @"Copy URL", @"Open Link in Safari", @"Hide on reddit", @"Save on reddit", @"Save on Instapaper", nil]; currentSheet.actionSheetStyle = UIActionSheetStyleDefault; @@ -424,14 +424,18 @@ - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger otherButtonTitles:nil] autorelease] show]; } } + + else if (buttonIndex == 0){ + [self copyURL:nil]; + } - else if(buttonIndex == 1 ) + else if(buttonIndex == 2 ) { //open link in safari //[[Beacon shared] startSubBeaconWithName:@"openedInSafari" timeSession:NO]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]]; } - else if (buttonIndex == 2) + else if (buttonIndex == 3) { if (![[LoginController sharedLoginController] isLoggedIn]) [LoginViewController presentWithDelegate:(id )self context:@"hide"]; @@ -441,7 +445,7 @@ - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger // [[Beacon shared] startSubBeaconWithName:@"savedOnReddit" timeSession:NO]; } } - else if (buttonIndex == 3) + else if (buttonIndex == 4) { if (![[LoginController sharedLoginController] isLoggedIn]) [LoginViewController presentWithDelegate:(id )self context:@"save"]; @@ -451,15 +455,21 @@ - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger // [[Beacon shared] startSubBeaconWithName:@"savedOnReddit" timeSession:NO]; } } - else if(buttonIndex == 4) + else if(buttonIndex == 5) { [self saveOnInstapaper:nil]; //[[Beacon shared] startSubBeaconWithName:@"instapaper" timeSession:NO]; } - else if(buttonIndex == 4) + else if(buttonIndex == 5) [self actionSheetCancel:currentSheet]; } +-(void)copyURL:(id)sender{ + UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; + pasteboard.url = [NSURL URLWithString: story.URL]; + [pasteboard release]; +} + - (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error { [controller dismissModalViewControllerAnimated:YES];