Skip to content

Commit

Permalink
added telegram join link
Browse files Browse the repository at this point in the history
  • Loading branch information
robinsrk committed Dec 31, 2024
1 parent 71af7fb commit b519162
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
applicationId = "dev.robin.flip_2_dnd"
minSdk = 23
targetSdk = 34
versionCode = 9
versionName = "1.0.9"
versionCode = 10
versionName = "1.1.0"
vectorDrawables {
useSupportLibrary = true
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package dev.robin.flip_2_dnd.presentation.settings

import android.content.ActivityNotFoundException
import android.content.Intent
import android.net.Uri
import android.widget.Toast
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand All @@ -25,6 +29,7 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
Expand All @@ -38,6 +43,7 @@ fun SettingsScreen(
navController: NavController? = null,
onDonateClick: () -> Unit
) {
val context = LocalContext.current
val soundEnabled by viewModel.soundEnabled.collectAsState()
val vibrationEnabled by viewModel.vibrationEnabled.collectAsState()
val screenOffOnly by viewModel.screenOffOnly.collectAsState()
Expand Down Expand Up @@ -112,14 +118,38 @@ fun SettingsScreen(
)
}
Row(horizontalArrangement = Arrangement.End, modifier = Modifier.fillMaxWidth()) {
Button(onClick = {
val telegramUsername = "flip_2_dnd"
val telegramUri = "tg://resolve?domain=$telegramUsername"
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(telegramUri))
try {
context.startActivity(intent)
} catch (e: ActivityNotFoundException) {
// Handle the case where no activity can handle the intent
// For example, show a toast or log the error
Toast.makeText(context, "Telegram app not found", Toast.LENGTH_SHORT).show()
println("No activity found to handle the intent: $e")
}
}) {
Row(verticalAlignment = Alignment.CenterVertically) {
Image(
painter = painterResource(id = R.drawable.telegram),
contentDescription = "Logo",
modifier = Modifier.width(30.dp)
)
Spacer(Modifier.width(10.dp))
Text("Join telegram")
}
}
Spacer(Modifier.width(10.dp))
Button(onClick = onDonateClick) {
Row(verticalAlignment = Alignment.CenterVertically) {
Image(
painter = painterResource(id = R.drawable.donation),
contentDescription = "Logo",
modifier = Modifier.width(30.dp)
)
Spacer(Modifier.width(20.dp))
Spacer(Modifier.width(10.dp))
Text("Donate")
}
}
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/telegram.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="200dp"
android:height="200dp"
android:viewportWidth="48"
android:viewportHeight="48">
<path
android:fillColor="#FF000000"
android:pathData="M41.419,7.309C41.419,7.309 45.305,5.794 44.981,9.473C44.873,10.988 43.902,16.291 43.146,22.026L40.556,39.016C40.556,39.016 40.34,41.505 38.397,41.938C36.455,42.37 33.541,40.423 33.001,39.99C32.569,39.665 24.907,34.796 22.209,32.415C21.453,31.765 20.59,30.467 22.316,28.952L33.649,18.131C34.944,16.832 36.239,13.802 30.843,17.481L15.733,27.762C15.733,27.762 14.006,28.844 10.769,27.87L3.753,25.705C3.753,25.705 1.163,24.082 5.588,22.459C16.381,17.373 29.656,12.179 41.419,7.309Z"/>
</vector>
1 change: 1 addition & 0 deletions assets/images/telegram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions metadata/en-US/changelogs/10.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- added telegram group join link

0 comments on commit b519162

Please sign in to comment.