Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facebook Open Graph support #158

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Classes/Example/ShareKitAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ - (void)applicationWillTerminate:(UIApplication *)application
// Save data if appropriate
}

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
SHKFacebook *facebookSharer = [[[SHKFacebook alloc] init] autorelease];
return [[facebookSharer facebook] handleOpenURL:url];
}


#pragma mark -
#pragma mark Memory management
Expand Down
2 changes: 1 addition & 1 deletion Classes/ShareKit/Core/SHKItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ typedef enum
} SHKShareType;


@interface SHKItem : NSObject
@interface SHKItem : NSObject
{
SHKShareType shareType;

Expand Down
23 changes: 22 additions & 1 deletion Classes/ShareKit/Core/SHKItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,19 @@ + (SHKItem *)itemFromDictionary:(NSDictionary *)dictionary
item.title = [dictionary objectForKey:@"title"];
item.text = [dictionary objectForKey:@"text"];
item.tags = [dictionary objectForKey:@"tags"];

if ([dictionary objectForKey:@"custom"] != nil)
item.custom = [[[dictionary objectForKey:@"custom"] mutableCopy] autorelease];

if ([dictionary objectForKey:@"mimeType"] != nil)
item.mimeType = [dictionary objectForKey:@"mimeType"];

if ([dictionary objectForKey:@"filename"] != nil)
item.filename = [dictionary objectForKey:@"filename"];

if ([dictionary objectForKey:@"image"] != nil)
item.image = [UIImage imageWithData:[dictionary objectForKey:@"image"]];

return [item autorelease];
}

Expand All @@ -177,6 +186,18 @@ - (NSDictionary *)dictionaryRepresentation
if (tags != nil)
[dictionary setObject:tags forKey:@"tags"];

if (mimeType != nil)
[dictionary setObject:mimeType forKey:@"mimeType"];

if (filename != nil)
[dictionary setObject:filename forKey:@"filename"];

if (data != nil)
[dictionary setObject:data forKey:@"data"];

if (image != nil)
[dictionary setObject:UIImagePNGRepresentation(image) forKey:@"image"];

// If you add anymore, make sure to add a method for retrieving them to the itemWithDictionary function too

return dictionary;
Expand Down
31 changes: 26 additions & 5 deletions Classes/ShareKit/SHKConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,27 @@
#define SHKDeliciousSecretKey @""

// Facebook - http://www.facebook.com/developers
// If SHKFacebookUseSessionProxy is enabled then SHKFacebookSecret is ignored and should be left blank
// iOS SDK - https://github.com/facebook/facebook-ios-sdk
/*
Important Facebook settings to get right:

URL Schemes
---
You must create a URL scheme in your Info.plist that is in the format fb[app_id]. See the documentation on the iOS SDK under Authentication and Authorization for more details. This is to allow
the new Single Sign-on capabilities of the iOS SDK to callback to your application, should it use fast app switching to authenticate in the Facebook app or Safari.

Modify AppDelegate class
---
You must implement the application:handleOpenURL: method in your AppDelegate class. In this method, call the handleOpenURL: method on the facebook property of an SHKFacebook instance.

For example:
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
SHKFacebook *facebookSharer = [[[SHKFacebook alloc] init] autorelease];
return [[facebookSharer facebook] handleOpenURL:url];
}
*/
#define SHKFacebookAppId @""

#define SHKFacebookUseSessionProxy NO
#define SHKFacebookKey @""
#define SHKFacebookSecret @""
#define SHKFacebookSessionProxyURL @""

// Read It Later - http://readitlaterlist.com/api/?shk
#define SHKReadItLaterKey @""
Expand All @@ -75,6 +90,12 @@
#define SHKTwitterUseXAuth 0 // To use xAuth, set to 1
#define SHKTwitterUsername @"" // Enter your app's twitter account if you'd like to ask the user to follow it when logging in. (Only for xAuth)

// Evernote - http://www.evernote.com/about/developer/api/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This evernote config probably wasn't intended to be part of your pull request.

#define SHKEvernoteUserStoreURL @""
#define SHKEvernoteSecretKey @""
#define SHKEvernoteConsumerKey @""
#define SHKEvernoteNetStoreURLBase @""

// Bit.ly (for shortening URLs on Twitter) - http://bit.ly/account/register - after signup: http://bit.ly/a/your_api_key
#define SHKBitLyLogin @""
#define SHKBitLyKey @""
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
18 changes: 9 additions & 9 deletions Classes/ShareKit/Sharers/Services/Facebook/FBConnect/FBConnect.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/*
* Copyright 2009 Facebook
* Copyright 2010 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0

* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/


#import "FBSession.h"
#import "FBRequest.h"
#import "FBLoginButton.h"
#import "FBLoginDialog.h"
#import "FBPermissionDialog.h"
#import "FBStreamDialog.h"
#include "Facebook.h"
#include "FBDialog.h"
#include "FBLoginDialog.h"
#include "FBRequest.h"
#include "SBJSON.h"
218 changes: 0 additions & 218 deletions Classes/ShareKit/Sharers/Services/Facebook/FBConnect/FBConnectGlobal.h

This file was deleted.

Loading