@24i/bigscreen-sdk 1.0.5-alpha.2129 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/packages/developer-tools/src/DeveloperConsole/DeveloperConsole.tsx +1 -0
- package/packages/developer-tools/src/TechnicalInfo/TechnicalInfo.tsx +2 -0
- package/packages/device/src/driver/index.android.tv.ts +1 -0
- package/packages/device/src/resolver/resolver.ts +6 -0
- package/packages/driver-androidtv/src/DeviceAndroidTV.ts +179 -0
- package/packages/driver-androidtv/src/__mocks__/javaScriptBridge.ts +12 -0
- package/packages/driver-androidtv/src/formatUserAgent.ts +11 -0
- package/packages/driver-androidtv/src/index.ts +1 -0
- package/packages/driver-androidtv/src/keymap.ts +9 -0
- package/packages/driver-androidtv/src/types.ts +27 -0
- package/packages/driver-base/src/DeviceBase.ts +2 -0
- package/packages/epg/src/v2/DatePicker.tsx +6 -3
- package/packages/l10n/src/date/common.ts +12 -0
- package/packages/l10n/src/date/cs.ts +2 -8
- package/packages/l10n/src/date/de.ts +97 -0
- package/packages/l10n/src/date/en-001.ts +3 -3
- package/packages/l10n/src/date/en-common.ts +5 -4
- package/packages/l10n/src/date/en-us.ts +3 -3
- package/packages/l10n/src/date/es.ts +71 -0
- package/packages/l10n/src/date/fr.ts +93 -0
- package/packages/l10n/src/date/iso.ts +12 -13
- package/packages/l10n/src/date/types.ts +6 -0
- package/packages/l10n/src/l10n.ts +8 -0
- package/packages/toast/src/ToastService.scss +1 -0
- package/packages/create-package/dist/createPackage.js +0 -66
- package/packages/create-package/dist/createPackage.js.map +0 -1
- package/packages/create-package/dist/index.js +0 -5
- package/packages/create-package/dist/index.js.map +0 -1
- package/packages/create-package/dist/questionnaire/questions.js +0 -35
- package/packages/create-package/dist/questionnaire/questions.js.map +0 -1
- package/packages/create-package/dist/settings/Settings.js +0 -10
- package/packages/create-package/dist/settings/Settings.js.map +0 -1
- package/packages/create-package/dist/types.js +0 -3
- package/packages/create-package/dist/types.js.map +0 -1
- package/packages/rnv-build-engine/dist/src/constants/buildSchemes.js +0 -14
- package/packages/rnv-build-engine/dist/src/constants/index.js +0 -7
- package/packages/rnv-build-engine/dist/src/constants/platforms.js +0 -14
- package/packages/rnv-build-engine/dist/src/engine.js +0 -94
- package/packages/rnv-build-engine/dist/src/index.js +0 -26
- package/packages/rnv-build-engine/dist/src/resolvers/index.js +0 -29
- package/packages/rnv-build-engine/dist/src/resolvers/resolveBaseUrl.js +0 -31
- package/packages/rnv-build-engine/dist/src/resolvers/resolveBuildFileExtension.js +0 -12
- package/packages/rnv-build-engine/dist/src/resolvers/resolveBuildFileName.js +0 -36
- package/packages/rnv-build-engine/dist/src/resolvers/resolveBuildVersion.js +0 -42
- package/packages/rnv-build-engine/dist/src/resolvers/resolveBuildVersionOffset.js +0 -34
- package/packages/rnv-build-engine/dist/src/resolvers/resolveDeployLocations.js +0 -79
- package/packages/rnv-build-engine/dist/src/resolvers/resolveGenericRnvConfig.js +0 -47
- package/packages/rnv-build-engine/dist/src/resolvers/resolveHbbtvDeployConfig.js +0 -13
- package/packages/rnv-build-engine/dist/src/resolvers/resolveHbbtvDeployUrl.js +0 -11
- package/packages/rnv-build-engine/dist/src/resolvers/resolveHbbtvRemoteBuildDirRelativePath.js +0 -24
- package/packages/rnv-build-engine/dist/src/resolvers/resolveSupportedPlatforms.js +0 -5
- package/packages/rnv-build-engine/dist/src/resolvers/resolveUsedFlavours.js +0 -23
- package/packages/rnv-build-engine/dist/src/resolvers/resolveZippedPlatformBuildsRelativeFilePath.js +0 -14
- package/packages/rnv-build-engine/dist/src/scripts/buildAllWithScheme.js +0 -25
- package/packages/rnv-build-engine/dist/src/scripts/generateDeployUrls/formatTableDataSpaces.js +0 -30
- package/packages/rnv-build-engine/dist/src/scripts/generateDeployUrls/generateDeployUrls.js +0 -90
- package/packages/rnv-build-engine/dist/src/scripts/generateDeployUrls/index.js +0 -4
- package/packages/rnv-build-engine/dist/src/scripts/generateDeployUrls/makeTableDataByScheme.js +0 -63
- package/packages/rnv-build-engine/dist/src/scripts/gitReleaser/afterVersionBump.js +0 -18
- package/packages/rnv-build-engine/dist/src/scripts/gitReleaser/beforeVersionBump.js +0 -12
- package/packages/rnv-build-engine/dist/src/scripts/gitReleaser/checkReleaseNotes.js +0 -16
- package/packages/rnv-build-engine/dist/src/scripts/gitReleaser/pushRelease.js +0 -31
- package/packages/rnv-build-engine/dist/src/scripts/gitReleaser/pushReleaseCandidate.js +0 -6
- package/packages/rnv-build-engine/dist/src/scripts/gitReleaser/pushReleaseNotes.js +0 -37
- package/packages/rnv-build-engine/dist/src/scripts/release/deleteSourceMaps.js +0 -11
- package/packages/rnv-build-engine/dist/src/scripts/release/deployToAppCenter.js +0 -83
- package/packages/rnv-build-engine/dist/src/scripts/release/githubRelease.js +0 -128
- package/packages/rnv-build-engine/dist/src/scripts/release/notifySlack/generateWebhoook.js +0 -65
- package/packages/rnv-build-engine/dist/src/scripts/release/notifySlack/makePayload.js +0 -85
- package/packages/rnv-build-engine/dist/src/scripts/release/notifySlack/notifySlack.js +0 -44
- package/packages/rnv-build-engine/dist/src/scripts/release/notifySlack/slackBlockKitBuilder.js +0 -39
- package/packages/rnv-build-engine/dist/src/scripts/release/sentryRelease.js +0 -85
- package/packages/rnv-build-engine/dist/src/scripts/release/urlsMarkdown.js +0 -62
- package/packages/rnv-build-engine/dist/src/scripts/releaseAllWithScheme.js +0 -79
- package/packages/rnv-build-engine/dist/src/scripts/utils/cmdUtils.js +0 -12
- package/packages/rnv-build-engine/dist/src/scripts/utils/fsUtils.js +0 -33
- package/packages/rnv-build-engine/dist/src/scripts/utils/generateIcons.js +0 -29
- package/packages/rnv-build-engine/dist/src/scripts/utils/gitUtils.js +0 -78
- package/packages/rnv-build-engine/dist/src/scripts/utils/index.js +0 -27
- package/packages/rnv-build-engine/dist/src/scripts/utils/stringUtils.js +0 -5
- package/packages/rnv-build-engine/dist/src/sdks/index.js +0 -42
- package/packages/rnv-build-engine/dist/src/sdks/sdk-tizen/index.js +0 -13
- package/packages/rnv-build-engine/dist/src/sdks/sdk-tizen/sdkTizen.js +0 -168
- package/packages/rnv-build-engine/dist/src/sdks/sdk-utils/index.js +0 -14
- package/packages/rnv-build-engine/dist/src/sdks/sdk-utils/registerSdkPath.js +0 -14
- package/packages/rnv-build-engine/dist/src/sdks/sdk-utils/sdk-installer/index.js +0 -5
- package/packages/rnv-build-engine/dist/src/sdks/sdk-utils/sdk-installer/sdkInstaller.js +0 -37
- package/packages/rnv-build-engine/dist/src/sdks/sdk-utils/sdk-installer/services/clean.js +0 -11
- package/packages/rnv-build-engine/dist/src/sdks/sdk-utils/sdk-installer/services/download.js +0 -76
- package/packages/rnv-build-engine/dist/src/sdks/sdk-utils/sdk-installer/services/index.js +0 -11
- package/packages/rnv-build-engine/dist/src/sdks/sdk-utils/sdk-installer/services/install.js +0 -23
- package/packages/rnv-build-engine/dist/src/sdks/sdk-utils/sdk-installer/services/unzip.js +0 -12
- package/packages/rnv-build-engine/dist/src/sdks/sdk-webos/index.js +0 -13
- package/packages/rnv-build-engine/dist/src/sdks/sdk-webos/sdkWebos.js +0 -80
- package/packages/rnv-build-engine/dist/src/sdks/sdk-webpack/index.js +0 -13
- package/packages/rnv-build-engine/dist/src/sdks/sdk-webpack/sdkWebpack.js +0 -6
- package/packages/rnv-build-engine/dist/src/sdks/sdk-xbox/index.js +0 -13
- package/packages/rnv-build-engine/dist/src/sdks/sdk-xbox/sdkXbox.js +0 -221
- package/packages/rnv-build-engine/dist/src/tasks/deploy/aswS3/aws.js +0 -22
- package/packages/rnv-build-engine/dist/src/tasks/deploy/aswS3/deployS3.js +0 -71
- package/packages/rnv-build-engine/dist/src/tasks/deploy/hbbtv/deployHbbtv.js +0 -94
- package/packages/rnv-build-engine/dist/src/tasks/engineTasks.js +0 -24
- package/packages/rnv-build-engine/dist/src/tasks/task.rnv.build.js +0 -91
- package/packages/rnv-build-engine/dist/src/tasks/task.rnv.configure.js +0 -42
- package/packages/rnv-build-engine/dist/src/tasks/task.rnv.configureSoft.js +0 -30
- package/packages/rnv-build-engine/dist/src/tasks/task.rnv.deploy.js +0 -40
- package/packages/rnv-build-engine/dist/src/tasks/task.rnv.hooks.run.js +0 -70
- package/packages/rnv-build-engine/dist/src/tasks/task.rnv.package.js +0 -18
- package/packages/rnv-build-engine/dist/src/tasks/task.rnv.platform.configure.js +0 -37
- package/packages/rnv-build-engine/dist/src/tasks/task.rnv.project.configure.js +0 -116
- package/packages/rnv-build-engine/dist/src/tasks/task.rnv.start.js +0 -73
- package/packages/rnv-build-engine/dist/src/types/c.js +0 -2
- package/packages/rnv-build-engine/dist/src/types/constants.js +0 -2
- package/packages/rnv-build-engine/dist/src/types/index.js +0 -2
- package/packages/rnv-build-engine/dist/src/utils/forEachSupportedPlatformFlavour.js +0 -24
- package/packages/rnv-build-engine/dist/src/utils/generatePngSpriteMap.js +0 -78
- package/packages/rnv-build-engine/dist/src/utils/generateSvgSpriteMap.js +0 -113
- package/packages/rnv-build-engine/dist/src/utils/mergeSvgAndPngIcons.js +0 -65
- package/packages/rnv-build-engine/dist/src/utils/replaceRelevantStringsInConfig/index.js +0 -5
- package/packages/rnv-build-engine/dist/src/utils/replaceRelevantStringsInConfig/replaceRelevantStringsInConfig.js +0 -31
- package/packages/rnv-build-engine/dist/src/utils/replaceRelevantStringsInConfig/replaceTemplateString.js +0 -40
- package/packages/rnv-build-engine/dist/src/utils/zipBuildsByPlatforms.js +0 -61
- package/packages/rnv-build-engine/dist/templates/platforms/_shared/template.js +0 -87
- package/packages/rnv-build-engine/dist/templates/platforms/_shared/utils/extendSass.js +0 -29
- package/packages/rnv-build-engine/dist/templates/platforms/_shared/utils/joinStrings.js +0 -5
- package/packages/rnv-build-engine/dist/templates/platforms/_shared/webpack.base.js +0 -234
- package/packages/rnv-build-engine/dist/templates/platforms/_shared/webpack.config.dev.js +0 -6
- package/packages/rnv-build-engine/dist/templates/platforms/_shared/webpack.config.prod.js +0 -6
- package/packages/rnv-build-engine/dist/templates/platforms/_shared/webpack.extend.js +0 -8
- package/packages/rnv-build-engine/dist/templates/platforms/_shared/webpackConfigAdapter.js +0 -100
- package/packages/rnv-build-engine/dist/templates/platforms/_shared/webpackPlatformProps.js +0 -8
- package/packages/rnv-build-engine/dist/templates/platforms/hbbtv/webpackPlatformProps.js +0 -24
- package/packages/rnv-build-engine/dist/templates/platforms/tizen/project/.project +0 -24
- package/packages/rnv-build-engine/dist/templates/platforms/tizen/project/.tproject +0 -12
- package/packages/rnv-build-engine/dist/templates/platforms/tizen/project/config.xml +0 -17
- package/packages/rnv-build-engine/dist/templates/platforms/webos/project/.project +0 -35
- package/packages/rnv-build-engine/dist/templates/platforms/webos/project/appinfo.json +0 -19
- package/packages/rnv-build-engine/dist/templates/platforms/webos/webpackPlatformProps.js +0 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@24i/bigscreen-sdk",
|
|
3
|
-
"version": "1.0.5
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "SmartApps BIGscreen SDK monorepo",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -103,6 +103,7 @@
|
|
|
103
103
|
"./device/resolver/keymap": "./packages/device/resolver/keymap.ts",
|
|
104
104
|
"./device": "./packages/device/src/index.ts",
|
|
105
105
|
"./digital-clock": "./packages/digital-clock/src/index.ts",
|
|
106
|
+
"./driver-androidtv": "./packages/driver-androidtv/src/index.ts",
|
|
106
107
|
"./driver-base/keymap": "./packages/driver-base/src/KeyMap/index.ts",
|
|
107
108
|
"./driver-base": "./packages/driver-base/src/index.ts",
|
|
108
109
|
"./driver-browser": "./packages/driver-browser/src/index.ts",
|
|
@@ -351,6 +351,7 @@ export class DeveloperConsole extends Component<Props> implements IDeveloperTool
|
|
|
351
351
|
ref={this.developerConsoleRef}
|
|
352
352
|
onKeyDown={this.onKeyDown}
|
|
353
353
|
tabIndex={0}
|
|
354
|
+
dir="ltr"
|
|
354
355
|
>
|
|
355
356
|
<div className="developer-console-panel" ref={this.developerConsolePanelRef} />
|
|
356
357
|
<div className="developer-console-controls">
|
|
@@ -88,6 +88,7 @@ export class TechnicalInfo extends Component<Props> implements IDeveloperTool<Pr
|
|
|
88
88
|
ref={this.horizontalNavigation}
|
|
89
89
|
domRef={this.rootRef}
|
|
90
90
|
focusableChildren={[this.technicalInfoRef, this.closeButtonRef]}
|
|
91
|
+
dir="ltr"
|
|
91
92
|
>
|
|
92
93
|
<div className="content">
|
|
93
94
|
<TechnicalInfoDetail
|
|
@@ -117,6 +118,7 @@ export class TechnicalInfo extends Component<Props> implements IDeveloperTool<Pr
|
|
|
117
118
|
ref={this.rootRef}
|
|
118
119
|
className={`technical-info ${DISPLAY_NONE}`}
|
|
119
120
|
onKeyDown={this.onKeyDown}
|
|
121
|
+
dir="ltr"
|
|
120
122
|
/>
|
|
121
123
|
);
|
|
122
124
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DeviceAndroidTV as Device } from '@24i/bigscreen-sdk/driver-androidtv';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { KeycodeKeyMap, DeviceEventMap } from '@24i/bigscreen-sdk/driver-base';
|
|
2
|
+
import { DeviceAndroidTV } from '@24i/bigscreen-sdk/driver-androidtv';
|
|
2
3
|
import { DeviceBrowser } from '@24i/bigscreen-sdk/driver-browser';
|
|
3
4
|
import { DeviceEntone } from '@24i/bigscreen-sdk/driver-entone';
|
|
4
5
|
import { DeviceHbbTV } from '@24i/bigscreen-sdk/driver-hbbtv';
|
|
@@ -39,6 +40,11 @@ const getDevice = () => {
|
|
|
39
40
|
info('KreaTV');
|
|
40
41
|
return new DeviceKreaTV();
|
|
41
42
|
}
|
|
43
|
+
// any because JavaScriptBridge property is defined on Android TV Bridge platform
|
|
44
|
+
if (typeof (window as any).JavaScriptBridge !== 'undefined') {
|
|
45
|
+
info('AndroidTV');
|
|
46
|
+
return new DeviceAndroidTV();
|
|
47
|
+
}
|
|
42
48
|
// any because ENTONE property is defined on Entone platform
|
|
43
49
|
if (typeof (window as any).ENTONE !== 'undefined') {
|
|
44
50
|
info('Entone');
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DeviceBase,
|
|
3
|
+
ConnectionType,
|
|
4
|
+
ScreenSaverStatus,
|
|
5
|
+
VolumeRange,
|
|
6
|
+
} from '@24i/bigscreen-sdk/driver-base';
|
|
7
|
+
import { IJavaScriptBridge } from './types';
|
|
8
|
+
import { getFirmware } from './formatUserAgent';
|
|
9
|
+
import { getKeyMap } from './keymap';
|
|
10
|
+
|
|
11
|
+
interface CustomKeyboardEvent extends KeyboardEvent {
|
|
12
|
+
/** Flag indicating that the driver has already re-emitted this event. */
|
|
13
|
+
bigscreenSdkRelaunched?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare global {
|
|
17
|
+
interface Window extends IJavaScriptBridge {}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Android TV driver implementing API of Android TV Bridge.
|
|
22
|
+
*
|
|
23
|
+
* See https://github.com/24i/prd-smart-ott-androidtv
|
|
24
|
+
*/
|
|
25
|
+
export class DeviceAndroidTV extends DeviceBase {
|
|
26
|
+
keyMap = getKeyMap();
|
|
27
|
+
|
|
28
|
+
platformInfo = window.JavaScriptBridge.bridgeJavaScriptToAndroid_GetDeviceInfo();
|
|
29
|
+
|
|
30
|
+
firmware = getFirmware(navigator.userAgent);
|
|
31
|
+
|
|
32
|
+
async initDevice(): Promise<void> {
|
|
33
|
+
this.initKeydownListener();
|
|
34
|
+
this.initKeyupListener();
|
|
35
|
+
this.initNetworkChangeListener();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
initKeydownListener() {
|
|
39
|
+
window.addEventListener('keydown', this.relaunchKeyEvent, true);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
initKeyupListener() {
|
|
43
|
+
window.addEventListener('keyup', this.relaunchKeyEvent, true);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Handles keydown/up events for the BACK key which are dispatched on the document
|
|
48
|
+
* from the Android TV Bridge. We must catch them and re-emit them properly
|
|
49
|
+
* on the active (focused) element in the DOM tree.
|
|
50
|
+
* @param event keyboard event
|
|
51
|
+
*/
|
|
52
|
+
relaunchKeyEvent = (event: CustomKeyboardEvent) => {
|
|
53
|
+
if (event.bigscreenSdkRelaunched) { // prevent to relaunch event in loop
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const { keyCode } = event;
|
|
57
|
+
if (keyCode === this.keyMap.BACK) {
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
event.stopImmediatePropagation();
|
|
60
|
+
const newEvent = new KeyboardEvent(event.type, {
|
|
61
|
+
keyCode, bubbles: true, cancelable: true, composed: true,
|
|
62
|
+
}) as CustomKeyboardEvent;
|
|
63
|
+
newEvent.bigscreenSdkRelaunched = true;
|
|
64
|
+
document.activeElement?.dispatchEvent(newEvent);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
initNetworkChangeListener() {
|
|
69
|
+
window.addEventListener('online', () => {
|
|
70
|
+
this.triggerEvent('networkchange', { isConnected: true });
|
|
71
|
+
});
|
|
72
|
+
window.addEventListener('offline', () => {
|
|
73
|
+
this.triggerEvent('networkchange', { isConnected: false });
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
reboot(): void {
|
|
78
|
+
let rootPath = '';
|
|
79
|
+
const splitUrl = window.location.href.split('#');
|
|
80
|
+
if (splitUrl.length > 1) rootPath = splitUrl[0];
|
|
81
|
+
window.location.href = rootPath;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
exit(): void {
|
|
85
|
+
window.JavaScriptBridge.bridgeJavaScriptToAndroid_Back();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async getManufacturerName(): Promise<string> {
|
|
89
|
+
return this.platformInfo.deviceBrand || '';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async getPlatformName(): Promise<string> {
|
|
93
|
+
return 'AndroidTV';
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async getPlatformVersion(): Promise<string> {
|
|
97
|
+
return this.platformInfo.osVersion || '';
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async getDeviceName(): Promise<string> {
|
|
101
|
+
const modelName = await this.getModelName();
|
|
102
|
+
const manufacturerName = await this.getManufacturerName();
|
|
103
|
+
return `AndroidTV ${manufacturerName} ${modelName}`.trim();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async getModelName(): Promise<string> {
|
|
107
|
+
return this.platformInfo.deviceModel || '';
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async getFirmware(): Promise<string> {
|
|
111
|
+
return this.firmware || '';
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
async is4KSupported(): Promise<boolean> {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
async is8KSupported(): Promise<boolean> {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
async getUuid(): Promise<string> {
|
|
123
|
+
return this.getBaseUuid();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async getVolume(): Promise<number> {
|
|
127
|
+
return VolumeRange.UNSUPPORTED;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
131
|
+
async setVolume(volumePercentage: number): Promise<void> {
|
|
132
|
+
// not supported on AndroidTV platform
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
136
|
+
async mute(mute: boolean): Promise<void> {
|
|
137
|
+
// not supported on AndroidTV platform
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async isMute(): Promise<boolean> {
|
|
141
|
+
// not supported on AndroidTV platform
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
async getScreenSaver(): Promise<ScreenSaverStatus> {
|
|
146
|
+
// not supported on AndroidTV platform
|
|
147
|
+
return { enabled: false };
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
151
|
+
async setScreenSaver(status: ScreenSaverStatus): Promise<void> {
|
|
152
|
+
// not supported on AndroidTV platform
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
156
|
+
async setUserAgent(userAgent: string): Promise<boolean> {
|
|
157
|
+
// not supported on AndroidTV platform
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async isNetworkConnected(): Promise<boolean> {
|
|
162
|
+
return window.navigator.onLine;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
async getConnectionType(): Promise<ConnectionType> {
|
|
166
|
+
// not supported on AndroidTV platform
|
|
167
|
+
return 'unknown';
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
async getLocalIP(): Promise<string> {
|
|
171
|
+
// not supported on AndroidTV platform
|
|
172
|
+
return '';
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
async getMacAddress(): Promise<string> {
|
|
176
|
+
// not supported on AndroidTV platform
|
|
177
|
+
return '';
|
|
178
|
+
}
|
|
179
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IJavaScriptBridge } from '../types';
|
|
2
|
+
|
|
3
|
+
export const mockJavaScriptBridge: IJavaScriptBridge = {
|
|
4
|
+
JavaScriptBridge: {
|
|
5
|
+
bridgeJavaScriptToAndroid_GetDeviceInfo: () => ({
|
|
6
|
+
deviceBrand: 'Sony',
|
|
7
|
+
deviceModel: 'BRAVIA 4K 2015',
|
|
8
|
+
osVersion: '8.0.0',
|
|
9
|
+
}),
|
|
10
|
+
bridgeJavaScriptToAndroid_Back: () => {},
|
|
11
|
+
},
|
|
12
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses software version of Android TV from user agent string.
|
|
3
|
+
* @param userAgent User agent string
|
|
4
|
+
* @returns software version string or undefined if not found. Ex. "QTS1.220504.008"
|
|
5
|
+
*/
|
|
6
|
+
export const getFirmware = (userAgent: string) => {
|
|
7
|
+
const [
|
|
8
|
+
, firmware,
|
|
9
|
+
] = userAgent.match(/Build\/([^;]*)/) || [] as Array<undefined>;
|
|
10
|
+
return firmware;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DeviceAndroidTV } from './DeviceAndroidTV';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
interface JavaScriptBridge {
|
|
2
|
+
/**
|
|
3
|
+
* It returns device info.
|
|
4
|
+
*/
|
|
5
|
+
bridgeJavaScriptToAndroid_GetDeviceInfo: () => {
|
|
6
|
+
/**
|
|
7
|
+
* Device brand. Ex. "Sony"
|
|
8
|
+
*/
|
|
9
|
+
deviceBrand: string,
|
|
10
|
+
/**
|
|
11
|
+
* Device model. Ex. "BRAVIA 4K 2015"
|
|
12
|
+
*/
|
|
13
|
+
deviceModel: string,
|
|
14
|
+
/**
|
|
15
|
+
* Android version. Ex. "7.0"
|
|
16
|
+
*/
|
|
17
|
+
osVersion: string,
|
|
18
|
+
},
|
|
19
|
+
/**
|
|
20
|
+
* It simulates a native Android back press.
|
|
21
|
+
*/
|
|
22
|
+
bridgeJavaScriptToAndroid_Back: () => void,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface IJavaScriptBridge {
|
|
26
|
+
JavaScriptBridge: JavaScriptBridge,
|
|
27
|
+
}
|
|
@@ -124,6 +124,8 @@ export abstract class DeviceBase<
|
|
|
124
124
|
private bindPreventDefaultEvents(rootElement: HTMLElement) {
|
|
125
125
|
// prevent default to focus the next focusable element of event target
|
|
126
126
|
bindPreventDefaultEvent(rootElement, 'keydown');
|
|
127
|
+
// prevent default not to lose focus (Seen on Android TV Bridge)
|
|
128
|
+
bindPreventDefaultEvent(rootElement, 'keyup');
|
|
127
129
|
// prevent default to focus the nearest focusable ancestor of event target
|
|
128
130
|
bindPreventDefaultEvent(rootElement, 'mousedown');
|
|
129
131
|
}
|
|
@@ -44,9 +44,12 @@ const prepareDateData = ({
|
|
|
44
44
|
return { selectedValue, from, to, overrides };
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
const defaultFormat = (date: Date) =>
|
|
48
|
-
|
|
49
|
-
)
|
|
47
|
+
const defaultFormat = (date: Date) => {
|
|
48
|
+
const locale = i18n.getLanguage();
|
|
49
|
+
return l10n.date(date, locale).toLocaleDateString(
|
|
50
|
+
{ weekday: 'short', day: 'numeric', month: 'short' }
|
|
51
|
+
);
|
|
52
|
+
};
|
|
50
53
|
|
|
51
54
|
export class DatePicker extends Component<Props> implements IDatePicker {
|
|
52
55
|
datePicker = createRef<Picker<number>>();
|
|
@@ -151,3 +151,15 @@ export const dateFormatter = (
|
|
|
151
151
|
)(date),
|
|
152
152
|
};
|
|
153
153
|
};
|
|
154
|
+
|
|
155
|
+
export const toTwoDigitLocaleTimeString = (date: Date) => (
|
|
156
|
+
options: DateTimeFormatOptions = {
|
|
157
|
+
hour: '2-digit', minute: '2-digit', second: '2-digit',
|
|
158
|
+
},
|
|
159
|
+
) => collonSeparatedHour24MinuteSecond(date, options);
|
|
160
|
+
|
|
161
|
+
export const toNumericLocaleTimeString = (date: Date) => (
|
|
162
|
+
options: DateTimeFormatOptions = {
|
|
163
|
+
hour: 'numeric', minute: '2-digit', second: '2-digit',
|
|
164
|
+
},
|
|
165
|
+
) => collonSeparatedHour24MinuteSecond(date, options);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { dateFormatter, processYear, toNumericLocaleTimeString } from './common';
|
|
2
2
|
import type { DateTimeFormatOptions, Weekday, Day, Month, Year } from './types';
|
|
3
3
|
|
|
4
4
|
const WEEKDAYS = {
|
|
@@ -86,10 +86,4 @@ const toLocaleDateString = (date: Date) => (
|
|
|
86
86
|
return dateStringParts.join(' ');
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
-
const
|
|
90
|
-
options: DateTimeFormatOptions = {
|
|
91
|
-
hour: 'numeric', minute: '2-digit', second: '2-digit',
|
|
92
|
-
},
|
|
93
|
-
) => collonSeparatedHour24MinuteSecond(date, options);
|
|
94
|
-
|
|
95
|
-
export const csDateFormatter = dateFormatter(toLocaleTimeString, toLocaleDateString, ' ');
|
|
89
|
+
export const csDateFormatter = dateFormatter(toNumericLocaleTimeString, toLocaleDateString, ' ');
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { processYear, dateFormatter, toTwoDigitLocaleTimeString } from './common';
|
|
2
|
+
import { DateTimeFormatOptions, Day, Month, Weekday, Year } from './types';
|
|
3
|
+
|
|
4
|
+
//https://web.library.yale.edu/cataloging/months
|
|
5
|
+
const DE_MONTHS = {
|
|
6
|
+
narrow: [
|
|
7
|
+
'J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D',
|
|
8
|
+
],
|
|
9
|
+
short: [
|
|
10
|
+
'Jan', 'Feb', 'März', 'Apr', 'Mai', 'Juni', 'Juli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dez',
|
|
11
|
+
],
|
|
12
|
+
long: [
|
|
13
|
+
'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September',
|
|
14
|
+
'Oktober', 'November', 'Dezember',
|
|
15
|
+
],
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const DE_WEEKDAYS = {
|
|
19
|
+
narrow: [
|
|
20
|
+
'S', 'M', 'D', 'M', 'D', 'F', 'S',
|
|
21
|
+
],
|
|
22
|
+
short: [
|
|
23
|
+
'So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa',
|
|
24
|
+
],
|
|
25
|
+
long: [
|
|
26
|
+
'Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag',
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const processDay = (dateParts: string[], day: Day | undefined, date: Date) => {
|
|
31
|
+
if (typeof day === 'undefined') return;
|
|
32
|
+
const strDate = date.getDate().toString();
|
|
33
|
+
dateParts.push(`${strDate}.`);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const processMonth = (
|
|
37
|
+
dateParts: string[],
|
|
38
|
+
month: Month | undefined,
|
|
39
|
+
date: Date,
|
|
40
|
+
) => {
|
|
41
|
+
if (typeof month === 'undefined') return;
|
|
42
|
+
if (month === '2-digit' || month === 'numeric') {
|
|
43
|
+
const strMonth = (date.getMonth() + 1).toString() + '.';
|
|
44
|
+
dateParts.push(strMonth);
|
|
45
|
+
} else {
|
|
46
|
+
const finalMonth = DE_MONTHS[month][date.getMonth()];
|
|
47
|
+
if (month === 'short') dateParts.push(`${finalMonth}.`);
|
|
48
|
+
else dateParts.push(finalMonth);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const processWeekday = (
|
|
53
|
+
dateStringParts: string[],
|
|
54
|
+
year: Year | undefined,
|
|
55
|
+
month: Month | undefined,
|
|
56
|
+
day: Day | undefined,
|
|
57
|
+
weekday: Weekday | undefined,
|
|
58
|
+
date: Date,
|
|
59
|
+
) => {
|
|
60
|
+
if (typeof weekday === 'undefined') return;
|
|
61
|
+
let weekdayString = DE_WEEKDAYS[weekday][date.getDay()];
|
|
62
|
+
if (weekday === 'short') weekdayString += '.';
|
|
63
|
+
if (
|
|
64
|
+
typeof year !== 'undefined'
|
|
65
|
+
|| typeof month !== 'undefined'
|
|
66
|
+
|| typeof day !== 'undefined'
|
|
67
|
+
) {
|
|
68
|
+
weekdayString += ',';
|
|
69
|
+
}
|
|
70
|
+
dateStringParts.push(weekdayString);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const toLocaleDateString = (date: Date) => (
|
|
74
|
+
{ weekday, year, month, day }: DateTimeFormatOptions = {
|
|
75
|
+
year: 'numeric', month: '2-digit', day: '2-digit',
|
|
76
|
+
},
|
|
77
|
+
) => {
|
|
78
|
+
const dateStringParts: string[] = [];
|
|
79
|
+
processWeekday(dateStringParts, year, month, day, weekday, date);
|
|
80
|
+
const dateConnection = '';
|
|
81
|
+
const dateParts: string[] = [];
|
|
82
|
+
processDay(dateParts, day, date);
|
|
83
|
+
if ((month === 'narrow' ||
|
|
84
|
+
month === 'short' ||
|
|
85
|
+
month === 'long') &&
|
|
86
|
+
day != null
|
|
87
|
+
) {
|
|
88
|
+
dateParts.push(' ');
|
|
89
|
+
}
|
|
90
|
+
processMonth(dateParts, month, date);
|
|
91
|
+
if (month === 'long') dateParts.push(' ');
|
|
92
|
+
processYear(dateParts, year, date);
|
|
93
|
+
dateStringParts.push(dateParts.join(dateConnection));
|
|
94
|
+
return dateStringParts.join(' ');
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const deDateFormatter = dateFormatter(toTwoDigitLocaleTimeString, toLocaleDateString);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
collonSeparatedHour12MinuteSecond, dateFormatter, processYear, SECOND_FROM_END,
|
|
3
3
|
} from './common';
|
|
4
|
-
import {
|
|
4
|
+
import { EN_MONTHS, processWeekday, isDdMmYyyy } from './en-common';
|
|
5
5
|
import type { DateTimeFormatOptions, Day, Month, Year } from './types';
|
|
6
6
|
|
|
7
7
|
const processMonth = (
|
|
@@ -19,7 +19,7 @@ const processMonth = (
|
|
|
19
19
|
: numericMonth
|
|
20
20
|
}${typeof year !== 'undefined' ? ',' : ''}`);
|
|
21
21
|
} else {
|
|
22
|
-
dateStringParts.push(
|
|
22
|
+
dateStringParts.push(EN_MONTHS[month][date.getMonth()]);
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
|
|
@@ -49,7 +49,7 @@ const getDdMmYyyy = (dateStringParts: string[], year: Year | undefined, date: Da
|
|
|
49
49
|
dateStringParts.push(`${d}/${m}/${y}`);
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
const toLocaleDateString = (date: Date) => (
|
|
53
53
|
{ weekday, year, month, day }: DateTimeFormatOptions = {
|
|
54
54
|
year: 'numeric', month: '2-digit', day: '2-digit',
|
|
55
55
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Day, Month, Weekday, Year } from './types';
|
|
1
|
+
import type { Day, Month, Weekday, LocaleData, Year } from './types';
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const EN_MONTHS = {
|
|
4
4
|
narrow: [
|
|
5
5
|
'J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D',
|
|
6
6
|
],
|
|
@@ -13,7 +13,7 @@ export const MONTHS = {
|
|
|
13
13
|
],
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export const
|
|
16
|
+
export const EN_WEEKDAYS = {
|
|
17
17
|
narrow: [
|
|
18
18
|
'S', 'M', 'T', 'W', 'T', 'F', 'S',
|
|
19
19
|
],
|
|
@@ -32,9 +32,10 @@ export const processWeekday = (
|
|
|
32
32
|
day: Day | undefined,
|
|
33
33
|
weekday: Weekday | undefined,
|
|
34
34
|
date: Date,
|
|
35
|
+
weekdaysLocaleData: LocaleData = EN_WEEKDAYS
|
|
35
36
|
) => {
|
|
36
37
|
if (typeof weekday === 'undefined') return;
|
|
37
|
-
let weekdayString =
|
|
38
|
+
let weekdayString = weekdaysLocaleData[weekday][date.getDay()];
|
|
38
39
|
if (
|
|
39
40
|
typeof year !== 'undefined'
|
|
40
41
|
|| typeof month !== 'undefined'
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
processYear,
|
|
5
5
|
SECOND_FROM_END,
|
|
6
6
|
} from './common';
|
|
7
|
-
import {
|
|
7
|
+
import { EN_MONTHS, processWeekday, isDdMmYyyy } from './en-common';
|
|
8
8
|
import type { DateTimeFormatOptions, Day, Month, Year } from './types';
|
|
9
9
|
|
|
10
10
|
const processMonth = (dateStringParts: string[], month: Month | undefined, date: Date) => {
|
|
@@ -16,7 +16,7 @@ const processMonth = (dateStringParts: string[], month: Month | undefined, date:
|
|
|
16
16
|
? `0${numericMonth}` : numericMonth,
|
|
17
17
|
);
|
|
18
18
|
} else {
|
|
19
|
-
dateStringParts.push(
|
|
19
|
+
dateStringParts.push(EN_MONTHS[month][date.getMonth()]);
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
|
|
@@ -56,7 +56,7 @@ const getDdMmYyyy = (
|
|
|
56
56
|
dateStringParts.push(`${m}/${d}/${y}`);
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
const toLocaleDateString = (date: Date) => (
|
|
60
60
|
{ weekday, year, month, day }: DateTimeFormatOptions = {
|
|
61
61
|
year: 'numeric', month: 'numeric', day: 'numeric',
|
|
62
62
|
},
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { processYear, dateFormatter, toNumericLocaleTimeString } from './common';
|
|
2
|
+
import { processWeekday } from './en-common';
|
|
3
|
+
import { DateTimeFormatOptions, Day, Month } from './types';
|
|
4
|
+
|
|
5
|
+
const ES_MONTHS = {
|
|
6
|
+
narrow: [
|
|
7
|
+
'E', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D',
|
|
8
|
+
],
|
|
9
|
+
// https://web.library.yale.edu/cataloging/months
|
|
10
|
+
short: [
|
|
11
|
+
'ene', 'feb', 'mar', 'abr', 'mayo', 'jun', 'jul', 'ago', 'set', 'oct', 'nov', 'dic',
|
|
12
|
+
],
|
|
13
|
+
long: [
|
|
14
|
+
'enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre',
|
|
15
|
+
'octubre', 'noviembre', 'diciembre',
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const ES_WEEKDAYS = {
|
|
20
|
+
// https://letsspeakspanish.com/blog/days-of-week-months-seasons-in-spanish/
|
|
21
|
+
narrow: [
|
|
22
|
+
'D', 'L', 'M', 'X', 'J', 'V', 'S',
|
|
23
|
+
],
|
|
24
|
+
short: [
|
|
25
|
+
'dom', 'lun', 'mar', 'mié', 'jue', 'vie', 'sáb',
|
|
26
|
+
],
|
|
27
|
+
long: [
|
|
28
|
+
'domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado',
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const processDay = (dateParts: string[], day: Day | undefined, date: Date) => {
|
|
33
|
+
if (typeof day === 'undefined') return;
|
|
34
|
+
const strDate = date.getDate().toString();
|
|
35
|
+
dateParts.push(strDate);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const processMonth = (
|
|
39
|
+
dateParts: string[],
|
|
40
|
+
month: Month | undefined,
|
|
41
|
+
date: Date,
|
|
42
|
+
) => {
|
|
43
|
+
if (typeof month === 'undefined') return;
|
|
44
|
+
if (month === '2-digit' || month === 'numeric') {
|
|
45
|
+
const strMonth = (date.getMonth() + 1).toString();
|
|
46
|
+
dateParts.push(strMonth);
|
|
47
|
+
} else {
|
|
48
|
+
const finalMonth = ES_MONTHS[month][date.getMonth()];
|
|
49
|
+
dateParts.push(finalMonth);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const toLocaleDateString = (date: Date) => (
|
|
54
|
+
{ weekday, year, month, day }: DateTimeFormatOptions = {
|
|
55
|
+
year: 'numeric', month: '2-digit', day: '2-digit',
|
|
56
|
+
},
|
|
57
|
+
) => {
|
|
58
|
+
const dateStringParts: string[] = [];
|
|
59
|
+
processWeekday(dateStringParts, year, month, day, weekday, date, ES_WEEKDAYS);
|
|
60
|
+
const dateConnection = month === '2-digit' || month === 'numeric' ? '/' : ' ';
|
|
61
|
+
const dateParts: string[] = [];
|
|
62
|
+
processDay(dateParts, day, date);
|
|
63
|
+
if (month === 'long' && day != null) dateParts.push('de');
|
|
64
|
+
processMonth(dateParts, month, date);
|
|
65
|
+
if (month === 'long') dateParts.push('de');
|
|
66
|
+
processYear(dateParts, year, date);
|
|
67
|
+
dateStringParts.push(dateParts.join(dateConnection));
|
|
68
|
+
return dateStringParts.join(' ');
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const esDateFormatter = dateFormatter(toNumericLocaleTimeString, toLocaleDateString);
|