fix: made changes for 16KB page sizes and removed unused code#185
fix: made changes for 16KB page sizes and removed unused code#185
Conversation
WalkthroughThis PR removes several in-project extension classes, renames calls from ExecuteCommandIfAvailable to ExecuteWhenAvailable across controls and handlers, adds a global using for FreakyKit.Utils, updates project metadata and dependencies to 1.0.0, and adjusts sample routes and styling. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Control as UI Control (e.g., FreakyButton)
participant Ext as ExecuteWhenAvailable (extension)
participant Cmd as ICommand
User->>Control: Tap/Change
Control->>Ext: ExecuteWhenAvailable(parameter)
Ext->>Cmd: CanExecute(parameter)?
alt can execute
Ext->>Cmd: Execute(parameter)
else cannot execute
note right of Ext #f9f9f9: No-op (no execute)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (6)
MAUI.FreakyControls/MAUI.FreakyControls/Platforms/iOS/FreakyAutoCompleteViewHandler.ios.cs (1)
118-124: Fix potential NRE: awaiting a possibly-null Task.await entry.ImageSource?.ToNativeImageSourceAsync() can be null and crash at runtime. Guard before awaiting.
Apply:
- var entry = handler.VirtualView; - var uiImage = await entry.ImageSource?.ToNativeImageSourceAsync(); + var entry = handler.VirtualView; + if (entry.ImageSource is null) + return; + var uiImage = await entry.ImageSource.ToNativeImageSourceAsync();Optionally clear/replace any existing Left/RightView to avoid stacking multiple gesture recognizers when remapped.
MAUI.FreakyControls/MAUI.FreakyControls/Platforms/iOS/FreakyDatePickerHandler.ios.cs (1)
22-27: Fix potential NRE during image load.Same nullable-await issue here.
Apply:
- var uiImage = await entry.ImageSource?.ToNativeImageSourceAsync(); + if (entry.ImageSource is null) + return; + var uiImage = await entry.ImageSource.ToNativeImageSourceAsync();MAUI.FreakyControls/MAUI.FreakyControls/Platforms/iOS/FreakyPickerHandler.ios.cs (1)
20-26: Fix nullable-await crash on missing ImageSource.Guard before awaiting to prevent NRE.
Apply:
- var uiImage = await entry.ImageSource?.ToNativeImageSourceAsync(); + if (entry.ImageSource is null) + return; + var uiImage = await entry.ImageSource.ToNativeImageSourceAsync();MAUI.FreakyControls/MAUI.FreakyControls/Platforms/iOS/FreakyEntryHandler.ios.cs (1)
29-37: Prevent nullable-await crash when ImageSource is null.Same pattern as other handlers; guard before awaiting.
Apply:
- var uiImage = await entry.ImageSource?.ToNativeImageSourceAsync(); + if (entry.ImageSource is null) + return; + var uiImage = await entry.ImageSource.ToNativeImageSourceAsync();MAUI.FreakyControls/MAUI.FreakyControls/FreakyChip/FreakyChip.xaml.cs (1)
67-69: Wrong BindableProperty owner type (should be FreakyChip, not FreakyCheckbox)This can break XAML tooling/bindings and is misleading.
Apply:
- BindableProperty.Create(nameof(SelectedChangedCommand), typeof(ICommand), typeof(FreakyCheckbox)); + BindableProperty.Create(nameof(SelectedChangedCommand), typeof(ICommand), typeof(FreakyChip));MAUI.FreakyControls/MAUI.FreakyControls/FreakySignatureView/FreakySignaturePadView.xaml.cs (1)
81-97: Wrong owner type on BindableProperties (uses FreakySvgImageView)Use FreakySignaturePadView as the declaring type to avoid binding/XAML issues.
- typeof(FreakySvgImageView), + typeof(FreakySignaturePadView),Apply to ClearImageAssemblyProperty, ClearResourceIdProperty, ClearImageBase64Property.
🧹 Nitpick comments (10)
MAUI.FreakyControls/MAUI.FreakyControls/FreakyChip/FreakyChip.xaml.cs (2)
327-339: Duplicate property checks; missing watchers for UnselectedBackgroundColor/Text colorsUI won’t update when UnselectedBackgroundColor, SelectedTextColor, or UnselectedTextColor change.
Apply:
- if (propertyName == nameof(IsSelected) || - propertyName == nameof(SelectedBackgroundColor) || - propertyName == nameof(SelectedBackgroundColor)) + if (propertyName == nameof(IsSelected) || + propertyName == nameof(SelectedBackgroundColor) || + propertyName == nameof(UnselectedBackgroundColor)) { border.BackgroundColor = IsSelected ? SelectedBackgroundColor : UnselectedBackgroundColor; } - if (propertyName == nameof(IsSelected) || - propertyName == nameof(SelectedBackgroundColor) || - propertyName == nameof(SelectedBackgroundColor)) + if (propertyName == nameof(IsSelected) || + propertyName == nameof(SelectedTextColor) || + propertyName == nameof(UnselectedTextColor)) { this.chipLabel.TextColor = IsSelected ? SelectedTextColor : UnselectedTextColor; }
1-1: Remove stale usingThe ExecuteWhenAvailable extension now comes from FreakyKit.Utils (globally imported). This using is no longer needed.
-using Maui.FreakyControls.Extensions; +// (global using FreakyKit.Utils is present)MAUI.FreakyControls/MAUI.FreakyControls/FreakySignatureView/FreakySignaturePadView.xaml.cs (2)
461-477: Fix Dispose patternDispose(bool) is empty; disposing work is done outside. Move resource cleanup into disposing guard and unsubscribe events to avoid leaks.
public void Dispose() { - this.Dispose(true); - GC.SuppressFinalize(this); - ClearLabel.Dispose(); - SignaturePadCanvas.Handler?.DisconnectHandler(); + Dispose(true); + GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { + if (!disposing) return; + try + { + ClearLabel?.Handler?.DisconnectHandler(); + SignaturePadCanvas?.Handler?.DisconnectHandler(); + // detach any event handlers if attached + ClearLabel = null; + } + catch { /* swallow to be safe in finalizers */ } }
1-1: Remove stale usingExtension now comes via FreakyKit.Utils global using.
-using Maui.FreakyControls.Extensions; +// (global using FreakyKit.Utils is present)MAUI.FreakyControls/MAUI.FreakyControls/Platforms/Android/NativeControls/Helpers/DrawableHandlerCallback.cs (2)
1-1: Remove stale usingUse of old extensions namespace is unnecessary now.
-using Maui.FreakyControls.Extensions; +// (global using FreakyKit.Utils is present)
17-23: Consider explicit default handlingAdd a default case to make intent clear for Top/Bottom or future enum values.
switch (target) { case DrawablePosition.Left: case DrawablePosition.Right: frentry.ImageCommand?.ExecuteWhenAvailable(frentry.ImageCommandParameter); break; + default: + // no-op + break; }MAUI.FreakyControls/MAUI.FreakyControls/FreakyChip/FreakyChipGroup.cs (3)
145-158: Index propagation bug in LoopChildren across nested layoutsindex is passed by value; nested increments don’t flow back, leading to wrong selections with nested chips.
-private void LoopChildren(IList<IView> children, int index) +private int LoopChildren(IList<IView> children, int index) { foreach (var child in children) { if (child is FreakyChip radioButton) { radioButton.IsSelected = index == SelectedIndex; index++; } else if (child is Layout layout) { - LoopChildren(layout.Children, index); + index = LoopChildren(layout.Children, index); } } + return index; } // caller -LoopChildren(Children, index); +_ = LoopChildren(Children, index);
120-141: FindIndexRecursive does not advance index across nested layoutsSame by-value issue; nested counts are not accumulated.
-private int FindIndexRecursive(IList<IView> children, FreakyChip radioButton, int index) +private int FindIndexRecursive(IList<IView> children, FreakyChip radioButton, int index) { foreach (var child in children) { if (child is FreakyChip) { if (child == radioButton) { return index; } index++; } else if (child is Layout layout) { - int childIndex = FindIndexRecursive(layout.Children, radioButton, index); + int childIndex = FindIndexRecursive(layout.Children, radioButton, index); if (childIndex != -1) { return childIndex; } + // advance index by number of nested chips + index = LoopChildren(layout.Children, index); } } return -1; }
69-89: Detach handlers on removal to avoid leakschips list is only appended; override OnChildRemoved and unsubscribe SelectedChanged to prevent retained references.
// New method to add protected override void OnChildRemoved(Element child) { base.OnChildRemoved(child); if (child is FreakyChip chip) { chip.SelectedChanged -= FreakyChip_CheckedChanged; chips.Remove(chip); } else if (child is Layout layout) { foreach (var grandChild in layout.Children.OfType<FreakyChip>()) { grandChild.SelectedChanged -= FreakyChip_CheckedChanged; chips.Remove(grandChild); } } }MAUI.FreakyControls/MAUI.FreakyControls/Maui.FreakyControls.csproj (1)
30-33: Expand release notes to call out breaking changesMention the ExecuteCommandIfAvailable → ExecuteWhenAvailable rename and removed extensions to set user expectations.
- <PackageReleaseNotes>Android 16k Pages are now supported</PackageReleaseNotes> + <PackageReleaseNotes>Android 16k pages are now supported. Breaking: command extension renamed to ExecuteWhenAvailable; removed legacy *Extensions files.</PackageReleaseNotes>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (27)
MAUI.FreakyControls/MAUI.FreakyControls/Extensions/CollectionExtensions.cs(0 hunks)MAUI.FreakyControls/MAUI.FreakyControls/Extensions/ExceptionExtensions.cs(0 hunks)MAUI.FreakyControls/MAUI.FreakyControls/Extensions/Extensions.cs(0 hunks)MAUI.FreakyControls/MAUI.FreakyControls/Extensions/StreamExtensions.cs(0 hunks)MAUI.FreakyControls/MAUI.FreakyControls/Extensions/TaskExtensions.cs(0 hunks)MAUI.FreakyControls/MAUI.FreakyControls/FreakyButton/FreakyButton.xaml.cs(1 hunks)MAUI.FreakyControls/MAUI.FreakyControls/FreakyCheckbox/FreakyCheckbox.cs(1 hunks)MAUI.FreakyControls/MAUI.FreakyControls/FreakyChip/FreakyChip.xaml.cs(1 hunks)MAUI.FreakyControls/MAUI.FreakyControls/FreakyChip/FreakyChipGroup.cs(1 hunks)MAUI.FreakyControls/MAUI.FreakyControls/FreakyCodeView/FreakyCodeView.xaml.cs(1 hunks)MAUI.FreakyControls/MAUI.FreakyControls/FreakyRadioButton/FreakyRadioButton.cs(1 hunks)MAUI.FreakyControls/MAUI.FreakyControls/FreakyRadioButton/FreakyRadioGroup.cs(1 hunks)MAUI.FreakyControls/MAUI.FreakyControls/FreakySignatureView/FreakySignatureCanvasView.cs(1 hunks)MAUI.FreakyControls/MAUI.FreakyControls/FreakySignatureView/FreakySignaturePadView.xaml.cs(1 hunks)MAUI.FreakyControls/MAUI.FreakyControls/FreakySwipeButton/FreakySwipeButton.cs(1 hunks)MAUI.FreakyControls/MAUI.FreakyControls/FreakySwitch/FreakySwitch.cs(1 hunks)MAUI.FreakyControls/MAUI.FreakyControls/Maui.FreakyControls.csproj(3 hunks)MAUI.FreakyControls/MAUI.FreakyControls/Platforms/Android/NativeControls/Helpers/DrawableHandlerCallback.cs(1 hunks)MAUI.FreakyControls/MAUI.FreakyControls/Platforms/iOS/FreakyAutoCompleteViewHandler.ios.cs(1 hunks)MAUI.FreakyControls/MAUI.FreakyControls/Platforms/iOS/FreakyDatePickerHandler.ios.cs(1 hunks)MAUI.FreakyControls/MAUI.FreakyControls/Platforms/iOS/FreakyEntryHandler.ios.cs(2 hunks)MAUI.FreakyControls/MAUI.FreakyControls/Platforms/iOS/FreakyPickerHandler.ios.cs(1 hunks)MAUI.FreakyControls/MAUI.FreakyControls/Platforms/iOS/FreakyTimePickerHandler.ios.cs(3 hunks)MAUI.FreakyControls/MAUI.FreakyControls/Usings.cs(1 hunks)MAUI.FreakyControls/Samples/AppShell.xaml.cs(2 hunks)MAUI.FreakyControls/Samples/MainViewModel.cs(1 hunks)MAUI.FreakyControls/Samples/Pickers/PickersView.xaml(0 hunks)
💤 Files with no reviewable changes (6)
- MAUI.FreakyControls/Samples/Pickers/PickersView.xaml
- MAUI.FreakyControls/MAUI.FreakyControls/Extensions/StreamExtensions.cs
- MAUI.FreakyControls/MAUI.FreakyControls/Extensions/CollectionExtensions.cs
- MAUI.FreakyControls/MAUI.FreakyControls/Extensions/TaskExtensions.cs
- MAUI.FreakyControls/MAUI.FreakyControls/Extensions/Extensions.cs
- MAUI.FreakyControls/MAUI.FreakyControls/Extensions/ExceptionExtensions.cs
🧰 Additional context used
🧬 Code graph analysis (1)
MAUI.FreakyControls/MAUI.FreakyControls/FreakySignatureView/FreakySignatureCanvasView.cs (1)
MAUI.FreakyControls/MAUI.FreakyControls/FreakySignatureView/FreakySignaturePadView.xaml.cs (1)
UpdateBindableProperties(454-457)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-plugin-ci
🔇 Additional comments (24)
MAUI.FreakyControls/MAUI.FreakyControls/FreakySwitch/FreakySwitch.cs (1)
341-341: Migration to ExecuteWhenAvailable looks correct.The change from
ExecuteCommandIfAvailabletoExecuteWhenAvailableis part of a project-wide migration to use a new extension method from the FreakyKit.Utils library. This change is consistent with similar updates across all other controls in the codebase.MAUI.FreakyControls/Samples/MainViewModel.cs (1)
64-64: ScratchView temporarily disabled for this release.The ScratchView has been commented out, which aligns with similar changes in AppShell.xaml.cs. This appears to be a deliberate decision to disable this feature for the current release.
MAUI.FreakyControls/Samples/AppShell.xaml.cs (2)
18-18: Consistent with MainViewModel changes.The ScratchView constant declaration is commented out, which matches the removal of ScratchView from the AppShell items in MainViewModel.cs.
36-36: Route registration also disabled.The route registration for ScratchView is properly commented out, maintaining consistency with the constant declaration. This ensures no routing conflicts or dead routes exist.
MAUI.FreakyControls/MAUI.FreakyControls/FreakySwipeButton/FreakySwipeButton.cs (1)
114-114: Consistent command execution pattern.The migration to
ExecuteWhenAvailable()follows the same pattern as other controls. The swipe completion logic remains intact with just the command execution method updated.MAUI.FreakyControls/MAUI.FreakyControls/Platforms/iOS/FreakyTimePickerHandler.ios.cs (1)
48-48: Platform-specific handler updated correctly.The iOS handler correctly migrates to
ExecuteWhenAvailablefor image command execution. This maintains consistency with the cross-platform migration effort.MAUI.FreakyControls/MAUI.FreakyControls/FreakySignatureView/FreakySignatureCanvasView.cs (2)
288-288: Command execution updated for stroke completion.The migration to
ExecuteWhenAvailable()maintains the same functionality while using the new extension method pattern.
296-296: Command execution updated for canvas clearing.Consistent with the stroke completion command, the clear command also migrates to the new pattern.
MAUI.FreakyControls/MAUI.FreakyControls/FreakyCodeView/FreakyCodeView.xaml.cs (1)
141-141: Code entry completion command migration looks good.The change maintains the same parameter passing (
CodeValue) while switching to the new extension method. The functionality remains equivalent.MAUI.FreakyControls/MAUI.FreakyControls/Usings.cs (1)
1-1: Global using OK — confirm package origin & vulnerability statusGlobal using FreakyKit.Utils is appropriate and supports the ExecuteWhenAvailable migration. I couldn't find a public NuGet package or security advisories for "FreakyKit.Utils" v1.0.1 (nuget.org / NVD / GHSA). Confirm whether this is an internal/local library or hosted on a private NuGet feed (or provide the correct public package link/version) and run
dotnet list package --vulnerableand check deps.dev / nuget.org / GitHub Advisory DB for advisories.MAUI.FreakyControls/MAUI.FreakyControls/Platforms/iOS/FreakyAutoCompleteViewHandler.ios.cs (1)
126-131: Command rename is consistent with the PR-wide change.No functional change beyond the rename. Ensure ExecuteWhenAvailable mirrors CanExecute checks.
MAUI.FreakyControls/MAUI.FreakyControls/Platforms/iOS/FreakyDatePickerHandler.ios.cs (1)
44-49: Command rename looks good.Behavior is unchanged; verify ExecuteWhenAvailable retains CanExecute checks.
MAUI.FreakyControls/MAUI.FreakyControls/FreakyRadioButton/FreakyRadioGroup.cs (1)
106-111: Command rename is correct; event ordering unchanged.SelectedRadioButtonChangedCommand is executed before the event; assuming intentional.
MAUI.FreakyControls/MAUI.FreakyControls/Platforms/iOS/FreakyPickerHandler.ios.cs (1)
44-49: Command rename is fine here.No further changes required.
MAUI.FreakyControls/MAUI.FreakyControls/FreakyButton/FreakyButton.xaml.cs (1)
382-385: Command rename LGTM.Tap animation, Clicked then command execution order preserved.
MAUI.FreakyControls/MAUI.FreakyControls/Platforms/iOS/FreakyEntryHandler.ios.cs (1)
53-59: Command rename looks correct.No functional changes beyond rename.
MAUI.FreakyControls/MAUI.FreakyControls/FreakyCheckbox/FreakyCheckbox.cs (1)
569-576: Command rename OK — ExecuteWhenAvailable confirmedglobal using present at MAUI.FreakyControls/MAUI.FreakyControls/Usings.cs and PackageReference to FreakyKit.Utils v1.0.1 in MAUI.FreakyControls/MAUI.FreakyControls/Maui.FreakyControls.csproj — ExecuteWhenAvailable resolves; no changes required.
MAUI.FreakyControls/MAUI.FreakyControls/FreakyRadioButton/FreakyRadioButton.cs (1)
275-282: Confirm ExecuteWhenAvailable semantics
Global using FreakyKit.Utils is in Usings.cs so extension resolution will succeed. ExecuteWhenAvailable is defined externally—verify it checks CanExecute and invokes on the MainThread to match prior behavior.MAUI.FreakyControls/MAUI.FreakyControls/FreakyChip/FreakyChip.xaml.cs (1)
303-304: Rename to ExecuteWhenAvailable — LGTMCall-site update is correct and consistent with the new extension.
MAUI.FreakyControls/MAUI.FreakyControls/FreakySignatureView/FreakySignaturePadView.xaml.cs (1)
444-452: Rename to ExecuteWhenAvailable — LGTMCommand invocations align with the new extension.
MAUI.FreakyControls/MAUI.FreakyControls/Platforms/Android/NativeControls/Helpers/DrawableHandlerCallback.cs (1)
21-22: Rename to ExecuteWhenAvailable — LGTMAndroid click handler update is correct.
MAUI.FreakyControls/MAUI.FreakyControls/FreakyChip/FreakyChipGroup.cs (1)
109-111: Rename to ExecuteWhenAvailable — LGTMMatches the new extension API.
MAUI.FreakyControls/MAUI.FreakyControls/Maui.FreakyControls.csproj (2)
16-19: Version bump to 1.0.0 — LGTMAppropriate for API surface changes.
142-147: Verify package compatibility with .NET 9 and Android 16KB page‑size supportFile: MAUI.FreakyControls/MAUI.FreakyControls/Maui.FreakyControls.csproj (lines 142–147)
- SkiaSharp.Views.Maui.Controls 3.119.0 — release notes do not mention Android 16KB page‑size fixes (16KB was noted in a 3.118 preview). Confirm 16KB/NDK alignment is present in 3.119.0 or pin to a version that explicitly documents the fix.
- Svg.Skia 3.0.6 — NuGet targets net6/net8/netstandard and depends on SkiaSharp >=2.88.9; it does not explicitly declare compatibility with SkiaSharp 3.119.x or .NET 9. Validate runtime compatibility with SkiaSharp 3.119.x on .NET 9 or upgrade to a declared-compatible release.
- FreakyKit.Utils 1.0.1 — no public package or repo found to verify ICommand.ExecuteWhenAvailable (signature/null-safety). Provide the package URL or repo or include the API/signature/tests so the method and null-safety can be confirmed.
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
MAUI.FreakyControls/Samples/InputViews/InputViewModel.cs (1)
45-45: Fix undefined identifier: useNames(capital N) instead ofnames.This won’t compile because
namesisn’t declared in scope; everywhere else you useNames.Apply this diff:
- NamesModel = [.. names.Select(x => new AutoCompleteModel { Name = x })]; + NamesModel = [.. Names.Select(x => new AutoCompleteModel { Name = x })];If the project isn’t on C# 12 collection expressions, use:
NamesModel = Names.Select(x => new AutoCompleteModel { Name = x }).ToList();
🧹 Nitpick comments (1)
MAUI.FreakyControls/Samples/InputViews/InputViewModel.cs (1)
2-2: Redundant import if global usings are enabled.You added a global using for FreakyKit.Utils in the PR; this local import is then unnecessary.
Apply this diff if the global using is present:
-using FreakyKit.Utils;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
MAUI.FreakyControls/MAUI.FreakyControls/Extensions/Extensions.cs(0 hunks)MAUI.FreakyControls/Samples/InputViews/InputViewModel.cs(1 hunks)MAUI.FreakyControls/Samples/InputViews/InputViews.xaml.cs(1 hunks)
💤 Files with no reviewable changes (1)
- MAUI.FreakyControls/MAUI.FreakyControls/Extensions/Extensions.cs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-plugin-ci
🔇 Additional comments (2)
MAUI.FreakyControls/Samples/InputViews/InputViews.xaml.cs (2)
1-2: LGTM: brings inToObservable()from FreakyKit.Utils.No functional change; safe addition given the migration.
3-3: Do not removeusing Maui.FreakyControls.Extensions;— it’s referenced across the repo.rg output shows this using in many files (Samples/MauiProgram.cs and numerous control/handler files). Remove or replace it only after a complete migration and updating all references to FreakyKit.Utils; otherwise leave it.
Likely an incorrect or invalid review comment.
Summary by CodeRabbit
New Features
Refactor
Breaking / API
Chores
Samples