diff --git a/Classes/Example/ExampleShareImage.m b/Classes/Example/ExampleShareImage.m index e7031f0f..d68ca966 100644 --- a/Classes/Example/ExampleShareImage.m +++ b/Classes/Example/ExampleShareImage.m @@ -70,6 +70,7 @@ - (void)loadView - (void)share { SHKItem *item = [SHKItem image:imageView.image title:@"San Francisco"]; + [item setAlternateText:@"Golden Gate Bridge #SanFrancisco" toShareOn:@"Twitter"]; SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item]; [actionSheet showFromToolbar:self.navigationController.toolbar]; diff --git a/Classes/Example/ExampleShareLink.m b/Classes/Example/ExampleShareLink.m index 308de462..b7f6c41f 100644 --- a/Classes/Example/ExampleShareLink.m +++ b/Classes/Example/ExampleShareLink.m @@ -56,6 +56,7 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil - (void)share { SHKItem *item = [SHKItem URL:webView.request.URL title:[webView pageTitle]]; + [item setAlternateText:[NSString stringWithFormat:@"%@ #channel",[webView pageTitle]] toShareOn:@"Twitter"]; SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item]; [actionSheet showFromToolbar:self.navigationController.toolbar]; } diff --git a/Classes/Example/ExampleShareText.m b/Classes/Example/ExampleShareText.m index cc66d29f..3b7239e7 100644 --- a/Classes/Example/ExampleShareText.m +++ b/Classes/Example/ExampleShareText.m @@ -77,6 +77,8 @@ - (void)share SHKItem *item = [SHKItem text:text]; + [item setAlternateText:[item.text stringByAppendingString:@" #ShareKit"] toShareOn:@"Twitter"]; + [item setAlternateText:[item.text stringByAppendingString:@"

Alternate text for Email Action"] toShareOn:@"Email"]; SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item]; [actionSheet showFromToolbar:self.navigationController.toolbar]; diff --git a/Classes/ShareKit/Core/Base Sharer Classes/SHKSharer.m b/Classes/ShareKit/Core/Base Sharer Classes/SHKSharer.m index 01b5834b..6d214e0f 100644 --- a/Classes/ShareKit/Core/Base Sharer Classes/SHKSharer.m +++ b/Classes/ShareKit/Core/Base Sharer Classes/SHKSharer.m @@ -166,6 +166,7 @@ - (id)init { self.shareDelegate = self; self.item = [[[SHKItem alloc] init] autorelease]; + self.item.currentOwner = self; if ([self respondsToSelector:@selector(modalPresentationStyle)]) self.modalPresentationStyle = [SHK modalPresentationStyle]; @@ -187,6 +188,8 @@ + (id)shareItem:(SHKItem *)i // Create controller and set share options SHKSharer *controller = [[self alloc] init]; controller.item = i; + controller.item.currentOwner = controller; + // share and/or show UI [controller share]; diff --git a/Classes/ShareKit/Core/SHKItem.h b/Classes/ShareKit/Core/SHKItem.h index 19064a41..2969fb1d 100644 --- a/Classes/ShareKit/Core/SHKItem.h +++ b/Classes/ShareKit/Core/SHKItem.h @@ -55,6 +55,7 @@ typedef enum @private NSMutableDictionary *custom; + NSObject *currentOwner; } @property (nonatomic) SHKShareType shareType; @@ -71,11 +72,15 @@ typedef enum @property (nonatomic, retain) NSString *mimeType; @property (nonatomic, retain) NSString *filename; +@property (assign) NSObject *currentOwner; + + (SHKItem *)URL:(NSURL *)url title:(NSString *)title; + (SHKItem *)image:(UIImage *)image title:(NSString *)title; + (SHKItem *)text:(NSString *)text; + (SHKItem *)file:(NSData *)data filename:(NSString *)filename mimeType:(NSString *)mimeType title:(NSString *)title; +- (void)setAlternateText:(NSString *)alternateText toShareOn:(NSString *)sharer; + - (void)setCustomValue:(NSString *)value forKey:(NSString *)key; - (NSString *)customValueForKey:(NSString *)key; - (BOOL)customBoolForSwitchKey:(NSString *)key; diff --git a/Classes/ShareKit/Core/SHKItem.m b/Classes/ShareKit/Core/SHKItem.m index 76a44613..1dd3088a 100644 --- a/Classes/ShareKit/Core/SHKItem.m +++ b/Classes/ShareKit/Core/SHKItem.m @@ -26,6 +26,7 @@ // #import "SHKItem.h" +#import "SHKSharer.h" #import "SHK.h" @@ -37,7 +38,7 @@ @interface SHKItem() @implementation SHKItem @synthesize shareType; -@synthesize URL, image, title, text, tags, data, mimeType, filename; +@synthesize URL, image, title, text, tags, data, mimeType, filename, currentOwner; @synthesize custom; - (void)dealloc @@ -135,6 +136,21 @@ - (BOOL)customBoolForSwitchKey:(NSString *)key return [[custom objectForKey:key] isEqualToString:SHKFormFieldSwitchOn]; } +#pragma mark - + +//Special getter for convenience in sharers +//It "magically" gets alternate text set for particular sharer +- (NSString *)text { + NSString *sharerTitle = [(SHKSharer *)currentOwner sharerTitle]; + NSString *alternateText = [self customValueForKey:[NSString stringWithFormat:@"alternateTextFor%@",sharerTitle]]; + return (alternateText == nil) ? text : alternateText; +} + +//Adds ability to add custom text for each sharer by name +- (void)setAlternateText:(NSString *)alternateText toShareOn:(NSString *)sharer { + [self setCustomValue:alternateText forKey:[NSString stringWithFormat:@"alternateTextFor%@",sharer]]; +} + #pragma mark - diff --git a/Classes/ShareKit/Core/SHKOfflineSharer.m b/Classes/ShareKit/Core/SHKOfflineSharer.m index 0c9ce9d8..8b922820 100644 --- a/Classes/ShareKit/Core/SHKOfflineSharer.m +++ b/Classes/ShareKit/Core/SHKOfflineSharer.m @@ -79,6 +79,7 @@ - (void)share // create sharer self.sharer = [[NSClassFromString(sharerId) alloc] init]; sharer.item = item; + sharer.item.currentOwner = sharer; sharer.quiet = YES; sharer.shareDelegate = self; diff --git a/Classes/ShareKit/SHKConfig.h b/Classes/ShareKit/SHKConfig.h index c2aa3565..d2aa7889 100644 --- a/Classes/ShareKit/SHKConfig.h +++ b/Classes/ShareKit/SHKConfig.h @@ -86,6 +86,13 @@ #define SHKSharedWithSignature 0 +//Evernote settings +#define SHKEvernoteUserStoreURL @"" +#define SHKEvernoteConsumerKey @"" +#define SHKEvernoteSecretKey @"" +#define SHKEvernoteNetStoreURLBase @"" + + /* UI Configuration : Basic @@ -118,6 +125,8 @@ // Append 'Shared With 'Signature to Email (and related forms) #define SHKSharedWithSignature 0 + + /* UI Configuration : Advanced ------