source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '11.0'

target 'AICity' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!
  pod 'Masonry'
  pod 'MJRefresh','3.7.5'
  pod 'SDWebImage','5.12.1'
  pod 'AFNetworking'
  pod 'ZFPlayer', '4.1.4'
  pod 'ZFPlayer/ControlView', '4.1.4'
  pod 'ZFPlayer/AVPlayer', '4.1.4'
  pod 'ZFPlayer/ijkplayer', '4.1.4'
  pod 'FDFullscreenPopGesture'
  pod 'MBProgressHUD'
  pod 'MJExtension'
  # pod 'WechatOpenSDK'  # 暂时注释，模拟器不支持
  # pod 'AlipaySDK-iOS', '15.8.17'  # 暂时注释，版本不兼容
  
  # 腾讯云播放器SDK - 短剧秒切功能需要
  # 参考: specs/004-/quickstart.md
  pod 'TXLiteAVSDK_Player', '~> 11.8'
end

# Post-install hook: 修复 CocoaPods 脚本的沙箱问题
post_install do |installer|
  resources_script = 'Pods/Target Support Files/Pods-AICity/Pods-AICity-resources.sh'
  if File.exist?(resources_script)
    text = File.read(resources_script)
    # 修复 realpath -mq 问题
    text = text.gsub(/realpath -mq/, '')
    # 修复沙箱写入问题
    text = text.gsub(/RESOURCES_TO_COPY=\$\{PODS_ROOT\}/, 'RESOURCES_TO_COPY="${TEMP_DIR}"')
    File.write(resources_script, text)
    puts "✓ Fixed Pods-AICity-resources.sh sandbox issues"
  end
  
  frameworks_script = 'Pods/Target Support Files/Pods-AICity/Pods-AICity-frameworks.sh'
  if File.exist?(frameworks_script)
    text = File.read(frameworks_script)
    # 修复 ARCHS[@] 问题
    text = text.gsub('${ARCHS[@]}', '${ARCHS}')
    File.write(frameworks_script, text)
    puts "✓ Fixed Pods-AICity-frameworks.sh ARCHS issues"
  end
end
