Ejemplo n.º 1
0
        IEnumerator StartRequest(Action <RemoteConfig> onSuccess, Action <string> onFailure)
        {
            _request = RequestHelper.CreateDownloadRequest(string.Format(ConfigRequestUrlPattern, AppId));

            while (!_request.IsDone())
            {
                yield return(null);
            }

            if (_request.GetErrorMessage() != null)
            {
                IsInProgress = false;
                onFailure(GetErrorMessage(_request.GetErrorMessage()));
            }
            else
            {
                try
                {
                    var remoteConfig = RemoteConfig.FromDict(
                        GSJson.Deserialize(_request.GetString()) as Dictionary <string, object>);

                    IsInProgress = false;
                    onSuccess(remoteConfig);
                }
                catch (Exception e)
                {
                    IsInProgress = false;
                    onFailure(e.Message);
                }
            }
        }
Ejemplo n.º 2
0
        IEnumerator StartRequest(Action <RemoteConfig> onSuccess, Action <string> onFailure)
        {
            _unityWebRequest = new WWW(string.Format(ConfigRequestUrlPattern, AppId));

            while (!_unityWebRequest.isDone)
            {
                yield return(null);
            }

            if (_unityWebRequest.error != null)
            {
                IsInProgress = false;
                onFailure(GetErrorMessage(_unityWebRequest.error));
            }
            else
            {
                try
                {
                    var remoteConfig = RemoteConfig.FromDict(
                        GSJson.Deserialize(_unityWebRequest.text) as Dictionary <string, object>);

                    IsInProgress = false;
                    onSuccess(remoteConfig);
                }
                catch (Exception e)
                {
                    IsInProgress = false;
                    onFailure(e.Message);
                }
            }
        }
Ejemplo n.º 3
0
        private List <string> ExtractDeeplinksFromRemoteConfig(RemoteConfig remoteConfig)
        {
            var productionDeepLinkDomains = remoteConfig.Android.DeepLinkDomains;
            var deeplinks = new List <string>(productionDeepLinkDomains);

            // add testing environment domains for the test app
            if (GetSocialSettings.AppId == GetSocialSettings.UnityDemoAppAppId)
            {
                productionDeepLinkDomains.ForEach(productionDomain =>
                {
                    var parts = productionDomain.Split('.').ToList();
                    parts.Insert(1, "testing");
                    string testingDomain = string.Join(".", parts.ToArray());

                    deeplinks.Add(testingDomain);
                });
            }

            return(deeplinks);
        }