Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在不改动原有代码结构基础上,增加一点扩展,使其用任意可启动activity的context申请权限,不必强求activity继承自FragmentActivity。 #286

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Knightwood
Copy link

不改变原有代码结构,在PermissionX中增加一个新init方法,并使用一个frgment activity代理权限请求。
如此,不改变原用法基础上,任意可启动activity的context都可以申请权限,而不再限定FragmentActivity。这在compose中,不用再继承FragmentActivity。

新增加方法使用方式:

PermissionX.init(context) {
      //请求权限,与之前用法一致
      it.permissions(Manifest.permission.READ_CONTACTS, Manifest.permission.CAMERA)
        .request { allGranted, grantedList, deniedList ->
            
        }
}

@Knightwood Knightwood changed the title 在不改动原有代码结构基础上,增加一点点扩展,使其可脱离FragmentActivity申请权限。 在不改动原有代码结构基础上,增加一点扩展,使其用任意可启动activity的context申请权限,不必强求activity继承自FragmentActivity。 Sep 28, 2024
@yinanwang1
Copy link

太需要这个功能了。点赞。
FlutterActivity用不了,真的是尴尬。

@cymok
Copy link

cymok commented Nov 14, 2024

出发点是好的。就是代码提交得有点乱(有些没必要提交的修改)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants