Coder Social home page Coder Social logo

diffusiondocs's Introduction

Diffusion

Social networking for iOS

Features

  • Share on the iOS built-in social networks
  • Supports Facebook, Twitter, and more
  • Easily extendable with custom UIActivities

Requirements

  • Unity 4.2 or higher
  • iOS 6.0 or higher

Getting Started

Install the Unity package and drop the Diffusion prefab into your scene, then you're ready to go.

Send a Share() message to the prefab to share your content!


Configuration

Platforms to hide

The networking menu is generated automatically based on what type of data you want to share, and what platforms are available. If the user has not signed into Facebook, it will not show up in the list, for example. However, sometimes options will show up that you do not actually want. For example if you're only sharing text, you may get a "Copy" option which isn't very useful.

This selection will allow you to explicitly hide options that you do not want to show. Many are disabled by default.

Custom Platforms

Diffusion offers an interface for using external UIActivities. To use them, you need to include the files provided by the UIActivity into Plugins/iOS in your Unity project, and add the class to the Custom Platforms field on the Diffusion prefab.

In order for Diffusion to access the classes for your custom UIActivity, you'll need to create a new category that includes the headers. You can do this through the new file menu in Xcode, or by hand. A template is included in the Custom Platforms folder.


Methods

Sharing

Share()

Shares the message and URL set in the inspector.

Share(string message, string filePath)

Shares the message provided, and a file.

Share(string message, string url, string filePath)

Shares a message, URL, and file as provided.

Accounts

isFacebookConnected()

Checks if the user has logged into Facebook.

isTwitterConnected()

Checks if the user has logged into Twitter.


Messages

If you connect a GameObject into the Event Receiver field on the Diffusion prefab, it will these messages will be sent to it.

Do not put your event receiver script on the prefab.

OnCompleted(DiffusionPlatform platform)

Sharing completed successfully. Returns the platform the user selected to share with.

OnCancelled()

User cancelled the sharing process.

Delegates

For slightly better performance, or if multiple listeners are necessary, the above events are also exposed as delegates.


Notes

  • Twitter's URL shortener assumed any URL to be 22 characters (20, plus spaces). In reality, there is a bug in the UIActivity's character counting, and URLs show as 36 characters.
  • There is an included PostProcessDiffusion script, which is used to add Social.framework to your Xcode project. If this only to enable the isFacebookConnected() and isTwitterConnected() checks. If the post-process script is causing problems for your project and you don't need these functions, you can remove it.

diffusiondocs's People

Contributors

cbaltzer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.