Skip to content

Use environment appName instead of hardcoded Loop#14

Closed
marionbarker wants to merge 3 commits into
LoopKit:mainfrom
loopandlearn:enable_appName
Closed

Use environment appName instead of hardcoded Loop#14
marionbarker wants to merge 3 commits into
LoopKit:mainfrom
loopandlearn:enable_appName

Conversation

@marionbarker
Copy link
Copy Markdown
Contributor

  1. Add code needed to use environment that ties appName to CFBundleDisplayName
  2. Use the appName from the environment to replace hardcoded Loop in strings
    • For one file, I did not know how to insert the environment variable for appName, so I put in a work-around string instead
    • This can be updated if someone provides instructions (PumpOpsSession.swift)

None of these changes could be tested.

  • I think some of these views just aren't used anymore
  • The one that is used requires an MDT with MySentry to test and I only have an MDT


static func useMySentry(_ value: Bool) -> T {
let vc = T()
@Environment(\.appName) var appName
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Environment is generally used on a SwiftUI view (this is an extension on a UIKit View controller), as the data is passed through the view hierarchy. I'm not sure how/if this is working?

@marionbarker
Copy link
Copy Markdown
Contributor Author

I prepared code to use appName based off a few hints. I am working via "prototype example" and don't have a solid understanding of how and why it works. Your comment above that "@Environment is generally used on a SwiftUI view (this is an extension on a UIKit View controller)" probably indicates this will not work for MinimedKitUI/RadioSelectionTableViewController.swift as desired.

I was not able to test the modification for this file because I do not have a Medtronic pump that supports MySentry. I was able to test the other instances and show that they did work as expected.

There was a case for OmniBLE/Kit (BeepPreference) where the attempt to use appName did not succeed. See this link:

To summarize tests done in that PR: "To reiterate the problem, this picks up the defaultValue from LoopKit instead of the appName from the environment that I expected."

In that case, I demonstrated that whatever value was found on this line in LoopKit/LoopKitUI/Extensions/Environment+AppName.swift is what is inserted into appName when I tried to use it.

marionbarker added a commit to loopandlearn/MinimedKit that referenced this pull request Jun 19, 2024
Parallel PR to LoopKit LoopKit#14, Enable app name instead of hardcoded Loop
@marionbarker
Copy link
Copy Markdown
Contributor Author

I opened this PR a long time ago when I did not know very much.
These are the problems with this:

  • I could not get appName in all the places I needed it.
  • The screens that I modified to use appName are not used by Trio (which is why I started working on the appName PR in the first place).
  • The code and localization for LoopWorkspace and iAPS do not have this modification
  • The localization for Trio, which had a parallel PR merged, has stale translations
    • When building with Xcode, the xcstring files are updated to indicate stale

I just merged PR #16 which has a change that is used by Trio but does not affect Loop.

Decision - I'm closing this PR. Later on I will update the trio branch of MinimedKit at loopanlearn to be aligned with the LoopKit main branch. That will be one less difference between repositories used for Loop and Trio.

@marionbarker marionbarker deleted the enable_appName branch October 14, 2025 23:05
loopkitdev pushed a commit to loopkitdev/MinimedKit that referenced this pull request Mar 12, 2026
* async updates

* Changes for protocol updates
loopkitdev pushed a commit to loopkitdev/MinimedKit that referenced this pull request Mar 12, 2026
* async updates

* Changes for protocol updates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants