Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(appx): Add AppX option to show app name on tiles #3802

Merged
merged 1 commit into from
Apr 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/app-builder-lib/scheme.json
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@
"null",
"string"
]
},
"showNameOnTiles": {
"description": "Whether to overlay the app's name on top of tile images on the Start screen. Defaults to `false`. (https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-shownameontiles) in the dependencies.",
"type": "boolean"
}
},
"title": "AppXOptions",
Expand Down
8 changes: 7 additions & 1 deletion packages/app-builder-lib/src/options/AppXOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ export interface AppXOptions extends TargetSpecificOptions {
*/
readonly addAutoLaunchExtension?: boolean

/**
* Whether to overlay the app's name on top of tile images on the Start screen. Defaults to `false`. (https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-shownameontiles) in the dependencies.
* @default false
*/
readonly showNameOnTiles?: boolean

/**
* @private
* @default false
Expand All @@ -54,4 +60,4 @@ export interface AppXOptions extends TargetSpecificOptions {

/** @private */
readonly makeappxArgs?: Array<string> | null
}
}
15 changes: 12 additions & 3 deletions packages/app-builder-lib/src/targets/AppxTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export default class AppXTarget extends Target {
return lockScreenTag(userAssets)

case "defaultTile":
return defaultTileTag(userAssets)
return defaultTileTag(userAssets, options.showNameOnTiles || false)

case "splashScreen":
return splashScreenTag(userAssets)
Expand Down Expand Up @@ -303,7 +303,7 @@ function lockScreenTag(userAssets: Array<string>): string {
}
}

function defaultTileTag(userAssets: Array<string>): string {
function defaultTileTag(userAssets: Array<string>, showNameOnTiles: boolean): string {
const defaultTiles: Array<string> = ["<uap:DefaultTile", 'Wide310x150Logo="assets\\Wide310x150Logo.png"']

if (isDefaultAssetIncluded(userAssets, "LargeTile.png")) {
Expand All @@ -313,7 +313,16 @@ function defaultTileTag(userAssets: Array<string>): string {
defaultTiles.push('Square71x71Logo="assets\\SmallTile.png"')
}

defaultTiles.push("/>")
if (showNameOnTiles) {
defaultTiles.push(">")
defaultTiles.push("<uap:ShowNameOnTiles>")
defaultTiles.push("<uap:ShowOn", 'Tile="wide310x150Logo"', "/>")
defaultTiles.push("<uap:ShowOn", 'Tile="square150x150Logo"', "/>")
defaultTiles.push("</uap:ShowNameOnTiles>")
defaultTiles.push("</uap:DefaultTile>")
} else {
defaultTiles.push("/>")
}
return defaultTiles.join(" ")
}

Expand Down
8 changes: 4 additions & 4 deletions test/out/__snapshots__/BuildTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@ Object {
"size": 2339,
},
"util.js": Object {
"size": 3007,
"size": 3034,
},
},
},
Expand Down Expand Up @@ -1416,18 +1416,18 @@ Object {
"files": Object {
"semver": Object {
"executable": true,
"size": 4784,
"size": 4418,
},
},
},
"package.json": Object {
"size": 358,
"size": 407,
},
"range.bnf": Object {
"size": 619,
},
"semver.js": Object {
"size": 37959,
"size": 38803,
},
},
},
Expand Down