[ALOY-237] social builtin create and authorize functions do not seem to be working as expected
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2012-08-29T15:54:49.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | Benjamin Hatfield |
Assignee | Russell McMahon |
Created | 2012-08-29T14:59:57.000+0000 |
Updated | 2014-06-22T13:23:09.000+0000 |
Description
Reproduction:
Copy and paste the code below into the index.js controller. Replace consumer-secret and consumer-key with the ones given when registering a Twitter app. Build and run for iPhone.
var social = require('alloy/social').create({
site: 'twitter',
consumerSecret: 'consumer-secret',
consumerKey: 'consumer-key'
});
Ti.API.info("social:" + JSON.stringify(social));
social.authorize(function(e){
alert('Callback');
});
var status = social.isAuthorized()
Ti.API.info("isAuthorized:" + status);
Results:
When executing the authorize function, the application should have either launched an authorize UI window, reported an error or the callback should have been called. I did not see any of these events.
Also, should the object returned when creating an instance not be empty?
Console Output:
{noformat}
[INFO] *********************************************
[INFO] If you like the OAuth Adapter, consider donating at
[INFO] https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=T5HUU4J5EQTJU&lc=IT&item_name=OAuth%20Adapter¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted
[INFO] *********************************************
[INFO] social:{}
[INFO] isAuthorized:false
[WARN] Titanium.UI.AUTODETECT_NONE DEPRECATED in 1.8.0, in favor of Ti.UI.iOS.AUTODETECT_NONE.
{noformat}
Oops. So this one is actually working. I could not see the authorize UI window until I made the main view transparent. It was opening it in the background. I had to do'$.index.open()' before calling the social functions.