Skip to content

Commit

Permalink
CR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
HowardWolosky committed Feb 6, 2018
1 parent 7af0f6b commit ad348a6
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 70 deletions.
9 changes: 5 additions & 4 deletions Documentation/PDP.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,17 @@ where:

> Only relevant for Application submissions
There are two different types of 3 different types of images that can be used for a listing:
There are three different types of images that can be used for a listing:
1. Screenshots (these have captions)
2. Additional Assets (these are images that have no concept of captions)
3. Trailer screenshots (which also don't have captions, but are tied to trailers)

In the [previous section](#screenshots-and-captions), we talked about screenshots
(and their captions). Now we will talkabout #2 (Additional Assets).
(and their captions). Now we will talk about #2 (Additional Assets).

You can learn more about the specifics of these different images and how they're used by referring to the
[dev portal's online documentation](https://docs.microsoft.com/en-us/windows/uwp/publish/app-screenshots-and-images).
[dev portal's online documentation](https://docs.microsoft.com/en-us/windows/uwp/publish/app-screenshots-and-images),
and the related [API documentation](https://docs.microsoft.com/en-us/windows/uwp/monetize/manage-app-submissions#image-object).

To define these assets, there is a top-level element called `AdditionalAssets` (which
is a sibling to `ScreenshotCaptions`). It can contain any (or all) of the following
Expand All @@ -147,7 +148,7 @@ elements:
* `BackgroundImage1000X800`
* `PromotionalArtwork414X180`

Those elements do not have any InnerText/content -- they only have a single attribute
These elements do not have any InnerText/content -- they only have a single attribute
called `FileName` which should reference the .png file for that image type.

Similar to Screenshots, there is full [fallback language support](#fallback-language-support).
Expand Down
2 changes: 1 addition & 1 deletion Documentation/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ cloned submission:
(the localized content from the PDP's), deleting any existing data along the way.
Please note that your application must have
["Advanced Listing Permission"](https://docs.microsoft.com/en-us/windows/uwp/monetize/manage-app-submissions#advanced-listings)
enabled for this to work. For more info on trailers, review [PDP.md](./PDP.md).
enabled for this to work. For more info on trailers, review [PDP.md](./PDP.md#trailers).

* **`-UpdateNotesForCertification`** - This will change the `notesForCertification` field of
the cloned submission to that which is specified in your json.
Expand Down
61 changes: 51 additions & 10 deletions Extensions/ConvertFrom-ExistingIapSubmission.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
The most recent submission for IapId will be used unless a value for this parameter is
provided.
.PARAMETER SubmissionId
The submission object that you want to convert, which was previously retrieved.
.PARAMETER Release
The release to use. This value will be placed in each new PDP and used in conjunction with '-OutPath'.
Some examples could be "1601" for a January 2016 release, "March 2016", or even just "1".
Expand All @@ -36,15 +39,49 @@
Each of these sub-folders will have region-specific subfolders for their file content.
.EXAMPLE
.\ConvertFrom-ExistingSubmission -IapId 0ABCDEF12345 -Release "March Release" -OutPath "C:\NewPDPs"
.\ConvertFrom-ExistingIapSubmission -IapId 0ABCDEF12345 -Release "March Release" -OutPath "C:\NewPDPs"
Converts the data from the last published submission for IapId 0ABCDEF12345. The generated files
will use the default name of "PDP.xml" and be located in lang-code specific sub-directories within
c:\NewPDPs.
.EXAMPLE
.\ConvertFrom-ExistingIapSubmission -IapId 0ABCDEF12345 -SubmissionId 1234567890123456789 -Release "March Release" -PdpFileName "InAppProductDescription.xml" -OutPath "C:\NewPDPs"
Converts the data from submission 1234567890123456789 for IapId 0ABCDEF12345 (which might be a
published or pending submission). The generated files will be named "InAppProductDescription.xml" and
will be located in lang-code specific sub-directories within c:\NewPDPs.
.EXAMPLE
.\ConvertFrom-ExistingIapSubmission -Submission $sub -Release "March Release" -OutPath "C:\NewPDPs"
Converts the data from a submission object that was captured earlier in your PowerShell session.
It might have come from Get-InAppProductSubmission, or it might have been generated some other way.
This method of running the script was created more for debugging purposes, but others may find it
useful. The generated files will use the default name of "PDP.xml" and be located in lang-code
specific sub-directories within c:\NewPDPs.
#>
[CmdletBinding()]
[CmdletBinding(
SupportsShouldProcess,
DefaultParametersetName = "UseApi")]
param(
[Parameter(Mandatory)]
[Parameter(
Mandatory,
ParameterSetName = "UseApi",
Position = 0)]
[string] $IapId,

[Parameter(
ParameterSetName = "UseApi",
Position = 1)]
[string] $SubmissionId = $null,

[Parameter(
Mandatory,
ParameterSetName = "ProvideSubmission",
Position = 0)]
[PSCustomObject] $Submission = $null,

[Parameter(Mandatory)]
[string] $Release,

Expand Down Expand Up @@ -548,18 +585,22 @@ function Main
throw $message
}

if ([String]::IsNullOrEmpty($SubmissionId))
$sub = $Submission
if ($null -eq $sub)
{
$iap = Get-InAppProduct -IapId $IapId
$SubmissionId = $iap.lastPublishedInAppProductSubmission.id
if ([String]::IsNullOrEmpty($SubmissionId))
{
$SubmissionId = $iap.pendingInAppProductSubmission.id
Write-Log -Message "No published submission exists for this In-App Product. Using the current pending submission." -Level Warning
$iap = Get-InAppProduct -IapId $IapId
$SubmissionId = $iap.lastPublishedInAppProductSubmission.id
if ([String]::IsNullOrEmpty($SubmissionId))
{
$SubmissionId = $iap.pendingInAppProductSubmission.id
Write-Log -Message "No published submission exists for this In-App Product. Using the current pending submission." -Level Warning
}
}
}

$sub = Get-InAppProductSubmission -IapId $IapId -SubmissionId $SubmissionId
$sub = Get-InAppProductSubmission -IapId $IapId -SubmissionId $SubmissionId
}

$langImageNames = @{}
$langs = ($sub.listings | Get-Member -type NoteProperty)
Expand Down
38 changes: 28 additions & 10 deletions Extensions/ConvertFrom-ExistingSubmission.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,30 @@
.EXAMPLE
.\ConvertFrom-ExistingSubmission -AppId 0ABCDEF12345 -Release "March Release" -OutPath "C:\NewPDPs"
Converts the data from the last published submission for AppId 0ABCDEF12345. The generated files
will use the default name of "PDP.xml" and be located in lang-code specific sub-directories within
c:\NewPDPs.
.EXAMPLE
.\ConvertFrom-ExistingSubmission -AppId 0ABCDEF12345 -SubmissionId 1234567890123456789 -Release "March Release" -PdpFileName "ProductDescription.xml" -OutPath "C:\NewPDPs"
Converts the data from submission 1234567890123456789 for AppId 0ABCDEF12345 (which might be a
published or pending submission). The generated files will be named "ProductDescription.xml" and
will be located in lang-code specific sub-directories within c:\NewPDPs.
.EXAMPLE
.\ConvertFrom-ExistingSubmission -Submission $sub -Release "March Release" -OutPath "C:\NewPDPs"
Converts the data from a submission object that was captured earlier in your PowerShell session.
It might have come from Get-ApplicationSubmission, or it might have been generated some other way.
This method of running the script was created more for debugging purposes, but others may find it
useful. The generated files will use the default name of "PDP.xml" and be located in lang-code
specific sub-directories within c:\NewPDPs.
#>
[CmdletBinding(
SupportsShouldProcess,
DefaultParametersetName = "GetSubmission")]
DefaultParametersetName = "UseApi")]
param(
[Parameter(
Mandatory,
Expand All @@ -51,7 +71,7 @@ param(

[Parameter(
ParameterSetName = "UseApi",
Position = 01)]
Position = 1)]
[string] $SubmissionId = $null,

[Parameter(
Expand Down Expand Up @@ -514,7 +534,7 @@ function Add-ScreenshotCaptions
$imageType = $_.imageType
$fileName = Split-Path -Path ($_.fileName) -Leaf
$description = $_.description
if ((-not $script:ScreenshotAttributeMap.Contains($imageType)))
if (-not $script:ScreenshotAttributeMap.Contains($imageType))
{
if (-not $script:AdditionalAssetNames.Contains($imageType))
{
Expand Down Expand Up @@ -1085,7 +1105,7 @@ function ConvertFrom-Listing
the March 2016 PDP schema.
.PARAMETER Submission
Ths submission object that was used to generate the set of PDP files.
The submission object that was used to generate the set of PDP files.
.PARAMETER Listing
The base listing from the submission for the indicated Lang.
Expand Down Expand Up @@ -1165,12 +1185,10 @@ function ConvertFrom-Listing

# PowerShell likes to convert arrays of single items back to individual items.
# We need to ensure that we're definitely concatenting arrays together, and don't have
# any single items in there, so we use the comma-notation to force PowerShell to treat
# each variable as an array, even if there's only a single item.
$mediaFileNames = @()
$mediaFileNames += $screenshotFileNames
$mediaFileNames += $additionalAssetFileNames
$mediaFileNames += $trailerFileNames
# any single items in there. Therefore, we wrap each variable in an array to force it
# to be an array for merging purposes.
$mediaFileNames = @($screenshotFileNames) + @($additionalAssetFileNames) + @($trailerFileNames)

return $mediaFileNames
}

Expand Down
Loading

0 comments on commit ad348a6

Please sign in to comment.