//package com.gingersoft.gsa.cloud.common.function;
//
//import android.util.Log;
//
//import androidx.fragment.app.Fragment;
//import androidx.fragment.app.FragmentActivity;
//
//import com.permissionx.guolindev.PermissionCollection;
//import com.permissionx.guolindev.PermissionX;
//
//import org.aspectj.lang.ProceedingJoinPoint;
//import org.aspectj.lang.annotation.Around;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.annotation.Pointcut;
//
///**
// * @author 宇航. 1239658231@qq.com
// * User: admin
// * Date: 2021/5/15
// * Time: 17:27
// * Use:
// */
//@Aspect
//public class CheckPermissionAspect {
//
//    @Pointcut("execution(@com.gingersoft.gsa.cloud.common.function.CheckPermission * *(..))")
//    public void cutOffPoint() {
//    }
//
//    @Around("cutOffPoint() && @annotation(checkPermission)")
//    public void executionMethod(ProceedingJoinPoint joinPoint, CheckPermission checkPermission) {
//        Log.e("eee", "executionMethod");
//        Object aThis = joinPoint.getThis();
////        if (aThis != null) {
////            PermissionCollection permissionCollection = null;
////            if (aThis instanceof Fragment) {
////                Fragment fragment = (Fragment) aThis;
////                permissionCollection = PermissionX.init(fragment);
////            } else if (aThis instanceof FragmentActivity) {
////                FragmentActivity fragmentActivity = (FragmentActivity) aThis;
////                permissionCollection = PermissionX.init(fragmentActivity);
////            }
////            if (permissionCollection != null) {
////                permissionCollection.permissions(checkPermission.permissions())
////                        .onExplainRequestReason((scope, deniedList) -> scope.showRequestReasonDialog(deniedList, checkPermission.onExplainRequestReason(), "確定", "取消"))
////                        .onForwardToSettings((scope, deniedList) -> scope.showForwardToSettingsDialog(deniedList, checkPermission.onForwardToSettings(), "確定", "取消"))
////                        .request((allGranted, grantedList, deniedList) -> {
////                            if (allGranted) {
////                                try {
////                                    joinPoint.proceed();
////                                } catch (Throwable throwable) {
////                                    throwable.printStackTrace();
////                                }
////                            }
////                        });
////            }
////        }
//    }
//}
