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

fix(android)(9_0_X): fall through request permissions #11563

Merged
merged 2 commits into from
Apr 9, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import java.util.ArrayList;

import android.provider.CalendarContract;

import org.appcelerator.kroll.KrollDict;
import org.appcelerator.kroll.KrollFunction;
import org.appcelerator.kroll.KrollModule;
import org.appcelerator.kroll.annotations.Kroll;
Expand Down Expand Up @@ -127,6 +129,9 @@ public boolean hasCalendarPermissions()
public void requestCalendarPermissions(@Kroll.argument(optional = true) KrollFunction permissionCallback)
{
if (hasCalendarPermissions()) {
KrollDict response = new KrollDict();
response.putCodeAndMessage(0, null);
permissionCallback.callAsync(getKrollObject(), response);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ public boolean hasContactsPermissions()
public void requestContactsPermissions(@Kroll.argument(optional = true) KrollFunction permissionCallback)
{
if (hasContactsPermissions()) {
KrollDict response = new KrollDict();
response.putCodeAndMessage(0, null);
permissionCallback.callAsync(getKrollObject(), response);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import org.appcelerator.kroll.KrollDict;
import org.appcelerator.kroll.KrollFunction;
import org.appcelerator.kroll.KrollInvocation;
import org.appcelerator.kroll.KrollModule;
Expand Down Expand Up @@ -111,6 +112,9 @@ private boolean hasStoragePermissions()
public void requestStoragePermissions(@Kroll.argument(optional = true) KrollFunction permissionCallback)
{
if (hasStoragePermissions()) {
KrollDict response = new KrollDict();
response.putCodeAndMessage(0, null);
permissionCallback.callAsync(getKrollObject(), response);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,9 @@ public void showCamera(@SuppressWarnings("rawtypes") HashMap options)
public void requestCameraPermissions(@Kroll.argument(optional = true) KrollFunction permissionCallback)
{
if (hasCameraPermissions()) {
KrollDict response = new KrollDict();
response.putCodeAndMessage(0, null);
permissionCallback.callAsync(getKrollObject(), response);
return;
}

Expand All @@ -565,6 +568,9 @@ public void requestCameraPermissions(@Kroll.argument(optional = true) KrollFunct
public void requestAudioRecorderPermissions(@Kroll.argument(optional = true) KrollFunction permissionCallback)
{
if (hasAudioRecorderPermissions()) {
KrollDict response = new KrollDict();
response.putCodeAndMessage(0, null);
permissionCallback.callAsync(getKrollObject(), response);
return;
}
String[] permissions = new String[] { Manifest.permission.RECORD_AUDIO };
Expand Down