示例#1
0
        private async void ChallengeV2kWebViewDOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args)
        {
            // {"location": "instagram://checkpoint/dismiss", "type": "CHALLENGE_REDIRECTION", "status": "ok"}

            SignInVM.LoadingOff();
            try
            {
                string html = await FacebookWebView.InvokeScriptAsync("eval", new string[] { "document.documentElement.outerHTML;" });

                if (html.Contains("\"instagram://checkpoint/dismiss\"") || html.Contains("instagram://checkpoint/dismiss"))
                {
                    ChallengeV2CloseButtonClick(null, null);

                    SignInVM.Login(null);
                }
            }
            catch { }
        }
示例#2
0
        private async void FbStart()
        {
            try
            {
                FacebookGrid.Visibility = Visibility.Visible;
                SignInVM.LoadingOn();
                using (var client = new HttpClient())
                {
                    var response = await client.GetAsync(InstaFbHelper.FacebookAddress);

                    if (!response.IsSuccessStatusCode)
                    {
                        FacebookGrid.Visibility = Visibility.Collapsed;
                        SignInVM.LoadingOff();
                        FacebookBlockedMsg.ShowMsg();
                        return;
                    }
                }
            }
            catch
            {
                FacebookGrid.Visibility = Visibility.Collapsed;
                SignInVM.LoadingOff();
                FacebookBlockedMsg.ShowMsg();
                return;
            }
            try
            {
                UserAgentHelper.SetUserAgent("Mozilla/5.0 (Linux; Android 4.4; Nexus 5 Build/_BuildID_) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36");
            }
            catch { }
            try
            {
                DeleteFacebookCookies();
            }
            catch { }
            FacebookGrid.Visibility = Visibility.Visible;
            SignInVM.LoadingOn();
            await Task.Delay(1500);

            var facebookLogin = InstaFbHelper.GetFacebookLoginUri();

            FacebookWebView.Navigate(facebookLogin);
        }
示例#3
0
        private async void WebViewFacebookDOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args)
        {
            try
            {
                SignInVM.LoadingOff();
                try
                {
                    string html = await FacebookWebView.InvokeScriptAsync("eval", new string[] { "document.documentElement.outerHTML;" });

                    if (InstaFbHelper.IsLoggedIn(html))
                    {
                        var cookies   = GetBrowserCookie(args.Uri);
                        var sbCookies = new StringBuilder();
                        foreach (var item in cookies)
                        {
                            sbCookies.Append($"{item.Name}={item.Value}; ");
                        }

                        var fbToken = InstaFbHelper.GetAccessToken(html);

                        Helper.InstaApiTrash = Helper.BuildApi();
                        await Helper.InstaApiTrash.SendRequestsBeforeLoginAsync();

                        SignInVM.LoadingOn();
                        var loginResult = await Helper.InstaApiTrash.LoginWithFacebookAsync(fbToken, sbCookies.ToString());

                        FacebookGrid.Visibility = Visibility.Collapsed;
                        SignInVM.HandleLogin(loginResult);
                    }
                }
                catch { }
            }
            catch (Exception ex)
            {
                ex.PrintException("WebViewFacebookDOMContentLoaded");
            }
        }
示例#4
0
        private async void ImportFromLocalButtonClick(object sender, RoutedEventArgs e)
        {
            try
            {
                Helper.DontUseTimersAndOtherStuff = true;
                var filePicker = new FileOpenPicker
                {
                    ViewMode         = PickerViewMode.Thumbnail,
                    CommitButtonText = "Open and load"
                };
                filePicker.FileTypeFilter.Add(Helper.SessionFileType);

                var file = await filePicker.PickSingleFileAsync();

                Helper.DontUseTimersAndOtherStuff = false;
                if (file == null)
                {
                    return;
                }
                try
                {
                    var json = await FileIO.ReadTextAsync(file);

                    if (string.IsNullOrEmpty(json))
                    {
                        ShowError();
                        return;
                    }
                    var content = CryptoHelper.Decrypt(json);
                    if (string.IsNullOrEmpty(content))
                    {
                        ShowError();
                        return;
                    }
                    Helper.InstaApiTrash = Helper.BuildApi();
                    await Helper.InstaApiTrash.LoadStateDataFromStringAsync(content);

                    if (!Helper.InstaApiTrash.IsUserAuthenticated)
                    {
                        ShowError();
                    }
                    else
                    {
                        SignInVM.LoadingOn();
                        var result = await Helper.InstaApiTrash.UserProcessor.GetCurrentUserAsync();

                        SignInVM.LoadingOff();
                        if (result.Succeeded)
                        {
                            Helper.InstaApi = Helper.InstaApiTrash;
                            Helper.AddInstaApi(Helper.InstaApi);
                            Helper.InstaApiSelectedUsername = Helper.InstaApiTrash.GetLoggedUser().LoggedInUser.UserName.ToLower();
                            Helper.InstaApiTrash            = null;
                            MultiApiHelper.SetupPushNotification(Helper.InstaApiList);

                            SessionHelper.SaveCurrentSession();
                            //NavigationService.Navigate(typeof(MainPage));
                            MainPage.Current?.NavigateToMainView();
                        }
                        else
                        {
                            ShowError();
                        }
                    }
                }
                catch
                {
                    ShowError();
                }
            }
            catch
            {
                Helper.DontUseTimersAndOtherStuff = false;
            }
        }
示例#5
0
 private void FacebookCloseButtonClick(object sender, RoutedEventArgs e)
 {
     FacebookGrid.Visibility = Visibility.Collapsed;
     SignInVM.LoadingOff();
 }