Skip to content

Commit

Permalink
修复同分组权限重复申请BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
goweii committed Oct 1, 2019
1 parent 120e9a3 commit d28c74d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,15 @@ public void onAction(final List<String> data) {
}

private void next() {
// findUnGrantedPermissions();
if (mUnGrantedPermissions.peek() == null) {
onSuccess();
return;
}
if (AndPermission.hasPermissions(mContext, mUnGrantedPermissions.peek())) {
mUnGrantedPermissions.poll();
next();
return;
}
onBeforeRequest();
}

Expand All @@ -195,6 +199,11 @@ private void again() {
onSuccess();
return;
}
if (AndPermission.hasPermissions(mContext, mUnGrantedPermissions.peek())) {
mUnGrantedPermissions.poll();
next();
return;
}
if (AndPermission.hasAlwaysDeniedPermission(mContext, mUnGrantedPermissions.peek())) {
onGoSetting();
} else {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ protected void onActivityResult(int requestCode, int resultCode, @Nullable Inten
}

private void requestRuntime() {
mRuntimeRequester = AnyPermission.with(this).runtime(1)
mRuntimeRequester = AnyPermission.with(this)
.runtime(1)
.permissions(Manifest.permission.CAMERA,
Manifest.permission.CALL_PHONE,
Manifest.permission.READ_CALENDAR,
Manifest.permission.READ_CONTACTS,
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.RECORD_AUDIO,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.SEND_SMS)
.onBeforeRequest(new RequestInterceptor<String>() {
Expand Down

0 comments on commit d28c74d

Please sign in to comment.