mirror of
https://github.com/samsonjs/samhuri.net-ios.git
synced 2026-04-27 15:07:44 +00:00
basic support for viewing and editing links
This commit is contained in:
parent
b1b7cc6a70
commit
f8ff5abebd
2 changed files with 142 additions and 30 deletions
|
|
@ -58,7 +58,7 @@
|
||||||
<color key="barTintColor" red="0.1333333333" green="0.1333333333" blue="0.1333333333" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="barTintColor" red="0.1333333333" green="0.1333333333" blue="0.1333333333" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
</toolbar>
|
</toolbar>
|
||||||
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="wrG-1y-ZY3">
|
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="wrG-1y-ZY3">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="600" height="492"/>
|
<rect key="frame" x="0.0" y="25" width="600" height="467"/>
|
||||||
<color key="backgroundColor" red="0.26666666666666666" green="0.26666666666666666" blue="0.26666666666666666" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="backgroundColor" red="0.26666666666666666" green="0.26666666666666666" blue="0.26666666666666666" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
|
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
|
||||||
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
|
|
@ -68,36 +68,36 @@
|
||||||
<outlet property="delegate" destination="JEX-9P-axG" id="vKD-HY-lGQ"/>
|
<outlet property="delegate" destination="JEX-9P-axG" id="vKD-HY-lGQ"/>
|
||||||
</connections>
|
</connections>
|
||||||
</textView>
|
</textView>
|
||||||
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="http://samhuri.net" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UkA-he-S6k">
|
||||||
|
<rect key="frame" x="16" y="4" width="568" height="17"/>
|
||||||
|
<fontDescription key="fontDescription" style="UICTFontTextStyleSubhead"/>
|
||||||
|
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
|
||||||
|
<nil key="highlightedColor"/>
|
||||||
|
</label>
|
||||||
</subviews>
|
</subviews>
|
||||||
<color key="backgroundColor" red="0.1333333333" green="0.1333333333" blue="0.1333333333" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="backgroundColor" red="0.1333333333" green="0.1333333333" blue="0.1333333333" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
<color key="tintColor" red="0.7953414352" green="0.0" blue="0.013255690590000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="tintColor" red="0.7953414352" green="0.0" blue="0.013255690590000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="centerY" secondItem="wrG-1y-ZY3" secondAttribute="centerY" id="8IO-mb-1kq"/>
|
<constraint firstItem="UkA-he-S6k" firstAttribute="leading" secondItem="svH-Pt-448" secondAttribute="leadingMargin" id="1qg-MA-LsX"/>
|
||||||
<constraint firstAttribute="width" secondItem="wrG-1y-ZY3" secondAttribute="width" id="8hl-Ab-ACB"/>
|
<constraint firstAttribute="width" secondItem="wrG-1y-ZY3" secondAttribute="width" id="8hl-Ab-ACB"/>
|
||||||
<constraint firstItem="YUD-Xe-6Cc" firstAttribute="bottom" secondItem="GAO-Cl-Wes" secondAttribute="top" id="DLQ-Z3-h8m"/>
|
<constraint firstItem="YUD-Xe-6Cc" firstAttribute="bottom" secondItem="GAO-Cl-Wes" secondAttribute="top" id="DLQ-Z3-h8m"/>
|
||||||
<constraint firstAttribute="centerX" secondItem="wrG-1y-ZY3" secondAttribute="centerX" id="FEY-jO-Mjl"/>
|
<constraint firstAttribute="centerX" secondItem="wrG-1y-ZY3" secondAttribute="centerX" id="FEY-jO-Mjl"/>
|
||||||
|
<constraint firstItem="UkA-he-S6k" firstAttribute="top" secondItem="SYR-Wa-9uf" secondAttribute="bottom" constant="4" id="IFr-2C-sgA"/>
|
||||||
<constraint firstAttribute="centerX" secondItem="YUD-Xe-6Cc" secondAttribute="centerX" id="JTh-pp-5hr"/>
|
<constraint firstAttribute="centerX" secondItem="YUD-Xe-6Cc" secondAttribute="centerX" id="JTh-pp-5hr"/>
|
||||||
<constraint firstAttribute="height" secondItem="wrG-1y-ZY3" secondAttribute="height" id="ORx-N8-ZLB"/>
|
<constraint firstAttribute="trailingMargin" secondItem="UkA-he-S6k" secondAttribute="trailing" id="cre-bi-Ah8"/>
|
||||||
<constraint firstItem="SYR-Wa-9uf" firstAttribute="top" secondItem="wrG-1y-ZY3" secondAttribute="top" id="VlL-zs-EVE"/>
|
|
||||||
<constraint firstAttribute="height" secondItem="YUD-Xe-6Cc" secondAttribute="height" id="dwI-2s-ERv"/>
|
|
||||||
<constraint firstAttribute="height" secondItem="wrG-1y-ZY3" secondAttribute="height" id="ecu-u5-SXU"/>
|
|
||||||
<constraint firstItem="YUD-Xe-6Cc" firstAttribute="top" secondItem="wrG-1y-ZY3" secondAttribute="bottom" id="iTL-zi-eKI"/>
|
<constraint firstItem="YUD-Xe-6Cc" firstAttribute="top" secondItem="wrG-1y-ZY3" secondAttribute="bottom" id="iTL-zi-eKI"/>
|
||||||
<constraint firstAttribute="width" secondItem="YUD-Xe-6Cc" secondAttribute="width" id="n19-6i-zpg"/>
|
<constraint firstAttribute="width" secondItem="YUD-Xe-6Cc" secondAttribute="width" id="n19-6i-zpg"/>
|
||||||
<constraint firstItem="wrG-1y-ZY3" firstAttribute="top" secondItem="SYR-Wa-9uf" secondAttribute="bottom" id="tUU-ig-gJV"/>
|
<constraint firstItem="wrG-1y-ZY3" firstAttribute="top" secondItem="SYR-Wa-9uf" secondAttribute="bottom" constant="25" id="tUU-ig-gJV"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<variation key="default">
|
|
||||||
<mask key="constraints">
|
|
||||||
<exclude reference="8IO-mb-1kq"/>
|
|
||||||
<exclude reference="ORx-N8-ZLB"/>
|
|
||||||
<exclude reference="ecu-u5-SXU"/>
|
|
||||||
<exclude reference="VlL-zs-EVE"/>
|
|
||||||
<exclude reference="dwI-2s-ERv"/>
|
|
||||||
</mask>
|
|
||||||
</variation>
|
|
||||||
</view>
|
</view>
|
||||||
<toolbarItems/>
|
<toolbarItems/>
|
||||||
<navigationItem key="navigationItem" title="Article Title" id="mOI-FS-AaM">
|
<navigationItem key="navigationItem" title="Article Title" id="mOI-FS-AaM">
|
||||||
<barButtonItem key="backBarButtonItem" title=" " id="g7z-xe-9m6"/>
|
<barButtonItem key="backBarButtonItem" title=" " id="KtM-fR-xtg"/>
|
||||||
|
<barButtonItem key="rightBarButtonItem" title="Link" id="tGf-LU-fFC">
|
||||||
|
<connections>
|
||||||
|
<action selector="presentLinkActionSheet:" destination="JEX-9P-axG" id="fuj-e9-dVF"/>
|
||||||
|
</connections>
|
||||||
|
</barButtonItem>
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="titleView" destination="udr-9h-BhX" id="t9J-lg-ow1"/>
|
<outlet property="titleView" destination="udr-9h-BhX" id="t9J-lg-ow1"/>
|
||||||
</connections>
|
</connections>
|
||||||
|
|
@ -107,6 +107,7 @@
|
||||||
<outlet property="linkLabel" destination="UkA-he-S6k" id="Czh-uA-7KF"/>
|
<outlet property="linkLabel" destination="UkA-he-S6k" id="Czh-uA-7KF"/>
|
||||||
<outlet property="publishBarButtonItem" destination="qEb-VA-ueB" id="biG-Yd-W5Z"/>
|
<outlet property="publishBarButtonItem" destination="qEb-VA-ueB" id="biG-Yd-W5Z"/>
|
||||||
<outlet property="textView" destination="wrG-1y-ZY3" id="lvo-lm-t7Z"/>
|
<outlet property="textView" destination="wrG-1y-ZY3" id="lvo-lm-t7Z"/>
|
||||||
|
<outlet property="textViewTopConstraint" destination="tUU-ig-gJV" id="Wzj-Rc-kuM"/>
|
||||||
<outlet property="titleView" destination="udr-9h-BhX" id="fju-wx-M92"/>
|
<outlet property="titleView" destination="udr-9h-BhX" id="fju-wx-M92"/>
|
||||||
<outlet property="toolbar" destination="YUD-Xe-6Cc" id="SIv-cT-WDD"/>
|
<outlet property="toolbar" destination="YUD-Xe-6Cc" id="SIv-cT-WDD"/>
|
||||||
</connections>
|
</connections>
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
@property (nonatomic, weak) IBOutlet UILabel *titleView;
|
@property (nonatomic, weak) IBOutlet UILabel *titleView;
|
||||||
@property (nonatomic, weak) IBOutlet UITextView *textView;
|
@property (nonatomic, weak) IBOutlet UITextView *textView;
|
||||||
|
@property (nonatomic, weak) IBOutlet NSLayoutConstraint *textViewTopConstraint;
|
||||||
|
@property (nonatomic, weak) IBOutlet UILabel *linkLabel;
|
||||||
@property (nonatomic, weak) IBOutlet UIToolbar *toolbar;
|
@property (nonatomic, weak) IBOutlet UIToolbar *toolbar;
|
||||||
@property (nonatomic, weak) IBOutlet UIBarButtonItem *publishBarButtonItem;
|
@property (nonatomic, weak) IBOutlet UIBarButtonItem *publishBarButtonItem;
|
||||||
@property (strong, nonatomic) Post *modifiedPost;
|
@property (strong, nonatomic) Post *modifiedPost;
|
||||||
|
|
@ -37,7 +39,38 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)configureView {
|
- (void)configureView {
|
||||||
NSString *title = nil;
|
[self configureTitleView];
|
||||||
|
[self configureLinkView];
|
||||||
|
[self configureBodyView];
|
||||||
|
[self configureToolbar];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)configureTitleView {
|
||||||
|
self.titleView.text = self.modifiedPost.title.length ? self.modifiedPost.title : @"Untitled";
|
||||||
|
[self.titleView sizeToFit];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)configureLinkView {
|
||||||
|
NSURL *url = self.modifiedPost.url;
|
||||||
|
if (url) {
|
||||||
|
self.linkLabel.text = url.absoluteString;
|
||||||
|
self.linkLabel.alpha = 0;
|
||||||
|
[UIView animateWithDuration:0.3 animations:^{
|
||||||
|
self.linkLabel.alpha = 1;
|
||||||
|
self.textViewTopConstraint.constant = CGRectGetMaxY(self.linkLabel.frame) + 4;
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
[UIView animateWithDuration:0.3 animations:^{
|
||||||
|
self.linkLabel.alpha = 0;
|
||||||
|
self.textViewTopConstraint.constant = 0;
|
||||||
|
} completion:^(BOOL finished) {
|
||||||
|
self.linkLabel.text = nil;
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)configureBodyView {
|
||||||
NSString *body = nil;
|
NSString *body = nil;
|
||||||
CGPoint scrollOffset = CGPointZero;
|
CGPoint scrollOffset = CGPointZero;
|
||||||
Post *post = self.modifiedPost;
|
Post *post = self.modifiedPost;
|
||||||
|
|
@ -46,23 +79,18 @@
|
||||||
body = post.body;
|
body = post.body;
|
||||||
// TODO: restore scroll offset for this post ... user defaults?
|
// TODO: restore scroll offset for this post ... user defaults?
|
||||||
}
|
}
|
||||||
[self configureTitleView];
|
|
||||||
self.textView.text = body;
|
self.textView.text = body;
|
||||||
self.textView.contentOffset = scrollOffset;
|
self.textView.contentOffset = scrollOffset;
|
||||||
// TODO: url
|
}
|
||||||
|
|
||||||
BOOL toolbarEnabled = post != nil;
|
- (void)configureToolbar {
|
||||||
|
BOOL toolbarEnabled = self.modifiedPost != nil;
|
||||||
[self.toolbar.items enumerateObjectsUsingBlock:^(UIBarButtonItem *item, NSUInteger idx, BOOL *stop) {
|
[self.toolbar.items enumerateObjectsUsingBlock:^(UIBarButtonItem *item, NSUInteger idx, BOOL *stop) {
|
||||||
item.enabled = toolbarEnabled;
|
item.enabled = toolbarEnabled;
|
||||||
}];
|
}];
|
||||||
self.publishBarButtonItem.title = self.modifiedPost.draft ? @"Publish" : @"Unpublish";
|
self.publishBarButtonItem.title = self.modifiedPost.draft ? @"Publish" : @"Unpublish";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)configureTitleView {
|
|
||||||
self.titleView.text = self.modifiedPost.title.length ? self.modifiedPost.title : @"Untitled";
|
|
||||||
[self.titleView sizeToFit];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
[self configureView];
|
[self configureView];
|
||||||
|
|
@ -75,8 +103,8 @@
|
||||||
|
|
||||||
- (void)viewWillDisappear:(BOOL)animated {
|
- (void)viewWillDisappear:(BOOL)animated {
|
||||||
[super viewWillDisappear:animated];
|
[super viewWillDisappear:animated];
|
||||||
[self savePost];
|
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillResignActiveNotification object:nil];
|
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillResignActiveNotification object:nil];
|
||||||
|
[self savePost];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||||
|
|
@ -151,6 +179,7 @@
|
||||||
|
|
||||||
- (void)updatePostURL:(NSURL *)url {
|
- (void)updatePostURL:(NSURL *)url {
|
||||||
self.modifiedPost = [self.modifiedPost copyWithURL:url];
|
self.modifiedPost = [self.modifiedPost copyWithURL:url];
|
||||||
|
[self configureLinkView];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)publishOrUnpublish:(id)sender {
|
- (IBAction)publishOrUnpublish:(id)sender {
|
||||||
|
|
@ -189,7 +218,9 @@
|
||||||
presentationController.sourceView = self.view;
|
presentationController.sourceView = self.view;
|
||||||
presentationController.sourceRect = CGRectMake(CGRectGetWidth(self.view.bounds) / 2, 0, 1, 1);
|
presentationController.sourceRect = CGRectMake(CGRectGetWidth(self.view.bounds) / 2, 0, 1, 1);
|
||||||
presentationController.permittedArrowDirections = UIPopoverArrowDirectionUp;
|
presentationController.permittedArrowDirections = UIPopoverArrowDirectionUp;
|
||||||
|
__weak __typeof__(changeTitleViewController) weakChangeTitleViewController = changeTitleViewController;
|
||||||
changeTitleViewController.dismissBlock = ^{
|
changeTitleViewController.dismissBlock = ^{
|
||||||
|
__typeof__(changeTitleViewController) changeTitleViewController = weakChangeTitleViewController;
|
||||||
NSString *title = changeTitleViewController.articleTitle;
|
NSString *title = changeTitleViewController.articleTitle;
|
||||||
[self updatePostTitle:title];
|
[self updatePostTitle:title];
|
||||||
[self dismissViewControllerAnimated:YES completion:nil];
|
[self dismissViewControllerAnimated:YES completion:nil];
|
||||||
|
|
@ -197,14 +228,94 @@
|
||||||
[self presentViewController:changeTitleViewController animated:YES completion:nil];
|
[self presentViewController:changeTitleViewController animated:YES completion:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - UIPopoverPresentationControllerDelegate methods
|
||||||
|
|
||||||
- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller {
|
- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller {
|
||||||
return UIModalPresentationNone;
|
return UIModalPresentationNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)popoverPresentationControllerDidDismissPopover:(UIPopoverPresentationController *)popoverPresentationController {
|
- (void)popoverPresentationControllerDidDismissPopover:(UIPopoverPresentationController *)popoverPresentationController {
|
||||||
ChangeTitleViewController *changeTitleViewController = (ChangeTitleViewController *)popoverPresentationController.presentedViewController;
|
UIViewController *dismissedVC = popoverPresentationController.presentedViewController;
|
||||||
|
if ([dismissedVC isKindOfClass:[ChangeTitleViewController class]]) {
|
||||||
|
ChangeTitleViewController *changeTitleViewController = (ChangeTitleViewController *)dismissedVC;
|
||||||
NSString *title = changeTitleViewController.articleTitle;
|
NSString *title = changeTitleViewController.articleTitle;
|
||||||
[self updatePostTitle:title];
|
[self updatePostTitle:title];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - Alerts
|
||||||
|
|
||||||
|
- (void)showAlertWithTitle:(NSString *)title message:(NSString *)message {
|
||||||
|
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
__weak __typeof__(self) welf = self;
|
||||||
|
[alertController addAction:[UIAlertAction actionWithTitle:@"Dismiss" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
|
||||||
|
__typeof__(self) self = welf;
|
||||||
|
[self dismissViewControllerAnimated:YES completion:nil];
|
||||||
|
}]];
|
||||||
|
[self presentViewController:alertController animated:YES completion:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - Link management
|
||||||
|
|
||||||
|
- (IBAction)presentLinkActionSheet:(id)sender {
|
||||||
|
if (self.presentedViewController) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSURL *currentURL = self.modifiedPost.url;
|
||||||
|
|
||||||
|
// If nothing to add or remove, then don't present the action sheet.
|
||||||
|
if (!currentURL && ![self pasteboardHasLink]) {
|
||||||
|
[self showAlertWithTitle:@"No Link Found" message:@"Copy a link to the pasteboard to add it."];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UIAlertController *menuController = [UIAlertController alertControllerWithTitle:nil message:currentURL.absoluteString preferredStyle:UIAlertControllerStyleActionSheet];
|
||||||
|
|
||||||
|
// Cancel
|
||||||
|
[menuController addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
|
||||||
|
[self dismissViewControllerAnimated:YES completion:nil];
|
||||||
|
}]];
|
||||||
|
|
||||||
|
// Add/Replace from Pasteboard
|
||||||
|
NSString *addVerb = self.modifiedPost.link ? @"Replace" : @"Add";
|
||||||
|
if ([self pasteboardHasLink]) {
|
||||||
|
NSString *title = [NSString stringWithFormat:@"%@ from Pasteboard", addVerb];
|
||||||
|
__weak __typeof__(self) welf = self;
|
||||||
|
[menuController addAction:[UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
|
||||||
|
__typeof__(self) self = welf;
|
||||||
|
[self dismissViewControllerAnimated:YES completion:^{
|
||||||
|
[self addLinkFromPasteboard];
|
||||||
|
}];
|
||||||
|
}]];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove Link
|
||||||
|
if (currentURL) {
|
||||||
|
__weak __typeof__(self) welf = self;
|
||||||
|
[menuController addAction:[UIAlertAction actionWithTitle:@"Remove Link" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
|
||||||
|
__typeof__(self) self = welf;
|
||||||
|
[self dismissViewControllerAnimated:YES completion:^{
|
||||||
|
[self updatePostURL:nil];
|
||||||
|
}];
|
||||||
|
}]];
|
||||||
|
}
|
||||||
|
|
||||||
|
[self presentViewController:menuController animated:YES completion:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)pasteboardHasLink {
|
||||||
|
return [UIPasteboard generalPasteboard].URL != nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)addLinkFromPasteboard {
|
||||||
|
NSURL *pasteboardURL = [UIPasteboard generalPasteboard].URL;
|
||||||
|
if (pasteboardURL) {
|
||||||
|
[self updatePostURL:pasteboardURL];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
[self showAlertWithTitle:@"Error" message:@"No link found on pasteboard"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue