ShareKit icon indicating copy to clipboard operation
ShareKit copied to clipboard

making login/logout buttons

Open jwombat opened this issue 14 years ago • 6 comments

Is there a recommended way to access sharer attributes to get access to the sessions? I need to have buttons for login/logout of the different sharers, and it would be best if the buttons were connected to what SHK is doing.

jwombat avatar Apr 23 '11 21:04 jwombat

For status, you can check [ServiceClassName isAuthorized] to see whether the service has been authorized.

For logout, call [SHK logoutOfService:@"ServiceClassName"].

For login, you can instantiate a sharer and call [sharer authorize] to force the login process. However, if you need notification of the successful login (likely), you'll need to modify the source code. I've posted a working implementation here: #213

smkiewel avatar Apr 24 '11 17:04 smkiewel

How can I know if facebook or twittter session has been started? or is that the same as [ServiceClassName isAuthorized] ? I'd like to know this to enable or disable my logout buttons. Thanks.

Ricardo1980 avatar Aug 29 '11 21:08 Ricardo1980

See the issue linked in my previous comment (#213). It has code that was included in the main branch that produces notifications. There is an example of use there as well.

smkiewel avatar Aug 29 '11 22:08 smkiewel

Thanks smkiewel, but notifications is not what I'm looking for. I'd like something like this in my viewDidLoad: if (facebook logged) { facebookButton.tittle.text=@"Log Out" } else { facebookButton.tittle.text=@"Log In" }

Maybe isAuthorized is for that, I'm going to try that now. What do you think? Thanks. BTW, how can I put code here? is there any keyword?

Ricardo1980 avatar Aug 30 '11 07:08 Ricardo1980

Yes, you would do something like:

if ([SHKFacebook isAuthorized]) {
  facebookButton.title.text=@"Log Out";
} else {
  facebookButton.title.text=@"Log In";
}

Code formatting is done by prepending 4 spaces. See the "Github Flavored Markdown" link at the top right of the comment box.

smkiewel avatar Aug 30 '11 12:08 smkiewel

OK, thanks a lot.

BTW, do you know if ShareKit is still be maintained by his author?

Ricardo1980 avatar Aug 30 '11 12:08 Ricardo1980