echo "脚本使用帮助"
echo "0、修改包名、版本号+1"
echo "1、编译release版本"
echo "2、创建新的签名文件"
echo "3、commit 和 push Base代码"
echo "4、commit 和 push UI代码 (需手动修改分支)"
echo "5、pull Base代码 "
echo "6、pull UI代码 "
echo "7、为 resGuardApks 目录下的 *_release.apk 打渠道包"
echo "8、提交一个渠道包Tag"
echo "9、开始四大组件混淆"
echo "10、插入乱码"
echo "11、还原代码"
echo "12、SDK插拔"
echo "13、copy apk"
echo "14、生成工具包"
echo "15、功能代码同步"
echo "16、压缩切图"
echo "17、给GP图片添加水印"
echo "18、加固"
echo "19、混淆api"


echo -n "请输入指令编号："
read commod

if (($commod == '0'))
then
    chmod a+x pkgname_generator.py
    ./pkgname_generator.py

elif (($commod == '1'))
then
    chmod a+x release_builder.sh
    ./release_builder.sh

elif (($commod == '2'))
then
    chmod a+x creat_keystore.sh
    ./creat_keystore.sh
elif (($commod == '3'))
then
    chmod a+x base_push.sh
    ./base_push.sh

elif (($commod == '4'))
then
    chmod a+x module_push.sh
    ./module_push.sh

elif (($commod == '5'))
then
    cd ..
    git pull
    cd ../lib_yitu
    git checkout master
    git pull

elif (($commod == '6'))
then
    cd ../../
    git pull

elif (($commod == '7'))
then
    chmod a+x make_channel.sh
    ./make_channel.sh

elif (($commod == '8'))
then
    chmod a+x push_with_tag.sh
    ./push_with_tag.sh

elif (($commod == '9'))
then
    cd garble
    chmod a+x rename_project.sh
    ./rename_project.sh

elif (($commod == '10'))
then
    cd garble
    chmod a+x insert.sh
    ./insert.sh

elif (($commod == '11'))
then
    cd garble
    chmod a+x reset_name.sh
    ./reset_name.sh

elif (($commod == '12'))
then
    echo "1、开启SDK"
    echo "2、关闭SDK"
    echo -n "请选择操作："
    read action

    echo "TD(同盾)、AF(Appsflyer)"
    echo -n "输入要操作的SDK代码："
    read sdk

    chmod a+x sdk_manager.py
    if (($action == '1'))
    then
        ./sdk_manager.py 'open' ${sdk}
    elif (($action == '2'))
    then
        ./sdk_manager.py 'close' ${sdk}
    fi

elif (($commod == '13'))
then
    chmod a+x move_apk.sh
    ./move_apk.sh

elif (($commod == '14'))
then
    chmod a+x build_tool_apk.sh
    ./build_tool_apk.sh

elif (($commod == '15'))
then
    cd code
    chmod a+x code_sync.sh
    ./code_sync.sh

elif (($commod == '16'))
then
    chmod a+x tinypng.py
    ./tinypng.py -d ../../app/src/main/res/drawable-xxhdpi

elif (($commod == '17'))
then
    . ../../gradle.properties
    chmod a+x mark_screen_img.py
    ./mark_screen_img.py "${corp_id}" "${signing_keyAlias}"

elif (($commod == '18'))
then
    chmod a+x jiagu.sh
    ./jiagu.sh

elif (($commod == '19'))
then
    cd code
    chmod a+x rename_api.py
    ./rename_api.py

else
    echo "找不到编号"
fi
