diff --git a/app/src/main/java/com/starry/myne/helpers/Constants.kt b/app/src/main/java/com/starry/myne/helpers/Constants.kt index ed47f97a..e1dd8ea4 100644 --- a/app/src/main/java/com/starry/myne/helpers/Constants.kt +++ b/app/src/main/java/com/starry/myne/helpers/Constants.kt @@ -31,6 +31,7 @@ object Constants { const val DEV_TELEGRAM_URL = "https://t.me/starryboi" const val PROJECT_CONTRIBUTORS = "https://github.com/Pool-Of-Tears/Myne/graphs/contributors" const val GITHUB_REPO = "https://github.com/Pool-Of-Tears/Myne" + const val WEBSITE = "https://pooloftears.in" const val PRIVACY_POLICY = "https://github.com/Pool-Of-Tears/Myne/blob/main/legal/PRIVACY-POLICY.md" const val GITHUB_ISSUE = "https://github.com/Pool-Of-Tears/Myne/issues/new/choose" diff --git a/app/src/main/java/com/starry/myne/helpers/Utils.kt b/app/src/main/java/com/starry/myne/helpers/Utils.kt index 13aac783..5b5b9883 100644 --- a/app/src/main/java/com/starry/myne/helpers/Utils.kt +++ b/app/src/main/java/com/starry/myne/helpers/Utils.kt @@ -17,7 +17,12 @@ package com.starry.myne.helpers +import android.content.ActivityNotFoundException +import android.content.Context +import android.content.Intent +import android.net.Uri import android.os.Build +import com.starry.myne.R import java.io.BufferedReader import java.io.IOException import java.io.InputStreamReader @@ -48,6 +53,23 @@ object Utils { } } + /** + * Opens a web link in the default browser. + * + * @param context The context to use. + * @param url The URL to open. + */ + fun openWebLink(context: Context, url: String) { + val uri: Uri = Uri.parse(url) + val intent = Intent(Intent.ACTION_VIEW, uri) + try { + context.startActivity(intent) + } catch (exc: ActivityNotFoundException) { + exc.printStackTrace() + context.getString(R.string.error).toToast(context) + } + } + /** * Check if the device is running on MIUI. * diff --git a/app/src/main/java/com/starry/myne/ui/screens/settings/composables/AboutScreen.kt b/app/src/main/java/com/starry/myne/ui/screens/settings/composables/AboutScreen.kt index d11e6f85..4c01a6a2 100644 --- a/app/src/main/java/com/starry/myne/ui/screens/settings/composables/AboutScreen.kt +++ b/app/src/main/java/com/starry/myne/ui/screens/settings/composables/AboutScreen.kt @@ -16,10 +16,7 @@ package com.starry.myne.ui.screens.settings.composables -import android.content.ActivityNotFoundException import android.content.Context -import android.content.Intent -import android.net.Uri import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.clickable @@ -40,6 +37,7 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.Notes import androidx.compose.material.icons.filled.Favorite import androidx.compose.material.icons.filled.PrivacyTip +import androidx.compose.material.icons.filled.Web import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults import androidx.compose.material3.ExperimentalMaterial3Api @@ -72,11 +70,11 @@ import coil.request.ImageRequest import com.starry.myne.BuildConfig import com.starry.myne.R import com.starry.myne.helpers.Constants +import com.starry.myne.helpers.Utils import com.starry.myne.ui.common.CustomTopAppBar import com.starry.myne.ui.theme.figeronaFont -@OptIn(ExperimentalMaterial3Api::class) @Composable fun AboutScreen(navController: NavController) { val context = LocalContext.current @@ -121,7 +119,7 @@ fun AboutScreen(navController: NavController) { SettingItem(ImageVector.vectorResource(id = R.drawable.ic_osi_logo), mainText = stringResource(id = R.string.project_contributors), subText = stringResource(id = R.string.project_contributors_desc), - onClick = { openWebLink(context, Constants.PROJECT_CONTRIBUTORS) } + onClick = { Utils.openWebLink(context, Constants.PROJECT_CONTRIBUTORS) } ) } @@ -144,27 +142,32 @@ fun AboutScreen(navController: NavController) { SettingItem(icon = Icons.AutoMirrored.Filled.Notes, mainText = stringResource(id = R.string.link_readme), subText = stringResource(id = R.string.link_readme_desc), - onClick = { openWebLink(context, Constants.GITHUB_REPO) } + onClick = { Utils.openWebLink(context, Constants.GITHUB_REPO) } + ) + SettingItem(icon = Icons.Filled.Web, + mainText = stringResource(id = R.string.link_website), + subText = stringResource(id = R.string.link_website_desc), + onClick = { Utils.openWebLink(context, Constants.WEBSITE) } ) SettingItem(icon = Icons.Filled.PrivacyTip, mainText = stringResource(id = R.string.link_privacy_policy), subText = stringResource(id = R.string.link_privacy_policy_desc), - onClick = { openWebLink(context, Constants.PRIVACY_POLICY) } + onClick = { Utils.openWebLink(context, Constants.PRIVACY_POLICY) } ) SettingItem(icon = ImageVector.vectorResource(id = R.drawable.ic_github_logo), mainText = stringResource(id = R.string.link_gh_issue), subText = stringResource(id = R.string.link_gh_issue_desc), - onClick = { openWebLink(context, Constants.GITHUB_ISSUE) } + onClick = { Utils.openWebLink(context, Constants.GITHUB_ISSUE) } ) SettingItem(ImageVector.vectorResource(id = R.drawable.ic_telegram_logo), mainText = stringResource(id = R.string.link_telegram), subText = stringResource(id = R.string.link_telegram_desc), - onClick = { openWebLink(context, Constants.TELEGRAM_GROUP) } + onClick = { Utils.openWebLink(context, Constants.TELEGRAM_GROUP) } ) SettingItem(icon = Icons.Filled.Favorite, mainText = stringResource(id = R.string.link_support), subText = stringResource(id = R.string.link_support_desc), - onClick = { openWebLink(context, Constants.SUPPORT) } + onClick = { Utils.openWebLink(context, Constants.SUPPORT) } ) } @@ -353,14 +356,14 @@ private fun DeveloperCard(context: Context) { text = "Github", icon = ImageVector.vectorResource(id = R.drawable.ic_github_logo) ) { - openWebLink(context, Constants.DEV_GITHUB_URL) + Utils.openWebLink(context, Constants.DEV_GITHUB_URL) } LinkButton( text = "Telegram", icon = ImageVector.vectorResource(id = R.drawable.ic_telegram_logo) ) { - openWebLink(context, Constants.DEV_TELEGRAM_URL) + Utils.openWebLink(context, Constants.DEV_TELEGRAM_URL) } } } @@ -368,16 +371,6 @@ private fun DeveloperCard(context: Context) { } } -private fun openWebLink(context: Context, url: String) { - val uri: Uri = Uri.parse(url) - val intent = Intent(Intent.ACTION_VIEW, uri) - try { - context.startActivity(intent) - } catch (exc: ActivityNotFoundException) { - exc.printStackTrace() - } -} - @ExperimentalMaterial3Api @Composable @Preview(showBackground = true) diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index a17a1308..905ae172 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -138,6 +138,8 @@ روابط مفيدة README تفقد README للتطبيق على Github. + الموقع الإلكتروني + قم بزيارة موقعنا الإلكتروني لمزيد من المعلومات. سياسة الخصوصية اقرأ سياسة الخصوصية الأخيرة لدينا. مشاكل Github diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 206e8fc2..80878bf6 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -137,6 +137,8 @@ Užitečné odkazy README Zkontrolujte README aplikace na Githubu. + Webová stránka + Navštivte naše webové stránky pro více informací. Zásady ochrany osobních údajů Přečtěte si naše nejnovější zásady ochrany osobních údajů. Problémy na Githubu diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index a3670659..950525bf 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -139,6 +139,8 @@ Nützliche Links README Schauen Sie sich das README der App auf Github an. + Webseite + Besuchen Sie unsere Webseite für weitere Informationen. Datenschutzrichtlinie Lesen Sie unsere neueste Datenschutzrichtlinie. Github-Probleme diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index a2661edf..2afd12c1 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -138,6 +138,8 @@ Nützliche Links README Schauen Sie sich das README der App auf Github an. + Sitio web + Visite nuestro sitio web para más información. Datenschutzrichtlinie Lesen Sie unsere neueste Datenschutzrichtlinie. Github-Probleme diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 2939f49c..211c8fec 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -138,6 +138,8 @@ Link Utili README Consulta il README dell\'app su Github. + Sito web + Visita il nostro sito web per maggiori informazioni. Informativa sulla Privacy Leggi la nostra ultima informativa sulla privacy. Problemi Github diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 2183fbd4..a47515a8 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -138,6 +138,8 @@ Link Utili README Consulta il README dell\'app su Github. + Site + Visite nosso site para mais informações. Informativa sulla Privacy Leggi la nostra última informativa sulla privacy. Problemi Github diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 99d5cbe8..5036634e 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -139,6 +139,8 @@ Link-uri Utile README Consultă README-ul aplicației pe Github. + Site web + Vizitați site-ul nostru pentru mai multe informații. Politica de Confidențialitate Citește ultima noastră politică de confidențialitate. Probleme Github diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 26f7f47b..fee59861 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -138,6 +138,8 @@ Полезные Ссылки README Информация о проекте на Github. + Веб-сайт + Посетите наш веб-сайт для получения дополнительной информации. Политика Конфиденциальности Прочтите нашу последнюю политику конфиденциальности. Темы на Github diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index ea118f9d..7bcc3aee 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -139,6 +139,8 @@ 有用链接 自述文件 在Github上查看应用的自述文件。 + 网站 + 访问我们的网站以获取更多信息。 隐私政策 阅读我们的最新隐私政策。 Github问题 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1880949d..e488d633 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -141,6 +141,8 @@ Useful Links README Checkout app\'s README on Github. + Website + Visit our website for more information. Privacy Policy Read our latest privacy policy. Github Issues