Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import com.deskpro.messenger.util.extensions.EvaluateScriptsUtil.initAndOpenScri
import com.deskpro.messenger.util.extensions.extractAppId
import com.deskpro.messenger.util.extensions.extractUrl
import timber.log.Timber
import java.net.MalformedURLException
import java.net.URL

/**
* Activity hosting the WebView for DeskPro Messenger functionality.
Expand Down Expand Up @@ -115,8 +117,16 @@ internal class MessengerWebViewActivity : AppCompatActivity() {
error: WebResourceError?
) {
super.onReceivedError(view, request, error)
binding.progressBar.visibility = View.GONE
loadErrorHtmlPage()
// Only redirect to error page if the error came from the Messenger domain
try {
if (URL(url).host == request?.url?.host) {
Comment thread
ccw-morris marked this conversation as resolved.
Comment thread
ccw-morris marked this conversation as resolved.
binding.progressBar.visibility = View.GONE
loadErrorHtmlPage()
}
} catch (e: MalformedURLException) {
// If url is malformed then Messenger has failed to load
Comment thread
ccw-morris marked this conversation as resolved.
loadErrorHtmlPage()
}
Comment thread
ccw-morris marked this conversation as resolved.
}
}
}
Expand Down