-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open Loop with "Loop://" URLs from other applications #1897
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
Conversation
|
Probably best to rebase this on the current dev; it has a lot of branch history atm from the master->dev sync, that doesn't need to be here. |
Sorry about that! Should be better now. |
Loop/AppDelegate.swift
Outdated
| options: [UIApplication.OpenURLOptionsKey : Any] = [:] ) -> Bool { | ||
|
|
||
| // Process the URL. | ||
| guard let components = NSURLComponents(url: url, resolvingAgainstBaseURL: true), let linkTarget = components.host else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to not include any of this example/aspirational code yet. It'd be better to be able to evaluate it in the context of an actual feature that was using it.
|
OK, done. When you have a chance (either here or in Zulip), I'd appreciate any thoughts on how to go a step further, i.e. best practice for switching view controllers to handle deeper links. |
|
Thanks! I think for discussing navigating to specific places in Loop via the url scheme, why don't you open another PR with what you're thinking, and we can continue the discussion there? As for some starting guidance, I think it would make more sense to have the URL paths be aligned more around use cases, like "/add_meal?carbs=35g&duration=3hours" rather than just navigation commands, like "/show_carb_entry_view_controller?..." |
|
When building archive to TestFlight, upload fails with below error if the MAIN_APP_DISPLAY_NAME does not conform to RFC1738. Changing the value from "Loop Dev" to something conformant like "Loop-Dev" avoids the error and allows successful upload to TestFlight but imposes on the app display name in iOS and Nightscout Loop pill. Building to a simulator device directly does not provoke an error. |
|
Resolved: Setting URL_SCHEME_NAME allows MAIN_APP_DISPLAY_NAME to avoid RFC1738 restrictions. But you already know this. :) MAIN_APP_DISPLAY_NAME = Loop Dev |
This PR defines a general URL scheme for opening Loop from other applications. There is a config variable that defines the URL to use, which by default is the app's display name. I'll submit a separate PR to LoopWorkspace with a placeholder override variable showing how to override that.
There is skeleton code that extracts the rest of the URL so that URLs like "Loop://bolus" could be used to link to the Bolus view directly, but right now I'm unsure of the right place/method for doing that. I thought I'd start by PR'ing this part to get started, and perhaps you could advise on next steps for the deeper links.