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

Missing callback in event declaration [RequestPermissionsEventData] in TS #6

Open
mobifly-dev opened this issue Jul 27, 2022 · 0 comments

Comments

@mobifly-dev
Copy link

Which platform(s) does your issue occur on?

  • iOS/Android - Both
  • Version - all
  • Emulator and Physical device

Problem description

Simple thing but important - there is no callback declaration in event RequestPermissionsEventData in TypeScript. Without calling this callback the WebRTC will not start, even the permissions will be granted.

This callback is implemented in the plugin, but there is no proper declaration available.

Code

Instead of this:

export interface RequestPermissionsEventData extends WebViewExtEventData {
    eventName: EventNames.RequestPermissions;
    url: string;
    permissions: string[];
}

Should be this:

export interface RequestPermissionsEventData extends WebViewEventData {
    eventName: EventNames.RequestPermissions;
    url: string;
    permissions: RequestPermissionsString[];
    callback: (response: boolean) => void;
}

as was on @nota/nativescript-webview-ext plugin (which this is based on).

Currently needs to use ts-ignore to compile TS with no declaration ie.

webview.on(AWebView.requestPermissionsEvent, (arg: RequestPermissionsEventData) => {
            const requiredAndroidPermissions = arg.permissions
                .map((p) => {
                    (...)
                    return p;
                })
                .filter((p) => !!p);


            permissions
                .requestPermissions(requiredAndroidPermissions)
                //@ts-ignore
                .then(() => arg.callback(true))
                //@ts-ignore
                .catch(() => arg.callback(false));
        });

Please update this declaration on next version. Thanks.

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

No branches or pull requests

1 participant