javascript/lib/extensions/Facebook-android.js
function() {
        if(savedMessageFromLastFail) {
            // Last time we tried to publish there was a failure preventing it from ending up on the wall.
            // In such a case, we want to pre-populate the user's message with the same message from last time.
            // See 20552: ('Write Something..' text is lost on network error when attempting to share)
            wallPostObj.message = savedMessageFromLastFail;
            savedMessageFromLastFail = "";
        }
        
        // The backend passes in the following:
        //      wallPostObj: Contains the copy for the wall post
        //      withThesePermissions: permissions needed to post on the wall
        //      accessToken: the facebook token needed to set up the session
        //      tokenExpiry: the date the facebook token expires
        //      onSuccessCBToken: Callback method on success
        //      onCancelledCBToken: When the user cancels post
        backend.handlePostRequest_({
            facebookKeyValues: wallPostObj,
            accessToken: settings.get("facebook.access_token"),
            tokenExpire: settings.get("facebook.expires_at"),
            onSuccessCBToken: kirin.wrapCallback(function() {
                console.log("Publish successful");
                successCallback();
            }, "Facebook.", "publish."),
            onCancelledCBToken: kirin.wrapCallback(function() {
                console.log("Publish was cancelled");
                if(_.isFunction(cancelCallback)) {
                    cancelCallback();
                }
            }, "Facebook.", "cancelled."),
            onFailureCBToken: kirin.wrapCallback(function(devErrMsg) {
                console.log("Publish failed");
                showFacebookFailMsg();
                failureCallback(devErrMsg);
            }, "Facebook.", "failure.")
        });
    }
function() {
        if(savedMessageFromLastFail) {
            // Last time we tried to publish there was a failure preventing it from ending up on the wall.
            // In such a case, we want to pre-populate the user's message with the same message from last time.
            // See 20552: ('Write Something..' text is lost on network error when attempting to share)
            wallPostObj.message = savedMessageFromLastFail;
            savedMessageFromLastFail = "";
        }
        
        // The backend passes in the following:
        //      wallPostObj: Contains the copy for the wall post
        //      withThesePermissions: permissions needed to post on the wall
        //      accessToken: the facebook token needed to set up the session
        //      tokenExpiry: the date the facebook token expires
        //      onSuccessCBToken: Callback method on success
        //      onCancelledCBToken: When the user cancels post
        backend.handlePostRequest_({
            facebookKeyValues: wallPostObj,
            accessToken: settings.get("facebook.access_token"),
            tokenExpire: settings.get("facebook.expires_at"),
            onSuccessCBToken: kirin.wrapCallback(function() {
                console.log("Publish successful");
                successCallback();
            }, "Facebook.", "publish."),
            onCancelledCBToken: kirin.wrapCallback(function() {
                console.log("Publish was cancelled");
                if(_.isFunction(cancelCallback)) {
                    cancelCallback();
                }
            }, "Facebook.", "cancelled."),
            onFailureCBToken: kirin.wrapCallback(function(devErrMsg) {
                console.log("Publish failed");
                showFacebookFailMsg();
                failureCallback(devErrMsg);
            }, "Facebook.", "failure.")
        });
    }
function ( ) { if ( savedMessageFromLastFail ) { // Last time we tried to publish there was a failure preventing it from ending up on the wall. // In such a case, we want to pre-populate the user's message with the same message from last time. // See 20552: ('Write Something..' text is lost on network error when attempting to share) wallPostObj . message = savedMessageFromLastFail ; savedMessageFromLastFail = "" ; } // The backend passes in the following: //      wallPostObj: Contains the copy for the wall post //      withThesePermissions: permissions needed to post on the wall //      accessToken: the facebook token needed to set up the session //      tokenExpiry: the date the facebook token expires //      onSuccessCBToken: Callback method on success //      onCancelledCBToken: When the user cancels post backend . handlePostRequest_ ( { facebookKeyValues : wallPostObj , accessToken : settings . get ( "facebook.access_token" ) , tokenExpire : settings . get ( "facebook.expires_at" ) , onSuccessCBToken : kirin . wrapCallback ( function ( ) { console . log ( "Publish successful" ) ; successCallback ( ) ; } , "Facebook." , "publish." ) , onCancelledCBToken : kirin . wrapCallback ( function ( ) { console . log ( "Publish was cancelled" ) ; if ( _ . isFunction ( cancelCallback ) ) { cancelCallback ( ) ; } } , "Facebook." , "cancelled." ) , onFailureCBToken : kirin . wrapCallback ( function ( devErrMsg ) { console . log ( "Publish failed" ) ; showFacebookFailMsg ( ) ; failureCallback ( devErrMsg ) ; } , "Facebook." , "failure." ) } ) ; }
Function that deals with showing the preview popup and asking the user for their comment and confirmation for publishing. It will then post it with the mesasge once it gets user confirmation.
Function that deals with showing the preview popup and asking the user for their comment and confirmation for publishing . It will then post it with the mesasge once it gets user confirmation .