diff options
author | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-07-31 19:04:45 -0700 |
---|---|---|
committer | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-07-31 19:04:45 -0700 |
commit | a2b1e06c3def4a8a97a41f3379c336864ede21f8 (patch) | |
tree | 878f1ce1d9c2f90812b250a643cf893cf4282850 /indra/newview | |
parent | d0764f57a5b9591b452b6718d53a8169499e1856 (diff) |
ACME-778: Adjusted the facebook code so that isConnected() does not depend on state changes. Instead it returns true if the user successfully connected and false if the user successfully disconnected.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfacebookconnect.cpp | 23 | ||||
-rw-r--r-- | indra/newview/llfacebookconnect.h | 9 | ||||
-rw-r--r-- | indra/newview/llfloatersocial.cpp | 27 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/strings.xml | 3 |
4 files changed, 41 insertions, 21 deletions
diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index 2dbbb71cab..a7b7224d28 100644 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -199,6 +199,7 @@ public: } else { + LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_DISCONNECT_FAILED); log_facebook_connect_error("Disconnect", status, reason, content.get("error_code"), content.get("error_description")); } } @@ -313,6 +314,8 @@ public: // LLFacebookConnect::LLFacebookConnect() : mConnectionState(FB_NOT_CONNECTED), + mConnected(false), + mInfo(), mContent(), mGeneration(0) { @@ -334,8 +337,7 @@ void LLFacebookConnect::openFacebookWeb(std::string url) std::string LLFacebookConnect::getFacebookConnectURL(const std::string& route) { //static std::string sFacebookConnectUrl = gAgent.getRegion()->getCapability("FacebookConnect"); - //static std::string sFacebookConnectUrl = "http://int.fbc.aditi.lindenlab.com/agent/" + gAgentID.asString(); // TEMPORARY HACK FOR FB DEMO - Cho - static std::string sFacebookConnectUrl = "http://pdp15.lindenlab.com/fbc/agent/" + gAgentID.asString(); // ANOTHER HACK SO WE POINT TO PDP15 + static std::string sFacebookConnectUrl = "http://int.fbc.aditi.lindenlab.com/fbc/agent/" + gAgentID.asString(); // TEMPORARY HACK FOR FB DEMO - Cho std::string url = sFacebookConnectUrl + route; llinfos << url << llendl; @@ -360,13 +362,10 @@ void LLFacebookConnect::disconnectFromFacebook() void LLFacebookConnect::checkConnectionToFacebook(bool auto_connect) { - if ((mConnectionState == FB_NOT_CONNECTED) || (mConnectionState == FB_CONNECTION_FAILED) || (mConnectionState == FB_POST_FAILED)) - { const bool follow_redirects = false; const F32 timeout = HTTP_REQUEST_EXPIRY_SECS; LLHTTPClient::get(getFacebookConnectURL("/connection"), new LLFacebookConnectedResponder(auto_connect), LLSD(), timeout, follow_redirects); - } } void LLFacebookConnect::loadFacebookInfo() @@ -507,6 +506,15 @@ void LLFacebookConnect::clearContent() void LLFacebookConnect::setConnectionState(LLFacebookConnect::EConnectionState connection_state) { + if(connection_state == FB_CONNECTED) + { + setConnected(true); + } + else if(connection_state == FB_NOT_CONNECTED) + { + setConnected(false); + } + if (mConnectionState != connection_state) { LLSD state_info; @@ -516,3 +524,8 @@ void LLFacebookConnect::setConnectionState(LLFacebookConnect::EConnectionState c mConnectionState = connection_state; } + +void LLFacebookConnect::setConnected(bool connected) +{ + mConnected = connected; +} diff --git a/indra/newview/llfacebookconnect.h b/indra/newview/llfacebookconnect.h index be3028e3a0..b9afd181e9 100644 --- a/indra/newview/llfacebookconnect.h +++ b/indra/newview/llfacebookconnect.h @@ -52,7 +52,8 @@ public: FB_POSTING = 4, FB_POSTED = 5, FB_POST_FAILED = 6, - FB_DISCONNECTING = 7 + FB_DISCONNECTING = 7, + FB_DISCONNECT_FAILED = 8 }; void connectToFacebook(const std::string& auth_code = "", const std::string& auth_state = ""); // Initiate the complete FB connection. Please use checkConnectionToFacebook() in normal use. @@ -73,8 +74,9 @@ public: const LLSD& getContent() const; void setConnectionState(EConnectionState connection_state); - bool isConnected() { return ((mConnectionState == FB_CONNECTED) || (mConnectionState == FB_DISCONNECTING) || (mConnectionState == FB_POSTING) || (mConnectionState == FB_POSTED)); } - bool isTransactionOngoing() { return ((mConnectionState == FB_CONNECTION_IN_PROGRESS) || (mConnectionState == FB_POSTING)); } + void setConnected(bool connected); + bool isConnected() { return mConnected; } + bool isTransactionOngoing() { return ((mConnectionState == FB_CONNECTION_IN_PROGRESS) || (mConnectionState == FB_POSTING) || (mConnectionState == FB_DISCONNECTING)); } EConnectionState getConnectionState() { return mConnectionState; } S32 generation() { return mGeneration; } @@ -88,6 +90,7 @@ private: std::string getFacebookConnectURL(const std::string& route = ""); EConnectionState mConnectionState; + BOOL mConnected; LLSD mInfo; LLSD mContent; S32 mGeneration; diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 8ca5043a35..0041ee9d7e 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -688,20 +688,17 @@ void LLSocialAccountPanel::onVisibilityChange(const LLSD& new_visibility) bool LLSocialAccountPanel::onFacebookConnectStateChange(const LLSD& data) { - - switch (data.get("enum").asInteger()) + if(LLFacebookConnect::instance().isConnected()) { - case LLFacebookConnect::FB_CONNECTED: - case LLFacebookConnect::FB_POSTING: - case LLFacebookConnect::FB_POSTED: - case LLFacebookConnect::FB_POST_FAILED: + //In process of disconnecting so leave the layout as is + if(data.get("enum").asInteger() != LLFacebookConnect::FB_DISCONNECTING) + { showConnectedLayout(); - break; - case LLFacebookConnect::FB_NOT_CONNECTED: - case LLFacebookConnect::FB_CONNECTION_IN_PROGRESS: - case LLFacebookConnect::FB_CONNECTION_FAILED: - showDisconnectedLayout(); - break; + } + } + else + { + showDisconnectedLayout(); } return false; @@ -882,6 +879,12 @@ void LLFloaterSocial::draw() mStatusLoadingText->setValue(status_text); mStatusLoadingIndicator->setVisible(true); break; + case LLFacebookConnect::FB_DISCONNECT_FAILED: + // Error disconnecting from the service + mStatusErrorText->setVisible(true); + status_text = LLTrans::getString("SocialFacebookErrorDisconnecting"); + mStatusErrorText->setValue(status_text); + break; } } LLFloater::draw(); diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 02b64ef7e3..d75b65896c 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -151,9 +151,10 @@ Please try logging in again in a minute.</string> <!-- Facebook Connect and, eventually, other Social Network --> <string name="SocialFacebookConnecting">Connecting to Facebook...</string> <string name="SocialFacebookPosting">Posting...</string> + <string name="SocialFacebookDisconnecting">Disconnecting from Facebook...</string> <string name="SocialFacebookErrorConnecting">Problem connecting to Facebook</string> <string name="SocialFacebookErrorPosting">Problem posting to Facebook</string> - <string name="SocialFacebookDisconnecting">Disconnecting from Facebook...</string> + <string name="SocialFacebookErrorDisconnecting">Problem disconnecting from Facebook</string> <!-- Tooltip --> <string name="TooltipPerson">Person</string><!-- Object under mouse pointer is an avatar --> |