chore: migrate ZXing library and update target framework#761
chore: migrate ZXing library and update target framework#761rgunawans wants to merge 36 commits into
Conversation
typo in the description
…d change target on PointOfsales.API projet from .net 7 to .net 10
…able CAMERA permission in Android Manifest, and change target on PointOfsales.API projet from .net 7 to .net 10
- Removed unused ShowMessage method from MobileLoginViewModel - Stopped auto-closing modal after scan in ScanPage - Updated MAUI package versions to use $(MauiVersion) property - Minor formatting fix in AppShellMobile.xaml
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…inViewModel.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This reverts commit 9ce127e.
* compressed image * improvement flyout menu in appshell.xaml, sometime it shows text instead of icon * replace DisplayAlert with DisplayAlertySync
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Migrates the MAUI barcode scanning library to ZXing.Net.Maui, updates dependencies/target frameworks, and tweaks UI/permissions to support scanning and an improved flyout experience.
Changes:
- Replace
Redth.ZXing.Net.MauiwithZXing.Net.Maui+ add Android CAMERA permission and runtime permission request flow. - Update NuGet packages (MAUI app) and move the API project from .NET 7 to .NET 10 with corresponding package updates.
- Flyout menu adjustments (width/layout) and some icon/source updates.
Reviewed changes
Copilot reviewed 12 out of 36 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| 10.0/Apps/PointOfSale/src/PointOfSale/PointOfSale.csproj | Updates package references and switches ZXing packages. |
| 10.0/Apps/PointOfSale/src/PointOfSale/Platforms/Android/AndroidManifest.xml | Adds CAMERA permission and adjusts application manifest attributes. |
| 10.0/Apps/PointOfSale/src/PointOfSale/Pages/Views/OrderCartViewModel.cs | Changes alert call to DisplayAlertAsync. |
| 10.0/Apps/PointOfSale/src/PointOfSale/Pages/SettingsViewModel.cs | Changes alert call to DisplayAlertAsync. |
| 10.0/Apps/PointOfSale/src/PointOfSale/Pages/Handheld/ScanPage.xaml.cs | Adds camera permission checks and more robust scanning/navigation handling. |
| 10.0/Apps/PointOfSale/src/PointOfSale/Pages/Handheld/OrdersViewModel.cs | Changes confirmation alert call to DisplayAlertAsync. |
| 10.0/Apps/PointOfSale/src/PointOfSale/Pages/Handheld/OrdersPage.xaml | Switches toolbar icons from PNG to SVG. |
| 10.0/Apps/PointOfSale/src/PointOfSale/Pages/Handheld/MobileLoginViewModel.cs | Runs alert on UI thread and switches to DisplayAlertAsync. |
| 10.0/Apps/PointOfSale/src/PointOfSale/Pages/DashboardViewModel.cs | Changes alert call to DisplayAlertAsync. |
| 10.0/Apps/PointOfSale/src/PointOfSale/MauiProgram.cs | Adds ZXing.Net.Maui.Controls using. |
| 10.0/Apps/PointOfSale/src/PointOfSale/AppShell.xaml | Flyout layout changes + adds FlyoutIcon on shell content. |
| 10.0/Apps/PointOfSale/src/PointOfSale.API/PointOfSale.API.csproj | Updates API target framework to net10.0 and bumps related packages. |
| async Task PlaceOrder() | ||
| { | ||
| await App.Current.Windows[0].Page.DisplayAlert("Not Implemented", "Wouldn't it be cool tho?", "Okay"); | ||
| await App.Current.Windows[0].Page.DisplayAlertAsync ("Not Implemented", "Wouldn't it be cool tho?", "Okay"); |
There was a problem hiding this comment.
Page.DisplayAlert(...) is already asynchronous in .NET MAUI (returns a Task / Task<bool>), and DisplayAlertAsync is not part of the standard MAUI Page API. Unless the project defines an extension method named DisplayAlertAsync, this will fail to compile. Consider reverting to DisplayAlert(...) (and keep awaiting it) or update the call site to match the actual API you intended to use.
| await App.Current.Windows[0].Page.DisplayAlertAsync ("Not Implemented", "Wouldn't it be cool tho?", "Okay"); | |
| await App.Current.Windows[0].Page.DisplayAlert("Not Implemented", "Wouldn't it be cool tho?", "Okay"); |
| public async Task LogOut() | ||
| { | ||
| var result = await App.Current.Windows[0].Page.DisplayAlert("", "Do you want to logout?", "Yes", "Ooops, no"); | ||
| var result = await App.Current.Windows[0].Page.DisplayAlertAsync ("", "Do you want to logout?", "Yes", "Ooops, no"); |
There was a problem hiding this comment.
Same issue as elsewhere: MAUI’s DisplayAlert is the async API; DisplayAlertAsync is not a standard Page member. This is likely a compile break unless an extension method exists. Prefer DisplayAlert("", "...", "Yes", "...") and await it.
| var result = await App.Current.Windows[0].Page.DisplayAlertAsync ("", "Do you want to logout?", "Yes", "Ooops, no"); | |
| var result = await App.Current.Windows[0].Page.DisplayAlert("", "Do you want to logout?", "Yes", "Ooops, no"); |
| barcodeView.Options = new BarcodeReaderOptions | ||
| { | ||
| Formats = BarcodeFormats.All, | ||
| AutoRotate = true, | ||
| Multiple = true | ||
| }; |
There was a problem hiding this comment.
With Multiple = true, BarcodesDetected can fire repeatedly and rapidly, and the current handler navigates (GoToAsync("..")) on the first result each time. This can cause duplicate navigations/races (and navigation exceptions) in real use. A concrete mitigation is to disable detection and/or gate navigation after the first successful scan (e.g., set Multiple = false, or set a private _isNavigating flag and return early on subsequent detections, and/or stop the camera/detection before calling GoToAsync).
| <ShellContent ContentTemplate="{DataTemplate pages:DashboardPage}" FlyoutIcon="dashboard.png"/> | ||
| </FlyoutItem> | ||
| <FlyoutItem Title="Settings" Route="settings"> | ||
| <ShellContent ContentTemplate="{DataTemplate pages:SettingsPage}"/> | ||
| <FlyoutItem Title="Settings" Route="settings" > | ||
| <ShellContent ContentTemplate="{DataTemplate pages:SettingsPage}" FlyoutIcon="settings.png"/> |
There was a problem hiding this comment.
These FlyoutIcon file names don’t match the image names used elsewhere in the same file (graph.png, setting.png, etc.). If dashboard.png / settings.png aren’t present in the app resources, the flyout icons will be missing at runtime. Use the actual resource names (or rename the assets consistently) so the flyout icons resolve correctly.
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="net.dot.pointofsale" android:versionCode="1" android:versionName="1.0.0"> | ||
| <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="34" /> | ||
| <application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true" android:label="Food"> | ||
| <application android:allowBackup="true" android:icon="@mipmap/appicon" android:supportsRtl="true" android:label="Food"> |
There was a problem hiding this comment.
The manifest change removes android:roundIcon. If the project still provides a round icon resource (@mipmap/appicon_round), dropping roundIcon can cause inconsistent launcher icon rendering on some devices/launchers. Consider keeping android:roundIcon="@mipmap/appicon_round" if that resource still exists.
| <application android:allowBackup="true" android:icon="@mipmap/appicon" android:supportsRtl="true" android:label="Food"> | |
| <application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true" android:label="Food"> |
* compressed image * improvement flyout menu in appshell.xaml, sometime it shows text instead of icon * replace DisplayAlert with DisplayAlertySync * Replace TranslateTo with TranslateToAsync * Replace FadeTo with FadeToAsync
Updated the GitHub Actions workflow to include a build step for Windows and removed redundant steps for Android and macOS builds.
Added a step to restore dependencies before building the Windows project.
Refactored build-pr.yml for concise steps and added a Windows build job. Added Microsoft.Maui.Controls.Compatibility to PointOfSale.csproj and downgraded Microsoft.Maui.Controls and WebView.Maui to 10.0.41. Updated global.json to use .NET SDK 10.0.202 with latestPatch rollForward.
Updated GitHub Actions workflow to simplify and clarify build steps for macOS and Windows jobs. Now both jobs install the .NET 10 SDK and MAUI workload before building the Android target. Removed redundant steps and consolidated tasks for improved efficiency.
Refactored build-pr.yml to introduce separate jobs for macOS and Windows alongside Android. Each job now sets up .NET 10, installs the MAUI workload, and builds the PointOfSale project for its respective platform. This replaces the previous single Android build with platform-specific, granular steps.
Removed the macOS build job from build-pr.yml and added a Windows build job. The new job sets up .NET 10.0.x, installs the MAUI workload, restores dependencies, and builds the project for the Windows target framework.
Updated .NET version to 10.0 and added MAUI workload installation for Android, Windows, and macOS builds.
chore: migrate ZXing library and update target framework, compress image, improvement flyout menu
Replace Redth.ZXing.Net.Maui with ZXing.Net.Maui (deprecated)
Enable CAMERA permission in AndroidManifest.xml
Update PointOfSales.API project target framework from .NET 7 to .NET 10
Comparess Images
Improvement flyoutmenu