File

libs/upp-base/src/modules/platform.ts

Description

platformService is a service that manages platform detection and configuration. It provides methods and properties to determine the type of device and control the display mode, as well as emitting events related to configuration changes.

This service is injected at the root level and depends on DeviceDetectorService, Platform, Router, and ActivatedRoute.

Index

Properties
Methods
Accessors

Constructor

constructor(detector: DeviceDetectorService, platform: Platform, router: Router, route: ActivatedRoute)

Constructor that initializes the platform service with required dependencies and sets up the platform configurations.

Parameters :
Name Type Optional Description
detector DeviceDetectorService No
  • Device detector service for detecting device-specific information.
platform Platform No
  • Ionic platform service for managing platform-specific features.
router Router No
  • Angular router for navigation.
route ActivatedRoute No
  • Activated route for accessing route-specific information.

Methods

is
is(_platform: AvailablePlats)

Determines whether the current platform matches the specified type.

Parameters :
Name Type Optional Description
_platform AvailablePlats No
  • The platform type to check (e.g., "ios", "android", "desktop").
Returns : any

true if the specified platform is detected; otherwise, false.

platforms
platforms()

Returns an array of detected platform types.

Returns : Array<AvailablePlats>

An array containing the available platform types.

ready
ready()

Resolves when the platform is ready.

Returns : any

A promise that resolves when the platform setup is complete.

Properties

Public _isDesktop
Default value : false

Indicates whether the current device is a desktop device.

Public _isMobile
Default value : false

Indicates whether the current device is a mobile device.

Public OnKioskChanged
Default value : this._onKioskChanged.asObservable()

Observable that emits when kiosk mode changes.

Public OnThemeChanged
Default value : this._onThemeChanged.asObservable()

Observable that emits when the theme changes.

Accessors

DeviceInfo
getDeviceInfo()

Retrieves detailed device information from DeviceDetectorService.

_isKiosk
get_isKiosk()

Retrieves the current kiosk mode status.

set_isKiosk(value)

Sets the kiosk mode and emits an event when the mode changes.

Kiosk mode can only be enabled if the device is not recognized as a mobile or tablet device.

Parameters :
Name Optional Description
value No
  • A boolean indicating whether kiosk mode should be enabled (true) or disabled (false).
Returns : void
_theme
get_theme()

Retrieves the current theme mode.

Returns : "dark" | "light" | null
set_theme(value: "dark" | "light")

Sets the current theme mode to either 'dark' or 'light' and emits a change event.

Parameters :
Name Type Optional Description
value "dark" | "light" No
  • The theme mode to set, either 'dark' or 'light'.
Returns : void
_zoomLevel
get_zoomLevel()

Retrieves the current zoom level of the application.

set_zoomLevel(value)

Sets the current zoom level of the application.

Parameters :
Name Optional Description
value No
  • The new zoom level to apply.
Returns : void
_scrollbar
get_scrollbar()

Retrieves the visibility status of the scrollbar.

set_scrollbar(value)

Toggles the display of the scroll bar based on the provided value.

Parameters :
Name Optional Description
value No
  • A boolean indicating whether the scroll bar should be shown (true) or hidden (false).
Returns : void
RunningOS
getRunningOS()

Returns the Operating System information object.

Browser
getBrowser()

Returns the browser type as a string (e.g., "Chrome", "Safari", "Firefox").

_viewMode
set_viewMode(value: string)
Parameters :
Name Type Optional
value string No
Returns : void
IsReady
getIsReady()

Returns the platform ready status

resize
getresize()

Wraps the platform resize event.

LegacyMobile
getLegacyMobile()

Determines if the current device should be considered as a legacy mobile device.

LegacyTablet
getLegacyTablet()

Determines if the current device should be considered as a legacy tablet device.

LegacyDesktop
getLegacyDesktop()

Determines if the current device should be considered as a legacy desktop device.

results matching ""

    No results matching ""