# 通过cmc下载sdk-ios.zip和meeting_ios_bin.zip

sdk_branch=$1
meeting_ios_bin_branch=$2
target_dir=$3

sh_path=$(readlink -f "$0")
current_path=$(dirname "$sh_path")

cd ${current_path}/iOSBinary
mkdir -p iOSBinary
cd ${current_path}/download
cat > package.json <<EOF
{
  "name": "index",
  "version": "1.0.0",
  "dependencies": {
  	"@hwmeetingsdk/sdk-ios_${sdk_branch}": "latest",
    "@hwmeetingios/meeting_ios_bin.${meeting_ios_bin_branch}": "latest"
  }
}
EOF
npm install
cp -f "./node_modules/@hwmeetingsdk/sdk-ios_${sdk_branch}/sdk-ios.zip" "${current_path}/HWMTupImp"
cp -f "./node_modules/@hwmeetingios/meeting_ios_bin.${meeting_ios_bin_branch}/meeting_ios_bin.zip" "${current_path}/iOSBinary/iOSBinary"
cp -f "./node_modules/@hwmeetingios/meeting_ios_bin.${meeting_ios_bin_branch}/meeting_ios_bin.zip" ${target_dir}

cd ${current_path}/HWMTupImp
unzip -q -o ./sdk-ios.zip
cd ${current_path}/iOSBinary/iOSBinary
unzip -q -o ./meeting_ios_bin.zip

cd ${current_path}/download
rm -rfv ./node_modules
rm -rfv ./package-lock.json
rm -rfv ./package.json
