Skip to content
This repository has been archived by the owner on Apr 8, 2021. It is now read-only.

Callback Constants #157

Open
juanjimenez-6 opened this issue Dec 1, 2015 · 3 comments
Open

Callback Constants #157

juanjimenez-6 opened this issue Dec 1, 2015 · 3 comments

Comments

@juanjimenez-6
Copy link

Hey guys. Sorry for opening another issue, but I feel this one's important.

According to the README there are some constants for the callback, depending on the type of share you select.

Let's take Facebook as an example.

ACTIVITY_FACEBOOK: UIActivityTypePostToFacebook

But when evaluating this on runtime:

case dk.napp.social.ACTIVITY_FACEBOOK:
Ti.API.info("User shared on Facebook");
break;

...I never get into the selected case.

After debugging I discovered the Activity Name differs a little, not only from the constant but also between devices.

For iPhone: com.apple.UIKit.activity.PostToFacebook
For iPad: com.facebook.Facebook.ShareExtension

[INFO] : {
[INFO] : activity = 383813760;
[INFO] : activityName = "com.facebook.Facebook.ShareExtension";
[INFO] : bubbles = 1;
[INFO] : cancelBubble = 0;
[INFO] : platform = activityPopover;
[INFO] : source = "[object DkNappSocialModule]";
[INFO] : success = 1;
[INFO] : type = complete;
[INFO] : }

Probably UIActivityTypePostToFacebook is from older versions of the Facebook app and also iOS.

Same happens for Twitter, and even the Mail app.

I hope this is helpful as a report. Thanks!!

@hansemannn
Copy link
Collaborator

Hi @JuanP6, I don't use the module but I think you have to call the constant on the declared variable of the module. If you have var social = require("dk.napp.social"); than you call it on social. ACTIVITY_FACEBOOK.

@juanjimenez-6
Copy link
Author

Hi @hansemannn,
Certainly! I am already doing that.
The problem is that the module's constants are not matching the actual name of the activity.

The value of Facebook's constant is UIActivityTypePostToFacebook.
But for instance, in iOS 9, the actual name of said activity is com.apple.UIKit.activity.PostToFacebook.

So in the callback, I can't really use the constants for operations.
Actual code snippet from my project:

//case Alloy.Globals.Social.ACTIVITY_FACEBOOK:
case "com.apple.UIKit.activity.PostToFacebook":
(...)
break;

And this is only for iPhones. For tables, the activity is a modal, and the event returns "com.facebook.Facebook.ShareExtension".

This is certainly iOS and Facebook's fault, it renders the module's constants useless.

Same for twitter.
Phones: "com.apple.UIKit.activity.PostToTwitter"
Tablets: "com.atebits.Tweetie2.ShareExtension"

@hansemannn
Copy link
Collaborator

The reason is, that it calls different share extensions (see here). So I think you should use the iPad sharing dialog there. Does that help?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants