Files
iosAiPage/src/utils/arrUtils
2025-09-08 20:53:24 +08:00

17 lines
723 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/** 从 app 列表里找 TikTok 的 bundleId */
export function pickTikTokBundleId(apps) {
if (!Array.isArray(apps)) return null
// 1) 首选常见的 TikTok 包名
const preferred = apps.find(a => a?.bundleId === 'com.zhiliaoapp.musically')
if (preferred) return preferred.bundleId
// 2) 其次按名字匹配(大小写不敏感)
const byName = apps.find(a => String(a?.name).toLowerCase() === 'tiktok')
|| apps.find(a => String(a?.name).toLowerCase().includes('tiktok'))
if (byName) return byName.bundleId
// 3) 兜底bundleId 里包含 musically
const fuzzy = apps.find(a => String(a?.bundleId || '').includes('musically'))
return fuzzy ? fuzzy.bundleId : null
}