Skip to content
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

Live Activities #35

Closed
wants to merge 42 commits into from
Closed

Live Activities #35

wants to merge 42 commits into from

Conversation

MikePlante1
Copy link
Contributor

@MikePlante1 MikePlante1 commented Mar 30, 2024

This pull request is a collection of commits involving Live Activity, mostly from @10nas and @polscm32 .

Live Activities requires iOS 16.2 to work, but this PR does not change the minimum iOS requirement to build and run Oi.

This adds a toggle in ⚙️>Notifications for Show Live Activity and a picker for Lock screen widget with options Simple and Detailed.

Notifications Settings

When Show Live Activity is toggled on, glucose data will be added to the Lock Screen as a Live Activity widget and to the Dynamic Island if the phone supports Dynamic Island (iPhone 14 Pro, 14 Pro Max, and all iPhone 15 variants). Live activities will stay refreshed and up-to-date on their own, but only if Oi is running in the background and has been opened in the past 8 hours.

If both slots are open in the Dynamic Island it will show current glucose and trend arrow on the left and delta on the right:

IMG_4175

If only one slot is open in the Dynamic Island, it will only show current glucose and trend arrow, and squeeze it a bit so it fits in the smaller space:

IMG_4176

Long pressing the Dynamic Island will expand it. Expanding when the default Simple is chosen in settings:

IMG_4178

Expanded Dynamic Island when Detailed is chosen in settings:

  • Glucose dots are color coded based on settings in Statistics and Home View menu. High = Orange, In-Range = Green, Low = Red. High is set to 140 for this screenshot.
  • Like the Statistics screen, glucose added by backfilling with a Glucose Simulator, Nightscout, or xDrip4iOS will not be included in the graph.

IMG_4177

Lock screen widget with the default Simple chosen in settings:

IMG_4179

Lock screen widget with Detailed chosen in settings:

  • Like Calendar entries, IOB & COB are from the previous loop cycle not the most recent.
  • Glucose dots are color coded based on settings in Statistics and Home View menu. High = Orange, In-Range = Green, Low = Red. High is set to 180 for this screenshot.
  • Like the Statistics screen, glucose added by backfilling with a Glucose Simulator, Nightscout, or xDrip4iOS will not be included in the graph.

IMG_4184

If the last glucose value is over 5 minutes old, a red strikethrough will be added to indicate it being stale:

Stale Lock Screen Widget
stale Dynamic Island

10nas and others added 30 commits March 9, 2024 16:46
adding in liveactivity identifier

forcing xcode 15.0.1 for creating certs
* fix mmol live activity, live activity off by default, re-create live activity always after it ended, better readability on lock screen

* typo

* lock screen cleanup

* fix padding, fix misaligned trailing dynamic island view

* camel case

* prevent unwanted hiding of live activity, update dynamic island padding

* also hide change label on stale live activity data

* update colors
fix incorrect timelabels in main chart
fix xGridLines that disappeared after last dev merge
improve readability for lockscreen widget in light mode
Use same calculator on Watch as on iPhone app.
This reverts changes not related to coreData for LiveActivities from commit a1c1160.
* conditionally show glucose graph in different colors dependent of high and low glucose settings
* To Do: add setting for showing graph in lockscreen and/or just a minimalistic view
- Run calculation of total insulin on scope only on change of picker panel, on appearance of the app and on change of boluses
	* to do: fix tins not updating on Pump History change

- Dynamic Island updates
	* add cob to lockscreen widget
	* add iob to lockscreen widget and adjust padding/spacing
	* to do: fix delay of updating cob and iob

- Change gradient of custom background color
This reverts changes not related to LiveActivities from commit 98fcad4.
@@ -189,6 +196,10 @@ platform :ios do
configure_bundle_id("FreeAPSWatch", "#{BUNDLE_ID}.watchkitapp", [
Spaceship::ConnectAPI::BundleIdCapability::Type::APP_GROUPS
])

configure_bundle_id("LiveActivityExtension", "ru.artpancreas.#{TEAMID}.FreeAPS.LiveActivity", [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MikePlante1 Another ru.artpancreas here.

@@ -124,6 +125,12 @@ platform :ios do
code_sign_identity: "iPhone Distribution",
targets: ["FreeAPSWatch"]
)
update_code_signing_settings(
path: "#{GITHUB_WORKSPACE}/FreeAPS.xcodeproj",
profile_name: mapping["ru.artpancreas.#{TEAMID}.FreeAPS.LiveActivity"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MikePlante1 Please note the relict ru.artpancreas here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I’ll get that fixed today.

@MikePlante1
Copy link
Contributor Author

MikePlante1 commented Apr 8, 2024

Question: Why is there so much whitespace along the left and bottom side of the chart? Is that on purpose for a good reason? Because it looks a bit odd.

@Sjoerd-Bo3 , I moved the updated label up a bit to make the padding more consistent. Is this better?
Screenshot 2024-04-08 at 10 38 13 AM

@Sjoerd-Bo3
Copy link
Contributor

Question: Why is there so much whitespace along the left and bottom side of the chart? Is that on purpose for a good reason? Because it looks a bit odd.

@Sjoerd-Bo3 , I moved the updated label up a bit to make the padding more consistent. Is this better? Screenshot 2024-04-08 at 10 38 13 AM

Yes, but in my view the chart needs to be a little down and to the right? It's not centered vertically and a little bit cramped on the left top. It needs a bit of safespace. If you know what I mean. Maybe tomorrow I can look at it.

Fix for the LiveActivity identifier in match()
"#{BUNDLE_ID}.LiveActivity"
@MikePlante1 MikePlante1 added the enhancement New feature or request label Apr 9, 2024
@Sjoerd-Bo3
Copy link
Contributor

Sjoerd-Bo3 commented Apr 10, 2024

Question: Why is there so much whitespace along the left and bottom side of the chart? Is that on purpose for a good reason? Because it looks a bit odd.

@Sjoerd-Bo3 , I moved the updated label up a bit to make the padding more consistent. Is this better? Screenshot 2024-04-08 at 10 38 13 AM

I would like to propose this (don't mind the bobble, that is just for me 🤣):
WhatsApp Image 2024-04-10 at 17 21 12_9e1ab974

Done like:
image

Also on your Screenshot the Updated tag is too much on the edge because of the "AM", but don't have the solution for that. Maybe a safezone in the whole widget would fix it.

@MikePlante1
Copy link
Contributor Author

I added your padding and nudged Updated over a smidge. Thoughts, @Sjoerd-Bo3 ?

padding-widget padding-code

@dnzxy
Copy link
Contributor

dnzxy commented Apr 10, 2024

Guys, this looks absolutely off and skewed. There are guidelines for how live activity cards should be designed and certain safe spaces that should be kept. Mike, your initial design looked great and had those. The recent changes don’t.

Refer to this example image by Apple:

In terms of paddings and margins: the initial design was okay and "correct". The chart as a whole design element (that includes axis marks, axis ticks, etc) had an even spacing all around. What was highlighted in a screenshot above as looking "off" was just the canvas space, not the actual chart-as-a-whole.

Let’s please not get stuck on such details now, when a wider redesign of the app definitely being up for grabs once 1.0.0 has dropped.

*Edit to fix typos.

@dnzxy
Copy link
Contributor

dnzxy commented Apr 10, 2024

From the initially proposed design there’s one element that is slightly off: the updated string. That would need to move up a little to make the LA card confer to Apple‘s guidelines.

@Sjoerd-Bo3
Copy link
Contributor

Sjoerd-Bo3 commented Apr 10, 2024

From the initially proposed design there’s one element that is slightly off: the updated string. That would need to move up a little to make the LA card confer to Apple‘s guidelines.

You can't say that the chart is right in this one:
image

I can agree on getting even bigger margins in there but this picture just doesn't look like it should be, it lacks a safe space. I strongly agree on the updated sign, Can't we change the wording to "Last:" or something? Because with the "AM" it is just too long. And indeed in needs to go up, and also maybe the whole right part a little to the left to give it a little more room on the right.

Sorry but from a UI perspective the chart carries weight. It should clear the bend at least:
image

Source: https://developer.apple.com/design/human-interface-guidelines/live-activities

@dnzxy
Copy link
Contributor

dnzxy commented Apr 10, 2024

The 300 tick on the y-axis and the updated-string are the only 2 elements that are "off", the rest is fine. Again, you are not looking at the chart as a whole element there.
image

Don’t mind my bad drawing skills on my phone please, but the red rectangle is the chart element and if you ignore the bad drawing a bit you‘ll realize the margin is even all around, i.e. what I‘ve been trying to say.

Edit to add: we basically need to put elements within this "inner" frame / safe space.
image

@Sjoerd-Bo3
Copy link
Contributor

Yeah okay, still don't agree on the top of the graph though.
FYI, the video says 14 point margin, so let's stick to that.

https://developer.apple.com/videos/play/wwdc2023/10194

@dnzxy
Copy link
Contributor

dnzxy commented Apr 10, 2024

Looking at the same sources as you are; that’s why I brought it up. The chart is a combination of text and a non-rounded shape content, so in a way both those rules apply.

The top of the graph (the axis mark 300 for the y-axis) is off, I agree with you 🤷🏻‍♂️

@Sjoerd-Bo3
Copy link
Contributor

Looking at the same sources as you are; that’s why I brought it up. The chart is a combination of text and a non-rounded shape content, so in a way both those rules apply.

The top of the graph (the axis mark 300 for the y-axis) is off, I agree with you 🤷🏻‍♂️

But to fix that 300, we need to put a 13 pt margin right? it shouldn't be outside that frame. Sorry if I'm coming off annoying, but I'm a design snob and the area on the bottom compared to the top of the chart feels really off. Not like an apple thing.

@Sjoerd-Bo3
Copy link
Contributor

Sjoerd-Bo3 commented Apr 10, 2024

Side note: It would be nice in the future to expand the dynamic island when an alert comes in or something.
https://developer.apple.com/videos/play/wwdc2023/10185

@dnzxy
Copy link
Contributor

dnzxy commented Apr 10, 2024

Yup, and I‘m a person that worked as an actual designer for 5yrs, so we clash. It’s all good - we‘re discussing, not being annoying 😊

I‘d need to get a display ruler here and really check the exact distances, but this should be okay. The axis ticks and marks are just a bit off and I think that’s why it all looks a bit weird to some.

One could maybe try rotating the numbers for the axis marks on the y-axis by 90 degree, so that they take the same height/width (depending on interpretation) as the marks on the x-axis, which could make it look more even and also let margins be perceived as more even. It might also implicitly fix the top y-axis mark from being off. I‘m not sure if that can easily be done with Swift Charts; other chart frameworks I‘ve worked with (D3 for example) can do that.

The current implementation of the live activity and dynamic island feature is a V1.0 by a user named nas10 for iAPS who chose not to contribute anymore due to the drama happening over there. I‘m sure he might actually resurface once Oi gets released.

@polscm32
Copy link
Contributor

You can rotate the marks as you want to, but I really don't think thats necessary here 😅

@dnzxy
Copy link
Contributor

dnzxy commented Apr 11, 2024

You can rotate the marks as you want to, but I really don't think thats necessary here 😅

Thanks for that info, so that’s doable, nice.

It was just an idea to make the chart as an element more evenly sized all around to make it easier to evenly space it within the card.

@MikePlante1
Copy link
Contributor Author

Closed due to these commits being added to alpha via #72 and expanded on in #75

@MikePlante1 MikePlante1 closed this May 2, 2024
@MikePlante1 MikePlante1 mentioned this pull request May 2, 2024
@bjornoleh bjornoleh deleted the liveActivities branch May 2, 2024 20:30
Sjoerd-Bo3 pushed a commit to Sjoerd-Bo3/Trio that referenced this pull request Aug 12, 2024
…trio

Don't use default calendar if one is already set
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

10 participants