Skip to content
This repository has been archived by the owner on Sep 11, 2018. It is now read-only.

This should be added - copy submission to UIPasteBoard #26

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Classes/ViewControllers/StoryViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
24 changes: 17 additions & 7 deletions Classes/ViewControllers/StoryViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#import <MessageUI/MessageUI.h>
#import <MessageUI/MFMailComposeViewController.h>

#import <MobileCoreServices/UTCoreTypes.h>
@implementation StoryViewController

@synthesize story, scoreItem, commentCountItem, segmentedControl, loadingView, toggleButtonItem, webview;
Expand Down Expand Up @@ -360,7 +360,7 @@ - (IBAction)share:(id)sender
delegate:(id <UIActionSheetDelegate>)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;

Expand Down Expand Up @@ -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 <LoginViewControllerDelegate>)self context:@"hide"];
Expand All @@ -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 <LoginViewControllerDelegate>)self context:@"save"];
Expand All @@ -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];
Expand Down