fix(ios): 🐛 fix ios simulator can't start

add entitlements modification and improve OAuth provider detection
This commit is contained in:
Dawn
2026-01-06 01:26:52 +08:00
parent 0ba61876b3
commit cb2028a971
5 changed files with 41 additions and 11 deletions

View File

@@ -503,6 +503,7 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ARCHS = arm64;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION = YES;
CODE_SIGN_ENTITLEMENTS = hula_iOS/hula_iOS.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
DEVELOPMENT_TEAM = A9KV47CC3V;
@@ -553,6 +554,7 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ARCHS = arm64;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION = YES;
CODE_SIGN_ENTITLEMENTS = hula_iOS/hula_iOS.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
DEVELOPMENT_TEAM = A9KV47CC3V;

View File

@@ -61,6 +61,7 @@ targets:
settings:
base:
ENABLE_BITCODE: false
CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION: YES
ARCHS: [arm64]
VALID_ARCHS: arm64
OTHER_LDFLAGS: $(inherited) -lswiftCompatibilityConcurrency

View File

@@ -249,16 +249,33 @@ const badgeLoadedMap = ref<Record<string, boolean>>({})
const avatarSrc = computed(() => AvatarUtils.getAvatarUrl((resolvedUserInfo.value?.avatar as string) || ''))
/** 是否是当前登录的用户 */
const isCurrentUserUid = computed(() => userUid.value === uid)
/** 绑定标识(带当前用户信息兜底) */
const linkedGitee = computed(
() => resolvedUserInfo.value?.linkedGitee ?? (isCurrentUserUid.value ? userStore.userInfo?.linkedGitee : false)
)
const linkedGithub = computed(
() => resolvedUserInfo.value?.linkedGithub ?? (isCurrentUserUid.value ? userStore.userInfo?.linkedGithub : false)
)
const linkedGitcode = computed(
() => resolvedUserInfo.value?.linkedGitcode ?? (isCurrentUserUid.value ? userStore.userInfo?.linkedGitcode : false)
)
const providerFieldMap = {
gitee: 'linkedGitee',
github: 'linkedGithub',
gitcode: 'linkedGitcode'
} as const
type OAuthProvider = keyof typeof providerFieldMap
const resolveLinkedState = (provider: OAuthProvider) => {
const fieldKey = providerFieldMap[provider]
const resolvedInfo = resolvedUserInfo.value
const fallbackInfo = isCurrentUserUid.value ? userStore.userInfo : undefined
return (
resolvedInfo?.[fieldKey] ??
fallbackInfo?.[fieldKey] ??
resolvedInfo?.oauthProviders?.includes(provider) ??
fallbackInfo?.oauthProviders?.includes(provider) ??
false
)
}
/** 绑定标识(带当前用户信息兜底,同时兼容 oauthProviders 列表) */
const linkedGitee = computed(() => resolveLinkedState('gitee'))
const linkedGithub = computed(() => resolveLinkedState('github'))
const linkedGitcode = computed(() => resolveLinkedState('gitcode'))
/** 是否是我的好友 */
const isMyFriend = computed(() => !!contactStore.contactsList.find((item) => item.uid === uid))
/** 是否为群聊 */

View File

@@ -634,7 +634,15 @@ export const useLogin = () => {
if (!token || !refreshToken) {
throw new Error('授权回调缺少 token 或 refreshToken')
}
await TokenManager.updateToken(token, refreshToken, uid || undefined)
const targetUid = uid || undefined
await TokenManager.updateToken(token, refreshToken, targetUid)
await invoke('sync_messages', {
param: {
asyncData: true,
fullSync: false,
uid: targetUid
}
})
loginDisabled.value = true
loading.value = false
loginText.value = t('login.status.success_redirect')

View File

@@ -285,6 +285,8 @@ export type UserInfoType = {
linkedGithub?: boolean
/** 是否绑定 GitCode */
linkedGitcode?: boolean
/** 已绑定的 OAuth 提供商 */
oauthProviders?: ('gitee' | 'github' | 'gitcode')[]
}
export type BadgeType = {