Ejemplo n.º 1
0
        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();
                }
            }
        }