Improve handling my link when not logged in (#3826)

This commit is contained in:
Joris Pelgröm 2023-08-28 23:42:20 +02:00 committed by GitHub
parent c11f2da26f
commit 201931b91e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -37,11 +37,21 @@ class MyActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (!serverManager.isRegistered()) {
finish()
return
}
val binding = ActivityMyBinding.inflate(layoutInflater)
setContentView(binding.root)
if (Intent.ACTION_VIEW == intent?.action && intent.data != null) {
if (intent.data?.getQueryParameter("mobile")?.equals("1") == true) {
if (intent?.action == Intent.ACTION_VIEW && intent.data != null) {
if (
intent.data?.scheme != "https" ||
intent.data?.host != "my.home-assistant.io" ||
intent.data?.path?.startsWith("/redirect/") != true ||
intent.data?.getQueryParameter("mobile")?.equals("1") == true
) {
finish()
return
}