-
-
Notifications
You must be signed in to change notification settings - Fork 818
Display LocalFirstScreen only when necessary #5933
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
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.
LGTM
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.
Not sure if you wanted to do this in another PR, but to fully address the feedback, the messaging should also be changed for plaintext + publicly accessible (like http://home.example.com
, or simple port forwarding without SSL).
val addresses = withContext(Dispatchers.IO) { | ||
InetAddress.getAllByName(fqdn) | ||
} | ||
addresses.none { it.isPrivateOrLocal() } |
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.
What about people using a public FQDN, but running an internal DNS server so it resolves to the internal IP when at home (with a short TTL so it is refreshed frequently)? I've seen that more than once. Maybe a simple check based on TLD is enough.
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.
Well I think it makes sense when the call is actually made, for such setup ppl "know" what they are doing and most probably they have HTTPS.
But some ppl have static entry in their local DNS for a domain that is not registered externally.
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.
were probably still going to have cases where users who feel shouldnt see this screen still do
common/src/test/kotlin/io/homeassistant/companion/android/util/UrlUtilTest.kt
Outdated
Show resolved
Hide resolved
...tlin/io/homeassistant/companion/android/onboarding/nameyourdevice/NameYourDeviceViewModel.kt
Outdated
Show resolved
Hide resolved
...tlin/io/homeassistant/companion/android/onboarding/nameyourdevice/NameYourDeviceViewModel.kt
Outdated
Show resolved
Hide resolved
def75b1
to
9d9eb73
Compare
@bgoncal suggested to drop the last sentence in this screen If the users agrees to share his location in any case we are going to choose I'm not sure we need to add a mention on this screen wdyt? (both of you @bgoncal and @jpelgrom) |
I don't think it's needed. Keep it simple |
I created a PR for iOS similar to this but I will leave DNS resolution out of the equation until I get feedback that it's needed home-assistant/iOS#3900 |
But it still mentions "only accessible on your home network", "set up remoe access later", while it is remotely accessible. This is not going to be fixed by removing/adding one sentence. @dshokouhi since it is based on your feedback, this is what I find confusing but maybe you have more/other comments |
That will be "handled" by the check that @TimoPtr made to detect if it's internal or external URL. The endgame is to always receive from core what is the internal and what is the remote for that server, but we don't have that yet. |
Which check are you referring to? I don't recognize anything like that in the code changes or are able to get it to behave differently, and this PR does not depend on another branch. |
Perhaps I misunderstood, Timo can confirm tomorrow but in my mind the check for if the URL is publicly available was to determine during onboarding if we are onboarding a local or remote URL. In iOS specifically this means that we put the URL in the correct "place" in the configuration, as you know in iOS we call internal/external URL. Given the above we could determine if we need to display this disclaimer screen or not. |
That may be the goal, but is not what the PR is doing. There is also no such thing as only having an "internal" URL in the Android app architecture so that would require bigger changes which are definitely out of scope of this PR.
... but we're not there yet, the reason mentioned is a specific comment from @dshokouhi and I agree that it is somewhat confusing to see this screen when using something like |
Had a chance to test the PR, at least for my setup I no longer see the screen which is what I would expect. Generally speaking I dont think we will be handle to every check to ensure this doesnt show up for every user and every configuration. Handling the majority probably makes the most sense. |
@jpelgrom In that case I'll leave for @TimoPtr to take over the discussion, if it can't be determined if remote access exist (in a best effort manner), then this screen shouldn't be shown at all in Android. But the way I see it, a quick fix is:
Not saying this PR does that, that's just my opinion on what should happen. |
I think all this confusion can be lift off by simplifying the condition. Today we show this screen if it plaintext OR if it is publicly accessible. We do have another screen later to notify the user if the connection is not encrypted (LocationForSecureConnection and later the "blocking" screen). I propose to simply the condition to show this screen to only when we know it is a non public address. Yes it means that ppl with a complex setup like changing the DNS entry using a short TTL are going to see this screen. But technically this screen is true the user is onboarding on a private address, I don't think it is going to bother the user to see this screen. Mostly because he knows his setup. It is going to be an issue for a secondary user, but I would assume that in that case the secondary user is going to ask the admin to help him setup remote access. WDYT @bgoncal @jpelgrom @dshokouhi ? |
Looks good to me, my main concern is the average user. |
Agreed we should focus on average. Simplifying it to only show if it's a non-public address works for me to as a solution to avoid confusion about "only accessible on your home network" 👍 |
|
||
@Test | ||
fun `Given unresolved TLD when checking isPubliclyAccessible then returns false`() = runTest { | ||
val url = URL("http://this-domain-definitely-does-not-exist-12345.com:8123") |
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.
If someone wants to troll us they'll buy the domain
Summary
We want to avoid displaying the LocalFirstScreen when it doesn't make sense, like when we are sure that the URL used is publicly accessible. This PR make sure of that by displaying the screen only when it makes sense.
It address the feedback from @dshokouhi #5909 (comment)
Checklist
Any other notes
It needs to be merged after #5912 to avoid conflicts.