Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

CLEANUP: Instagram after merge

  • Loading branch information...
commit a5f224e7bacf8999db5ccb9be8745522ab22dd18 1 parent 5e49f41
Vilém Kurz VilemKurz authored
11 Classes/Example/ExampleShareImage.m
View
@@ -68,13 +68,16 @@ - (void)loadView
- (void)share
{
SHKItem *item = [SHKItem image:imageView.image title:@"San Francisco"];
+
+ /* optional examples
item.tags = [NSArray arrayWithObjects:@"bay bridge", @"architecture", @"california", nil];
+
+ //give a source rect in the coords of the view set with setRootViewController:
+ item.popOverSourceRect = [self.navigationController.toolbar convertRect:self.navigationController.toolbar.bounds toView:self.view];
+ */
+
SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];
[SHK setRootViewController:self];
-
- //optional line to give a source rect in the coords of the view set with setRootViewController:
- item.popOverSourceRect = [self.navigationController.toolbar convertRect:self.navigationController.toolbar.bounds toView:self.view];
-
[actionSheet showFromToolbar:self.navigationController.toolbar];
}
5 Classes/ShareKit/Sharers/Services/Instagram/SHKInstagram.h
View
@@ -26,8 +26,5 @@
#import "SHKSharer.h"
@interface SHKInstagram : SHKSharer <UIDocumentInteractionControllerDelegate>
-{
- UIDocumentInteractionController* dic;
- bool didSend;
-}
+
@end
25 Classes/ShareKit/Sharers/Services/Instagram/SHKInstagram.m
View
@@ -26,15 +26,18 @@
#import "SHKConfiguration.h"
@interface SHKInstagram()
+
@property (nonatomic, retain) UIDocumentInteractionController* dic;
+@property BOOL didSend;
+
@end
@implementation SHKInstagram
-@synthesize dic;
- (void)dealloc {
- dic.delegate = nil;
- [dic release];
+
+ _dic.delegate = nil;
+ [_dic release];
[super dealloc];
}
@@ -130,10 +133,10 @@ - (BOOL)send
[[NSFileManager defaultManager] createFileAtPath:docPath contents:imgData attributes:nil];
NSURL* url = [NSURL fileURLWithPath:docPath isDirectory:NO ];
self.dic = [UIDocumentInteractionController interactionControllerWithURL:url];
- dic.UTI = @"com.instagram.photo";
+ self.dic.UTI = @"com.instagram.photo";
NSString *captionString = [NSString stringWithFormat:@"%@%@%@", ([item.title length] ? item.title : @""), ([item.title length] && [item.tags count] ? @" " : @""), [self tagStringJoinedBy:@" " allowedCharacters:[NSCharacterSet alphanumericCharacterSet] tagPrefix:@"#"]];
- dic.annotation = @{@"InstagramCaption" : captionString};
- dic.delegate = self;
+ self.dic.annotation = @{@"InstagramCaption" : captionString};
+ self.dic.delegate = self;
UIView* bestView = self.view;
if(bestView.window == nil){
// we haven't been presented yet, so we're not in the hierarchy. On the iPad the DIC is
@@ -146,7 +149,7 @@ - (BOOL)send
}
if(bestView.window != nil){
[self retain]; // retain ourselves until the menu has done it's job or we'll nuke the popup (see documentInteractionControllerDidDismissOpenInMenu)
- [dic presentOpenInMenuFromRect:item.popOverSourceRect inView:bestView animated:YES];
+ [self.dic presentOpenInMenuFromRect:item.popOverSourceRect inView:bestView animated:YES];
}
return YES;
}
@@ -154,13 +157,15 @@ - (BOOL)send
}
- (void)documentInteractionControllerDidDismissOpenInMenu:(UIDocumentInteractionController *)controller{
- if(didSend)
+ if(self.didSend) {
+ self.quiet = YES; //so that we do not show "Saved!" prematurely
[self sendDidFinish];
- else
+ } else {
[self sendDidCancel];
+ }
[self autorelease];
}
- (void) documentInteractionController: (UIDocumentInteractionController *) controller willBeginSendingToApplication: (NSString *) application{
- didSend = true;
+ self.didSend = true;
}
@end
142 ShareKit.xcodeproj/project.pbxproj
View
@@ -84,6 +84,16 @@
7A16F38C161341570019645D /* OARequestParameter.m in Sources */ = {isa = PBXBuildFile; fileRef = 43A5369D11DBE3B9004A1712 /* OARequestParameter.m */; };
7A16F38D161341570019645D /* OAServiceTicket.m in Sources */ = {isa = PBXBuildFile; fileRef = 43A5369F11DBE3B9004A1712 /* OAServiceTicket.m */; };
7A16F38E161341570019645D /* OAToken.m in Sources */ = {isa = PBXBuildFile; fileRef = 43A536A211DBE3B9004A1712 /* OAToken.m */; };
+ 7A16F3B016134A790019645D /* SHKInstagram.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A16F3AE16134A790019645D /* SHKInstagram.h */; };
+ 7A16F3B216134A790019645D /* SHKInstagram.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A16F3AF16134A790019645D /* SHKInstagram.m */; };
+ 7A16F3B816134A890019645D /* Base64Transcoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A26E5B4156CD8A70011E15F /* Base64Transcoder.h */; };
+ 7A16F3B916134A890019645D /* hmac.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A26E5B6156CD8A70011E15F /* hmac.h */; };
+ 7A16F3BA16134A890019645D /* sha1.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A26E5B8156CD8A70011E15F /* sha1.h */; };
+ 7A16F3BB16134A890019645D /* SHKFormFieldCellText.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A164DC0157662ED00D55DB4 /* SHKFormFieldCellText.h */; };
+ 7A16F3BC16134A890019645D /* SHKFormFieldCellSwitch.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ABCDBA71577528B003BBFFD /* SHKFormFieldCellSwitch.h */; };
+ 7A16F3BD16134A890019645D /* SHKFormFieldCellOptionPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ABCDBAE157757D1003BBFFD /* SHKFormFieldCellOptionPicker.h */; };
+ 7A16F3BE16134A890019645D /* SHKFormFieldCell_PrivateProperties.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A4CAA161577BEF90010E6B3 /* SHKFormFieldCell_PrivateProperties.h */; };
+ 7A16F3C316134AA10019645D /* SHKInstagram.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A16F3AF16134A790019645D /* SHKInstagram.m */; };
7A1AFCA4160E11810086B98A /* Base64Transcoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A26E5B4156CD8A70011E15F /* Base64Transcoder.h */; };
7A1AFCA5160E11810086B98A /* hmac.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A26E5B6156CD8A70011E15F /* hmac.h */; };
7A1AFCA6160E11810086B98A /* sha1.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A26E5B8156CD8A70011E15F /* sha1.h */; };
@@ -721,6 +731,9 @@
7A164DC0157662ED00D55DB4 /* SHKFormFieldCellText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SHKFormFieldCellText.h; sourceTree = "<group>"; };
7A164DC1157662ED00D55DB4 /* SHKFormFieldCellText.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SHKFormFieldCellText.m; sourceTree = "<group>"; };
7A16F37E161340DD0019645D /* libOAuth.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libOAuth.a; sourceTree = BUILT_PRODUCTS_DIR; };
+ 7A16F3AE16134A790019645D /* SHKInstagram.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SHKInstagram.h; path = Instagram/SHKInstagram.h; sourceTree = "<group>"; };
+ 7A16F3AF16134A790019645D /* SHKInstagram.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SHKInstagram.m; path = Instagram/SHKInstagram.m; sourceTree = "<group>"; };
+ 7A16F3C216134A890019645D /* libInstagram.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libInstagram.a; sourceTree = BUILT_PRODUCTS_DIR; };
7A1AFCAE160E11810086B98A /* libJSONKit.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libJSONKit.a; sourceTree = BUILT_PRODUCTS_DIR; };
7A1AFCC0160E11F90086B98A /* libSSKeyChain.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSSKeyChain.a; sourceTree = BUILT_PRODUCTS_DIR; };
7A1AFCD1160E123C0086B98A /* libReachability.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libReachability.a; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -890,6 +903,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 7A16F3B616134A890019645D /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
7A1AFCA2160E11810086B98A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -1156,6 +1176,7 @@
7AEE042D160E1D5A00FEC06E /* libRead It Later.a */,
7AEE043D160E1D5B00FEC06E /* libTumblr.a */,
7A16F37E161340DD0019645D /* libOAuth.a */,
+ 7A16F3C216134A890019645D /* libInstagram.a */,
);
name = Products;
sourceTree = "<group>";
@@ -1596,6 +1617,7 @@
43A536C011DBE3B9004A1712 /* Services */ = {
isa = PBXGroup;
children = (
+ 7A16F3AC16134A5D0019645D /* Instagram */,
1A52EDF315CB032B00A737D8 /* Kippt */,
7A0F91CB156B9FCE009CB40A /* Delicious */,
FDB495A11520349A00505A99 /* Readability */,
@@ -1747,6 +1769,15 @@
name = LFWebAPIKit;
sourceTree = "<group>";
};
+ 7A16F3AC16134A5D0019645D /* Instagram */ = {
+ isa = PBXGroup;
+ children = (
+ 7A16F3AE16134A790019645D /* SHKInstagram.h */,
+ 7A16F3AF16134A790019645D /* SHKInstagram.m */,
+ );
+ name = Instagram;
+ sourceTree = "<group>";
+ };
7A26E5B2156CD8A70011E15F /* Crypto */ = {
isa = PBXGroup;
children = (
@@ -1974,6 +2005,20 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 7A16F3B716134A890019645D /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7A16F3B816134A890019645D /* Base64Transcoder.h in Headers */,
+ 7A16F3B916134A890019645D /* hmac.h in Headers */,
+ 7A16F3BA16134A890019645D /* sha1.h in Headers */,
+ 7A16F3BB16134A890019645D /* SHKFormFieldCellText.h in Headers */,
+ 7A16F3BC16134A890019645D /* SHKFormFieldCellSwitch.h in Headers */,
+ 7A16F3BD16134A890019645D /* SHKFormFieldCellOptionPicker.h in Headers */,
+ 7A16F3BE16134A890019645D /* SHKFormFieldCell_PrivateProperties.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
7A1AFCA3160E11810086B98A /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
@@ -2102,6 +2147,7 @@
7ABCDBA91577528B003BBFFD /* SHKFormFieldCellSwitch.h in Headers */,
7ABCDBB0157757D1003BBFFD /* SHKFormFieldCellOptionPicker.h in Headers */,
7A4CAA171577BEFA0010E6B3 /* SHKFormFieldCell_PrivateProperties.h in Headers */,
+ 7A16F3B016134A790019645D /* SHKInstagram.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2455,6 +2501,23 @@
productReference = 7A16F37E161340DD0019645D /* libOAuth.a */;
productType = "com.apple.product-type.library.static";
};
+ 7A16F3B316134A890019645D /* Instagram */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 7A16F3BF16134A890019645D /* Build configuration list for PBXNativeTarget "Instagram" */;
+ buildPhases = (
+ 7A16F3B416134A890019645D /* Sources */,
+ 7A16F3B616134A890019645D /* Frameworks */,
+ 7A16F3B716134A890019645D /* Headers */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = Instagram;
+ productName = ShareKitLibrary;
+ productReference = 7A16F3C216134A890019645D /* libInstagram.a */;
+ productType = "com.apple.product-type.library.static";
+ };
7A1AFC47160E11810086B98A /* JSONKit */ = {
isa = PBXNativeTarget;
buildConfigurationList = 7A1AFCAB160E11810086B98A /* Build configuration list for PBXNativeTarget "JSONKit" */;
@@ -3041,6 +3104,7 @@
7AEE03C3160E1C0C00FEC06E /* Flickr */,
7A1AFD15160E13740086B98A /* Flickr SDK */,
7AEE03D3160E1C0D00FEC06E /* Google Reader */,
+ 7A16F3B316134A890019645D /* Instagram */,
7AEE03E3160E1C0E00FEC06E /* Instapaper */,
7AEE03FE160E1D5400FEC06E /* LinkedIn */,
7AEE040E160E1D5800FEC06E /* Pinboard */,
@@ -3152,6 +3216,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 7A16F3B416134A890019645D /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7A16F3C316134AA10019645D /* SHKInstagram.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
7A1AFC48160E11810086B98A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -3390,6 +3462,7 @@
7AB8050E15AC7A9D004FB430 /* ENCredentialStore.m in Sources */,
7AB8050F15AC7AAF004FB430 /* ENOAuthViewController.m in Sources */,
7AB8051015AC7BC9004FB430 /* GTMNSString+HTML.m in Sources */,
+ 7A16F3B216134A790019645D /* SHKInstagram.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -3764,6 +3837,66 @@
};
name = Release;
};
+ 7A16F3C016134A890019645D /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = (
+ armv6,
+ "$(ARCHS_STANDARD_32_BIT)",
+ );
+ COPY_PHASE_STRIP = NO;
+ DSTROOT = /tmp/ShareKitLibrary.dst;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "ShareKitLibrary/ShareKitLibrary-Prefix.pch";
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_THUMB_SUPPORT = NO;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 4.0;
+ OTHER_LDFLAGS = (
+ "-ObjC",
+ "-all_load",
+ );
+ PRODUCT_NAME = Instagram;
+ SKIP_INSTALL = YES;
+ };
+ name = Debug;
+ };
+ 7A16F3C116134A890019645D /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = (
+ armv6,
+ "$(ARCHS_STANDARD_32_BIT)",
+ );
+ COPY_PHASE_STRIP = YES;
+ DSTROOT = /tmp/ShareKitLibrary.dst;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "ShareKitLibrary/ShareKitLibrary-Prefix.pch";
+ GCC_THUMB_SUPPORT = NO;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 4.0;
+ OTHER_LDFLAGS = (
+ "-ObjC",
+ "-all_load",
+ );
+ PRODUCT_NAME = Instagram;
+ SKIP_INSTALL = YES;
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
7A1AFCAC160E11810086B98A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -5690,6 +5823,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
+ 7A16F3BF16134A890019645D /* Build configuration list for PBXNativeTarget "Instagram" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7A16F3C016134A890019645D /* Debug */,
+ 7A16F3C116134A890019645D /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
7A1AFCAB160E11810086B98A /* Build configuration list for PBXNativeTarget "JSONKit" */ = {
isa = XCConfigurationList;
buildConfigurations = (

1 comment on commit a5f224e

Paulo Cesar

"presentOpenInMenuFromRect:item.popOverSourceRect" causes a crash here. I had the same problem on the Instagram sharer I wrote some time ago, and couldn't figure out how to solve it..

'Attempting to begin a modal transition from to <_UIDocumentActivityViewController: 0x20293690> while a transition is already in progress. Wait for viewDidAppear/viewDidDisappear to know the current transition has completed'

Any ideas?

Please sign in to comment.
Something went wrong with that request. Please try again.