private void OnUserLoginStateChange(bool userInfoReady, bool loggedIn) { if (!userInfoReady || m_PackageDatabase.isEmpty || !m_PageManager.IsInitialFetchingDone()) { return; } var entitlements = m_PackageDatabase.allPackages.Where(package => package.hasEntitlements); if (loggedIn) { if (entitlements.Any(package => (package.versions?.primary.isInstalled ?? false) && (package.versions?.primary.hasEntitlementsError ?? false))) { m_UpmClient.Resolve(); } else { m_PageManager.Refresh(RefreshOptions.UpmList | RefreshOptions.UpmSearch); m_PageManager.TriggerOnSelectionChanged(); } } else { if (entitlements.Any()) { m_PageManager.Refresh(RefreshOptions.UpmList | RefreshOptions.UpmSearch); m_PageManager.TriggerOnSelectionChanged(); } } }
public void OnFilterTabChanged(PackageFilterTab filterTab) { // Check if groups have changed only for InProject tab if (filterTab == PackageFilterTab.InProject && m_PageManager.IsInitialFetchingDone(PackageFilterTab.InProject)) { var needGroupsReordering = false; var currentPackageItems = packageItems.ToList(); foreach (var packageItem in currentPackageItems) { // Check if group has changed var package = packageItem.package; var groupName = m_PageManager.GetCurrentPage().GetGroupName(package); if (packageItem.packageGroup.name != groupName) { var oldGroup = GetOrCreateGroup(packageItem.packageGroup.name); var newGroup = GetOrCreateGroup(groupName); var state = m_PageManager.GetVisualState(package); if (state != null) { state.groupName = groupName; } // Move PackageItem from old group to new group oldGroup.RemovePackageItem(packageItem); newGroup.AddPackageItem(packageItem); needGroupsReordering = true; if (!oldGroup.packageItems.Any()) { m_ItemsList.Remove(oldGroup); } } } if (needGroupsReordering) { ReorderGroups(); } } }
// Returns true if the list of packages is visible (either listView or scrollView), false otherwise private bool UpdateListVisibility(bool skipListRebuild = false) { if (m_PackageFiltering.currentFilterTab == PackageFilterTab.AssetStore && !m_UnityConnect.isUserLoggedIn) { HideListShowLogin(); return(false); } var page = m_PageManager.GetCurrentPage(); var isListEmpty = !page.visualStates.Any(v => v.visible); var isInitialFetchingDone = m_PageManager.IsInitialFetchingDone(); var isCheckUpdateInProgress = m_PackageFiltering.currentFilterTab == PackageFilterTab.AssetStore && m_AssetStoreCallQueue.isCheckUpdateInProgress && page.filters.updateAvailableOnly; if (isListEmpty || !isInitialFetchingDone || isCheckUpdateInProgress) { HideListShowMessage(m_PageManager.IsRefreshInProgress(), isInitialFetchingDone, isCheckUpdateInProgress); return(false); } HideEmptyAreaShowList(skipListRebuild); return(true); }