nativescript-community / nativescript-community/ui-webview
Missing callback in event declaration [RequestPermissionsEventData] in TS
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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