Categories
support trivia

Bookmarking to Delicious from Twitter

A few people have asked if I can provide a way that they can save links they see in tweets to Delicious using Yummy. And the answer to that is… partly. Yummy already has a bookmarklet that you can use in Safari to add bookmarks, and developers can use the same mechanism in their applications. Of course whether people implement that side is not up to me.

That, however, is not the whole story. My current favourite Twitter client for the iPhone is TwitterFon and that is Open Source, which means that I can make changes. The look like this.

You start with your list of tweets:

When you drill down on a tweet with a link, you get to the web view screen. And at the bottom right, much like in Yummy, is an action button where you can do things with the current page. In my tweaked version it looks like this:

Clearly this is not a “production ready” patch. I have not put in any code so that the button is not displayed if you don’t have Yummy for example. If you have the developer tools and would like to apply the patch, here’s the code:


Index: WebViewController.m
===================================================================
--- WebViewController.m (revision 1677)
+++ WebViewController.m (working copy)
@@ -136,7 +136,7 @@
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
- otherButtonTitles:@"Open with Safari", @"Email This Link", nil];
+ otherButtonTitles:@"Open with Safari", @"Email This Link", @"Send to Yummy", nil];
[as showInView:self.navigationController.parentViewController.view];
[as release];

@@ -146,18 +146,29 @@
{
if (as.cancelButtonIndex == buttonIndex) return;

- if (buttonIndex == 0) {
- [[UIApplication sharedApplication] openURL:currentURL];
+ NSString* sendTo;
+ NSString *body;
+
+ switch (buttonIndex) {
+ case 0:
+ [[UIApplication sharedApplication] openURL:currentURL];
+ break;
+ case 1:
+ body = @"nnSent from TwitterFon";
+
+ sendTo = [NSString stringWithFormat:@"mailto:?subject=%@&body=%@%@",
+ [titleLabel.text encodeAsURIComponent],
+ currentURL,
+ [body encodeAsURIComponent]];
+ [[UIApplication sharedApplication] openURL:[NSURL URLWithString:sendTo]];
+ break;
+ case 2:
+ sendTo = [NSString stringWithFormat:@"yummy://post?title=%@&url=%@",
+ [titleLabel.text encodeAsURIComponent],
+ currentURL];
+ [[UIApplication sharedApplication] openURL:[NSURL URLWithString:sendTo]];
+ break;
}
- else {
- NSString *body = @"nnSent from TwitterFon";
-
- NSString *mailTo = [NSString stringWithFormat:@"mailto:?subject=%@&body=%@%@",
- [titleLabel.text encodeAsURIComponent],
- currentURL,
- [body encodeAsURIComponent]];
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:mailTo]];
- }
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex