ACME 824: Suggested Friends do not repopulate if you disconnect and reconnect to Facebook API in same viewer session
parent
6368714806
commit
481abb1381
|
|
@ -197,9 +197,11 @@ public:
|
|||
{
|
||||
LL_DEBUGS("FacebookConnect") << "Disconnect successful. content: " << content << LL_ENDL;
|
||||
|
||||
// Clear all facebook stuff
|
||||
LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_NOT_CONNECTED);
|
||||
// Clear data
|
||||
LLFacebookConnect::instance().clearInfo();
|
||||
LLFacebookConnect::instance().clearContent();
|
||||
//Notify state change
|
||||
LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_NOT_CONNECTED);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -320,7 +322,9 @@ LLFacebookConnect::LLFacebookConnect()
|
|||
: mConnectionState(FB_NOT_CONNECTED),
|
||||
mConnected(false),
|
||||
mInfo(),
|
||||
mContent()
|
||||
mContent(),
|
||||
mRefreshInfo(false),
|
||||
mRefreshContent(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -388,18 +392,24 @@ void LLFacebookConnect::checkConnectionToFacebook(bool auto_connect)
|
|||
|
||||
void LLFacebookConnect::loadFacebookInfo()
|
||||
{
|
||||
const bool follow_redirects = false;
|
||||
const F32 timeout = HTTP_REQUEST_EXPIRY_SECS;
|
||||
LLHTTPClient::get(getFacebookConnectURL("/info"), new LLFacebookInfoResponder(),
|
||||
LLSD(), timeout, follow_redirects);
|
||||
if(mRefreshInfo)
|
||||
{
|
||||
const bool follow_redirects = false;
|
||||
const F32 timeout = HTTP_REQUEST_EXPIRY_SECS;
|
||||
LLHTTPClient::get(getFacebookConnectURL("/info"), new LLFacebookInfoResponder(),
|
||||
LLSD(), timeout, follow_redirects);
|
||||
}
|
||||
}
|
||||
|
||||
void LLFacebookConnect::loadFacebookFriends()
|
||||
{
|
||||
const bool follow_redirects = false;
|
||||
const F32 timeout = HTTP_REQUEST_EXPIRY_SECS;
|
||||
LLHTTPClient::get(getFacebookConnectURL("/friends"), new LLFacebookFriendsResponder(),
|
||||
LLSD(), timeout, follow_redirects);
|
||||
if(mRefreshContent)
|
||||
{
|
||||
const bool follow_redirects = false;
|
||||
const F32 timeout = HTTP_REQUEST_EXPIRY_SECS;
|
||||
LLHTTPClient::get(getFacebookConnectURL("/friends"), new LLFacebookFriendsResponder(),
|
||||
LLSD(), timeout, follow_redirects);
|
||||
}
|
||||
}
|
||||
|
||||
void LLFacebookConnect::postCheckin(const std::string& location, const std::string& name, const std::string& description, const std::string& image, const std::string& message)
|
||||
|
|
@ -495,6 +505,8 @@ void LLFacebookConnect::updateStatus(const std::string& message)
|
|||
void LLFacebookConnect::storeInfo(const LLSD& info)
|
||||
{
|
||||
mInfo = info;
|
||||
mRefreshInfo = false;
|
||||
|
||||
sInfoWatcher->post(info);
|
||||
}
|
||||
|
||||
|
|
@ -503,9 +515,15 @@ const LLSD& LLFacebookConnect::getInfo() const
|
|||
return mInfo;
|
||||
}
|
||||
|
||||
void LLFacebookConnect::clearInfo()
|
||||
{
|
||||
mInfo = LLSD();
|
||||
}
|
||||
|
||||
void LLFacebookConnect::storeContent(const LLSD& content)
|
||||
{
|
||||
mContent = content;
|
||||
mRefreshContent = false;
|
||||
|
||||
sContentWatcher->post(content);
|
||||
}
|
||||
|
|
@ -520,11 +538,18 @@ void LLFacebookConnect::clearContent()
|
|||
mContent = LLSD();
|
||||
}
|
||||
|
||||
void LLFacebookConnect::setDataDirty()
|
||||
{
|
||||
mRefreshInfo = true;
|
||||
mRefreshContent = true;
|
||||
}
|
||||
|
||||
void LLFacebookConnect::setConnectionState(LLFacebookConnect::EConnectionState connection_state)
|
||||
{
|
||||
if(connection_state == FB_CONNECTED)
|
||||
{
|
||||
setConnected(true);
|
||||
setDataDirty();
|
||||
}
|
||||
else if(connection_state == FB_NOT_CONNECTED)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -69,9 +69,11 @@ public:
|
|||
|
||||
void storeInfo(const LLSD& info);
|
||||
const LLSD& getInfo() const;
|
||||
void clearContent();
|
||||
void clearInfo();
|
||||
void storeContent(const LLSD& content);
|
||||
const LLSD& getContent() const;
|
||||
void clearContent();
|
||||
void setDataDirty();
|
||||
|
||||
void setConnectionState(EConnectionState connection_state);
|
||||
void setConnected(bool connected);
|
||||
|
|
@ -92,6 +94,8 @@ private:
|
|||
BOOL mConnected;
|
||||
LLSD mInfo;
|
||||
LLSD mContent;
|
||||
bool mRefreshInfo;
|
||||
bool mRefreshContent;
|
||||
|
||||
static boost::scoped_ptr<LLEventPump> sStateWatcher;
|
||||
static boost::scoped_ptr<LLEventPump> sInfoWatcher;
|
||||
|
|
|
|||
|
|
@ -835,12 +835,16 @@ void LLPanelPeople::updateRecentList()
|
|||
|
||||
bool LLPanelPeople::onConnectedToFacebook(const LLSD& data)
|
||||
{
|
||||
if (data.get("enum").asInteger() == LLFacebookConnect::FB_CONNECTED)
|
||||
{
|
||||
LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLPanelPeople");
|
||||
LLSD::Integer connection_state = data.get("enum").asInteger();
|
||||
|
||||
if (connection_state == LLFacebookConnect::FB_CONNECTED)
|
||||
{
|
||||
LLFacebookConnect::instance().loadFacebookFriends();
|
||||
}
|
||||
else if(connection_state == LLFacebookConnect::FB_NOT_CONNECTED)
|
||||
{
|
||||
updateSuggestedFriendList();
|
||||
};
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -852,21 +856,16 @@ void LLPanelPeople::updateFacebookList(bool visible)
|
|||
LLEventPumps::instance().obtain("FacebookConnectContent").stopListening("LLPanelPeople"); // just in case it is already listening
|
||||
LLEventPumps::instance().obtain("FacebookConnectContent").listen("LLPanelPeople", boost::bind(&LLPanelPeople::updateSuggestedFriendList, this));
|
||||
|
||||
if (mTryToConnectToFbc)
|
||||
{
|
||||
// try to reconnect to facebook!
|
||||
if (LLFacebookConnect::instance().isConnected())
|
||||
{
|
||||
LLFacebookConnect::instance().loadFacebookFriends();
|
||||
}
|
||||
else
|
||||
{
|
||||
LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLPanelPeople"); // just in case it is already listening
|
||||
LLEventPumps::instance().obtain("FacebookConnectState").listen("LLPanelPeople", boost::bind(&LLPanelPeople::onConnectedToFacebook, this, _1));
|
||||
LLFacebookConnect::instance().checkConnectionToFacebook();
|
||||
}
|
||||
LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLPanelPeople"); // just in case it is already listening
|
||||
LLEventPumps::instance().obtain("FacebookConnectState").listen("LLPanelPeople", boost::bind(&LLPanelPeople::onConnectedToFacebook, this, _1));
|
||||
|
||||
// don't try again
|
||||
if (LLFacebookConnect::instance().isConnected())
|
||||
{
|
||||
LLFacebookConnect::instance().loadFacebookFriends();
|
||||
}
|
||||
else if(mTryToConnectToFbc)
|
||||
{
|
||||
LLFacebookConnect::instance().checkConnectionToFacebook();
|
||||
mTryToConnectToFbc = false;
|
||||
}
|
||||
|
||||
|
|
@ -874,6 +873,7 @@ void LLPanelPeople::updateFacebookList(bool visible)
|
|||
}
|
||||
else
|
||||
{
|
||||
LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLPanelPeople");
|
||||
LLEventPumps::instance().obtain("FacebookConnectContent").stopListening("LLPanelPeople");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue