You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Refactor/2025/09 (#12)
* better priveleges checker
* Replace globals with an application struct and dependency injection
* Extract UI update logic and use withAutorunRegistry helper similar to theme functions.
* global variables in globals.go that mirror fields in the App struct in main.go
* Made app a local variable in main()
* Removed unsafe pointer usage
Used safer Windows API
Simplified admin check
Added proper error handling - Better error checking for token operations
Removed magic numbers - Added named constant for admin SID
* Fixed magic numbers by introducing named constants for event IDs. This improves code readability and maintainability.
* Remove the redundant call and let setupEventLog() handle it properly
* In semver.go, the isVersionNewer() function hardcodes 3 as the number of version parts (major.minor.patch), making it inflexible and unclear
* Separate UI update from temporary message display, making the function more predictable and testable.
* Problem: In theme.go, the toggleSystemMode() function handles registry reads, writes, logging, UI updates, and tooltip management all in one function, violating single responsibility principle.
Fix: Break it down into smaller, focused functions that each handle one concern.
* Implement proper goroutine lifecycle management with context or a quit channel.
* Removed restrictive 3-part requirement
Added version padding with zeros for different lengths
Extracted padVersionParts() helper function (DRY principle)
Added max() utility function
Now handles versions like "1.2" vs "1.2.3" properly
* Separated error handling responsibility - logEvent() now returns errors instead of mixing console fallback
Added logEventSafe() - Fire-and-forget logging for non-critical cases
Better error context - Proper error wrapping and unknown event type handling
Consistent patterns - Functions either return errors or handle them, not both
* Extract console logging to a separate function and eliminate duplication
* Problem: Global version variable in main.go is unused and confusing alongside NewApp(version) parameter.Fix: Remove global variable, use build-time injection pattern properly.
* Problem: toggleTheme() in theme.go takes two parameters that are always identical, violating KISS principle.Fix: Simplify interface to single parameter and make function purpose clearer.
* Simplify the error notification logic and separate concerns
* Merge duplicate functions in setTemporaryTooltip and showTemporaryThemeTooltip
* rm duplicate showTemporaryTooltip
* Replace blocking sleep with a non-blocking timer
* recommendations from coderabbit
* update build script
* 2025-09-18 14:54:26+04:00
* rsrc update
* inject version
* avoid popup for non-admin users