public dealWithSACWebView(Activity f, AccountOAuth.OAuthTypes ProviderType, ISocialProviderManager Provider, ImageButton btnBack) { this.parent = f; this.Provider = Provider; this.ProviderType = ProviderType; string authUrl = this.Provider.BrowserAuthUrl; btnBack.Click += delegate { parent.Finish(); }; switch (ProviderType) { case AccountOAuth.OAuthTypes.Google: AccessTokenReceived += (occurred, expires, accessToken, accessTokenSecret, refreshToken) => { AndroidData.GooglePlusAccessToken = accessToken; AndroidData.GooglePlusRefreshToken = refreshToken; AndroidData.GoogleAccessTokenExpiration = expires; ShowAfterLoginScreen(); }; break; case AccountOAuth.OAuthTypes.FaceBook: LFacebookManager lFace = new LFacebookManager(LOLConstants.FacebookAPIKey, LOLConstants.FacebookAppSecret); AccessTokenReceived += (occurred, expires, accessToken, accessTokenSecret, refreshToken) => { try { if (lFace.RefreshAccessToken()) { AndroidData.FacebookAccessToken = lFace.AccessToken; AndroidData.FacebookAccessTokenExpiration = lFace.AccessTokenExpirationTime ?? DateTime.Now; }//end if } catch { AndroidData.FacebookAccessToken = accessToken; AndroidData.FacebookAccessTokenExpiration = expires; } ShowAfterLoginScreen(); }; break; case AccountOAuth.OAuthTypes.LinkedIn: AccessTokenReceived += (occurred, expires, accessToken, accessTokenSecret, refreshToken) => { AndroidData.LinkedInAccessToken = accessToken; AndroidData.LinkedInAccessTokenSecret = accessTokenSecret; ShowAfterLoginScreen(); }; break; } }
public dealWithWebView(Activity f, AccountOAuth.OAuthTypes ProviderType, ISocialProviderManager Provider, ImageButton btnBack) { this.parent = f; this.Provider = Provider; this.ProviderType = ProviderType; string authUrl = this.Provider.BrowserAuthUrl; user = AndroidData.user; btnBack.Click += delegate { parent.Finish(); }; switch (ProviderType) { case AccountOAuth.OAuthTypes.Google: AccessTokenReceived += (occurred, expires, accessToken, accessTokenSecret, refreshToken) => { AndroidData.GooglePlusAccessToken = accessToken; AndroidData.GooglePlusRefreshToken = refreshToken; AndroidData.GoogleAccessTokenExpiration = expires; startUserLogin(Provider); }; break; case AccountOAuth.OAuthTypes.FaceBook: LFacebookManager lFace = new LFacebookManager(LOLConstants.FacebookAPIKey, LOLConstants.FacebookAppSecret); AccessTokenReceived += (occurred, expires, accessToken, accessTokenSecret, refreshToken) => { try { if (lFace.RefreshAccessToken()) { AndroidData.FacebookAccessToken = lFace.AccessToken; AndroidData.FacebookAccessTokenExpiration = lFace.AccessTokenExpirationTime ?? DateTime.Now; } } catch { AndroidData.FacebookAccessToken = accessToken; AndroidData.FacebookAccessTokenExpiration = expires; } startUserLogin(Provider); }; break; case AccountOAuth.OAuthTypes.LinkedIn: AccessTokenReceived += (occurred, expires, accessToken, accessTokenSecret, refreshToken) => { AndroidData.LinkedInAccessToken = accessToken; AndroidData.LinkedInAccessTokenSecret = accessTokenSecret; startUserLogin(Provider); }; break; case AccountOAuth.OAuthTypes.Twitter: LTwitterManager lTwit = new LTwitterManager(LOLConstants.TwitterConsumerKey, LOLConstants.TwitterConsumerSecret, AndroidData.TwitterAccessToken, AndroidData.TwitterAccessTokenSecret, AndroidData.TwitterScreenName, AndroidData.TwitterUserId); AccessTokenReceived += (occurred, expires, accessToken, accessTokenSecret, refreshToken) => { AndroidData.TwitterAccessToken = accessToken; AndroidData.TwitterAccessTokenSecret = accessTokenSecret; AndroidData.TwitterScreenName = lTwit.ScreenName; AndroidData.TwitterUserId = lTwit.UserId; startUserLogin(Provider); }; break; case AccountOAuth.OAuthTypes.YouTube: AccessTokenReceived += (occurred, expires, accessToken, accessTokenSecret, refreshToken) => { AndroidData.YouTubeAccessToken = accessToken; AndroidData.YouTubeRefreshToken = refreshToken; AndroidData.YouTubeAccessTokenExpiration = expires; startUserLogin(Provider); }; break; } }