[PM-27100] Autotype Desktop URI Label (#24520)

* [PM-27100] Add the autotype client models, draft

* [PM-27100] URI label change

* [PM-27100] Move autotype pairing data schema to libs/common

* [PM-27100] Add more comments

* [PM-27100] Update this PR based on schema 1.0.0 change from #24468

* [PM-27100] Retain unknown params in uri for future optional compatability

* [PM-27100] Handle non-empty strings

* [PM-27100] Small tests change

* [PM-27100] Small comment change

* [PM-27100] Remove (URI) from text
This commit is contained in:
Colton Hurst
2026-11-10 12:18:32 -05:00
committed by GitHub
parent 997aa47f91
commit 187430f5b3
5 changed files with 59 additions and 26 deletions

View File

@@ -7078,12 +7078,13 @@
}
}
},
"appUri": {
"message": "App (URI)"
"desktopApp": {
"message": "Desktop app",
"description": "Label for a field that shows an application installed on the computer that the item is paired with."
},
"appUriCount": {
"message": "App (URI) $COUNT$",
"description": "Label for an input field that contains an app URI. The input field is part of a list of fields, and the count indicates the position of the field in the list.",
"desktopAppCount": {
"message": "Desktop app $COUNT$",
"description": "Label for a field that shows an application installed on the computer that the item is paired with. The field is part of a list of fields, and the count indicates the position of the field in the list.",
"placeholders": {
"count": {
"content": "$1",

View File

@@ -974,12 +974,13 @@
}
}
},
"appUri": {
"message": "App (URI)"
"desktopApp": {
"message": "Desktop app",
"description": "Label for a field that shows an application installed on the computer that the item is paired with."
},
"appUriCount": {
"message": "App (URI) $COUNT$",
"description": "Label for an input field that contains an app URI. The input field is part of a list of fields, and the count indicates the position of the field in the list.",
"desktopAppCount": {
"message": "Desktop app $COUNT$",
"description": "Label for a field that shows an application installed on the computer that the item is paired with. The field is part of a list of fields, and the count indicates the position of the field in the list.",
"placeholders": {
"count": {
"content": "$1",

View File

@@ -649,12 +649,13 @@
}
}
},
"appUri": {
"message": "App (URI)"
"desktopApp": {
"message": "Desktop app",
"description": "Label for a field that shows an application installed on the computer that the item is paired with."
},
"appUriCount": {
"message": "App (URI) $COUNT$",
"description": "Label for an input field that contains an app URI. The input field is part of a list of fields, and the count indicates the position of the field in the list.",
"desktopAppCount": {
"message": "Desktop app $COUNT$",
"description": "Label for a field that shows an application installed on the computer that the item is paired with. The field is part of a list of fields, and the count indicates the position of the field in the list.",
"placeholders": {
"count": {
"content": "$1",

View File

@@ -226,23 +226,49 @@ describe("UriOptionComponent", () => {
expect(component["uriLabel"]).toBe("websiteUriCount 2");
});
it("returns 'appUri' for a desktopapp:// URI at index 0 when showAppLabel is true", () => {
it("returns 'desktopApp' for a desktopapp:// URI at index 0 when showAppLabel is true", () => {
component.writeValue({ uri: DESKTOP_APP_URI_PREFIX, matchDetection: null });
component.index = 0;
fixture.componentRef.setInput("showAppLabel", true);
expect(component["uriLabel"]).toBe("appUri");
expect(component["uriLabel"]).toBe("desktopApp");
});
it("returns 'appUriCount' for a desktopapp:// URI at index greater than 0 when showAppLabel is true", () => {
it("returns 'desktopAppCount' for a desktopapp:// URI at index greater than 0 when showAppLabel is true", () => {
component.writeValue({ uri: DESKTOP_APP_URI_PREFIX, matchDetection: null });
component.index = 1;
fixture.componentRef.setInput("showAppLabel", true);
expect(component["uriLabel"]).toBe("appUriCount 2");
expect(component["uriLabel"]).toBe("desktopAppCount 2");
});
});
describe("isAppUri", () => {
it("returns true for a desktopapp:// URI when showAppLabel is true", () => {
component.writeValue({ uri: DESKTOP_APP_URI_PREFIX, matchDetection: null });
fixture.componentRef.setInput("showAppLabel", true);
expect(component["isAppUri"]).toBe(true);
});
it("returns false for a desktopapp:// URI when showAppLabel is false", () => {
component.writeValue({ uri: DESKTOP_APP_URI_PREFIX, matchDetection: null });
fixture.componentRef.setInput("showAppLabel", false);
expect(component["isAppUri"]).toBe(false);
});
it.each(["https://example.com", ""])(
"returns false for the non desktop app URI %p when showAppLabel is true",
(uri) => {
component.writeValue({ uri, matchDetection: null });
fixture.componentRef.setInput("showAppLabel", true);
expect(component["isAppUri"]).toBe(false);
},
);
});
describe("advanced match strategy dialog", () => {
function testDialogAction(action: "onContinue" | "onCancel", expected: number) {
const openSpy = jest

View File

@@ -143,7 +143,7 @@ export class UriOptionComponent implements ControlValueAccessor {
@Input({ required: true }) index: number;
/**
* When true, URIs prefixed with the desktop app scheme will display the "App (URI)" label
* When true, URIs prefixed with the desktop app scheme will display the "Desktop app" label
* instead of "Website (URI)". Should only be true when the WindowsDesktopAutotypeGA feature
* flag is enabled.
*/
@@ -176,15 +176,19 @@ export class UriOptionComponent implements ControlValueAccessor {
}
}
protected get uriLabel() {
const isAppUri =
/** Returns true if this URI is a desktop app pairing */
protected get isAppUri(): boolean {
return (
this.showAppLabel() &&
(this.uriForm.controls.uri.value?.startsWith(DESKTOP_APP_URI_PREFIX) ?? false);
(this.uriForm.controls.uri.value?.startsWith(DESKTOP_APP_URI_PREFIX) ?? false)
);
}
if (isAppUri) {
protected get uriLabel() {
if (this.isAppUri) {
return this.index === 0
? this.i18nService.t("appUri")
: this.i18nService.t("appUriCount", this.index + 1);
? this.i18nService.t("desktopApp")
: this.i18nService.t("desktopAppCount", this.index + 1);
}
return this.index === 0