/// <summary> /// Method to perform the reauthentication step once a user bearer token has become expired. /// </summary> public void PerformReauthentication() { if (ConnectivityTester.HasInternetConnection()) { PlayerPrefs.DeleteKey("RewardMobAuthenticationTokenExpirationDate"); isReauthenticating = true; //go through the reauthentication steps Application.OpenURL(RewardMobEndpoints.GetAuthenticationURL()); } }
/// <summary> /// Register /// </summary> /// <param name="message"></param> private static void RegisterWebviewSuccessCallbacks(string message) { //check to see if we're loading a URL from the callback if (message.StartsWith("url=")) { // Strip url= from string, leaving just the URL. string url = message.Substring(4); // Perform iOS Specific check. #if UNITY_IOS if (url.Contains("oauth/authorize") || url.Contains("auth/logout")) { // Logging in or out. // If iOS, call native code to load in SafariViewController. _OpenSafari(url); return; } #endif if (url.Contains("oauth/authorize")) { RewardMob.instance.isLoggingIn = true; } //Load in default browser if not IOS Application.OpenURL(url); return; } //handle different callback cases switch (message) { //bring user through authentication flow case ("authenticateUser"): Application.OpenURL(RewardMobEndpoints.GetAuthenticationURL()); break; //log the user out case ("logoutUser"): #if UNITY_IOS // If iOS, hit the Logout page in SafariViewController. _LogoutUser(RewardMobEndpoints.CurrentModeToString()); #endif RewardMob.instance.ClearPersistentData(); SampleWebView.webViewObject.SetVisibility(false); RewardMob.instance.OnClosedWebView(); RewardMob.instance.TotalRewardCount = 0; break; //hide the webview case ("hideWebView"): SampleWebView.webViewObject.SetVisibility(false); RewardMob.instance.OnClosedWebView(); break; //let client know that the page is done loading case ("pageDoneLoading"): RewardMob.instance.ToggleLoadingScreen(false); webViewObject.SetVisibility(true); break; default: break; } }