Skip to content

Commit

Permalink
Merge pull request #19 from openremote/notifiocation_fixes
Browse files Browse the repository at this point in the history
Multiple fixes
  • Loading branch information
Miggets7 authored Nov 5, 2024
2 parents 7602234 + 0abdc2a commit d3aabad
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class NotificationActivity : AppCompatActivity() {
acknowledgement
)
}
val appUrl = intent.getStringExtra("appUrl")
var appUrl = intent.getStringExtra("appUrl")
if (!appUrl.isNullOrBlank()) {
val openInBrowser = intent.getBooleanExtra("openInBrowser", false)
val silent = intent.getBooleanExtra("silent", false)
Expand All @@ -52,6 +52,9 @@ class NotificationActivity : AppCompatActivity() {

when {
openInBrowser -> {
if (!appUrl.startsWith("http://") && !appUrl.startsWith("https://")) {
appUrl = "http://$appUrl"
}
// Don't load the app just send straight to browser
val i = Intent(Intent.ACTION_VIEW)
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
Expand All @@ -60,6 +63,9 @@ class NotificationActivity : AppCompatActivity() {
}

silent -> {
if (!appUrl.startsWith("http://") && !appUrl.startsWith("https://")) {
appUrl = "http://$appUrl"
}
// Do silent HTTP request
notificationResource!!.executeRequest(httpMethod!!, appUrl, data)
}
Expand All @@ -79,7 +85,7 @@ class NotificationActivity : AppCompatActivity() {
startActivity(launchIntent)
}
}
finish()
}
finish()
}
}

0 comments on commit d3aabad

Please sign in to comment.