Permalink
Browse files

Merge pull request #7 from shazron/plugin-example-ios

iOS Example, using PhoneGap 1.0.0rc1
  • Loading branch information...
2 parents aef8848 + 52bb9fb commit 4041b857696d1a5f99f9fd1ded8ea09564a70e7e Dave Johnson committed Jul 15, 2011
Showing with 11,701 additions and 0 deletions.
  1. +508 −0 example/iOS/PhoneGapFacebookConnect.xcodeproj/project.pbxproj
  2. +29 −0 example/iOS/PhoneGapFacebookConnect/Classes/AppDelegate.h
  3. +111 −0 example/iOS/PhoneGapFacebookConnect/Classes/AppDelegate.m
  4. +46 −0 example/iOS/PhoneGapFacebookConnect/PhoneGap.plist
  5. +60 −0 example/iOS/PhoneGapFacebookConnect/PhoneGapFacebookConnect-Info.plist
  6. +8 −0 example/iOS/PhoneGapFacebookConnect/PhoneGapFacebookConnect-Prefix.pch
  7. +27 −0 example/iOS/PhoneGapFacebookConnect/Plugins/FBPlugin/FB_src/FBConnect.h
  8. BIN example/iOS/PhoneGapFacebookConnect/Plugins/FBPlugin/FB_src/FBDialog.bundle/images/close.png
  9. BIN example/iOS/PhoneGapFacebookConnect/Plugins/FBPlugin/FB_src/FBDialog.bundle/images/fbicon.png
  10. +167 −0 example/iOS/PhoneGapFacebookConnect/Plugins/FBPlugin/FB_src/FBDialog.h
  11. +656 −0 example/iOS/PhoneGapFacebookConnect/Plugins/FBPlugin/FB_src/FBDialog.m
  12. +48 −0 example/iOS/PhoneGapFacebookConnect/Plugins/FBPlugin/FB_src/FBLoginDialog.h
  13. +94 −0 example/iOS/PhoneGapFacebookConnect/Plugins/FBPlugin/FB_src/FBLoginDialog.m
  14. +116 −0 example/iOS/PhoneGapFacebookConnect/Plugins/FBPlugin/FB_src/FBRequest.h
  15. +367 −0 example/iOS/PhoneGapFacebookConnect/Plugins/FBPlugin/FB_src/FBRequest.m
  16. +109 −0 example/iOS/PhoneGapFacebookConnect/Plugins/FBPlugin/FB_src/Facebook.h
  17. +606 −0 example/iOS/PhoneGapFacebookConnect/Plugins/FBPlugin/FB_src/Facebook.m
  18. +7 −0 example/iOS/PhoneGapFacebookConnect/Plugins/FBPlugin/FB_src/facebook_ios_sdk_Prefix.pch
  19. +24 −0 example/iOS/PhoneGapFacebookConnect/Plugins/FBPlugin/FacebookConnectPlugin.h
  20. +307 −0 example/iOS/PhoneGapFacebookConnect/Plugins/FBPlugin/FacebookConnectPlugin.m
  21. +1 −0 example/iOS/PhoneGapFacebookConnect/Plugins/README
  22. BIN example/iOS/PhoneGapFacebookConnect/Resources/Capture.bundle/controls_bg.png
  23. BIN example/iOS/PhoneGapFacebookConnect/Resources/Capture.bundle/controls_bg@2x.png
  24. BIN example/iOS/PhoneGapFacebookConnect/Resources/Capture.bundle/controls_bg~ipad.png
  25. BIN example/iOS/PhoneGapFacebookConnect/Resources/Capture.bundle/microphone.png
  26. BIN example/iOS/PhoneGapFacebookConnect/Resources/Capture.bundle/microphone@2x.png
  27. BIN example/iOS/PhoneGapFacebookConnect/Resources/Capture.bundle/microphone~ipad.png
  28. BIN example/iOS/PhoneGapFacebookConnect/Resources/Capture.bundle/record_button.png
  29. BIN example/iOS/PhoneGapFacebookConnect/Resources/Capture.bundle/record_button@2x.png
  30. BIN example/iOS/PhoneGapFacebookConnect/Resources/Capture.bundle/record_button~ipad.png
  31. BIN example/iOS/PhoneGapFacebookConnect/Resources/Capture.bundle/recording_bg.png
  32. BIN example/iOS/PhoneGapFacebookConnect/Resources/Capture.bundle/recording_bg@2x.png
  33. BIN example/iOS/PhoneGapFacebookConnect/Resources/Capture.bundle/recording_bg~ipad.png
  34. BIN example/iOS/PhoneGapFacebookConnect/Resources/Capture.bundle/stop_button.png
  35. BIN example/iOS/PhoneGapFacebookConnect/Resources/Capture.bundle/stop_button@2x.png
  36. BIN example/iOS/PhoneGapFacebookConnect/Resources/Capture.bundle/stop_button~ipad.png
  37. +10 −0 example/iOS/PhoneGapFacebookConnect/Resources/en.lproj/Localizable.strings
  38. +9 −0 example/iOS/PhoneGapFacebookConnect/Resources/es.lproj/Localizable.strings
  39. BIN example/iOS/PhoneGapFacebookConnect/Resources/icons/icon-72.png
  40. BIN example/iOS/PhoneGapFacebookConnect/Resources/icons/icon.png
  41. BIN example/iOS/PhoneGapFacebookConnect/Resources/icons/icon@2x.png
  42. BIN example/iOS/PhoneGapFacebookConnect/Resources/splash/Default.png
  43. BIN example/iOS/PhoneGapFacebookConnect/Resources/splash/Default@2x.png
  44. BIN example/iOS/PhoneGapFacebookConnect/Resources/splash/Default~ipad.png
  45. +2 −0 example/iOS/PhoneGapFacebookConnect/en.lproj/InfoPlist.strings
  46. +17 −0 example/iOS/PhoneGapFacebookConnect/main.m
  47. +24 −0 example/iOS/www/facebook-connect-0.0.1.js
  48. +4,551 −0 example/iOS/www/facebook.js
  49. BIN example/iOS/www/icon.png
  50. +130 −0 example/iOS/www/index.html
  51. +3,666 −0 example/iOS/www/phonegap-1.0.0rc1.js
  52. +1 −0 example/iOS/www/phonegap-1.0.0rc1.min.js

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,29 @@
+//
+// AppDelegate.h
+// PhoneGapFacebookConnect
+//
+// Created by shazron on 11-07-06.
+// Copyright __MyCompanyName__ 2011. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#ifdef PHONEGAP_FRAMEWORK
+ #import <PhoneGap/PhoneGapDelegate.h>
+#else
+ #import "PhoneGapDelegate.h"
+#endif
+
+@interface AppDelegate : PhoneGapDelegate {
+
+ NSString* invokeString;
+}
+
+// invoke string is passed to your app on launch, this is only valid if you
+// edit PhoneGapFacebookConnect.plist to add a protocol
+// a simple tutorial can be found here :
+// http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
+
+@property (copy) NSString* invokeString;
+
+@end
+
@@ -0,0 +1,111 @@
+//
+// AppDelegate.m
+// PhoneGapFacebookConnect
+//
+// Created by shazron on 11-07-06.
+// Copyright __MyCompanyName__ 2011. All rights reserved.
+//
+
+#import "AppDelegate.h"
+#ifdef PHONEGAP_FRAMEWORK
+ #import <PhoneGap/PhoneGapViewController.h>
+#else
+ #import "PhoneGapViewController.h"
+#endif
+
+@implementation AppDelegate
+
+@synthesize invokeString;
+
+- (id) init
+{
+ /** If you need to do any extra app-specific initialization, you can do it here
+ * -jm
+ **/
+ return [super init];
+}
+
+/**
+ * This is main kick off after the app inits, the views and Settings are setup here. (preferred - iOS4 and up)
+ */
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
+{
+
+ NSArray *keyArray = [launchOptions allKeys];
+ if ([launchOptions objectForKey:[keyArray objectAtIndex:0]]!=nil)
+ {
+ NSURL *url = [launchOptions objectForKey:[keyArray objectAtIndex:0]];
+ self.invokeString = [url absoluteString];
+ NSLog(@"PhoneGapFacebookConnect launchOptions = %@",url);
+ }
+
+ return [super application:application didFinishLaunchingWithOptions:launchOptions];
+}
+
+// this happens while we are running ( in the background, or from within our own app )
+// only valid if PhoneGapFacebookConnect.plist specifies a protocol to handle
+- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
+{
+ // must call super so all plugins will get the notification
+ return [super application:application handleOpenURL:url];
+}
+
+-(id) getCommandInstance:(NSString*)className
+{
+ /** You can catch your own commands here, if you wanted to extend the gap: protocol, or add your
+ * own app specific protocol to it. -jm
+ **/
+ return [super getCommandInstance:className];
+}
+
+/**
+ Called when the webview finishes loading. This stops the activity view and closes the imageview
+ */
+- (void)webViewDidFinishLoad:(UIWebView *)theWebView
+{
+ // only valid if PhoneGapFacebookConnect.plist specifies a protocol to handle
+ if(self.invokeString)
+ {
+ // this is passed before the deviceready event is fired, so you can access it in js when you receive deviceready
+ NSString* jsString = [NSString stringWithFormat:@"var invokeString = \"%@\";", self.invokeString];
+ [theWebView stringByEvaluatingJavaScriptFromString:jsString];
+ }
+ return [ super webViewDidFinishLoad:theWebView ];
+}
+
+- (void)webViewDidStartLoad:(UIWebView *)theWebView
+{
+ return [ super webViewDidStartLoad:theWebView ];
+}
+
+/**
+ * Fail Loading With Error
+ * Error - If the webpage failed to load display an error with the reason.
+ */
+- (void)webView:(UIWebView *)theWebView didFailLoadWithError:(NSError *)error
+{
+ return [ super webView:theWebView didFailLoadWithError:error ];
+}
+
+/**
+ * Start Loading Request
+ * This is where most of the magic happens... We take the request(s) and process the response.
+ * From here we can re direct links and other protocalls to different internal methods.
+ */
+- (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
+{
+ return [ super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType ];
+}
+
+
+- (BOOL) execute:(InvokedUrlCommand*)command
+{
+ return [ super execute:command];
+}
+
+- (void)dealloc
+{
+ [ super dealloc ];
+}
+
+@end
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>DetectPhoneNumber</key>
+ <true/>
+ <key>EnableAcceleration</key>
+ <true/>
+ <key>EnableLocation</key>
+ <false/>
+ <key>EnableViewportScale</key>
+ <false/>
+ <key>ExternalHosts</key>
+ <array/>
+ <key>Plugins</key>
+ <dict>
+ <key>com.phonegap.accelerometer</key>
+ <string>PGAccelerometer</string>
+ <key>com.phonegap.camera</key>
+ <string>PGCamera</string>
+ <key>com.phonegap.connection</key>
+ <string>PGConnection</string>
+ <key>com.phonegap.contacts</key>
+ <string>PGContacts</string>
+ <key>com.phonegap.debugconsole</key>
+ <string>PGDebugConsole</string>
+ <key>com.phonegap.file</key>
+ <string>PGFile</string>
+ <key>com.phonegap.filetransfer</key>
+ <string>PGFileTransfer</string>
+ <key>com.phonegap.geolocation</key>
+ <string>PGLocation</string>
+ <key>com.phonegap.media</key>
+ <string>PGSound</string>
+ <key>com.phonegap.mediacapture</key>
+ <string>PGCapture</string>
+ <key>com.phonegap.notification</key>
+ <string>PGNotification</string>
+ <key>com.facebook.phonegap.Connect</key>
+ <string>FacebookConnectPlugin</string>
+
+ </dict>
+ <key>TopActivityIndicator</key>
+ <string>gray</string>
+</dict>
+</plist>
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string>icon.png</string>
+ <key>CFBundleIconFiles</key>
+ <array>
+ <string>icon.png</string>
+ <string>icon@2x.png</string>
+ <string>icon-72.png</string>
+ </array>
+ <key>CFBundleIdentifier</key>
+ <string>ca.nitobee.PhoneGapFacebookConnect</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>NSMainNibFile</key>
+ <string></string>
+ <key>NSMainNibFile~ipad</key>
+ <string></string>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ </array>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>CFBundleURLTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleURLName</key>
+ <string>ca.nitobee.PhoneGapFacebookConnect.login</string>
+ <key>CFBundleURLSchemes</key>
+ <array>
+ <string>fb188240441228254</string>
+ </array>
+ </dict>
+ </array>
+</dict>
+</plist>
@@ -0,0 +1,8 @@
+//
+// Prefix header for all source files of the 'PhoneGapFacebookConnect' target in the 'PhoneGapFacebookConnect' project
+//
+
+#ifdef __OBJC__
+ #import <UIKit/UIKit.h>
+ #import <Foundation/Foundation.h>
+#endif
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+
+#include "Facebook.h"
+#include "FBDialog.h"
+#include "FBLoginDialog.h"
+#include "FBRequest.h"
+
+#ifdef PHONEGAP_FRAMEWORK
+ #import <PhoneGap/SBJSON.h>
+#else
+ #import "SBJSON.h"
+#endif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.

0 comments on commit 4041b85

Please sign in to comment.