Draft: Make QrCodeModule configurable
This is a draft, do not start it yet :D
QrCodeModule adds a home page entry. The goal now is to configure if and at which position the module provides this entry – at the moment the module determines this completely on it's own.
Home page entries
Add a static method .provideEntries(config?:QrCodeModuleConfig)
to the module expecting an optional value of an interface like this:
export interface QrCodeModuleConfig {
menuEntry?: boolean | number
}
Use provideHomePageEntry()
in that static method.
- If
.provideEntries(...)
is not used when importing QrCodeModule, do not provide a home page entry. - If
.provideEntries()
is used without parameter provide the menu entry already defined in the module file. - If
config.provideHomepageEntry
is undefined or false do not provide any home page entry. - If
config.provideHomepageEntry
is true use the HomePageEntry objects as already defined in the module file. - If
config.provideHomepageEntry
is a number use the HomePageEntry object as already defined in the module file, but replace the position value with the given number.
Scanner service
- The QrCodeModule already has a static method
.forRoot
. Please remove it and instead addprovideScanService(scanService: Type<RccQrCodeScanner>)
tolib/common/qr-code/qr-code.commons.ts
. Update modules that used the static methodQrCodeModule.forRoot()
and make them useprovideScanService()
instead. - Use
RccQrCodeScanner
as injection token.
Requirements
-
When imported in features.module.ts
of the HCP(doc) and pat variant, you can useQrCodeModule.provideEntries(...)
to configure the positions of home page entry. -
QrCodeModule.forRoot()
is no longer in use and the QR-Code-Scanner still works.
Edited by Andreas Pittrich