private async void WebViewOnNavigated(object sender, WebNavigatedEventArgs e) { var accessToken = ExtractAccessTokenFromUrl(e.Url); if (accessToken != "") { var facebookServices = new FacebookServices(); var facebookProfile = await facebookServices.GetFacebookProfileAsync(accessToken); Settings.FacebookId = facebookProfile.Id; string[] arr = new string[] { }; User user = new User { Facebookid = facebookProfile.Id, Fname = facebookProfile.FirstName, Lname = facebookProfile.LastName, Imgurl = facebookProfile.Picture.Data.Url, Description = string.Empty, Range = 0, Zipcode = string.Empty }; var favorService = new FavorService(); bool check = await favorService.CheckUserAsync(facebookProfile.Id); if (check == true) { favorService.CreateUserAsync(user); } await Navigation.PopToRootAsync(); } }
public FacebookScopedClient(string appId, string appSecret, string scope) { this.appId = appId; this.appSecret = appSecret; this.scope = scope; _facebookServices = DependencyResolver.Current.GetService <FacebookServices>(); }
//public const string graphApiToken = "https://graph.facebook.com/oauth/access_token?"; //public const string graphApiMe = "https://graph.facebook.com/me?"; public FacebookScopedClient() { appId = Constants.FB_APP_ID; appSecret = Constants.FB_APP_SECRET; scope = Constants.FB_SCOPE; _facebookServices = new FacebookServices();// DependencyResolver.Current.GetService<FacebookServices>(); }
public async Task SetFacebookUserProfileAsync(string accessToken) { var facebookServices = new FacebookServices(); var face = FacebookProfile = await facebookServices.GetFacebookProfileAsync(accessToken); Settings.IsEmailIn = face.email; Settings.IsUserdIn = face.FirstName + " " + face.LastName; }
public async Task SetFacebookUserProfileAsync(string accessToken) { if (UserServices.currentUser.FromFacebook) { var facebookServices = new FacebookServices(); FacebookProfile = await facebookServices.GetFacebookProfileAsync(accessToken); UserServices.currentUser.SetUser(FacebookProfile); } }
public async Task SetFacebookUserProfileAsync(string accessToken) { var facebookServices = new FacebookServices(); try { FacebookProfile = await facebookServices.GetFacebookProfileAsync(accessToken); if (FacebookProfile != null) { // await App.Current.MainPage.Navigation.PushAsync() } } catch { await App.Current.MainPage.DisplayAlert("", "Cannot log you into facebook", "ok"); } }
private async void WebViewOnNavigated(object sender, WebNavigatedEventArgs e) { var accessToken = ExtractAccessTokenFromUrl(e.Url); int pas = 0; if (accessToken != "") { var vm = new FacebookServices(); await vm.GetFacebookProfileAsync(accessToken); Content = MainStackLayout; pas += 1; } if (pas > 0) { pas = 0; App.Current.MainPage = new NavigationPage(new ProductPage()); } }
public async Task SetFacebookUserProfileAsync(string accessToken) { var facebookServices = new FacebookServices(); FacebookProfile = await facebookServices.GetFacebookProfileAsync(accessToken); User user = new User(); user.FirstName = FacebookProfile.FirstName; user.LastName = FacebookProfile.LastName; user.Username = FacebookProfile.Name; user.ProfilePhoto = FacebookProfile.Picture.Data.Url; user.Gender = FacebookProfile.Gender; user.Age = FacebookProfile.AgeRange.Min; ObservableCollection <User> userIsInSystem = await userManager.GetUserByUsernameAsync(user.Username); if (userIsInSystem.Count == 0) { Settings.UserName = user.Username; Settings.UserPassword = "******"; await userManager.SaveUserAsync(user); } }
public async Task SetFacebookUserProfileAsync(string accessToken) { var facebookServices = new FacebookServices(); FacebookProfile = await facebookServices.GetFacebookProfileAsync(accessToken); }
public void UpdateStoreRegistrationSources() { try { var _wepServices = new WidgetEndpointServices(); var _fbServices = new FacebookServices(); var stores = WebStoreRepository.GetMany(x => x.RegistrationSourceId == null).ToList().OrderByDescending(x => x.StoreID).ToArray(); foreach (var store in stores) { //check Wix string error; if (store.WixInstanceId != null || store.TrackingID.LastIndexOf("zombie", StringComparison.Ordinal) >= 0) { UpdateStoreRegistrationSource(store, CommonEnums.eRegistrationSources.WIX); if (store.WixInstanceId != null) { Guid instanceId; if (Guid.TryParse(store.WixInstanceId.ToString(), out instanceId)) { if (instanceId != Guid.Empty) { _wepServices.SavePluginInstallaltion(new PluginInstallationDTO { Type = PluginEnums.ePluginType.WIX , Uid = instanceId.ToString() , UserId = store.OwnerUserID , AddOn = store.AddOn , IsActive = true }, out error); } } } else { //check Zombie var uid = store.TrackingID.Substring(store.TrackingID.LastIndexOf("_", StringComparison.Ordinal) + 1); _wepServices.SavePluginInstallaltion(new PluginInstallationDTO { Type = PluginEnums.ePluginType.WIX , Uid = uid , UserId = store.OwnerUserID , AddOn = store.AddOn , IsActive = false }, out error); } continue; } //check FB long pageId; if (Int64.TryParse(store.TrackingID, out pageId)) { if (pageId > 1000000 && _fbServices.ValidatePage(pageId)) //fbPageUrl.IsUrlValid() { UpdateStoreRegistrationSource(store, CommonEnums.eRegistrationSources.FB); var fbPageUrl = Utils.PageId2FacebookPageUrl(pageId); var appUrl = fbPageUrl.FacebookPageUrl2AppUrl(pageId); _wepServices.SavePluginInstallaltion(new PluginInstallationDTO { Type = PluginEnums.ePluginType.FB , Uid = pageId.ToString() , UserId = store.OwnerUserID , AddOn = store.AddOn , Domain = appUrl , IsActive = !String.IsNullOrEmpty(appUrl) }, out error); continue; } } //update as LFE store by default UpdateStoreRegistrationSource(store, CommonEnums.eRegistrationSources.LFE); } } catch (Exception ex) { Logger.Error("UpdateStoreRegistrationSources", ex, CommonEnums.LoggerObjectTypes.Application); } }