private void UpdateLandsWithAccess() { if (isBuilderInWorldActivated) { return; } DeployedScenesFetcher.FetchLandsFromOwner( Environment.i.platform.serviceProviders.catalyst, Environment.i.platform.serviceProviders.theGraph, userProfile.ethAddress, KernelConfig.i.Get().tld, BIWSettings.CACHE_TIME_LAND, BIWSettings.CACHE_TIME_SCENES) .Then(lands => landsWithAccess = lands.ToList()); }
private void FetchLandsAndScenes(float landCacheTime = CACHE_TIME_LAND, float scenesCacheTime = CACHE_TIME_SCENES) { if (isFetching) { return; } isFetching = true; var address = UserProfile.GetOwnUserProfile().ethAddress; var tld = KernelConfig.i.Get().tld; #if UNITY_EDITOR // NOTE: to be able to test in editor without getting a profile we hardcode an address here if (string.IsNullOrEmpty(address)) { address = TESTING_ETH_ADDRESS; tld = TESTING_TLD; DataStore.i.playerRealm.Set(new CurrentRealmModel() { domain = $"https://peer.decentraland.{TESTING_TLD}", contentServerUrl = $"https://peer.decentraland.{TESTING_TLD}/content", }); } #endif sectionsController.SetFetchingDataStart(); fetchLandPromise = DeployedScenesFetcher.FetchLandsFromOwner(catalyst, theGraph, address, tld, landCacheTime, scenesCacheTime); fetchLandPromise .Then(lands => { sectionsController.SetFetchingDataEnd(); isFetching = false; try { var scenes = lands.Where(land => land.scenes != null && land.scenes.Count > 0) .Select(land => land.scenes.Where(scene => !scene.isEmpty).Select(scene => (ISceneData) new SceneData(scene))) .Aggregate((i, j) => i.Concat(j)) .ToArray(); PanelOpenEvent(lands); landsController.SetLands(lands); scenesViewController.SetScenes(scenes); } catch (Exception e) { landsController.SetLands(lands); scenesViewController.SetScenes(new ISceneData[] { }); } }) .Catch(error => { isFetching = false; sectionsController.SetFetchingDataEnd(); landsController.SetLands(new LandWithAccess[] { }); scenesViewController.SetScenes(new ISceneData[] { }); Debug.LogError(error); }); }