-
-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Replace OpenHABTracker, use Observable variables for new tracker and Preferences #810
[WIP] Replace OpenHABTracker, use Observable variables for new tracker and Preferences #810
Conversation
743afad
to
509dd83
Compare
fyi , i'm probably going to close this. I ended up throwing out the tracker for a much more modern one. I |
I could not have helped on Combine. More and more of this Apple framework is replaced by async/await |
For reactive / event based observation of values, like our preference object, or the tracker logic where subscribers want to know when values changes (like our connection state) , but not make actual network calls themselves, I would think Combine is still the correct choice ? Or is there a better option ? |
I guess this looks like a replacement for combine, but its only available in ios 17 |
@observableobject should be the precursor to @observable and be very close in functionality Could be done in the last step migrating to SwiftUi |
So i completely rewrote a new tracker class. This has logic for trying connections in parallel, checking the current connection, supports priority ordering of connections (which one to pick in a tie) and will eventually support multiple connection pairs (think N number of connection configurations) . This also uses observable values instead of relying on delegates. It still relies on the NetworkConnection class and so AlamoFire, but that will be fixed in a latter PR (along with async/await conversions) I also refactored the Preferences class to support observable values. I plan on another PR, to refactor other parts of the code to start using this and get rid of a lot of ugly code. I'm going to test this quite a bit before moving on, also we need to merge the other PRs first, then i can update this to support those changes (swift ui changes) |
Oh, and this new Tracker is now in the OpenHABCore package, and can be shared with the watch app (another PR) |
Yes. The observation framework simplifies and replaces me. There are
significant differences but conceptually very similar.
…On Sat, 14 Sep 2024 at 05:52, Tim Bert ***@***.***> wrote:
@observableobject <https://github.com/observableobject> should be the
precursor to @observable <https://github.com/observable> and be very
close in functionality
Could be done in the last step migrating to SwiftUi
—
Reply to this email directly, view it on GitHub
<#810 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOJBPYCWLDZUD7EZAYOXUPLZWM7AVAVCNFSM6AAAAABOBVV36GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJQGA2TCNRQGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I upgraded Gemfile.lock to overcome the issue on Run Unit Tests |
Thanks! |
…allows native rendering for Sitemap navigation from notifications (which led to the refactor) Signed-off-by: Dan Cunningham <[email protected]>
Signed-off-by: Dan Cunningham <[email protected]>
Signed-off-by: Dan Cunningham <[email protected]>
Signed-off-by: Dan Cunningham <[email protected]>
Signed-off-by: Dan Cunningham <[email protected]>
…eferences Signed-off-by: Dan Cunningham <[email protected]>
Signed-off-by: Dan Cunningham <[email protected]>
Signed-off-by: Dan Cunningham <[email protected]>
c0fef14
to
e7a35b8
Compare
So i'm done with this, i have been testing it as best as i can, cellular, wifi, vpn, cloud, etc.... Both in strong and poor network conditions. So far this seems to work better then what we had, and is much cleaner IMHO. If there are no objections i think we should merge and get some testing on it. |
Yes please, let's get this out. |
Signed-off-by: Dan Cunningham <[email protected]>
Signed-off-by: Dan Cunningham <[email protected]>
96b9cf9
to
cdcd3a7
Compare
Signed-off-by: Dan Cunningham <[email protected]>
Signed-off-by: Dan Cunningham <[email protected]>
Uses "Combine" framework to watch OpenHABTracker state changes. Also allows native rendering for Sitemap navigation from notifications (which led to the refactor) and a small number of other network fixes.
This is my first time using Combine, so it might be a bit rough, but much more flexible then using delegates. The openHABTracker code still needs a good cleanup when we remove AlamoFire.
EDIT:
This is now a larger refactor which replaces the OpenHABTracker with a new class, and make it along with Preferences observable, no more delegates.