Actions¶
Create Action¶
To create an action:
var data = new Dictionary<string, string>
{
{"key1", "val1"}
};
var action = GetSocialAction.Create("my-custom-action", data);
For the default GetSocial actions use one of GetSocialActionKeys
constants to guarantee the default behavior. Also you can pass any custom data you want and handle it on the receiver side.
You can send any of predefined actions that will be handled by the SDK, for example to open Activity Feed with id “funny-stories” use:
var action = GetSocialAction.Create(GetSocialActionType.OpenActivity, new Dictionary<string, string> {
{ GetSocialActionKeys.OpenActivity.FeedName, "funny-stories" }
});
Currently you can attach actions to notifications or activity posts.
Handle Actions¶
public bool Handle(GetSocialAction action)
{
switch (action.Type)
{
case GetSocialActionType.OpenProfile:
ShowNewFriend(action.Data[GetSocialActionKeys.OpenProfile.UserId]);
return true;
case "try-campaign-mode":
StartCampaignMode();
return true;
default:
return false;
}
}
To handle custom actions use:
- Notification listener in Smart Notifications.
- Action listener in Activity Feed UI.
Tip
If you are not using GetSocial UI, we recommend to handle action by yourself - better user experience would be to react to actions.
GetSocial Actions¶
GetSocial SDK provides a list of predefined actions and Handle(...)
method to process them. We use it internally in GetSocial UI. For you it may be helpful when building your custom UI.
GetSocial.Handle(GetSocialAction action);
Handled by GetSocial Core¶
GetSocialActionType.OpenUrl
: Will open a system web browser with provided URL. Required parameters:GetSocialActionKeys.OpenUrl.Url
- URL to open.
GetSocialActionType.AddFriends
: Add user the the list of friends on Social Graph. Parameters:GetSocialActionKeys.AddFriend.UserId
- GetSocial user ID.
GetSocialActionType.ClaimPromoCode
: Claim a promo code. You can get the information about claiming via Webhook. We recommend you to override default behavior and callGetSocial.claimPromoCode
to have a feedback about success inside the app.GetSocialActionKeys.ClaimPromoCode.PromoCode
- promo code to claim.
Handled by GetSocial UI¶
GetSocialActionType.OpenInvites
: Will open Smart Invites view. Has no required parameters.-
GetSocialActionType.OpenActivity
: Will open Activity Feed. To open Activity Feed list provide following parameter:GetSocialActionKeys.OpenActivity.FeedName
- Feed to Open. UseActivitiesQuery.GlobalFeed
to open global feed.
To open Activity Feed post itself and optionally scroll to the certain comment provide following parameters:
-GetSocialActionKeys.OpenActivity.ActivityId
- Activity Feed post ID.
-GetSocialActionKeys.OpenActivity.CommentId
- Comment under that activity. Optional.
Not Handled¶
The following action is not handled by GetSocial:
GetSocialActionType.OpenProfile
. Required parameters:GetSocialActionKeys.OpenProfile.UserId
- GetSocial user ID whose profile should be opened.