Giter Site home page Giter Site logo

Comments (4)

whatadewitt avatar whatadewitt commented on July 19, 2024

... so this is what I ended up doing... may be better for the plugin to do the callback when the user has actually completed their share...

[activityVC setCompletionHandler:^(NSString *activityType, BOOL completed) {
        CDVPluginResult * pluginResult;
        if (completed) {
            NSString *network;
            if ([activityType rangeOfString:@"Twitter"].location != NSNotFound ) {
                network = @"twitter";
            } else if ([activityType rangeOfString:@"Facebook"].location != NSNotFound ) {
                network = @"facebook";
            } else {
                network = @"mail";
            }
            pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:network];
        } else {
            pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
        }
        [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
    }];

It's not pretty, but it's working for what I need it for at the moment.

Thanks!

--d

from socialsharing-phonegap-plugin.

EddyVerbruggen avatar EddyVerbruggen commented on July 19, 2024

Hi,

Glad you found a way!
I'll keep this issue open and consider adding such feedback to the successhandler. Thanks for the idea!

Best,
Eddy

from socialsharing-phonegap-plugin.

felipecarreramo avatar felipecarreramo commented on July 19, 2024

I'm using this

[activityVC setCompletionHandler:^(NSString *activityType, BOOL completed) {
    if (completed)
    {
        CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
        [self writeJavascript:[pluginResult toSuccessCallbackString:command.callbackId]];
    }
}];

and works fine for me.

from socialsharing-phonegap-plugin.

EddyVerbruggen avatar EddyVerbruggen commented on July 19, 2024

Hi,

I've opted for the solution of @felipecarreramo, because I think it's mostly useful for the user to know IF content was shared, not HOW. I may add the HOW in a later stage, but the code would be a bit messy. So for the IF part, I had to slightly adjust the aforementioned code.

When opening the share widget succeeds, the plugin considers it a success. The result is not returned to the app before the content is actually shared to a target app, or the share widget is closed, or sharing is aborted otherwise. Only in the first case the successCallback will receive a boolean TRUE, it's FALSE otherwise.

Thanks again guys,
Eddy

from socialsharing-phonegap-plugin.

Related Issues (20)

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.