Class SocialShareComposer
The SocialShareComposer class provides an interface to compose a post for supported social networking services.
Inheritance
Namespace: VoxelBusters.EssentialKit
Assembly: cs.temp.dll.dll
Syntax
public sealed class SocialShareComposer : NativeFeatureBehaviour
Examples
The following code example shows how to create composer for Facebook
using UnityEngine;
using System.Collections;
using VoxelBusters.EssentialKit;
public class ExampleClass : MonoBehaviour
{
public void Start()
{
SocialShareComposer newComposer = SocialShareComposer.CreateInstance(SocialShareComposerType.Facebook);
newComposer.AddText("Example");
newComposer.AddScreenshot();
newComposer.SetCompletionCallback(OnShareComposerClosed);
newComposer.Show();
}
private void OnShareComposerClosed(SocialShareComposerResult result, Error error)
{
// add your code
}
}
Methods
AddImage(Byte[])
Adds an image to the post.
Declaration
public void AddImage(byte[] imageData)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | imageData | The image to add to the post. |
AddImage(Texture2D, TextureEncodingFormat)
Adds an image to the post.
Declaration
public void AddImage(Texture2D image, TextureEncodingFormat textureEncodingFormat = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Texture2D | image | The image to add to the post. |
| TextureEncodingFormat | textureEncodingFormat |
AddScreenshot()
Creates a screenshot and adds it to the post.
Declaration
public void AddScreenshot()
AddURL(URLString)
Adds a URL to the post.
Declaration
public void AddURL(URLString url)
Parameters
| Type | Name | Description |
|---|---|---|
| URLString | url | The URL to add to the post. |
AwakeInternal(Object[])
Declaration
protected override void AwakeInternal(object[] args)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object[] | args |
CreateInstance(SocialShareComposerType)
Initializes a new instance of the SocialShareComposer class.
Declaration
public static SocialShareComposer CreateInstance(SocialShareComposerType composerType)
Parameters
| Type | Name | Description |
|---|---|---|
| SocialShareComposerType | composerType | Composer type. |
Returns
| Type | Description |
|---|---|
| SocialShareComposer |
DestroyInternal()
Declaration
protected override void DestroyInternal()
GetFeatureName()
Declaration
protected override string GetFeatureName()
Returns
| Type | Description |
|---|---|
| System.String |
IsAvailable()
Declaration
public override bool IsAvailable()
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsComposerAvailable(SocialShareComposerType)
Declaration
public static bool IsComposerAvailable(SocialShareComposerType composerType)
Parameters
| Type | Name | Description |
|---|---|---|
| SocialShareComposerType | composerType |
Returns
| Type | Description |
|---|---|
| System.Boolean |
SetCompletionCallback(EventCallback<SocialShareComposerResult>)
Specify the action to execute after the share sheet is dismissed.
Declaration
public void SetCompletionCallback(EventCallback<SocialShareComposerResult> callback)
Parameters
| Type | Name | Description |
|---|---|---|
| EventCallback<SocialShareComposerResult> | callback | The action to be called on completion. |
SetText(String)
Adds the initial text to be posted.
Declaration
public void SetText(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The text to add to the post. |
Show()
Shows the share sheet interface, anchored at screen position (0, 0).
Declaration
public void Show()
Show(Vector2)
Shows the share sheet interface, anchored to given position.
Declaration
public void Show(Vector2 screenPosition)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | screenPosition | The position (in the coordinate system of screen) at which to anchor the share sheet menu. This property is used in iOS platform only. |