nativescript-community / nativescript-community/ui-webview

Missing callback in event declaration [RequestPermissionsEventData] in TS

Open
#6 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
22
Forks
9
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the TypeScript declaration for RequestPermissionsEventData and compare it with the interface shown in the issue and the related @nota/nativescript-webview-ext implementation. Update the declaration so the event exposes the requested permission types and callback, then run the project's TypeScript checks to confirm consumers no longer need ts-ignore.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.