Skip to content

Commit

Permalink
Fix some not clickable links
Browse files Browse the repository at this point in the history
  • Loading branch information
Radiokot committed Jan 14, 2025
1 parent f95590c commit d585b9f
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 24 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
### Fixed

- Incorrect support email address in some error messages
- Not working links to the documentation on some screens

### Removed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,14 @@ class BakerRegistrationOpenActivity : BaseDelegationBakerActivity(
}
}

binding.openUrlExplain.handleUrlClicks { url ->
fun onUrlClicked(url: String) {
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
ContextCompat.startActivity(this, browserIntent, null)
}

binding.openUrlExplain.handleUrlClicks(::onUrlClicked)
binding.readMoreTextView.handleUrlClicks(::onUrlClicked)

binding.bakerRegistrationOpenContinue.setOnClickListener {
KeyboardUtil.hideKeyboard(this)
viewModel.bakerDelegationData.metadataUrl = binding.openUrl.text?.toString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,40 @@ class AboutActivity : BaseActivity(
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

binding.aboutContactText.handleUrlClicks { url ->
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
ContextCompat.startActivity(this, browserIntent, null)
}
fun onUrlClicked(url: String) = when {
url == "#terms" -> {
startActivity(Intent(this, WelcomeTermsActivity::class.java))
}

url.startsWith("mailto") -> {
val emailIntent = Intent(Intent.ACTION_SENDTO)
emailIntent.data = Uri.parse(url)
emailIntent.putExtra(Intent.EXTRA_EMAIL, arrayOf(url))
try {
// start email intent
startActivity(
Intent.createChooser(
emailIntent,
getString(R.string.about_support)
)
)
} catch (e: Exception) {
// Left empty on purpose
}
}

binding.aboutSupportText.handleUrlClicks { url ->
val emailIntent = Intent(Intent.ACTION_SENDTO)
emailIntent.data = Uri.parse(url)
emailIntent.putExtra(Intent.EXTRA_EMAIL, arrayOf(url))
try {
// start email intent
startActivity(Intent.createChooser(emailIntent, getString(R.string.about_support)))
} catch (e: Exception) {
// Left empty on purpose
else -> {
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
ContextCompat.startActivity(this, browserIntent, null)
}
}

binding.aboutVersionText.text = AppConfig.appVersion

binding.termsTextView.handleUrlClicks {
startActivity(Intent(this, WelcomeTermsActivity::class.java))
}

binding.privacyTextView.handleUrlClicks { url ->
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
ContextCompat.startActivity(this, browserIntent, null)
}
binding.aboutContactText.handleUrlClicks(::onUrlClicked)
binding.aboutSupportText.handleUrlClicks(::onUrlClicked)
binding.termsTextView.handleUrlClicks(::onUrlClicked)
binding.privacyTextView.handleUrlClicks(::onUrlClicked)

hideActionBarBack(isVisible = true)
binding.toolbarLayout.toolbarTitle.setTextAppearance(R.style.CCX_Typography_PageTitle)
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@

<string name="delegation_register_delegation_intro">You can delegate to an open pool of your choice, or you can stake using passive delegation.</string>
<string name="delegation_register_delegation_desc">If you don\'t already know which validator pool you want to delegate an amount to, you can look for one here:\n\n<a href="https://ccdscan.io/staking">https://ccdscan.io/staking</a></string>
<string name="delegation_register_delegation_desc_passive">Passive delegation is an alternative to delegation to a specific validator pool that has lower rewards. With passive delegation you do not have to worry about the uptime or quality of a validator node.\n\nFor more info you can visit\n\n<a href="https://developer.concordium.software/en/mainnet/net/concepts/concepts-delegation.html">developer.concordium.software</a></string>
<string name="delegation_register_delegation_desc_passive">Passive delegation is an alternative to delegation to a specific validator pool that has lower rewards. With passive delegation you do not have to worry about the uptime or quality of a validator node.\n\nFor more info you can visit\n\n<a href="https://docs.concordium.com/en/mainnet/docs/protocol/concepts-delegation.html">docs.concordium.com</a></string>
<string name="delegation_register_delegation_pool_id_hint">Enter validator pool ID</string>
<string name="delegation_register_delegation_pool_id_hint_update">Optional: New validator pool ID</string>
<string name="delegation_update_delegation_pool_id_baker">Current target: Validator id %1$s</string>
Expand Down Expand Up @@ -790,7 +790,7 @@

<string name="baker_registration_open_title">Add validator</string>
<string name="baker_registration_open_explain">You can choose to add a URL with metadata about your validator. Leave it blank if you don’t have any.</string>
<string name="baker_registration_open_read_more">You can read more about the metadata URL on <a href="https://developer.concordium.software">developer.concordium.software</a></string>
<string name="baker_registration_open_read_more">You can read more about the metadata URL on <a href="https://docs.concordium.com/en/mainnet/docs/mobile-wallet/add-baker-mw.html">docs.concordium.com</a></string>
<string name="baker_registration_open_continue">Continue</string>
<string name="baker_registration_open_url_hint">Paste your metadata URL here</string>
<string name="baker_registration_open_url_invalid">Please enter a valid HTTP or HTTPS URL</string>
Expand Down

0 comments on commit d585b9f

Please sign in to comment.