Software: Microsoft-IIS/10.0. PHP/7.4.33 uname -a: Windows NT LAKE 10.0 build 20348 (Windows Server 2016) AMD64 IWPD_801(traduongco) Safe-mode: OFF (not secure) C:\Windows\SystemApps\Microsoft.Windows.CloudExperienceHost_cw5n1h2txyewy\webapps\inclusiveOobe\js\ drwxrwxrwx | |
| Viewing file: Select action/file-type: // Copyright (C) Microsoft. All rights reserved.
define(['lib/knockout', 'corejs/knockouthelpers', 'legacy/bridge', 'legacy/appObjectFactory', 'legacy/events', 'legacy/core',
'optional!sample/Sample.Oobe.FeatureUpdateManager'],
(ko, KoHelpers, bridge, appObjectFactory, constants, core) => {
const intervalTime = 5 * 1000, scanTimeout = 2 * 60 * 1000;
const cxhSpeech = CloudExperienceHostAPI.Speech;
const winSpeech = Windows.Media.SpeechRecognition;
const acceptConstraintTag = "accept";
const skipConstraintTag = "skip";
class FeatureUpdateViewModel {
constructor(resourceStrings) {
this.resourceStrings = resourceStrings;
this.processingFlag = ko.observable(false);
this.title = resourceStrings.FeatureUpdateTitle;
this.updateLogo = resourceStrings.FeatureUpdateLogo;
this.leadText = resourceStrings.FeatureUpdateLeadText;
this.featureUpdateImage = "/webapps/inclusiveOobe/media/oobe-feature-update.svg";
this.isUpdateFound = ko.observable(false);
this.progressText = ko.observable("");
this.progressText.subscribe((newTitle) => {
document.title = newTitle;
});
this.featureUpdateManager = appObjectFactory.getObjectFromString("CloudExperienceHostAPI.OobeFeatureUpdateManagerStatics");
this.statusQueue = [];
this.featureUpdateManager.onstatuschanged = (status) => {
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "FeatureUpdateStatusChanged", status);
this.statusQueue.push(status);
this.processStatusQueue();
};
setImmediate(() => {
this.startScan();
});
this.flexStartHyperLinks = [
{
hyperlinkText: resourceStrings.FeatureUpdateSkipLink,
handler: () => {
this.onSkip();
}
}
];
this.flexEndButtons = [
{
buttonText: resourceStrings.FeatureUpdateButtonText,
buttonType: "button",
isPrimaryButton: true,
autoFocus: true,
buttonClickHandler: (() => {
this.onAccept();
}),
disableControl: ko.pureComputed(() => {
return this.processingFlag();
})
}
];
}
onProgressTextChange(newTextResID) {
this.progressText(resourceStrings[newTextResID]);
}
processStatusQueue() {
if (!this.processQueueTimerID) {
// Pick up the first status change immediately. We need to set a time interval before processing
// subsequent message. In case first status change is "scanning", timer will ensure the scanning
// message stays on the screen for certain amount of time and speech is completed. In all failure
// cases timer shall be cleared in exit.
this.processStatusChange();
this.processQueueTimerID = setTimeout(() => {
this.processStatusChange();
}, intervalTime);
}
}
processStatusChange() {
if (this.statusQueue.length > 0) {
let status = Number(this.statusQueue.shift());
switch (status) {
case CloudExperienceHostAPI.OobeFeatureUpdateStatus.scanning:
this.onProgressTextChange("Scanning");
this.showPage();
break;
case CloudExperienceHostAPI.OobeFeatureUpdateStatus.updateFound:
// Stop scan timer to prevent calling cancelScanAsync method.
this.cancelScanTimer();
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "oobeFeatureUpdateFound");
this.isUpdateFound(true);
KoHelpers.setFocusOnAutofocusElement();
this.onStartFeatureUpdateSpeech();
break;
case CloudExperienceHostAPI.OobeFeatureUpdateStatus.updateNotFound:
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "oobeFeatureUpdateNotFound");
this.exit(constants.AppResult.success);
break;
case CloudExperienceHostAPI.OobeFeatureUpdateStatus.scanFailed:
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "oobeFeatureUpdateScanFailed");
this.exit(constants.AppResult.fail);
break;
case CloudExperienceHostAPI.OobeFeatureUpdateStatus.scanCanceled:
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "oobeFeatureUpdateScanCanceled");
this.exit(constants.AppResult.cancel);
default:
break;
}
}
else {
this.cancelQueueTimer();
}
}
startScan() {
try {
this.featureUpdateManager.startScanAsync().done(() => {
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "oobeFeatureUpdateScanStarted");
},
(error) => {
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "oobeFeatureUpdateScanInitiationFailure", core.GetJsonFromError(error));
this.exit(constants.AppResult.fail);
});
this.startScanTimer();
}
catch (error) {
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "UnexpectedErrorStartingFeatureUpdateScan", core.GetJsonFromError(error));
this.exit(constants.AppResult.fail);
}
}
cancelScan() {
try {
this.featureUpdateManager.cancelScanAsync().done(() => { /* success do nothing */ },
(error) => {
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "oobeFeatureUpdateCancelInitiationFailure", core.GetJsonFromError(error));
this.exit(constants.AppResult.cancel);
});
}
catch (error) {
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "UnexpectedErrorCancelingFeatureUpdateScan", core.GetJsonFromError(error));
this.exit(constants.AppResult.cancel);
}
}
onAccept() {
if (!this.processingFlag()) {
this.processingFlag(true);
try {
this.featureUpdateManager.enableFeatureUpdate();
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "oobeFeatureUpdateOptedByUser");
this.exit(constants.AppResult.success);
}
catch (error) {
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "UnexpectedErrorEnablingFeatureUpdate", core.GetJsonFromError(error));
this.exit(constants.AppResult.fail);
}
}
}
onSkip() {
if (!this.processingFlag()) {
this.processingFlag(true);
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "oobeFeatureUpdateSkippedByUser");
this.exit(constants.AppResult.cancel);
}
}
startScanTimer() {
this.cancelScanTimer();
this.cancelTimerID = setTimeout(() => {
this.cancelScan();
}, scanTimeout);
}
cancelScanTimer() {
if (this.cancelTimerID) {
clearTimeout(this.cancelTimerID);
this.cancelTimerID = null;
}
}
cancelQueueTimer() {
if (this.processQueueTimerID) {
clearTimeout(this.processQueueTimerID);
this.processQueueTimerID = null;
}
}
exit(event) {
this.cancelScanTimer();
this.cancelQueueTimer();
this.featureUpdateManager.onstatuschanged = null;
bridge.fireEvent(constants.Events.done, event);
}
showPage() {
bridge.fireEvent(constants.Events.visible, true);
}
onStartFeatureUpdateSpeech() {
try {
cxhSpeech.SpeechRecognition.stop();
let constraints = [];
let acceptConstraint = new winSpeech.SpeechRecognitionListConstraint([this.resourceStrings.FeatureUpdateAccept1Constraint]);
acceptConstraint.tag = acceptConstraintTag;
let skipConstraint = new winSpeech.SpeechRecognitionListConstraint([this.resourceStrings.FeatureUpdateSkip1Constraint, this.resourceStrings.FeatureUpdateSkip2Constraint]);
skipConstraint.tag = skipConstraintTag;
constraints.push(acceptConstraint, skipConstraint, cxhSpeech.SpeechRecognitionKnownCommands.yes, cxhSpeech.SpeechRecognitionKnownCommands.no);
if (constraints.length > 0) {
cxhSpeech.SpeechRecognition.promptForCommandsAsync(this.resourceStrings.FeatureUpdateVoiceOver, constraints).done((result) => {
if (result && !this.processingFlag()) {
if ((result.constraint.tag == acceptConstraintTag) || (result.constraint.tag == cxhSpeech.SpeechRecognitionKnownCommands.yes.tag)) {
this.onAccept()
}
else if ((result.constraint.tag == skipConstraintTag) || (result.constraint.tag == cxhSpeech.SpeechRecognitionKnownCommands.no.tag)) {
this.onSkip();
}
}
});
}
}
catch (error) {
bridge.invoke("CloudExperienceHost.Telemetry.logEvent", "oobeFeatureUpdateSpeechFailure", core.GetJsonFromError(error));
}
}
}
return FeatureUpdateViewModel;
});
|
:: Command execute :: | |
--[ c99shell v. 2.1 [PHP 8 Update] [02.02.2022] maintained byC99Shell Github | Generation time: 0.5849 ]-- |