import permision from "@/js_sdk/wa-permission/permission.js"
const getCameraPermission = async(callback) => {
    const systemInfo = uni.getSystemInfoSync();
    // 判断平台
    if (systemInfo.platform === 'android') {
         let result = await permision.requestAndroidPermission('android.permission.CAMERA');
         if(result == 1){
            callback();
         }else{
            openModal('请授权相机权限');
         }
    } else if (systemInfo.platform === 'ios') {
        let iosResult = await permision.judgeIosPermission("camera")
          if(iosResult){
            callback();
          }else{
            openModal('请授权相机权限');
          }

    }

}
const openModal=(content)=>{
    uni.showModal({
        title: '提示',
        content:content,
        showCancel: true,
        success: (res) => {
            if(res.confirm){
                permision.gotoAppPermissionSetting();
            }
        }
    });
}
export { getCameraPermission };