Skip to content
Open
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
@@ -1,6 +1,8 @@
package org.wordpress.android.ui.about

import android.content.ActivityNotFoundException
import android.os.Bundle
import android.widget.Toast
import com.automattic.about.model.AboutConfigProvider
import org.wordpress.android.R
import org.wordpress.android.WordPress
Expand All @@ -19,14 +21,20 @@ class UnifiedAboutActivity : BaseAppCompatActivity(), AboutConfigProvider {
super.onCreate(savedInstanceState)
(application as WordPress).component().inject(this)
setContentView(R.layout.unified_about_activity)

viewModel.onNavigation.observeEvent(this) {
when (it) {
viewModel.onNavigation.observeEvent(this) { action ->
when (action) {
is Dismiss -> finish()
is OpenBlog -> ActivityLauncher.openUrlExternal(this, it.url)
is OpenBlog -> openExternalBlogUrl(action.url)
}
}
}

private fun openExternalBlogUrl(url: String){
try{
ActivityLauncher.openUrlExternal(this, url)
}catch(e: ActivityNotFoundException){
Toast.makeText(this, "External Activity does not exists or is invalid.", Toast.LENGTH_SHORT).show()
}
}
override fun getAboutConfig() = viewModel.getAboutConfig()
}