@sprucelabs/heartwood-view-controllers 129.0.5 → 129.1.0
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/build/esm/tests/AbstractViewControllerTest.js +2 -1
- package/build/esm/tests/SpyDevice.d.ts +3 -1
- package/build/esm/tests/SpyDevice.js +4 -1
- package/build/esm/types/heartwood.types.d.ts +4 -0
- package/build/tests/AbstractViewControllerTest.js +2 -1
- package/build/tests/SpyDevice.d.ts +3 -1
- package/build/tests/SpyDevice.js +4 -1
- package/build/types/heartwood.types.d.ts +4 -0
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ import { coreEventContracts } from '@sprucelabs/mercury-core-events';
|
|
|
12
12
|
import { SchemaRegistry } from '@sprucelabs/schema';
|
|
13
13
|
import { eventContractUtil } from '@sprucelabs/spruce-event-utils';
|
|
14
14
|
import AbstractSpruceTest from '@sprucelabs/test-utils';
|
|
15
|
+
import fakeStorage from '../__tests__/behavioral/devices/fakeStorage.js';
|
|
15
16
|
import EventFaker from '../__tests__/support/EventFaker.js';
|
|
16
17
|
import Authenticator from '../auth/Authenticator.js';
|
|
17
18
|
import renderUtil from '../utilities/render.utility.js';
|
|
@@ -73,7 +74,7 @@ export default class AbstractViewControllerTest extends AbstractSpruceTest {
|
|
|
73
74
|
}
|
|
74
75
|
Factory(options) {
|
|
75
76
|
const mercury = this.mercury;
|
|
76
|
-
return ViewControllerFactory.Factory(Object.assign({ controllerMap: this.controllerMap, device: new SpyDevice(), toastHandler: (message) => MockToastMessageHandler.getInstance().handleMessage(message), connectToApi: () => {
|
|
77
|
+
return ViewControllerFactory.Factory(Object.assign({ controllerMap: this.controllerMap, device: new SpyDevice(fakeStorage), toastHandler: (message) => MockToastMessageHandler.getInstance().handleMessage(message), connectToApi: () => {
|
|
77
78
|
return mercury.connectToApi();
|
|
78
79
|
} }, options));
|
|
79
80
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CachedValue, Device, SubmitFeedbackOptions, PowerBehaviorOptions, TheaterSettingValueTypes, TheatreSettingName } from '../types/heartwood.types';
|
|
1
|
+
import { CachedValue, Device, SubmitFeedbackOptions, PowerBehaviorOptions, TheaterSettingValueTypes, TheatreSettingName, DeviceOptions } from '../types/heartwood.types';
|
|
2
2
|
import MockAudioController from './MockAudioController';
|
|
3
3
|
export default class SpyDevice implements Device {
|
|
4
4
|
lastCommand?: string;
|
|
@@ -12,6 +12,8 @@ export default class SpyDevice implements Device {
|
|
|
12
12
|
private brightness;
|
|
13
13
|
lastPowerBehaviorOptions?: PowerBehaviorOptions;
|
|
14
14
|
lastFeedbackOptions?: SubmitFeedbackOptions;
|
|
15
|
+
isNative: boolean;
|
|
16
|
+
constructor(_storage: Storage, options?: DeviceOptions);
|
|
15
17
|
setCachedValue(key: string, value: CachedValue): void;
|
|
16
18
|
openUrl(url: string): void;
|
|
17
19
|
getCachedValue(key: string): CachedValue;
|
|
@@ -10,12 +10,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { SchemaError } from '@sprucelabs/schema';
|
|
11
11
|
import MockAudioController from './MockAudioController.js';
|
|
12
12
|
export default class SpyDevice {
|
|
13
|
-
constructor() {
|
|
13
|
+
constructor(_storage, options) {
|
|
14
14
|
this.vibrateCount = 0;
|
|
15
15
|
this.cachedValues = {};
|
|
16
16
|
this.allCommands = [];
|
|
17
17
|
this.kioskSettings = {};
|
|
18
18
|
this.brightness = 0;
|
|
19
|
+
this.isNative = true;
|
|
20
|
+
const { isNative = true } = options || {};
|
|
21
|
+
this.isNative = isNative;
|
|
19
22
|
}
|
|
20
23
|
setCachedValue(key, value) {
|
|
21
24
|
this.cachedValues[key] = value;
|
|
@@ -523,6 +523,10 @@ export interface TheaterSettingValueTypes {
|
|
|
523
523
|
'audio-volume': number | null;
|
|
524
524
|
}
|
|
525
525
|
export type TheatreSettingName = keyof TheaterSettingValueTypes;
|
|
526
|
+
export type DeviceConstructor = new (storage: Storage, options?: DeviceOptions) => Device;
|
|
527
|
+
export interface DeviceOptions {
|
|
528
|
+
isNative?: boolean;
|
|
529
|
+
}
|
|
526
530
|
export interface Device {
|
|
527
531
|
openUrl(url: string): void;
|
|
528
532
|
vibrate(): void;
|
|
@@ -8,6 +8,7 @@ const mercury_core_events_1 = require("@sprucelabs/mercury-core-events");
|
|
|
8
8
|
const schema_1 = require("@sprucelabs/schema");
|
|
9
9
|
const spruce_event_utils_1 = require("@sprucelabs/spruce-event-utils");
|
|
10
10
|
const test_utils_1 = __importDefault(require("@sprucelabs/test-utils"));
|
|
11
|
+
const fakeStorage_1 = __importDefault(require("../__tests__/behavioral/devices/fakeStorage"));
|
|
11
12
|
const EventFaker_1 = __importDefault(require("../__tests__/support/EventFaker"));
|
|
12
13
|
const Authenticator_1 = __importDefault(require("../auth/Authenticator"));
|
|
13
14
|
const render_utility_1 = __importDefault(require("../utilities/render.utility"));
|
|
@@ -60,7 +61,7 @@ class AbstractViewControllerTest extends test_utils_1.default {
|
|
|
60
61
|
const mercury = this.mercury;
|
|
61
62
|
return ViewControllerFactory_1.default.Factory({
|
|
62
63
|
controllerMap: this.controllerMap,
|
|
63
|
-
device: new SpyDevice_1.default(),
|
|
64
|
+
device: new SpyDevice_1.default(fakeStorage_1.default),
|
|
64
65
|
toastHandler: (message) => MockToastMessageHandler_1.default.getInstance().handleMessage(message),
|
|
65
66
|
connectToApi: () => {
|
|
66
67
|
return mercury.connectToApi();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CachedValue, Device, SubmitFeedbackOptions, PowerBehaviorOptions, TheaterSettingValueTypes, TheatreSettingName } from '../types/heartwood.types';
|
|
1
|
+
import { CachedValue, Device, SubmitFeedbackOptions, PowerBehaviorOptions, TheaterSettingValueTypes, TheatreSettingName, DeviceOptions } from '../types/heartwood.types';
|
|
2
2
|
import MockAudioController from './MockAudioController';
|
|
3
3
|
export default class SpyDevice implements Device {
|
|
4
4
|
lastCommand?: string;
|
|
@@ -12,6 +12,8 @@ export default class SpyDevice implements Device {
|
|
|
12
12
|
private brightness;
|
|
13
13
|
lastPowerBehaviorOptions?: PowerBehaviorOptions;
|
|
14
14
|
lastFeedbackOptions?: SubmitFeedbackOptions;
|
|
15
|
+
isNative: boolean;
|
|
16
|
+
constructor(_storage: Storage, options?: DeviceOptions);
|
|
15
17
|
setCachedValue(key: string, value: CachedValue): void;
|
|
16
18
|
openUrl(url: string): void;
|
|
17
19
|
getCachedValue(key: string): CachedValue;
|
package/build/tests/SpyDevice.js
CHANGED
|
@@ -6,12 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const schema_1 = require("@sprucelabs/schema");
|
|
7
7
|
const MockAudioController_1 = __importDefault(require("./MockAudioController"));
|
|
8
8
|
class SpyDevice {
|
|
9
|
-
constructor() {
|
|
9
|
+
constructor(_storage, options) {
|
|
10
10
|
this.vibrateCount = 0;
|
|
11
11
|
this.cachedValues = {};
|
|
12
12
|
this.allCommands = [];
|
|
13
13
|
this.kioskSettings = {};
|
|
14
14
|
this.brightness = 0;
|
|
15
|
+
this.isNative = true;
|
|
16
|
+
const { isNative = true } = options || {};
|
|
17
|
+
this.isNative = isNative;
|
|
15
18
|
}
|
|
16
19
|
setCachedValue(key, value) {
|
|
17
20
|
this.cachedValues[key] = value;
|
|
@@ -523,6 +523,10 @@ export interface TheaterSettingValueTypes {
|
|
|
523
523
|
'audio-volume': number | null;
|
|
524
524
|
}
|
|
525
525
|
export type TheatreSettingName = keyof TheaterSettingValueTypes;
|
|
526
|
+
export type DeviceConstructor = new (storage: Storage, options?: DeviceOptions) => Device;
|
|
527
|
+
export interface DeviceOptions {
|
|
528
|
+
isNative?: boolean;
|
|
529
|
+
}
|
|
526
530
|
export interface Device {
|
|
527
531
|
openUrl(url: string): void;
|
|
528
532
|
vibrate(): void;
|
package/package.json
CHANGED