Skip to content
This repository has been archived by the owner on Aug 3, 2019. It is now read-only.

Added the ability to publish me/og.like action and to preform blocking publish requests #47

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

tamir7
Copy link

@tamir7 tamir7 commented Nov 28, 2013

Default is still async, so no one using the lib and upgrading will need to change any code, but all publish functions can have another param that what will make Facebook SDK do executeAndWait instead of RequestAsyncTask().execute

@sromku
Copy link
Owner

sromku commented Nov 28, 2013

Hi @tamir7

Thanks a lot for making this library better! :)

To your commits:

  1. Commit 24ce653 - publish og.like
    Can you please explain more about the Like abilities. What is the object I can like on facebook or what is the correct input? Example will be great here.
  2. Commit dbb8a30 - sync publish option
    I see a lot of changes here. Actually I never used synced calls to facebook, but if someone use it, then it will be good to have it here. It also looks like you made the code cleaner by removing duplicated code of handling response. One of the reasons I kept the code like this is because the postId = graphResponse.getString("id"); for publishing feed and story can be changed and be different in the future. Thus, I wanted first to cover as much as possible in functionality and only then see what can be cleaned. I will test it and comment before making merge of this commit.

Thanks again!
Roman

@sromku
Copy link
Owner

sromku commented Dec 1, 2013

@tamir7 How are you :) ?
I want to start merging pull requests.
Can you give example to the first commit please (with Like). This commit I will merge.

For the second one, I thought about next suggestion and what do you think:
The SimpleFacebookConfiguration will have additional setting. Something like setPublishAsync(boolean) which will cause the publish actions to make the calls in a way you set the boolean flag.
Why to do this such way:

  1. I think, if you work in a sync mode (when you actually wait for callback), then you have to implement publishing facebook actions in separate thread, which means that the design of your application will always call facebook actions in separate thread. The developer will choose, whereas he wants to use all facebook calls in sync or async through all app. I can't see application design, that one time you will publish synchrony and another time asynchrony.
  2. Setting from configuration will leave the api cleaner. You have added publish(.., boolean async), which is good, but it makes other publish(...) redundant. There is no reason to have publish methods without boolean async flag.

Your thought?
Thanks!

@tamir7
Copy link
Author

tamir7 commented Dec 1, 2013

Hey. There's really not a lot of documentation for the like graph action
that I could find, so its all by trial and error. The object param
specifies a link to a web page. Facebook parses the page and gets the
facebook tags out of it to build the graph story. I've added Image, and
Title to override the params in the tags, and Link param to make the story
clickable (and directed to our web page.) There might be a way to post a
like without the object param if you specify all the tags the like action
needs, but I don't have a list of all of them.

My Like code is:

   Like like = new Like.Builder().setObject(url)
            .setTitle(name)
            .setLink(url)
            .setImage(imageUrl)
            .build();

    SimpleFacebook.getInstance().publish(like, new OnPublishListener() {

        @Override
        public void onFail(String reason) {

        }

        @Override
        public void onException(Throwable throwable) {

        }

        @Override
        public void onThinking() {
        }

        @Override
        public void onComplete(String id) {
        }
    }, false);

Setting the async flag in configuration is not an ideal solution. My app
uses both sync and async calls, I'm getting data asyncronicly, from
activity code, and posting syncronicly from a service. And as an API, the
library should be flexible enough to give the users choose the mode for
each call. I've kept the existing API as is, to not break the code for
users that already use the API.

On Sun, Dec 1, 2013 at 10:11 AM, Roman Kushnarenko <[email protected]

wrote:

@tamir7 https://github.com/tamir7 How are you :) ?
I want to start merging pull requests.
Can you give example to the first commit please (with Like). This commit I
will merge.

For the second one, I thought about next suggestion and what do you think:
The SimpleFacebookConfiguration will have additional setting. Something
like setPublishAsync(boolean) which will cause the publish actions to
make the calls in a way you set the boolean flag.
Why to do this such way:

I think, if you work in a sync mode (when you actually wait for
callback), then you have to implement publishing facebook actions in
separate thread, which means that the design of your application will
always call facebook actions in separate thread. The developer will choose,
whereas he wants to use all facebook calls in sync or async through all
app. I can't see application design, that one time you will publish
synchrony and another time asynchrony.
2.

Setting from configuration will leave the api cleaner. You have added publish(..,
boolean async), which is good, but it makes other publish(...)redundant. There is no reason to have publish methods without boolean
async flag.

Your thought?
Thanks!


Reply to this email directly or view it on GitHubhttps://github.com//pull/47#issuecomment-29569325
.

@fallen888
Copy link

Hey, I'm really looking forward to the Like building and publishing. When can this pull request get merged into the main branch? Thanks in advance!

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

Successfully merging this pull request may close these issues.

3 participants