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
Wear os authentication #1691
Wear os authentication #1691
Conversation
In onboarding, the home assistant urls are received from connected devices. If the user clicks on it, the authentication flow starts. The user can alter the login details and proceed to login. The authentication uses the "auth/login_flow" api, instead of the normal authentication api, since there is no support for webview on wear os.
b5cbff1
to
d1b2544
Compare
@JBassett do you think you could have a look at this PR? Please let me know if it is too big and needs splitting! |
Can this be the same Android app, with same one on the store, with app manifest for wear os also. |
you might want to familiarize yourself with how a standalone app works https://developer.android.com/training/wearables/overlays/independent-vs-dependent#identify data can be still be sent from phone to app but the intention is that everything you can do on the phone can also be done on the watch without needing the phone. |
@@ -124,6 +124,7 @@ class IntegrationRepositoryImpl @Inject constructor( | |||
} | |||
|
|||
override suspend fun isRegistered(): Boolean { | |||
Log.d(TAG, urlRepository.getApiUrls().toString()) |
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.
Extra logging I don't think we need.
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.
Agree, I used this for debugging. Have removed it now
wear/build.gradle.kts
Outdated
productFlavors { | ||
create("minimal") { | ||
applicationIdSuffix = ".minimal" | ||
versionNameSuffix = "-minimal" | ||
} | ||
create("full") { | ||
applicationIdSuffix = "" | ||
versionNameSuffix = "-full" | ||
} | ||
|
||
// Generate a list of application ids into BuildConfig | ||
val values = productFlavors.joinToString { | ||
"\"${it.applicationId ?: defaultConfig.applicationId}${it.applicationIdSuffix}\"" | ||
} | ||
|
||
defaultConfig.buildConfigField("String[]", "APPLICATION_IDS", "{$values}") | ||
} |
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 don't think we need multiple flavors since there aren't any de-googled wear os devices.
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.
You're right indeed, removed product flavors
val marginTop = (20 * Resources.getSystem().displayMetrics.density).toInt() | ||
(v.layoutParams as ViewGroup.MarginLayoutParams).topMargin = marginTop |
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.
This feels wrong, is there a better way to set the margin?
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.
This does not look great indeed, I removed the margin and added an additional header. This makes it more clear that this is a distinct option
Remove multiple product flavors Remove unnecessary log Replace margin with additional header
I don't understand how this error suddenly occurred during the test: ManualSetupPresenterImplSpec > presenter > on click ok with valid url > io.homeassistant.companion.android.onboarding.manual.ManualSetupPresenterImplSpec.should save the url FAILED |
hey @leroyboerefijn did you figure out what caused the error? :)
I'd love to see this PR get merged, so that actual feature-development could begin! :D |
The failure is a random test failure, its safe to ignore as every PR is hitting it. As of now this PR is waiting for another round of review to continue. |
Thanks for figuring it out @dshokouhi , I was on a holiday! |
Summary
In this PR a proof-of-concept for authentication on wear os devices. Note that a few changes needed to be made compared to the android app authentication:
On HomeActivity, a proof of connection/authentication is given, by loading the home assistant version and the number of instances from the server.
Screenshots
Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#
Any other notes
Once the authentication is implemented, next steps will be adding functionality to the wear OS app: