Skip to content

Commit

Permalink
Приложение вылетает при тапе на СВЯЗАТЬСЯ в футере #19
Browse files Browse the repository at this point in the history
  • Loading branch information
leffsu committed Sep 19, 2022
1 parent 4f1b656 commit 33fb508
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
9 changes: 9 additions & 0 deletions core/src/main/kotlin/ru/razrabs/core/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,13 @@ fun openWebPage(context: Context, url: String) {
Uri.parse(url)
)
)
}

fun openEmail(context: Context, url: String) {
context.startActivity(
Intent(
Intent.ACTION_SENDTO,
Uri.parse(url)
)
)
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ru.razrabs.core.constants

const val ABOUT_US_LINK = "https://razrabs.ru/post/3c6bcea4-c34a-4650-907a-bca8dd72a310"
const val CONTACT_EMAIL_ADDRESS = "razrabschannel@razrabs.ru"
const val CONTACT_EMAIL_ADDRESS = "mailto:razrabschannel@razrabs.ru"
const val GITHUB_LINK = "https://github.com/razrabs-media"
const val YT_LINK = "https://www.youtube.com/channel/UC-h5nFU9Qzo72dFW-fC_lkQ"
const val TG_LINK = "https://t.me/rzrbs"
Expand Down
1 change: 1 addition & 0 deletions core/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
<string name="with_us_since">С Разрабами с %1$s</string>
<string name="your_avatar">Ваш аватар</string>
<string name="comment_tooltip">Написать… (макс. 255 символов)</string>
<string name="no_email_app">Не найдено приложение электронной почты</string>
</resources>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ru.razrabs.design.components.home

import android.widget.Toast
import androidx.compose.foundation.layout.*
import androidx.compose.material.Divider
import androidx.compose.material.Text
Expand All @@ -12,6 +13,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import ru.razrabs.core.R
import ru.razrabs.core.constants.*
import ru.razrabs.core.openEmail
import ru.razrabs.core.openWebPage
import ru.razrabs.design.VerticalSpacer
import ru.razrabs.design.clickableWithoutRipple
Expand Down Expand Up @@ -43,7 +45,12 @@ fun Footer() {
uriHandler.openUri(ABOUT_US_LINK)
}
FooterText(stringResource(id = R.string.contact)) {
openWebPage(ctx, CONTACT_EMAIL_ADDRESS)
try {
openEmail(ctx, CONTACT_EMAIL_ADDRESS)
} catch (e: Exception) {
Toast.makeText(ctx, ctx.getString(R.string.no_email_app), Toast.LENGTH_LONG)
.show()
}
}
}
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
Expand Down

0 comments on commit 33fb508

Please sign in to comment.