togethersocialfacebook - TogetherGames/Public-Corona-Lua GitHub Wiki

TogetherSocialFacebook

Together::TogetherSocialFacebook

Overview

The TogetherSocialFacebook class handles all Facebook related operations.


Members

string FacebookAppID

The ID of the Facebook Application that is passed into the facebook.login() function.

table FacebookPrivileges

The privileges to request from facebook whenever the User logs in.

FriendManager FriendManager

The FriendManager also accessible from g_Together.FriendManager

table FacebookFriends

A table of external Facebook friends

table FacebookFriendsDictionaryBySocialID

A table of external Facebook friends where each key is a Friend's FacebookID

boolean FacebookFriendsRetrieved

A boolean indicating whether Facebook friends have been retrieved during this session


Methods


Initialize()

Initializes the instance so it can connect to Facebook.

Returns void
Syntax
TogetherSocialFacebook:Initialize( facebookAppID, facebookPrivileges )
Parameters

string facebookAppID

The Facebook Application ID to authenticate with

[table](#) facebookPrivileges

The privileges to authenticate with

--------------------------------------------------------------------------------

GetFacebookFriendCount()

Gets the number of FacebookFriends currently managed internally.

Returns number
Syntax
TogetherSocialFacebook:GetFacebookFriendCount(  )

GetFacebookFriend()

Finds the Facebook friend at the specified index.

Syntax
TogetherSocialFacebook:GetFacebookFriend( index )
Parameters

number index

The index of the friend to find

--------------------------------------------------------------------------------

FindBySocialID()

Finds the Facebook friend by their Facebook ID.

Syntax
TogetherSocialFacebook:FindBySocialID( socialID )
Parameters

string socialID

The index of the FacebookFriend to find if it exists, otherwise returns nil

--------------------------------------------------------------------------------

Login()

Attempts to log into Facebook. After successfully connecting, this will also register the user with their profile information. If this user has already registered through Facebook before, the accounts will be merged. Additionally, their Facebook friends list will be retrieved and synchronized to their Together friends list.

Returns void
Syntax
TogetherSocialFacebook:Login( togetherFacebookUser, callbackFunc )
Parameters

TogetherFacebookUser togetherFacebookUser

An instance of a FacebookUser object that gets filled in with their Facebook information.

[function](#) callbackFunc

The function to call upon completion.

--------------------------------------------------------------------------------

Logout()

Attempts to log the user out of Facebook if connected

Returns void
Syntax
TogetherSocialFacebook:Logout( callbackFunc )
Parameters

function callbackFunc

The function to call upon completion.

--------------------------------------------------------------------------------

SendPost()

Submits a wall post to the active user's wall

Note
This method does not display a dialog box

Returns void
Syntax
TogetherSocialFacebook:SendPost( postName, postDescription, postMessage, postPictureLink, postCaption, callbackFunc )
Parameters

string postName

The name/title of the wall post

[string](#) postDescription

The description of the wall post

[string](#) postMessage

A message for the wall post

[string](#) postPictureLink

A media link for the wall post

[string](#) postCaption

The caption for the wall post

[function](#) callbackFunc

The function to call upon completion.

--------------------------------------------------------------------------------

SendPostToUser()

Submits a wall post to a User's wall

Note
This method will attempt to display a Facebook dialog

Returns void
Syntax
TogetherSocialFacebook:SendPostToUser( who, postName, postDescription, postMessage, postPictureLink, postCaption, callbackFunc )
Parameters

ExternalFriend who

The receiver of the wall post must be a friend

[string](#) postName

A name/title for the wall post

[string](#) postDescription

The description of the wall post

[string](#) postMessage

A message for the wall post

[string](#) postPictureLink

A media link for the wall post

[string](#) postCaption

The caption for the wall post

[function](#) callbackFunc

The function to call upon completion.

--------------------------------------------------------------------------------

GetFriends()

Retrieves your Facebook friends list and synchronizes it with your Together friends list

Returns void
Syntax
TogetherSocialFacebook:GetFriends( callbackFunc )
Parameters

function callbackFunc

The function to call upon completion.

--------------------------------------------------------------------------------
⚠️ **GitHub.com Fallback** ⚠️