/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { this.InitializeComponent(); this.Suspending += OnSuspending; this.UnhandledException += App_UnhandledException; App.Current.Suspending += Current_Suspending; try { UserAgentHelper.SetUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36"); } catch { } }
public async void StartChallengeV2(InstaChallengeLoginInfo challengeLoginInfo) { try { try { var device = Helper.InstaApi.GetCurrentDevice(); //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"); UserAgentHelper.SetUserAgent($"Mozilla/5.0 (Linux; Android {device.AndroidVer.VersionNumber}; {device.DeviceModelIdentifier}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.86 Mobile Safari/537.36"); } catch { try { UserAgentHelper.SetUserAgent($"Mozilla/5.0 (Linux; Android 10; SM-A205U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.86 Mobile Safari/537.36"); } catch { } } try { SignInView.DeleteFacebookCookies(); } catch { } Visibility = Visibility.Visible; ChallengeV2LoadingOn(); await Task.Delay(1500); Uri baseUri = new Uri(challengeLoginInfo.Url); HttpBaseProtocolFilter filter = new HttpBaseProtocolFilter(); var cookies = Helper.InstaApi.HttpRequestProcessor.HttpHandler.CookieContainer .GetCookies(Helper.InstaApi.HttpRequestProcessor.Client.BaseAddress); foreach (System.Net.Cookie c in cookies) { HttpCookie cookie = new HttpCookie(c.Name, baseUri.Host, "/") { Value = c.Value }; filter.CookieManager.SetCookie(cookie, false); } HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, baseUri); ChallengeV2kWebView.NavigateWithHttpRequestMessage(httpRequestMessage); } catch (Exception ex) { ChallengeV2LoadingOff(); Helper.ShowErr("Something unexpected happened", ex); } }
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); }
public async void NavigateToInstagramForFacebookLogin() { if (WebViewFacebook == null) { return; } try { LoadingOn(); using (var client = new HttpClient()) { var response = await client.GetAsync(new Uri("https://m.facebook.com/")); if (!response.IsSuccessStatusCode) { LoadingOff(); await new MessageDialog(FacebookBlockedMsg).ShowAsync(); return; } } } catch { LoadingOff(); await new MessageDialog(FacebookBlockedMsg).ShowAsync(); 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 { } DeleteInstagramCookies(); DeleteFacebookCookies(); FacebookFirstTime = true; FacebookPassed = false; CancelFacebookLogin = false; FacebookGridVisibility = Visibility.Visible; LoadingOn(); WebViewFacebook.Navigate(InstagramUri); }
/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { this.InitializeComponent(); this.Suspending += OnSuspending; this.Resuming += OnResuming; this.EnteredBackground += OnEnteredBackground; this.UnhandledException += App_UnhandledException; //ExtensionHelper.GetAppVersion().PrintDebug(); DeviceHelper.GetDeviceInfo(); try { if (DeviceUtil.IsXbox) { Helper.FullscreenModeInXbox(); RequiresPointerMode = ApplicationRequiresPointerMode.WhenRequested; } } catch { } try { UserAgentHelper.SetUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36"); } catch { } try { if (/*AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Xbox"*/ DeviceUtil.IsXbox) { FocusVisualKind = FocusVisualKind.Reveal; } } catch { } //try //{ // Application.Current.Resources["DefaultBackgroundColor"] = Helper.GetColorBrush("#18227c"); //} //catch (Exception ex) //{ //} }
private async void LoginAsync() { LoadingOn(); UserSessionData User = new UserSessionData() { UserName = UserName, Password = Password }; AppCore.InstaApi = InstaApiBuilder.CreateBuilder() .SetUser(User) .UseLogger(new DebugLogger(LogLevel.Exceptions)) .Build(); var loginres = await AppCore.InstaApi.LoginAsync(); switch (loginres.Value) { case InstaLoginResult.ChallengeRequired: await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { var challenge = AppCore.InstaApi.GetChallenge(); if (WebView != null && challenge != null) { try { UserAgentHelper.SetUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36"); } catch { } DeleteInstagramCookies(); LoadingOn(); WebView.Visibility = Visibility.Visible; IsWebBrowserInUse = false; WebView.Navigate(new Uri(challenge.Url)); } else { LoadingOff(); } }); break; case InstaLoginResult.Success: LoadingOff(); await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, delegate { AppCore.SaveUserInfo(User.UserName, User.Password); MainPage.MainFrame.Navigate(typeof(MainView)); }); break; case InstaLoginResult.BadPassword: LoadingOff(); await new MessageDialog(loginres.Info.Message).ShowAsync(); break; case InstaLoginResult.InvalidUser: LoadingOff(); await new MessageDialog(loginres.Info.Message).ShowAsync(); break; case InstaLoginResult.TwoFactorRequired: LoadingOff(); await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, delegate { AppCore.SaveUserInfo(User.UserName, User.Password, false); MainPage.MainFrame.Navigate(typeof(TwoStepFactorView)); }); break; case InstaLoginResult.Exception: LoadingOff(); await new MessageDialog(loginres.Info.Exception.Message).ShowAsync(); break; default: break; } }
protected /*async*/ override void OnLaunched(LaunchActivatedEventArgs e) { PushHelperX.Register(); bool canEnablePrelaunch = Windows.Foundation.Metadata.ApiInformation.IsMethodPresent("Windows.ApplicationModel.Core.CoreApplication", "EnablePrelaunch"); if (e != null) { if (e.PreviousExecutionState == ApplicationExecutionState.Running) { Window.Current.Activate(); return; } } Helper.ChangeAppMinSize(540, 744); if (!(Window.Current.Content is Frame rootFrame)) { rootFrame = CreateRootFrame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState != ApplicationExecutionState.Running) { SplashView extendedSplash = new SplashView(e.SplashScreen); rootFrame.Content = extendedSplash; Window.Current.Content = rootFrame; } Window.Current.Content = rootFrame; } if (e.PrelaunchActivated == false) { if (canEnablePrelaunch) { TryEnablePrelaunch(); } if (rootFrame.Content == null) { rootFrame.Navigate(typeof(MainPage), e.Arguments); } Window.Current.Activate(); } DeviceHelper.GetDeviceInfo(); try { if (DeviceUtil.IsXbox) { Helper.FullscreenModeInXbox(); RequiresPointerMode = ApplicationRequiresPointerMode.WhenRequested; } } catch { } try { UserAgentHelper.SetUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36"); } catch { } try { if (DeviceUtil.IsXbox) { FocusVisualKind = FocusVisualKind.Reveal; } } catch { } //try //{ // await Helper.RunInBackground(async () => // { // StoreServicesEngagementManager engagementManager = StoreServicesEngagementManager.GetDefault(); // await engagementManager.RegisterNotificationChannelAsync(); // }); //} //catch //{ //} }