Example #1
0
        private static async Task <string> GetAppToken(SvrfApi api)
        {
            var httpClient = typeof(MediaApi)
                             .GetField("_httpClient", BindingFlags.NonPublic | BindingFlags.Instance)?
                             .GetValue(api.Media);

            var authApi = typeof(SvrfClient)
                          .GetProperty("Auth", BindingFlags.NonPublic | BindingFlags.Instance)?
                          .GetValue(api);

            var authTask = authApi?
                           .GetType()
                           .GetMethod("AuthenticateAsync", BindingFlags.Public | BindingFlags.Instance)?
                           .Invoke(authApi, null);

            if (authTask != null)
            {
                await(Task) authTask;
            }

            var tokenService = httpClient?
                               .GetType()
                               .GetField("_tokenService", BindingFlags.NonPublic | BindingFlags.Instance)?
                               .GetValue(httpClient);

            var token = tokenService?
                        .GetType()
                        .GetMethod("GetAppToken", BindingFlags.Public | BindingFlags.Instance)?
                        .Invoke(tokenService, null)
                        .ToString();

            return(token);
        }
        public void Start()
        {
            _svrfApi = new SvrfApi();

            ScrollViewController.OnPreviewClick      = OnLoadFaceFilter;
            ScrollViewController.OnReachLoadingPoint = OnAddNextItems;

            if (Application.isEditor)
            {
                DisableARCore();
            }

            SearchFaceFilters();
        }
        async void Start()
        {
            SvrfApi api = new SvrfApi();

            MediaRequestParams options = new MediaRequestParams {
                IsFaceFilter = true
            };
            MultipleMediaResponse trendingResponse = await api.Media.GetTrendingAsync(options);

            MediaModel model = trendingResponse.Media.First();

            await SvrfModel.GetSvrfModelAsync(model);

            Destroy(GameObject.Find("Loading"));
        }
Example #4
0
        public IEnumerator Start()
        {
            SvrfApi api = new SvrfApi();

            TaskBasedCoroutine <MultipleMediaResponse> requestCoroutine = api.Media.GetTrendingAsync().AsCoroutine();

            yield return(requestCoroutine);

            MediaModel       model   = requestCoroutine.Result.Media.First();
            SvrfModelOptions options = new SvrfModelOptions {
                WithOccluder = false
            };

            yield return(SvrfModel.GetSvrfModelAsync(model, options).AsCoroutine());

            Destroy(GameObject.Find("Loading"));
        }