microsoft / microsoft/Dynamics365Commerce.Solutions

NumPad support with CustomViewControllerBase

Open
#182 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
80
Forks
38
PR merge metrics
No merged PRs in 30d

Description

Extensibility request:

Provide support for adding NumPad and INumPadInputBroker to custom pos -views- that extend from CustomViewControllerBase.
Similar to how custom pos -dialogs- extend from ExtensionTemplatedDialogBase and thus get the NumPad and INumPadInputBroker brokers “for free” (without requiring extension code to initialize it).


Context:

In the legacy RetailSDK, when creating custom views, we extended the ExtensionViewControllerBase abstract class.
With the introduction of the CommerceSDK, ExtensionViewControllerBase is now deprecated.

This deprecated abstract class ExtensionViewControllerBase had some useful properties:

  • Ability to embed an OOTB NumPad to a custom view
  • An OOTB instance of INumPadInputBroker inherited from implementing INumPadContainer which allowed the NumPad to intercept keyboard (or scanner) input

With the new CommerceSDK, the requirement is to extend CustomViewControllerBase abstract class instead.

  • We no longer have the ability to add an OOTB NumPad (with OOTB INumPadInputBroker) to a custom view.

The official sample extension on GitHub for the InStore.BarcodeMsrDialogSample utilizes IAlphanumericNumPad but this is for a -dialog- (not a -view-).

  • The dialog class in the BarcodeMsrDialogSample is called BarcodeMsrDialog.ts
  • It extends from ExtensionTemplatedDialogBase which provides the implementation of an input broker "for free" (no need for the extension code to initialize it)
  • This functionality is not available for custom pos views though

As a potential workaround, I've attempted the following:

Implement INumPadInputSubscriberEndpoint:
image

Instantiate the broker from the subscriber:
image

Initialize options and bind the NumPad:
image


The workaround described above allows the NumPad to render on the custom view.
But it's still not behaving fully as intended.

Below describes the main issue:

The screenshot below has been taken immediately upon loading of the custom view.
And I’m typing on the keyboard but none of the digits are rendering on the NumPad (it doesn’t recognize it).
image

Because of that, as a test, I decided to click the NumPad “input bar” – you can see the dotted lines:
image

Now when I enter keyboard input, the digits show up:
image

^ If I “click out” of the input bar (no more dotted lines) – then it goes back to the first screenshot behaviour (it does not recognize/update keyboard input).


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

Start by comparing CustomViewControllerBase with ExtensionTemplatedDialogBase, then read the BarcodeMsrDialog.ts example at the stated sample path. Trace how NumPad and INumPadInputBroker are provided to dialogs and how the custom view workaround initializes them. Done means a custom view can use the OOTB NumPad and broker with keyboard or scanner input without requiring an input-bar focus workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.