mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-03 04:52:17 +00:00
Remove condition and notNecessary flags from the Permissions util.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package org.thoughtcrime.securesms.permissions;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
@@ -63,10 +62,6 @@ public class Permissions {
|
||||
private @DrawableRes int[] rationalDialogHeader;
|
||||
private String rationaleDialogMessage;
|
||||
|
||||
private boolean ifNecesary;
|
||||
|
||||
private boolean condition = true;
|
||||
|
||||
PermissionsBuilder(PermissionObject permissionObject) {
|
||||
this.permissionObject = permissionObject;
|
||||
}
|
||||
@@ -76,17 +71,6 @@ public class Permissions {
|
||||
return this;
|
||||
}
|
||||
|
||||
public PermissionsBuilder ifNecessary() {
|
||||
this.ifNecesary = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PermissionsBuilder ifNecessary(boolean condition) {
|
||||
this.ifNecesary = true;
|
||||
this.condition = condition;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PermissionsBuilder withRationaleDialog(@NonNull String message, @NonNull @DrawableRes int... headers) {
|
||||
this.rationalDialogHeader = headers;
|
||||
this.rationaleDialogMessage = message;
|
||||
@@ -137,7 +121,7 @@ public class Permissions {
|
||||
PermissionsRequest request = new PermissionsRequest(allGrantedListener, anyDeniedListener, anyPermanentlyDeniedListener, anyResultListener,
|
||||
someGrantedListener, someDeniedListener, somePermanentlyDeniedListener);
|
||||
|
||||
if (ifNecesary && (permissionObject.hasAll(requestedPermissions) || !condition)) {
|
||||
if (permissionObject.hasAll(requestedPermissions)) {
|
||||
executePreGrantedPermissionsRequest(request);
|
||||
} else if (rationaleDialogMessage != null && rationalDialogHeader != null) {
|
||||
executePermissionsRequestWithRationale(request);
|
||||
|
||||
Reference in New Issue
Block a user