Skip to content

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

Open
@mobifly-dev

Description

@mobifly-dev

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions