Example #1
0
        /// <summary>
        /// Attached to the button's clicked event.
        /// </summary>
        public void OnClick()
        {
#if !UNITY_EDITOR
            //if it's not visible, either load the logged in flow, or login screen based on the token's presence
            if (!SampleWebView.webViewObject.GetVisibility())
            {
                RewardMob.instance.ToggleLoadingScreen(true);
                SampleWebView.Init();

                SampleWebView.webViewObject.LoadURL(RewardMobEndpoints.GetWebViewURL());
            }
#endif
        }
Example #2
0
        /// <summary>
        /// Pop open a WebView for when an unauthorized user earns a Reward for the first time (Onboarding)
        /// </summary>
        private void ShowFirstTimeEarnedRewardScreen()
        {
#if !UNITY_EDITOR
            if ((earnedState == RewardMobAuthorizedState.NOT_EARNED_FIRST_REWARD) && (Token == null))
            {
                ToggleLoadingScreen(true);

                SampleWebView.Init();
                try
                {
                    SampleWebView.webViewObject.LoadURL(RewardMobEndpoints.GetWebViewURL(useLogicalRewards: true));

                    earnedState = RewardMobAuthorizedState.EARNED_FIRST_REWARD;
                }
                catch
                {
                    Debug.LogError("Fill out the Game ID section inside of the RewardMobData object at RewardMobSDK/Resources.");
                }
            }
#endif
        }