Skip to content
This repository has been archived by the owner on Jun 5, 2018. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
x2on committed Jun 1, 2012
0 parents commit b319881
Show file tree
Hide file tree
Showing 35 changed files with 2,155 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
@@ -0,0 +1,6 @@
.idea
build
include
*.a
simple-share.xcodeproj/project.xcworkspace
simple-share.xcodeproj/xcuserdata
12 changes: 12 additions & 0 deletions .gitmodules
@@ -0,0 +1,12 @@
[submodule "submodules/JSONKit"]
path = submodules/JSONKit
url = https://github.com/johnezang/JSONKit.git
[submodule "submodules/facebook-ios-sdk"]
path = submodules/facebook-ios-sdk
url = https://github.com/facebook/facebook-ios-sdk.git
[submodule "submodules/SVProgressHUD"]
path = submodules/SVProgressHUD
url = https://github.com/samvermette/SVProgressHUD.git
[submodule "submodules/sskeychain"]
path = submodules/sskeychain
url = https://github.com/samsoffes/sskeychain.git
38 changes: 38 additions & 0 deletions build.sh
@@ -0,0 +1,38 @@
#!/bin/bash

# Automatic build script for simple-share
# for iOS and iOSSimulator
#
# Created by Felix Schulze on 01.06.12.
# Copyright 2012 Felix Schulze. All rights reserved.
###########################################################################
#
SDKVERSION="5.1"
#
###########################################################################
#
# Don't change anything here
DEVICESDK="iphoneos${SDKVERSION}"
SIMSDK="iphonesimulator${SDKVERSION}"

echo "Building simple-share for iPhoneSimulator and iPhoneOS ${SDKVERSION}"
# Clean the targets
if ! xcodebuild -project "simple-share.xcodeproj" -target simple-share -configuration "Release" -sdk "$DEVICESDK" clean ; then
exit 1
fi
if ! xcodebuild -project "simple-share.xcodeproj" -target simple-share -configuration "Release" -sdk "$SIMSDK" clean ; then
exit 1
fi

# Build the targets
if ! xcodebuild -project "simple-share.xcodeproj" -target simple-share -configuration "Release" -sdk "$DEVICESDK" -arch "armv6 armv7" build ; then
exit 1
fi
if ! xcodebuild -project "simple-share.xcodeproj" -target simple-share -configuration "Release" -sdk "$SIMSDK" build ; then
exit 1
fi

echo "Build library..."
lipo "build/Release-iphoneos/libsimple-share.a" "build/Release-iphonesimulator/libsimple-share.a" -create -output "libsimple-share.a"
cp -R build/Release-iphoneos/include .
echo "Building done."
32 changes: 32 additions & 0 deletions simple-share-demo/AppDelegate.h
@@ -0,0 +1,32 @@
//
// AppDelegate.h
// simple-share-demo
//
// Created by on 30.05.12.
// Copyright 2012 Felix Schulze. All rights reserved.
//
// 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 <UIKit/UIKit.h>

@class ViewController;
@class SimpleFacebookShare;

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@property (strong, nonatomic) ViewController *viewController;
@property (nonatomic, strong) SimpleFacebookShare *simpleFacebookShare;

@end
91 changes: 91 additions & 0 deletions simple-share-demo/AppDelegate.m
@@ -0,0 +1,91 @@
//
// AppDelegate.m
// simple-share-demo
//
// Created by on 30.05.12.
// Copyright 2012 Felix Schulze. All rights reserved.
//
// 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 "AppDelegate.h"

#import "ViewController.h"
#import "SimpleFacebookShare.h"
#import "SimpleFacebookConfiguration.h"

@implementation AppDelegate

@synthesize window = _window;
@synthesize viewController = _viewController;
@synthesize simpleFacebookShare;


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

SimpleFacebookConfiguration *facebookConfiguration = [[SimpleFacebookConfiguration alloc] init];
facebookConfiguration.appId = @"theAppId";
facebookConfiguration.appName = @"theAppName";
facebookConfiguration.appUrl = @"theAppUrl";

self.simpleFacebookShare = [[SimpleFacebookShare alloc] initWithSimpleFacebookConfiguration:facebookConfiguration];

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil simpleFacebookShare:simpleFacebookShare];
} else {
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil simpleFacebookShare:simpleFacebookShare];
}
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];


return YES;
}

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
return [simpleFacebookShare handleOpenURL:url];
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [simpleFacebookShare handleOpenURL:url];
}

- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end
31 changes: 31 additions & 0 deletions simple-share-demo/ViewController.h
@@ -0,0 +1,31 @@
//
// ViewController.h
// simple-share-demo
//
// Created by on 30.05.12.
// Copyright 2012 Felix Schulze. All rights reserved.
//
// 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 <UIKit/UIKit.h>

@class SimpleFacebookShare;

@interface ViewController : UIViewController

- (id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil simpleFacebookShare:(SimpleFacebookShare *)theSimpleFacebookShare;

- (IBAction)postButtonPressed:(id)sender;
- (IBAction)twitterButtonPressed:(id)sender;

@end
63 changes: 63 additions & 0 deletions simple-share-demo/ViewController.m
@@ -0,0 +1,63 @@
//
// ViewController.m
// simple-share-demo
//
// Created by on 30.05.12.
// Copyright 2012 Felix Schulze. All rights reserved.
//
// 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 "ViewController.h"
#import "SimpleFacebookShare.h"
#import "SimpleTwitterShare.h"

@interface ViewController ()

@end

@implementation ViewController {
SimpleFacebookShare *facebookShare;
}

- (id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil simpleFacebookShare:(SimpleFacebookShare *)theSimpleFacebookShare {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
facebookShare = theSimpleFacebookShare;
}
return self;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
} else {
return YES;
}
}

- (IBAction)postButtonPressed:(id)sender {
[facebookShare shareUrl:[NSURL URLWithString:@"http://www.felixschulze.de"]];
}

- (IBAction)twitterButtonPressed:(id)sender {
SimpleTwitterShare *simpleTwitterShare = [[SimpleTwitterShare alloc] init];
if ([simpleTwitterShare canSendTweet]) {
[simpleTwitterShare shareText:@"Some text to share"];
}
else {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Not supported" message:@"Twitter is not supported" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
}
}
@end
2 changes: 2 additions & 0 deletions simple-share-demo/en.lproj/InfoPlist.strings
@@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

0 comments on commit b319881

Please sign in to comment.