Refactor - Separate View from Model
Motivation
Including views that display a model had caused crashes (i.e. Bug 444333) and is generally not a good practice.
Approach
By separating views from models, views can still access data from models, and models can still inform all views of updates through notifications (or becoming an ObservableObject
).
Changelog
- Fixed unpair device not working/crashes the app
- Fixed pairing timeout too early (now is 30 seconds)
- Fixed missing client device certificate by temporarily using my fork of CocoaAsyncSocket
- Should switch back to the original once merging https://github.com/robbiehanson/CocoaAsyncSocket/pull/782
- Fixed memory reference cycle caused by plugins (and links)
- Added animation to DevicesView list and battery status update
Known Issues
Currently, the implementation still relies on a workaround to trigger updates in DevicesDetailView
after plugin status has been updated from DeviceDetailPluginSettingsView
. Namely, BatteryStatus
has to observe connectedDevicesViewModel
when there really is no need to. This is too complex to solve in the same merge request, and it will be tracked in Phabricator once it is set up for iOS.
Edited by Apollo Zhu