Giter Club home page Giter Club logo

extension-share's Introduction

extension-share

Native Sharing calls for OpenFL

This is a simple "Share" API implementation. So far it calls the "Share Intent" on Android, iOS and BlackBerry, a popup on HTML5 and opens sharing URL from Facebook and Twitter on other platforms.

Simple use Example

// This example show a simple sharing of a text using the Share Classs.

import extension.share.Share;

class SimpleExample {
	function new(){
		Share.init(Share.TWITTER); // for non supported targets, we share on Twitter (you can also use Share.FACEBOOK)
		Share.defaultURL='http://www.puralax.com/'; // url to add at the end of each share (optional).
		Share.defaultSubject='Try puralax!'; // in case the user choose to share by email, set the subject.
		
		// Other things you may want to init for non-supported targets
		/*
		Share.facebookAppID='1239833828932'; // your facebook APP ID
		Share.defaultFallback=function(url:String){ ... }; // callback function (in case you want to open the share URL yourself).
		Share.facebookRedirectURI='http://www.puralax.com/share'; // URL to go after sharing on facebook.
		*/
	}

	function shareStuff(){
		Share.share('Hi, I\'m testing the OpenFL-Sharing extension!');
		// check the share paremeters to see what you can share using this extension:
		// public static function share(
		//	text:String, // text to share
		//	subject:String=null, // subject in case your user chooses "email"
		//	image:String='', // path to an image you want to share in case you have one
		//	html:String='', // html version of your shared text (android only)
		//	email:String='', // preset email address in case your user chooses "email"
		//	url:String=null, // url to append to the shared text
		//	socialNetwork:String=null, // default social network (for everything but android, ios & blackberry)
		//	fallback:String->Void=null, // function to call when we don't know how to share
		//	bdm:BitmapData = null); // bitmap data object: Will be saved as JPG and shared (ios & android only)
	}
}

How to Install

haxelib install extension-share

Disclaimer

Twitter is a registered trademark of Twitter Inc. http://unibrander.com/united-states/212050US/twitter.html

Facebook is a registered trademark of Facebook Inc. http://unibrander.com/united-states/221811US/facebook.html

License

The MIT License (MIT) - LICENSE.md

Copyright © 2014 SempaiGames (http://www.sempaigames.com)

Author: Federico Bricker

extension-share's People

Contributors

01010111 avatar fbricker avatar gama11 avatar hoothin avatar jgranick avatar rafadelahoz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

extension-share's Issues

issue with -Dnext compilation flag

Hi.

I am having this issue when compiling with -Dnext (openfl 3.3.3):

[javac] Compiling 8 source files to C:\Development\haxe\Darkaedalus\export\android\bin\bin\classes
[javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
[javac] C:\Development\haxe\Darkaedalus\export\android\bin\src\shareex\ShareEx.java:16: error: cannot find symbol
[javac] GameActivity.getInstance().getContext().startActivity(sendIntent);
[javac] ^
[javac] symbol: method getInstance()
[javac] location: class GameActivity
[javac] Note: C:\Development\haxe\Darkaedalus\export\android\bin\src\org\libsdl\app\SDLActivity.java uses or overrides a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] 1 error
[javac] 3 warnings

works fine when compiled with openfl legacy though.

Add Image to extension

For Android I would like to share an image and text. I was able to get this to work for IOS but now I am having an issue with Android.

How can I modify the ShareEx.java file so I can post an image and text?

Thanks

Error when calling Share.share() on iOS

Hi,
Thanks for that solution so simple it made me cry (tears of joy of course) !
Unfortunately if it works perfectly on android, flash and windows, I didn't managed to make it work on iOS. I've traced the error on Xcode (it shuts down the app):
libc++abi.dylib: terminating with unexpected exception of type NSException

Have you any idea?
Thanks!

haxelib

haxelib install extension-share says:
No such Project : extension-share

Type not found : openfl.utils.JNI

Hi!

Can't compile my project while using the extension-share, got that error:

C:/HaxeToolkit/haxe/lib/extension-share/2,4,3/extension/share/Share.hx:18: characters 75-81 : Type not found : openfl.utils.JNI
flixel 4.5.1
hxcpp 4.0.4
lime 7.1.1
openfl 8.6.4

An error occurred. Please try again later.

i see someone got this working 15 days ago which is why i am so confused. I am getting the error "An error occurred. Please try again later." when using your code in the sample with Share.init(Share.FACEBOOK);

I have tried using cpp, neko, html5 and flash.

Where have i gone wrong!? lol

Unable to build for iOS

I am trying to build this extension:

$ cd project
$ haxelib run hxcpp Build.xml -Diphone

Compiling group: iphone
g++ -Iinclude -Iios/include -c -fvisibility=hidden -stdlib=libstdc++ -Qunused-arguments -O2 -I/Users/alex-mac/haxelib/hxcpp/3,4,188/include -DHX_MACOS -m64 -Wno-parentheses -Wno-unused-value -Wno-format-extra-args -Wno-overflow -DHXCPP_M64 -DHXCPP_VISIT_ALLOCS(haxe) -DHXCPP_API_LEVEL=0(haxe) ... tags=[haxe,static]
 - ios/Share.mm 
Error: ./ios/Share.mm:2:9: fatal error: 'UIKit/UIKit.h' file not found
#import <UIKit/UIKit.h>
        ^~~~~~~~~~~~~~~
1 error generated.

And if i run lime rebuild from extension root directory:

$ lime rebuild . ios -debug

Compiling group: common
xcrun --sdk iphoneosnull clang++ -Iinclude -c -stdlib=libc++ -g -arch armv7 -isysroot /Library/Developer/CommandLineTools/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOSnull.sdk -miphoneos-version-min=5.0 -DENABLE_BITCODE=YES -fembed-bitcode-marker -Wno-parentheses -Wno-null-dereference -Wno-unused-value -Wno-overflow -Wno-bool-conversion -fno-stack-protector -DIPHONE=IPHONE -DIPHONEOS=IPHONEOS -DHXCPP_DEBUG -DSTATIC_LINK(static) -DHXCPP_VISIT_ALLOCS(haxe) -DHXCPP_API_LEVEL=0(haxe) -I/Users/alex-mac/haxelib/hxcpp/3,4,188/include -fexceptions -fstrict-aliasing ... tags=[haxe,static]
 - common/ExternalInterface.cpp 
Error: xcrun: error: SDK "iphoneosnull" cannot be located
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOSnull.sdk' [-Wmissing-sysroot]
In file included from ./common/ExternalInterface.cpp:11:
In file included from /Users/alex-mac/haxelib/hxcpp/3,4,188/include/hx/CFFI.h:15:
In file included from /Users/alex-mac/haxelib/hxcpp/3,4,188/include/hx/OS.h:85:
/Library/Developer/CommandLineTools/usr/include/c++/v1/errno.h:32:15: fatal error: 'errno.h' file not found
#include_next <errno.h>
              ^~~~~~~~~
1 error generated.

Callback with sharing info

Does the "extention-share" allow to know if a user has shared the app, and which platform it chose for sharing?
Thank you

Share-extension doesn't works in iOS

Hello
Just try for the first time "extension-share".
I tried for two targets: Android and iOS.
Everything seems to work correctly for Android Target (however I can not post images)
The application crash when I try to share to iOS Target.
Here is the error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '- [UIActivityViewController popoverPresentationController]: unrecognized selector sent to instance 0x16508e70'

Can't build for flash

Hello!
Can't build my project with the latest 2.4.1. share extension for flash target, didn't try other targets.
Get the following:
C:/HaxeToolkit/haxe/lib/extension-share/2,4,1/extension/share/Share.hx:5: characters 7-18 : You cannot access the sys package while targeting flash (for sys.io.File)
Same for
import sys.FileSystem;

Had no problems with 2.2.1.

Here is the commit, that's responsible for the problem:
a5d24c8#diff-150d1cfc3e34cecaafb8d397ae0b2c50

Any help?
Thank you!

ios compile

When i compile i got an error on ios with openfl 2.2.8, i can not see the error, lime just say:
Error:Compilation failed
Information:** BUILD FAILED **
Information:The following build commands failed:
Information:(1 failure)

It was my error dont include in project.xml sorry

iOS 7 crash

Calling Share.share on iOS 7 causes a crash.

Fixed

First of all thank you for your extension.

A few moments:

  1. Share.hx:
    var cleanUrl:String=StringTools.replace(url,'http://','');
    does you need to also clean 'https'?
  2. Share.hx:
    default: 'https://www.facebook.com/dialog/feed?app_id='+Share.facebookAppID+'&description='+text+'&display=popup&caption='+subject+'&link='+url+'&redirect_uri=http://www.puralax.com/shared/&images[]='+image;
    Hardcoded redirect_uri
  3. Is it possible to replace deprecated Feed Dialog (https://developers.facebook.com/docs/sharing/reference/feed-dialog/v2.1) with Share dialog, that doesn't require the user to be logged into your app using Facebook (https://developers.facebook.com/docs/android/share)
    with Feed Dialog as fallback (https://developers.facebook.com/docs/android/share#linkfeed)?

FB share problem

Hi,
we have implemented openfl-share in our game https://play.google.com/store/apps/details?id=com.phyziko.runningsnake.
This is the way that we are calling share method:
Share.share("I have just won " + Std.string(game.score) + " points on Running Snake!", "Running Snake", "http://phyziko.com/wp-content/uploads/2014/11/running-snake-512x512.png", "", "", "https://play.google.com/store/apps/details?id=com.phyziko.runningsnake", Share.FACEBOOK);
When I submit FB post from "share intent", none of information(text, subject, image) show up on facebook post, like on the attached images.
2015-02-18-21-13-09
fbwall

Thanks,
Marko

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.