RaveConnectFriendsController#

class: co.ravesocial.sdk.ui.RaveConnectFriendsController

Enum RaveFindFriendsState#

  • FIND_FRIENDS_STATE_NOT_DOWNLOADED: Friends syncing is not enabled

  • FIND_FRIENDS_STATE_DOWNLOADING: Friends sycning is in progress

  • FIND_FRIENDS_STATE_DOWNLOADED: Friends sycning is enabled


Interface RaveConnectFriendsStateObserver#

Implement this observer to track state changes in the controller to keep your UI up-to-date:

void onFindFriendsStateChanged(RaveFindFriendsState value);

Parameters:

value - Latest state value


RaveConnectFriendsController#

Constructor for new friends controller:

public RaveConnectFriendsController(String pluginKeyName);

Parameters:

pluginKeyName - Key for the plugin to use with this controller instance

Returns: Instance of RaveConnectFriendsController for the plugin specified


getDownloaded#

Check this value to see if the controller has downloaded your contacts:

public boolean getDownloaded();

Returns: True or false based on latest status


setFriendsObserver#

Implement RaveConnectFriendsStateObserver and set your observer instance in the controller:

public void setFriendsObserver(RaveConnectFriendsStateObserver observer);

Parameters:

observer - Reference to object implementing the state observer. Recommend you have a unique observer for each controller/plugin pair.


syncFriends#

Trigger sync friends operation asynchronously. Track state changes through the observer:

public void     syncFriends();

Note: Typically you will call attemptGetFriends instead.


attemptGetFriends#

Attempt to sync friends asynchronously. Checks internal logic to ensure that the plugin is enabled and that friends haven’t already been synced. If the user is authenticated will attempt to connect the plugin to the curent user in addition to syncing friends. Track changes to state through the observer:

public void attemptGetFriends();

attemptForgetFriends#

Attempt to stop syncing friends asynchronously. Checks internal logic to ensure that the plugin is enabled and that friends have been synced. If the user is authenticated this call will attempt to disconnect the plugin from the current user in addition to stopping syncing. Track changes to state through the observer:

public void attemptForgetFriends();

RaveConnectController#

Enum ConnectState#

  • CONNECT_STATE_DISABLED : Controller is disabled, plugin isn’t available

  • CONNECT_STATE_CONNECTED : Controller is connected, plugin is ready to use

  • CONNECT_STATE_CONNECTING : Controller is in the process of asynchronously attempting to connect, plugin is not ready

  • CONNECT_STATE_DISCONNECTED : Controller is disconnected, plugin is not ready

  • CONNECT_STATE_DISCONNECTING : Controller is in the process of asynchronously attempting to disconnect, plugin is not ready


Interface RaveConnectStateObserver#

Implement this observer to track state changes to the controller to keep your UI up-to-date:

void onConnectStateChanged(ConnectState state);

Parameters:

state - Latest state value


RaveConnectController#

Constructor for instances of RaveConnectController:

public RaveConnectController(String pluginKeyName);
public RaveConnectController(String pluginKeyName, boolean autoUpdate);

Parameters:

pluginKeyName - Key name for plugin to use for this controller

autoUpdate - True to automatically update connect state when observer is set (defaults to false)

Returns: Instance of RaveConnectController for the plugin specified


setObserver#

Implement RaveConnectStateObserver and set your instance in the controller using setObserver:

public void setObserver(RaveConnectStateObserver observer);

Parameters:

observer - Observer instance. Recommended that you have a different instance per plugin/controller pair.


attemptConnect#

Attempt to connect asynchronously. Checks internal logic to ensure that the plugin is enabled and plugin isn’t already connected. Track changes to state through the observer:

public void attemptConnect();

attemptDisconnect#

Attempt to disconnect asynchronously. Checks internal logic to ensure that the plugin is connected. Track changes to state through the observer:

public void attemptDisconnect();

updateConnectState#

Refresh the connect state of the controller with the plugin. Track changes to state through the observer:

public void updateConnectState();

Called automatically if autoUpdate is true for this controller.


setPluginKeyName#

Set the pluginKeyName for this controller. Typically shouldn’t be changed after construction:

public void setPluginKeyName(String pluginKeyName);

Parameters:

pluginKeyName - Key name for plugin to use


setCallback#

Set callback for asynchronous operations on this controller. Used to track errors that occur in the course of normal operations:

public void setCallback(RaveCompletionListener listener);

Parameters:

listener - Completion listener for error handling (see RaveCompletionListener)