Skip to content

Commit

Permalink
Example Share Kit Integration
Browse files Browse the repository at this point in the history
* Showing showing off how integration with ShareKit could work with
  the EGOPhotoViewer with the modular design.
  • Loading branch information
Franklin Webber committed Apr 23, 2012
1 parent eca7635 commit de136a6
Show file tree
Hide file tree
Showing 138 changed files with 13,982 additions and 1 deletion.
534 changes: 534 additions & 0 deletions Demo/EGOPhotoViewer_Demo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Demo/Project/EGOPhotoViewer_DemoAppDelegate.m
Expand Up @@ -48,7 +48,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
}

[self.window makeKeyAndVisible];

return YES;
}

Expand Down
15 changes: 15 additions & 0 deletions Demo/Project/iPhone/MySHKConfigurator.h
@@ -0,0 +1,15 @@
//
// MySHKConfigurator.h
// EGOPhotoViewer_Demo
//
// Created by Franklin Webber on 4/23/12.
// Copyright (c) 2012 Franklin Webber. All rights reserved.
//

#import "SHKConfiguration.h"

@interface MySHKConfigurator : DefaultSHKConfigurator

+ (void)setup;

@end
28 changes: 28 additions & 0 deletions Demo/Project/iPhone/MySHKConfigurator.m
@@ -0,0 +1,28 @@
//
// MySHKConfigurator.m
// EGOPhotoViewer_Demo
//
// Created by Franklin Webber on 4/23/12.
// Copyright (c) 2012 Franklin Webber. All rights reserved.
//

#import "MySHKConfigurator.h"

@implementation MySHKConfigurator

+ (void)setup {

static BOOL configurationHasNotBeenDone = YES;

if (configurationHasNotBeenDone) {
DefaultSHKConfigurator *configurator = [[MySHKConfigurator alloc] init];
[SHKConfiguration sharedInstanceWithConfigurator:configurator];

configurationHasNotBeenDone = NO;
}

}



@end
13 changes: 13 additions & 0 deletions Demo/Project/iPhone/RootViewController_iPhone.m
Expand Up @@ -9,6 +9,7 @@
#import "RootViewController_iPhone.h"
#import "EGOPhotoGlobal.h"
#import "EGODetailedCaptionView.h"
#import "SHKActionViewController.h"

#define kExampleFirstPhotoURL @"http://a3.twimg.com/profile_images/66601193/cactus.jpg"
#define kExampleSecondPhotoURL @"https://s3.amazonaws.com/twitter_production/profile_images/425948730/DF-Star-Logo.png"
Expand Down Expand Up @@ -89,6 +90,7 @@ - (NSDictionary *)examplesDictionary {
@"singlePhoto",@"Single Photo",
@"photoWithImage",@"Single Photo (From Image)",
@"photoWithURL",@"Single Photo (From URL)",
@"sharekitAction",@"Share Kit Action",
nil];
}

Expand Down Expand Up @@ -235,5 +237,16 @@ - (void)photoWithURL {
[self.navigationController pushViewController:photoController animated:YES];
}

- (void)sharekitAction {

id<EGOPhotoSource> source = [self examplePhotoSourceWithVariedPhotos];
EGOPhotoViewController *photoController = [[EGOPhotoViewController alloc] initWithPhotoSource:source];
photoController.captionView = [[EGODetailedCaptionView alloc] init];
photoController.actionViewController = [[SHKActionViewController alloc] init];

[self.navigationController pushViewController:photoController animated:YES];

}

@end

14 changes: 14 additions & 0 deletions Demo/Project/iPhone/SHKActionViewController.h
@@ -0,0 +1,14 @@
//
// SHKActionViewController.h
// EGOPhotoViewer_Demo
//
// Created by Franklin Webber on 4/23/12.
// Copyright (c) 2012 Franklin Webber. All rights reserved.
//

#import "EGOActionViewController.h"
#import "SHK.h"

@interface SHKActionViewController : UIViewController <EGOActionViewController,UIActionSheetDelegate>

@end
76 changes: 76 additions & 0 deletions Demo/Project/iPhone/SHKActionViewController.m
@@ -0,0 +1,76 @@
//
// SHKActionViewController.m
// EGOPhotoViewer_Demo
//
// Created by Franklin Webber on 4/23/12.
// Copyright (c) 2012 Franklin Webber. All rights reserved.
//

#import "SHKActionViewController.h"
#import "MySHKConfigurator.h"

@interface SHKActionViewController ()

@property (nonatomic,strong) SHKActionSheet *actionSheet;

@end

@implementation SHKActionViewController

@synthesize photoSource;
@synthesize currentIndex;
@synthesize embeddedInPopover;

@synthesize actionSheet = actionSheet_;

- (id)init {
self = [super init];
if (self) {
[MySHKConfigurator setup];
}
return self;
}

- (void)viewDidLoad {
[super viewDidLoad];

self.view.userInteractionEnabled = NO;

}

- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];

SHKItem *shareItem = [SHKItem image:[[self photo] image] title:[[self photo] title]];

SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:shareItem];

[SHK setRootViewController:self.parentViewController];

[actionSheet showFromToolbar:self.navigationController.toolbar];

actionSheet.delegate = self;
self.actionSheet = actionSheet;

}

- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
}

#pragma mark - Photo Helper

- (id<EGOPhoto>)photo {
return [self.photoSource photoAtIndex:self.currentIndex];
}

#pragma mark - UIActionSheetDelegate Adherence

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{

[self.view removeFromSuperview];
[self removeFromParentViewController];

}

@end
99 changes: 99 additions & 0 deletions Demo/Vendor/ShareKit/Configuration/DefaultSHKConfigurator.h
@@ -0,0 +1,99 @@
//
// DefaultSHKConfigurationDelegate.h
// ShareKit
//
// Created by Edward Dale on 10/16/10.

//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//

/*
Debugging
------
To show ShareKit specific debug output in the console, define _SHKDebugShowLogs (uncomment next line).
*/
//#define _SHKDebugShowLogs

#ifdef _SHKDebugShowLogs
#define SHKDebugShowLogs 1
#define SHKLog( s, ... ) NSLog( @"<%p %@:(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )
#else
#define SHKDebugShowLogs 0
#define SHKLog( s, ... )
#endif

#import <Foundation/Foundation.h>

@interface DefaultSHKConfigurator : NSObject

- (NSString*)appName;
- (NSString*)appURL;
- (NSArray*)defaultFavoriteURLSharers;
- (NSArray*)defaultFavoriteImageSharers;
- (NSArray*)defaultFavoriteTextSharers;
- (NSArray*)defaultFavoriteFileSharers;
- (NSString*)vkontakteAppId;
- (NSString*)facebookAppId;
- (NSString*)facebookLocalAppId;
- (NSArray*)facebookListOfPermissions;
- (NSString*)readItLaterKey;
- (NSNumber*)forcePreIOS5TwitterAccess;
- (NSString*)twitterConsumerKey;
- (NSString*)twitterSecret;
- (NSString*)twitterCallbackUrl;
- (NSNumber*)twitterUseXAuth;
- (NSString*)twitterUsername;
- (NSString*)evernoteUserStoreURL;
- (NSString*)evernoteNetStoreURLBase;
- (NSString*)evernoteConsumerKey;
- (NSString*)evernoteSecret;
- (NSString*)flickrConsumerKey;
- (NSString*)flickrSecretKey;
- (NSString*)flickrCallbackUrl;
- (NSString*)bitLyLogin;
- (NSString*)bitLyKey;
- (NSString*)linkedInConsumerKey;
- (NSString*)linkedInSecret;
- (NSString*)linkedInCallbackUrl;
- (NSString*)readabilityConsumerKey;
- (NSString*)readabilitySecret;
- (NSNumber*)readabilityUseXAuth;
- (NSString*)foursquareV2ClientId;
- (NSString*)foursquareV2RedirectURI;
- (NSNumber*)shareMenuAlphabeticalOrder;
- (NSNumber*)sharedWithSignature;
- (NSString*)barStyle;
- (UIColor*)barTintForView:(UIViewController*)vc;
- (UIColor*)formFontColor;
- (UIColor*)formBackgroundColor;
- (NSString*)modalPresentationStyle;
- (NSString*)modalTransitionStyle;
- (NSNumber*)maxFavCount;
- (NSNumber*)autoOrderFavoriteSharers;
- (NSString*)favsPrefixKey;
- (NSString*)authPrefix;
- (NSString*)sharersPlistName;
- (NSNumber*)showActionSheetMoreButton;
- (NSNumber*)allowOffline;
- (NSNumber*)allowAutoShare;
- (NSNumber*)usePlaceholders;

@end

0 comments on commit de136a6

Please sign in to comment.