creepymonster / GlucoseDirect

App programmed in Swift/SwiftUI for using Libre blood glucose sensors.
MIT License
361 stars 115 forks source link

Watch compliction #506

Open creepymonster opened 1 year ago

creepymonster commented 1 year ago

@bassrock i had quite a struggle with it until I had everything up and running again (all sorts of things with bundle identifiers).

Maybe you like to look over it once :)

Many greetings Reimar

bassrock commented 1 year ago

@creepymonster Re-looking into this, I think some things will need to be updated. Been a bit since I did watchOS apps (they now run on the watch 😅 instead of via the phone), the data can't easily be shared as I thought without implementing WatchConnectivity. https://developer.apple.com/documentation/watchconnectivity/implementing_two-way_communication_using_watch_connectivity

I'll take a look this weekend at that.

creepymonster commented 1 year ago

Thanks a lot :)

I have no experience with the Apple Watch at all.

As for the adjustments for WatchConnectivity I was not sure. I've always read about "Two-Way Communication" in that context - we actually only have One-Way, from the phone to the Watch.

I didn't have any data from the iPhone in the simulator, though. But maybe the Shared App Group on the iPhone is only there for different apps on the Watch 🤷.

Many greetings Reimar

bassrock commented 1 year ago

@creepymonster I started https://github.com/creepymonster/GlucoseDirect/pull/508 but wcsession is pretty tricky, i'll need to do a bunch of reading up to get something reliable. May need to get back to this later.

tzdesign commented 1 year ago

Hi guys,

I'm Tobi, also from Berlin.

I came across your app because the Libre lacks a bit in terms of UI.

Are you still working on the Apple Watch app? Maybe I can help you a bit. I have been through the same struggle myself.

Am I right in thinking that you use a lot of user defaults for data?

With cloudkitcontainers you could outsource the data to a framework and use it for both apps.

Otherwise there is no way around the watch connectivity. Most of the time it's important to have two-way communication just to ask the phone for data.

I will check out this PR during the week and can give you some guidance if you want.

robinwo commented 1 year ago

Hope we can make this work! Any update on this Tobi?

tzdesign commented 1 year ago

Omg, I'm sorry. I viewed it and got lost in other things.

I will add it to my todos and take another look. The biggest problems will be update times. There is a budget and you need live updates. There is no perfect way. You could update through remote notifications or use CloudKit. I recently discovered a nice drop in replacement for AppStorage called cloud storage. Will get back to you

tzdesign commented 11 months ago

@creepymonster it's hard to test, as I just used this app once while checking how my glucose levels are for 2 weeks.

I'm not sure how the sensor is allowed to update, but in general this frequent updates are not possible, except you directly talk to the watch.