[NOW-689][NOW-690][NOW-691]#475
Conversation
… using quick setup WiFi with WPA2 security mode Refactor: Extract logic for simple mode WiFi security Refactored the `_checkMode` method into `_setupSimpleMode` to improve clarity and separation of concerns. Extracted the logic for determining the available security types in simple mode into a new method, `getSimpleModeAvailableSecurityTypeList`. This method now calculates the intersection of available security types across all main WiFi networks. A new method, `getSimpleModeAvailableSecurityType`, has been added to determine the default security type for simple mode. It prioritizes WPA3, then WPA2/WPA3 Mixed, and then WPA2, if available. Added unit tests for the new methods to ensure their correctness.
1. [NOW-689]: Incredible-WiFi: The save button should be disabled when the password field is empty
2. [NOW-690]: Incredible-WiFi: After switching the setting mode, the settings in Quick Setup mode are not retained
3. [NOW-691]: Incredible-WiFi: Cannot save WPA3 security settings in Quick Setup mode after toggling Quick Setup off/on with modified settings
- Refactor SimpleModeView to be a stateless widget, with its state now managed by _SimpleModeViewState for improved simplicity and performance.
- Improve the logic for determining available security types in simple mode by using a priority order for selection, enhancing clarity and user experience.
- Centralize simple mode WiFi settings within the wifiListProvider to improve state management and remove the need for local text editing controllers in WiFiListView.
- Update the change detection and data verification logic to accurately handle simple mode, ensuring that changes are tracked correctly and data is validated before
saving.
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
| String password, WifiSecurityType securityType) { | ||
| if (securityType.isOpenVariant) { | ||
| _passwordController.text = ''; | ||
| } | ||
| return Opacity( |
There was a problem hiding this comment.
Suggestion: Avoid modifying controller state in build
| String password, WifiSecurityType securityType) { | |
| if (securityType.isOpenVariant) { | |
| _passwordController.text = ''; | |
| } | |
| return Opacity( | |
| String password, WifiSecurityType securityType) { | |
| return Opacity( |
AustinChangLinksys
left a comment
There was a problem hiding this comment.
Looks good to me
User description
NOW-689: Incredible-WiFi: The save button should be disabled when the password field is empty
NOW-690: Incredible-WiFi: After switching the setting mode, the settings in Quick Setup mode are not retained
NOW-691: Incredible-WiFi: Cannot save WPA3 security settings in Quick Setup mode after toggling Quick Setup off/on with modified settings
saving.
PR Type
Bug fix, Enhancement
Description
Refactor SimpleModeView to stateless widget with state management in _SimpleModeViewState
Centralize simple mode WiFi settings in wifiListProvider for improved state management
Implement priority-based security type selection for simple mode WiFi
Fix save button validation and state change detection for simple mode
Add comprehensive unit tests for new security type selection methods
Diagram Walkthrough
File Walkthrough
wifi_list_provider.dart
Centralize simple mode security type logic in providerlib/page/wifi_settings/providers/wifi_list_provider.dart
_checkMode()to_setupSimpleMode()for claritygetSimpleModeAvailableSecurityTypeList()to calculateintersection of security types across all WiFi networks
getSimpleModeAvailableSecurityType()with priority-basedselection (WPA3 → WPA2/3 Mixed → WPA2)
properly selected security type
@visibleForTestingannotation for unittesting
wifi_list_simple_mode_view.dart
Refactor SimpleModeView to stateless widget architecturelib/page/wifi_settings/views/wifi_list_simple_mode_view.dart
management in _SimpleModeViewState
from widget constructor
_passwordControllerin _SimpleModeViewState with properinitialization and disposal
open networks)
null-coalescing calls
instead of calculating available types
wifi_list_view.dart
Remove local state management and improve change detectionlib/page/wifi_settings/views/wifi_list_view.dart
password
_initSimpleModeSettings()method as state is now managed byprovider
initialization
_stateHasChanged()method to properly detect changes based onsimple/advanced mode
_dataVerify()to validate password based on current mode(simple vs advanced)
and simpleModeWifi changes in simple mode
wifi_list_provider_test.dart
Add unit tests for security type selection methodstest/page/wifi_settings/providers/wifi_list_provider_test.dart
getSimpleModeAvailableSecurityTypeList()methodgetSimpleModeAvailableSecurityType()methodmethods
priority-based selection
available