(error = null, state = null)
| 2810 | } |
| 2811 | |
| 2812 | async function getPreferredIcloudLoginUrl(error = null, state = null) { |
| 2813 | const currentState = state || await getState(); |
| 2814 | const configuredHost = getConfiguredIcloudHostPreference(currentState); |
| 2815 | if (configuredHost) { |
| 2816 | return getIcloudLoginUrlForHost(configuredHost); |
| 2817 | } |
| 2818 | |
| 2819 | const messageHint = getIcloudHostHintFromMessage(getErrorMessage(error)); |
| 2820 | if (messageHint) { |
| 2821 | return getIcloudLoginUrlForHost(messageHint); |
| 2822 | } |
| 2823 | |
| 2824 | const savedHost = normalizeIcloudHost(currentState?.preferredIcloudHost); |
| 2825 | if (savedHost) { |
| 2826 | return getIcloudLoginUrlForHost(savedHost); |
| 2827 | } |
| 2828 | |
| 2829 | const openHost = await getOpenIcloudHostPreference(); |
| 2830 | if (openHost) { |
| 2831 | return getIcloudLoginUrlForHost(openHost); |
| 2832 | } |
| 2833 | |
| 2834 | return ICLOUD_LOGIN_URLS[0]; |
| 2835 | } |
| 2836 | |
| 2837 | async function getPreferredIcloudSetupUrls(state = null, error = null) { |
| 2838 | const preferredLoginUrl = await getPreferredIcloudLoginUrl(error, state); |
no test coverage detected