-
Notifications
You must be signed in to change notification settings - Fork 23
Address PR #43 review-thread feedback on warning handling, docs, and release version bump #44
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
Open
Copilot
wants to merge
4
commits into
main
Choose a base branch
from
copilot/fix-comments-in-review-thread
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,10 +6,12 @@ Package Winget App to Intune with Winget-Install | |
| https://github.com/Romanitho/Winget-Intune-Packager | ||
| #> | ||
|
|
||
| #Requires -PSEdition Desktop | ||
|
|
||
| ### APP INFO ### | ||
|
|
||
| #Winget Intune Packager version | ||
| $Script:WingetIntunePackager = "1.2.2" | ||
| $Script:WingetIntunePackager = "1.2.3" | ||
| #Winget-Install Github Link | ||
| $Script:WIGithubLink = "https://github.com/Romanitho/Winget-Install/archive/refs/tags/v1.11.3.zip" | ||
| #Winget Intune Packager Icon Base64 | ||
|
|
@@ -210,6 +212,18 @@ function Start-InstallGUI { | |
|
|
||
| $ConnectButtonAction = { | ||
| Start-PopUp "Connecting..." | ||
| if ( | ||
| [string]::IsNullOrWhiteSpace($IntuneTenantIDTextbox.Text) ` | ||
| -or [string]::IsNullOrWhiteSpace($IntuneClientIDTextbox.Text) ` | ||
| -or [string]::IsNullOrWhiteSpace($IntuneRedirectUriTextbox.Text) | ||
| ) { | ||
| $ConnectionStatusTextBlock.Foreground = "Red" | ||
| $ConnectionStatusTextBlock.Text = "Please fill in all fields." | ||
| $ConnectionStatusTextBlock.Tag = $null | ||
| $CreateButton.IsEnabled = $false | ||
| Close-PopUp | ||
| return | ||
| } | ||
| $ConnectionStatus = Connect-MSIntuneGraph -TenantID $IntuneTenantIDTextbox.Text -ClientID $IntuneClientIDTextbox.Text -RedirectUri $IntuneRedirectUriTextbox.Text | ||
| if ($ConnectionStatus.ExpiresOn) { | ||
| $ConnectionStatusTextBlock.Foreground = "Green" | ||
|
|
@@ -271,20 +285,27 @@ function Start-InstallGUI { | |
| "AllowAvailableUninstall" = $AllowUninstallCheckbox.IsChecked | ||
| "InstallExperience" = $InstallUserContext | ||
| } | ||
| Invoke-IntunePackage $Win32AppArgs | ||
| $AppInfo = @() | ||
| $SearchTextBox.Text = "" | ||
| $IDComboBox.Text = "" | ||
| $IDComboBox.Items.Clear() | ||
| $VersionTextBox.Text = "" | ||
| $OverrideTextBox.Text = "" | ||
| $IntuneDescriptionTextBox.Text = "" | ||
| $WhitelistCheckbox.IsChecked = $false | ||
| $AllowUninstallCheckbox.IsChecked = $false | ||
| $InstallUserContextCheckbox.IsChecked = $false | ||
| $CreateButton.IsEnabled = $false | ||
| $AppIcon.Source = $null | ||
| Close-PopUp | ||
| Invoke-IntunePackage $Win32AppArgs -WarningVariable warning | ||
|
|
||
| if ([string]::IsNullOrEmpty($warning)) { | ||
| $AppInfo = @() | ||
| $SearchTextBox.Text = "" | ||
| $IDComboBox.Text = "" | ||
| $IDComboBox.Items.Clear() | ||
| $VersionTextBox.Text = "" | ||
| $OverrideTextBox.Text = "" | ||
| $IntuneDescriptionTextBox.Text = "" | ||
| $WhitelistCheckbox.IsChecked = $false | ||
| $AllowUninstallCheckbox.IsChecked = $false | ||
| $InstallUserContextCheckbox.IsChecked = $false | ||
| $CreateButton.IsEnabled = $false | ||
| $AppIcon.Source = $null | ||
| Close-PopUp | ||
| } | ||
|
|
||
| if (-not [string]::IsNullOrEmpty($warning)) { | ||
| Start-PopUp ($warning -join "`n") | ||
| } | ||
|
Comment on lines
+288
to
+308
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in the latest commit. Both checks now use PowerShell truthiness ( |
||
| }) | ||
|
|
||
| $GithubLinkLabel.Add_PreviewMouseDown({ | ||
|
|
@@ -329,7 +350,7 @@ Function Start-PopUp ($Message) { | |
| $PopUpWindow.Icon = $IconBase64 | ||
|
|
||
| #Store Form Objects In PowerShell | ||
| $XAML.SelectNodes("//*[@Name]") | foreach { | ||
| $XAML.SelectNodes("//*[@Name]") | ForEach-Object { | ||
| Set-Variable -Name "$($_.Name)" -Value $PopUpWindow.FindName($_.Name) -Scope Script | ||
| } | ||
|
|
||
|
|
@@ -519,12 +540,27 @@ function Get-WingetAppInfo ($AppID, $AppVersion) { | |
|
|
||
| #Get Google Image app icon | ||
| $SearchImageUrl = "https://www.google.com/search?tbm=isch&q=$($AppInfo.PackageName.replace('.','+'))+logo" | ||
| $IconUrl = ((Invoke-WebRequest -Uri $SearchImageUrl).Images | Select -ExpandProperty src)[1] | ||
| $AppInfo.Icon = "$Location\$($AppInfo.ID).jpg" | ||
| Invoke-WebRequest -Uri $IconUrl -OutFile $($AppInfo.Icon) | ||
| $images = (Invoke-WebRequest -Uri $SearchImageUrl -UseBasicParsing).Images | ||
| if ($images.Count -gt 1) { | ||
| $IconUrl = ($images | Select-Object -ExpandProperty src)[1] | ||
| } | ||
| if (-not [string]::IsNullOrEmpty($IconUrl)) { | ||
| $AppInfo.Icon = "$Location\$($AppInfo.ID).jpg" | ||
| try { | ||
| Invoke-WebRequest -Uri $IconUrl -OutFile $AppInfo.Icon -UseBasicParsing | ||
| } | ||
| catch { | ||
| $AppInfo.Icon = $null | ||
| } | ||
| } | ||
| } | ||
|
|
||
| function Invoke-IntunePackage ($Win32AppArgs) { | ||
| function Invoke-IntunePackage () { | ||
| [CmdletBinding()] | ||
| param ( | ||
| $Win32AppArgs | ||
| ) | ||
|
|
||
| # Package .intunewin file | ||
| if (!(Test-Path "$Location/Winget-Install*")) { | ||
| Get-GithubRepository $WIGithubLink | ||
|
|
@@ -550,7 +586,10 @@ function Invoke-IntunePackage ($Win32AppArgs) { | |
| $DetectionRule = New-IntuneWin32AppDetectionRuleScript -ScriptFile "$DetectionScriptPath\$DetectionScriptFile" | ||
|
|
||
| # Convert image file to icon | ||
| $Icon = New-IntuneWin32AppIcon -FilePath $AppInfo.Icon | ||
|
|
||
| if ($AppInfo.Icon) { | ||
| $Icon = New-IntuneWin32AppIcon -FilePath $AppInfo.Icon | ||
| } | ||
|
|
||
| # Add parameters to table for the Win32 app | ||
| $Win32AppArgs.DisplayName = $AppInfo.PackageName | ||
|
|
@@ -574,7 +613,10 @@ function Invoke-IntunePackage ($Win32AppArgs) { | |
| $Win32AppArgs.Icon = $Icon | ||
| } | ||
|
|
||
| Add-IntuneWin32App @Win32AppArgs | ||
| Add-IntuneWin32App @Win32AppArgs -WarningVariable warning -WarningAction SilentlyContinue | ||
| $warning | ForEach-Object { | ||
| Write-Warning $_ | ||
| } | ||
| } | ||
|
|
||
| function Get-WIPLatestVersion { | ||
|
|
@@ -668,7 +710,7 @@ function Get-WIPLatestVersion { | |
| Start-PopUp "Starting..." | ||
|
|
||
| # IntuneWin32App module needed | ||
| $IntuneWin32App = Get-InstalledModule "IntuneWin32App" -RequiredVersion $IntuneWin32AppVers -ErrorAction SilentlyContinue | ||
| $IntuneWin32App = Get-Module "IntuneWin32App" -ListAvailable | Where-Object { $PSItem.Version -eq $IntuneWin32AppVers } | ||
| if (!$IntuneWin32App) { | ||
| $NuGet = Get-PackageProvider -name "nuget" -ListAvailable -ErrorAction SilentlyContinue | ||
| if (!$NuGet) { | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in the latest commit. The
sedcommand now matches the$Script:WingetIntunePackagervariable name pattern rather than a hard-coded line number, so it stays correct regardless of file layout changes.