Skip to content
Closed
Show file tree
Hide file tree
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 @@ -348,8 +348,17 @@ private void initViewModel(WPWebViewUsageCategory webViewUsageCategory) {
});

mViewModel.getOpenExternalBrowser().observe(this, unit -> {
ReaderActivityLauncher.openUrl(WPWebViewActivity.this, mWebView.getUrl(),
ReaderActivityLauncher.OpenUrlType.EXTERNAL);
// Prefer the currently loaded URL, but fall back to the requested URL when the page
// hasn't finished loading yet (mWebView.getUrl() is null before the first load).
String urlToOpen = mWebView.getUrl();
if (TextUtils.isEmpty(urlToOpen)) {
Bundle extras = getIntent().getExtras();
urlToOpen = extras != null ? extras.getString(URL_TO_LOAD) : null;
}
if (!TextUtils.isEmpty(urlToOpen)) {
ReaderActivityLauncher.openUrl(WPWebViewActivity.this, urlToOpen,
ReaderActivityLauncher.OpenUrlType.EXTERNAL);
}
});

mViewModel.getPreviewModeSelector().observe(this, previewModelSelectorStatus -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ private void showCommentWhenNonNull(
updateStatusViews(binding, actionBinding, site, comment, note);

// navigate to author's blog when avatar or name clicked
if (comment.getAuthorUrl() != null) {
if (!TextUtils.isEmpty(comment.getAuthorUrl())) {
View.OnClickListener authorListener =
v -> ReaderActivityLauncher.openUrl(getActivity(), comment.getAuthorUrl());
binding.imageAvatar.setOnClickListener(authorListener);
Expand Down
Loading