private void OnPackagesClearCacheRootOperationResult(CacheRootConfig config) { // Send analytics PackageCacheManagementAnalytics.SendUpmEvent("resetPath", new [] { m_CurrentPackagesConfig.source.ToString() }, new [] { config.source.ToString() }); RefreshCurrentPackagesConfig(config); m_ClientProxy.Resolve(); }
private static void SendEvent(string action, string type, string[] oldPathStatuses, string[] newPathStatuses) { var editorAnalyticsProxy = ServicesContainer.instance.Resolve <EditorAnalyticsProxy>(); if (!editorAnalyticsProxy.RegisterEvent(k_EventName)) { return; } var parameters = new PackageCacheManagementAnalytics { action = action, type = type, old_path_statuses = oldPathStatuses, new_path_statuses = newPathStatuses }; editorAnalyticsProxy.SendEventWithLimit(k_EventName, parameters); }
private void DisplayAssetStoreCachePathSetting() { assetsCacheLocationInfo.enableRichText = true; assetsCacheLocationInfo.text = string.Format(L10n.Tr("Your assets will be store in <b>{0}</b> subfolder."), k_AssetStoreFolder); assetsCacheDropdown.SetIcon("folder"); var assetsCacheDropdownMenu = new DropdownMenu(); assetsCacheDropdownMenu.AppendAction(k_OpenFolder, action => { if (!string.IsNullOrWhiteSpace(assetsCachePath.text)) { m_ApplicationProxy.RevealInFinder(Paths.Combine(assetsCachePath.text, k_AssetStoreFolder)); } }, action => m_CurrentAssetStoreConfig.status == AssetStoreCachePathManager.ConfigStatus.InvalidPath ? DropdownMenuAction.Status.Disabled : DropdownMenuAction.Status.Normal, "openLocation"); assetsCacheDropdownMenu.AppendAction(k_ChangeLocation, action => { var path = m_ApplicationProxy.OpenFolderPanel("Select Assets Cache Location", Paths.Combine(assetsCachePath.text, k_AssetStoreFolder)); if (!string.IsNullOrWhiteSpace(path)) { path = path.NormalizePath(); if (path.EndsWith(Path.DirectorySeparatorChar + k_AssetStoreFolder)) { path = path.Substring(0, path.Length - k_AssetStoreFolder.Length - 1); } if (string.CompareOrdinal(path, m_CurrentAssetStoreConfig.path.NormalizePath()) == 0) { return; } if (!CancelDownloadInProgress()) { return; } var oldStatus = m_CurrentAssetStoreConfig?.status.ToString() ?? string.Empty; var oldSource = m_CurrentAssetStoreConfig?.source.ToString() ?? string.Empty; var status = m_AssetStoreCachePathProxy.SetConfig(path); // Send analytics PackageCacheManagementAnalytics.SendAssetStoreEvent("changePath", new [] { oldSource, oldStatus }, new [] { m_CurrentAssetStoreConfig.source.ToString(), m_CurrentAssetStoreConfig.status.ToString() }); if (status == AssetStoreCachePathManager.ConfigStatus.Failed) { DisplayAssetsCacheErrorBox(HelpBoxMessageType.Error, L10n.Tr($"Cannot set the Assets Cache location, \"{path}\" is invalid or inaccessible.")); } } }, action => m_CurrentAssetStoreConfig.source != ConfigSource.Environment ? DropdownMenuAction.Status.Normal : DropdownMenuAction.Status.Disabled, "selectLocation"); assetsCacheDropdownMenu.AppendAction(k_ResetToDefaultLocation, action => { if (!CancelDownloadInProgress()) { return; } var oldStatus = m_CurrentAssetStoreConfig?.status.ToString() ?? string.Empty; var oldSource = m_CurrentAssetStoreConfig?.source.ToString() ?? string.Empty; var status = m_AssetStoreCachePathProxy.ResetConfig(); // Send analytics PackageCacheManagementAnalytics.SendAssetStoreEvent("resetPath", new [] { oldSource, oldStatus }, new [] { m_CurrentAssetStoreConfig.source.ToString(), m_CurrentAssetStoreConfig.status.ToString() }); if (status == AssetStoreCachePathManager.ConfigStatus.Failed) { DisplayAssetsCacheErrorBox(HelpBoxMessageType.Error, L10n.Tr("Cannot reset the Assets Cache location to default.")); } }, action => m_CurrentAssetStoreConfig.source == ConfigSource.User ? DropdownMenuAction.Status.Normal : DropdownMenuAction.Status.Disabled, "resetLocation"); assetsCacheDropdown.menu = assetsCacheDropdownMenu; GetAssetStoreCacheConfig(); m_AssetStoreCachePathProxy.onConfigChanged += RefreshAssetStoreCachePathConfig; }