Rock Mobile Docs

Please login to access all of the features of the Community Site.

Follow

Mobile1.0

The command is used to follow and unfollow specific entities.

Previously, this behavior was only utilized using the Following Icon, but now with this command, you can easily mimic that to create custom follow/unfollow buttons.

When following a person you'll want to use the PersonAlias entity type, not the Person.

Note that this command does not refresh the page. If you have following icons and expect them to be updated from this command, it does not work as such. Consider using SetViewProperty to make visual changes in response to follow and unfollow actions.

Warning

Following needs a logged-in person. If no one is logged in, the command shows its not-logged-in message instead.

The command calls POST api/Followings/{entityTypeId}/{entityId} to follow and DELETE api/Followings/{entityTypeId}/{entityId} to unfollow. Both actions on the Followings REST controller need Edit permission, which you set under Admin Tools > Security > REST Controllers. Starting with Core v16, grant it to the 'RSR - Mobile Application Users' role. Earlier versions use 'All Authenticated Users'. Without it, people see "Unable to process your request." The Security Considerations section of Following Icon walks through the setup.

Properties

PropertyTypeDescriptions
EntityIdintThe Id of the entity to follow or unfollow.
EntityTypeIdintThe Id of the entity type to follow or unfollow.
PurposeKeystringAn optional parameter that allows you to set a 'Purpose Key' while following or unfollowing.
NotificationTextstringThe text to display on the Toast when an item is successfully followed/unfollowed. Note: Setting this as empty ("") will remove the Toast from ever being displayed, if you wish to do that.
NotificationTypeNotificationTypeThe notification type of the Toast to be displayed.
IsFollowboolWhether or not the command is used to follow or unfollow, set to false to configure "unfollowing" behavior. Defaults to true.
UseHapticFeedbackboolIf enabled, the command will perform haptic feedback when tapped. Defaults to true.
<HorizontalStackLayout>
    {% assign group = 70 | GroupById %}

    <Button Text="Follow"
        Command="{Binding Follow}">
        <Button.CommandParameter>
            <Rock:FollowParameters EntityId="{{ group.Id }}"
                EntityTypeId="{{ group.TypeId }}" />
        </Button.CommandParameter>
    </Button>

    <Button Text="Unfollow"
        Command="{Binding Follow}">
        <Button.CommandParameter>
            <Rock:FollowParameters IsFollow="False"
                EntityId="{{ group.Id }}"
                EntityTypeId="{{ group.TypeId }}"
                NotificationText="Unfollowed!" />
        </Button.CommandParameter>
    </Button>
</HorizontalStackLayout>