Packagecom.milkmangames.nativeextensions.ios
Classpublic class GoViral
InheritanceGoViral Inheritance flash.events.EventDispatcher

GoViral Native Extension



Public Properties
 PropertyDefined By
  goViral : GoViral
[static] [read-only] The current instance of the GoViral singelton.
GoViral
  logCallback : Function
Internal Logger Callback
GoViral
Public Methods
 MethodDefined By
  
GoViral(logCallback:Function = null)
Do not call this directly; use GoViral.create() to initialize or GoViral.goViral to get current instance.
GoViral
  
authenticateWithFacebook(permissions:String):void
Log the user into Facebook.
GoViral
  
[static] Initializes the GoViral Extension.
GoViral
  
dispose():void
Dispose of Context
GoViral
  
facebookGraphRequest(graphPath:String, httpMethod:String = GET, params:Object = null):void
Post a raw request to the Facebook Graph API.
GoViral
  
facebookPostPhoto(message:String, image:BitmapData):void
Posts a photo to Facebook.
GoViral
  
initFacebook(appId:String, urlSchemeSuffix:String):void
Initialize the Facebook native interface.
GoViral
  
Check if the user is logged in to Facebook Single Sign On for this app.
GoViral
  
isSupported():Boolean
[static] Checks if the current platform supports GoViral.
GoViral
  
Determine whether iOS Native Twitter features are available, which requires the current device is running iOS 5 or greater.
GoViral
  
Log the current user out of Facebook Single Sign On.
GoViral
  
requestFacebookFriends(extraParams:Object = null):void
Convenience method to request the user's Facebook friends.
GoViral
  
Convenience method to request the user's Facebook profile.
GoViral
  
showBasicTwitterPostDialog(message:String):void
Shows a basic Twitter post dialog using Twitter's web interface.
GoViral
  
showEmailComposer(subject:String, toWhom:String, body:String, isBodyHtml:Boolean):void
Show a native iOS Email Composer dialog.
GoViral
  
showEmailComposerWithBitmap(subject:String, toWhom:String, body:String, isBodyHtml:Boolean, bitmapData:BitmapData):void
Show a native iOS Email Composer dialog, with an attached image as BitmapData.
GoViral
  
showFacebookFeedDialog(name:String, caption:String, message:String, description:String, linkUrl:String = null, imageUrl:String = null):void
Displays a native Facebook Wall Post / Feed Post Dialog.
GoViral
  
showFacebookRequestDialog(message:String, title:String = null, data:String = null, filters:String = null, to:String = null, excludeIds:String = null, frictionless:Boolean = false):void
Show a native Facebook request dialog (e.g., invite friends.) On dismissal, a GVFacebookEvent will be dispatched with the result, of the type GVFacebookEvent.FB_DIALOG_FINISHED if the Dialog finished, GVFacebookEvent.FB_DIALOG_CANCELED if the dialog was cancelled, or GVFacebookEvent.FB_DIALOG_FAILED if the dialog failed.
GoViral
  
showTweetSheet(message:String):void
Shows a native iOS Twitter post dialog using iOS 5's built-in Twitter feature.
GoViral
  
showTweetSheetWithImage(message:String, image:BitmapData):void
Shows a native iOS Twitter post dialog using iOS 5's built-in Twitter feature, with an attached image.
GoViral
Events
 Event Summary Defined By
  Dispatched when a Facebook Dialog is cancelledGoViral
  Dispatched when a Facebook Dialog has failedGoViral
  Dispatched When a Facebook Dialog has finishedGoViral
  Dispatched When the user has logged in with FacebookGoViral
  Dispatched when the user has logged out with FacebookGoViral
  Dispatched When the User cancelled Facebook LoginGoViral
  Dispatched When Facebook Login failsGoViral
  Dispatched when a Facebook Graph Request has failedGoViral
  Dispatched when a Facebook Graph Request returns a responseGoViral
  Dispatched when a mail dialog is cancelledGoViral
  Dispatched when an email dialog failsGoViral
  Dispatched when the user saves an emailGoViral
  Dispatched when the user sends an emailGoViral
  Dispatched when a Twitter Dialog was cancelledGoViral
  Dispatched when a Twitter Dialog has FailedGoViral
  Dispatched when a Twitter Dialog is FinishedGoViral
Public Constants
 ConstantDefined By
  VERSION : String = 1.0.0
[static] Current API Version
GoViral
Property Detail
goViralproperty
goViral:GoViral  [read-only]

The current instance of the GoViral singelton. You must call GoViral.create() before this property is available.


Implementation
    public static function get goViral():GoViral

Throws
Error — if GoViral.create() was not called before first accessing this property.
logCallbackproperty 
public var logCallback:Function

Internal Logger Callback

Constructor Detail
GoViral()Constructor
public function GoViral(logCallback:Function = null)

Do not call this directly; use GoViral.create() to initialize or GoViral.goViral to get current instance.

Parameters
logCallback:Function (default = null)
Method Detail
authenticateWithFacebook()method
public function authenticateWithFacebook(permissions:String):void

Log the user into Facebook. The user must be authenticated with Facebook before calling any Facebook dialog or API methods. Upon calling authenticateWithFacebook(), the user will be presented with a dialog asking them to grant permissions to your app to use their account. If the official Facebook app is installed, and the device supports multitasking, iOS will task switch to the Facebook app to authenticate the user, then return to your app on completion. If the official Facebook app is not installed, and the device supports multi-tasking, iOS will task switch to Safari and present an authentication dialog there; on completion, your app will be returned to the foreground. If the device does not support multitasking, an authentication dialog will be presented inside your own app. A GVFaceBookEvent indicating the result will be dispatched when the login succeeds, fails, or is cancelled by the user- with the type of GVFacebookEvent.FB_LOGGED_IN, GVFacebookEvent.FB_LOGIN_FAILED, GVFacebookEvent.FB_LOGIN_CANCELED, respectively, and GVFacebookEvent.FB_LOGGED_OUT will be dispatched when and if the user logs out. You may check GoViral.goViral.isFacebookAuthenticated() first to determine if the user is already logged in.

Parameters

permissions:String — Optional. A comma-separated list of permission options for the app. Refer to Facebook's developer documentation for more information.

See also

create()method 
public static function create():GoViral

Initializes the GoViral Extension. You should check GoViral.isSupported first to ensure the platform is iOS. GoViral is a Singleton and you may have only one instance. After creation, you may access the instance through the static property GoViral.goViral .

Returns
GoViral — initialized instance of GoViral extension interface.

Throws
Error — if GoViral has already been initialized.
dispose()method 
public function dispose():void

Dispose of Context

facebookGraphRequest()method 
public function facebookGraphRequest(graphPath:String, httpMethod:String = GET, params:Object = null):void

Post a raw request to the Facebook Graph API. Results are returned as JSON. This gives you native access to the entire Facebook platform. Refer to the Facebook developer documentation for details on the many accessible API methods. After the request, a GVFacebookEvent will be dispatched with the result- GVFacebookEvent.FB_REQUEST_RESPONSE will be dispatched if the request succeeds, and the string value of its property 'jsonData' will contain the raw JSON response. The property 'data' will contain an Object of the parsed JSON for convenience. If the request fails, a GVFacebookEvent.FB_REQUEST_FAILED event will be dispatched.

Parameters

graphPath:String — The graph path command you wish to execute, such as "me/friends" to get user's friends. See the Facebook developer documentation for more details.
 
httpMethod:String (default = GET) — Optional. Default value is GVHttpMethod.GET. The httpMethod to use for the request, either GVHttpMethod.GET, GVHttpMethod.POST, or GVHttpMethod.DELETE. Refer to the Facebook developer documentation for details on the appropriate method.
 
params:Object (default = null) — Optional. An Object with string keys and values, for each additional parameter you want to send with the Graph request. See the Facebook developer documentation for more details.


Throws
ArgumentError — if httpMethod is not one GVHttpMethod.GET, GVHttpMethod.POST, or GVHttpMethod.DELETE

See also

facebookPostPhoto()method 
public function facebookPostPhoto(message:String, image:BitmapData):void

Posts a photo to Facebook. For this to work, you must have authenticated your application with a permissions value including 'user_photos,publish_stream' when authenticating with the GoViral.goViral.authenticateWithFacebook() method (for example, GoViral.goViral.authenticateWithFacebook("user_likes,user_photos,publish_stream"); ). This method wraps around facebookGraphRequest- a GVFacebookEvent.FB_REQUEST_RESPONSE or GVFacebookEvent.FB_REQUEST_FAILED event will be dispatched upon it's completion.

Parameters

message:String — The message to include with this photo posting.
 
image:BitmapData — BitmapData image to post as a photo.

initFacebook()method 
public function initFacebook(appId:String, urlSchemeSuffix:String):void

Initialize the Facebook native interface. You must call this before any other Facebook functions will be active. You should execute this function as early on in your program as possible, even if you don't need to call the Facebook methods until a later time.

Parameters

appId:String — The Facebook App ID- created in the Facebook developer site
 
urlSchemeSuffix:String — Optional. url scheme suffixes can be defined in the Facebook developer site, and used to share Single Sign On across multiple SKUs of one app (for instance, free and paid versions.) See Facebook's developer documentation for more information.

See also

isFacebookAuthenticated()method 
public function isFacebookAuthenticated():Boolean

Check if the user is logged in to Facebook Single Sign On for this app.

Returns
Boolean — true if the current user for this app is authenticated with Facebook.
isSupported()method 
public static function isSupported():Boolean

Checks if the current platform supports GoViral. Note that this only determines whether the app is running under iOS (as opposed to Android, Windows, etc.) Use this call before initializing GoViral in order to confirm that you are on iOS. (So that you can avoid initializing GoViral on an unsupported platform when building a multi-platform app.)

Returns
Boolean — true if GoViral is supported; false otherwise.
isTweetSheetAvailable()method 
public function isTweetSheetAvailable():Boolean

Determine whether iOS Native Twitter features are available, which requires the current device is running iOS 5 or greater. If it returns true, you may use GoViral.goViral.showTweetSheet() or GoViral.goViral.showTweetSheetWithImage(), which will invoke iOS 5 Native Twitter dialogs. If it returns false, you can use GoViral.goViral.showBasicTwitterPostDialog() as a fallback. Also note that the Adobe AIR SDK version 3.2 requires a Mac with the iOS SDK installed in order to build IPA files that can use native Twitter. To enable this, be sure to use the ANE file in the 'maconly' folder of the extension zip package.

Returns
Boolean — true if iOS 5 Native Twitter features are available (such as GoViral.goViral.showTweetSheet() or GoViral.goViral.showTweetSheetWithImage()).
logoutFacebook()method 
public function logoutFacebook():void

Log the current user out of Facebook Single Sign On.

requestFacebookFriends()method 
public function requestFacebookFriends(extraParams:Object = null):void

Convenience method to request the user's Facebook friends. After the request, a GVFacebookEvent will be dispatched. If the request is successful, GVFacebookEvent.FB_REQUEST_RESPONSE event will be dispatched, and its 'friends' property will contain a vector array of GVFacebookFriend objects. If the call fails, GVFacebookEvent.FB_REQUEST_FAILED will be dispatched.

Parameters

extraParams:Object (default = null) — Optional. Any extra parameters to append to the friend request. For instance, if you pass {fields:"installed"} the returned GVFacebookFriend objects will have an indicator of whether the friend has your app installed in its 'properties' field.

See also

requestMyFacebookProfile()method 
public function requestMyFacebookProfile():void

Convenience method to request the user's Facebook profile. After the request, a GVFacebookEvent will be dispatched. If the request is successful, GVFacebookEvent.FB_REQUEST_RESPONSE event will be dispatched, and its 'friends' property will contain a vector array with one GVFacebookFriend object for the logged in user. If the call fails, GVFacebookEvent.FB_REQUEST_FAILED will be dispatched.

See also

showBasicTwitterPostDialog()method 
public function showBasicTwitterPostDialog(message:String):void

Shows a basic Twitter post dialog using Twitter's web interface. This method is available as a fallback for devices with older iOS versions that cannot support native Twitter dialogs (versions less than 5.0.) Also note that the Adobe AIR SDK version 3.2 requires a Mac with the iOS SDK installed in order to build IPA files that use the native Twitter features. To enable this, be sure to use the ANE file in the 'maconly' folder of the extension zip package. To determine whether iOS Native Twitter features are available, or if you need to fall back to showBasicTwitterPostDialog(), use the GoViral.goViral.isTweetSheetAvailable() method. If it returns true, use GoViral.goViral.showTweetSheet() or GoViral.goViral.showTweetSheetWithImage(). If it returns false, you can use GoViral.goViral.showBasicTwitterPostDialog() as a fallback. After the dialog is dismissed, a GVTwitterEvent.TW_DIALOG_FINISHED, GVTwitterEvent.TW_DIALOG_CANCELED, or GVTwitterEvent.TW_DIALOG_CANCELED event will be dispatched.

Parameters

message:String — the message to prepulate into the twitter post dialog. The user will be able to change this if they wish.

See also

showEmailComposer()method 
public function showEmailComposer(subject:String, toWhom:String, body:String, isBodyHtml:Boolean):void

Show a native iOS Email Composer dialog. On dismissal, a GVMailEvent will be dispatched indicating the result, with a type of GVMailEvent.MAIL_SAVED if the user saved but did not send the message, GVMailEvent.MAIL_SENT if the user sent the message, GVMailEvent.MAIL_CANCELED if the user cancelled the dialog, or GVMailEvent.MAIL_FAILED if an error occurred sending.

Parameters

subject:String — subject line of the email
 
toWhom:String — 'to' line of the email. Comma separated list is accepted.
 
body:String — the body of the email
 
isBodyHtml:Boolean — set to 'true' if you wish for the email to be html formatted.

See also

showEmailComposerWithBitmap()method 
public function showEmailComposerWithBitmap(subject:String, toWhom:String, body:String, isBodyHtml:Boolean, bitmapData:BitmapData):void

Show a native iOS Email Composer dialog, with an attached image as BitmapData. On dismissal, a GVMailEvent will be dispatched indicating the result, with a type of GVMailEvent.MAIL_SAVED if the user saved but did not send the message, GVMailEvent.MAIL_SENT if the user sent the message, GVMailEvent.MAIL_CANCELED if the user cancelled the dialog, or GVMailEvent.MAIL_FAILED if an error occurred sending.

Parameters

subject:String — subject line of the email
 
toWhom:String — 'to' line of the email. Comma separated list is accepted.
 
body:String — the body of the email
 
isBodyHtml:Boolean — set to 'true' if you wish for the email to be html formatted.
 
bitmapData:BitmapData — the bitmapData of the image to attach to the email.

See also

showFacebookFeedDialog()method 
public function showFacebookFeedDialog(name:String, caption:String, message:String, description:String, linkUrl:String = null, imageUrl:String = null):void

Displays a native Facebook Wall Post / Feed Post Dialog. On dismissal, a GVFacebookEvent will be dispatched with the result, of the type GVFacebookEvent.FB_DIALOG_FINISHED if the Dialog finished, GVFacebookEvent.FB_DIALOG_CANCELED if the dialog was cancelled, or GVFacebookEvent.FB_DIALOG_FAILED if the dialog failed.

Parameters

name:String — the name of the post
 
caption:String — caption for the post
 
message:String — the message body of the post
 
description:String — description of the post
 
linkUrl:String (default = null) — Optional. Link URL for post to point at
 
imageUrl:String (default = null) — Optional. Image URL for post to display

See also

showFacebookRequestDialog()method 
public function showFacebookRequestDialog(message:String, title:String = null, data:String = null, filters:String = null, to:String = null, excludeIds:String = null, frictionless:Boolean = false):void

Show a native Facebook request dialog (e.g., invite friends.) On dismissal, a GVFacebookEvent will be dispatched with the result, of the type GVFacebookEvent.FB_DIALOG_FINISHED if the Dialog finished, GVFacebookEvent.FB_DIALOG_CANCELED if the dialog was cancelled, or GVFacebookEvent.FB_DIALOG_FAILED if the dialog failed.

Parameters

message:String — The message to include with the request. Max length of 255 characters- this will be truncated if it's more than that.
 
title:String (default = null) — Optional. Title to show on the request. Max length of 50 characters- this will be truncated if it's more than that.
 
data:String (default = null) — Optional. Extra data string for the request. Max length of 255 characters- this will be truncated if it's more than that.
 
filters:String (default = null) — Optional. Allows filtering of recipients to GVFacebookRequestFilter.ALL, GVFacebookRequestFilter.APP_USERS, or GVFacebookRequestFilter.APP_NON_USERS.
 
to:String (default = null) — Optional. A String facebook ID for the request to go to, or a comma delimited list of such IDs. If this is not set, a standard friend selector will appear.
 
excludeIds:String (default = null) — Optional. A comma delimited list of Facebook User IDs to exclude from the dialog picker.
 
frictionless:Boolean (default = false) — Optional. Set to 'true' to make this a frictionless request. See Facebook developer documentation for more information.


Throws
ArgumentError if — filters is not one of GVFacebookRequestFilter.ALL, GVFacebookRequestFilter.APP_USERS, or GVFacebookRequestFilter.APP_NON_USERS.

See also

showTweetSheet()method 
public function showTweetSheet(message:String):void

Shows a native iOS Twitter post dialog using iOS 5's built-in Twitter feature. This method is available for devices running iOS 5.0 or greater. Also note that the Adobe AIR SDK version 3.2 requires a Mac with the iOS SDK installed in order to build IPA files that can use this feature. To enable this, be sure to use the ANE file in the 'maconly' folder of the extension zip package. To determine whether iOS Native Twitter features are available, or if you need to fall back to showBasicTwitterPostDialog() instead, use the GoViral.goViral.isTweetSheetAvailable() method. If it returns true, use GoViral.goViral.showTweetSheet() or GoViral.goViral.showTweetSheetWithImage(). If it returns false, you can use GoViral.goViral.showBasicTwitterPostDialog() as a fallback. After the dialog is dismissed, a GVTwitterEvent.TW_DIALOG_FINISHED, GVTwitterEvent.TW_DIALOG_CANCELED, or GVTwitterEvent.TW_DIALOG_CANCELED event will be dispatched.

Parameters

message:String — the message to prepulate into the twitter post dialog. The user will be able to change this if they wish.

See also

showTweetSheetWithImage()method 
public function showTweetSheetWithImage(message:String, image:BitmapData):void

Shows a native iOS Twitter post dialog using iOS 5's built-in Twitter feature, with an attached image. This method is available for devices running iOS 5.0 or greater. Also note that the Adobe AIR SDK version 3.2 requires a Mac with the iOS SDK installed in order to build IPA files that can use this feature. To enable this, be sure to use the ANE file in the 'maconly' folder of the extension zip package. To determine whether iOS Native Twitter features are available, or if you need to fall back to showBasicTwitterPostDialog() instead, use the GoViral.goViral.isTweetSheetAvailable() method. If it returns true, use GoViral.goViral.showTweetSheet() or GoViral.goViral.showTweetSheetWithImage(). If it returns false, you can use GoViral.goViral.showBasicTwitterPostDialog() as a fallback. After the dialog is dismissed, a GVTwitterEvent.TW_DIALOG_FINISHED, GVTwitterEvent.TW_DIALOG_CANCELED, or GVTwitterEvent.TW_DIALOG_CANCELED event will be dispatched.

Parameters

message:String — BitmapData image to attach to the Tweet.
 
image:BitmapData — the message to prepulate into the twitter post dialog. The user will be able to change this if they wish.

See also

Event Detail
FB_DIALOG_CANCELED Event
Event Object Type: com.milkmangames.nativeextensions.ios.events.GVFacebookEvent

Dispatched when a Facebook Dialog is cancelled

FB_DIALOG_FAILED Event  
Event Object Type: com.milkmangames.nativeextensions.ios.events.GVFacebookEvent

Dispatched when a Facebook Dialog has failed

FB_DIALOG_FINISHED Event  
Event Object Type: com.milkmangames.nativeextensions.ios.events.GVFacebookEvent

Dispatched When a Facebook Dialog has finished

FB_LOGGED_IN Event  
Event Object Type: com.milkmangames.nativeextensions.ios.events.GVFacebookEvent

Dispatched When the user has logged in with Facebook

FB_LOGGED_OUT Event  
Event Object Type: com.milkmangames.nativeextensions.ios.events.GVFacebookEvent

Dispatched when the user has logged out with Facebook

FB_LOGIN_CANCELED Event  
Event Object Type: com.milkmangames.nativeextensions.ios.events.GVFacebookEvent

Dispatched When the User cancelled Facebook Login

FB_LOGIN_FAILED Event  
Event Object Type: com.milkmangames.nativeextensions.ios.events.GVFacebookEvent

Dispatched When Facebook Login fails

FB_REQUEST_FAILED Event  
Event Object Type: com.milkmangames.nativeextensions.ios.events.GVFacebookEvent

Dispatched when a Facebook Graph Request has failed

FB_REQUEST_RESPONSE Event  
Event Object Type: com.milkmangames.nativeextensions.ios.events.GVFacebookEvent

Dispatched when a Facebook Graph Request returns a response

MAIL_CANCELED Event  
Event Object Type: com.milkmangames.nativeextensions.ios.events.GVMailEvent

Dispatched when a mail dialog is cancelled

MAIL_FAILED Event  
Event Object Type: com.milkmangames.nativeextensions.ios.events.GVMailEvent

Dispatched when an email dialog fails

MAIL_SAVED Event  
Event Object Type: com.milkmangames.nativeextensions.ios.events.GVMailEvent

Dispatched when the user saves an email

MAIL_SENT Event  
Event Object Type: com.milkmangames.nativeextensions.ios.events.GVMailEvent

Dispatched when the user sends an email

TW_DIALOG_CANCELED Event  
Event Object Type: com.milkmangames.nativeextensions.ios.events.GVTwitterEvent

Dispatched when a Twitter Dialog was cancelled

TW_DIALOG_FAILED Event  
Event Object Type: com.milkmangames.nativeextensions.ios.events.GVTwitterEvent

Dispatched when a Twitter Dialog has Failed

TW_DIALOG_FINISHED Event  
Event Object Type: com.milkmangames.nativeextensions.ios.events.GVTwitterEvent

Dispatched when a Twitter Dialog is Finished

Constant Detail
VERSIONConstant
public static const VERSION:String = 1.0.0

Current API Version