Skip to content

Commit

Permalink
Improve handling my link when not logged in (home-assistant#3826)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpelgrom authored Aug 28, 2023
1 parent c11f2da commit 201931b
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 201931b

Please sign in to comment.