Skip to content

Commit e22c1f7

Browse files
committed
Stop showing a warning when opening websites to accelerate user flow
1 parent 6124eff commit e22c1f7

File tree

18 files changed

+17
-93
lines changed

18 files changed

+17
-93
lines changed

app-base/src/main/java/xyz/aprildown/timer/app/base/utils/WebsiteOpener.kt

+2-28
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,14 @@ package xyz.aprildown.timer.app.base.utils
33
import android.content.ActivityNotFoundException
44
import android.content.Context
55
import android.content.Intent
6-
import android.view.LayoutInflater
76
import androidx.browser.customtabs.CustomTabColorSchemeParams
87
import androidx.browser.customtabs.CustomTabsIntent
98
import androidx.core.content.ContextCompat
10-
import androidx.core.content.edit
119
import androidx.core.net.toUri
1210
import com.github.deweyreed.tools.helper.isDarkTheme
13-
import com.github.deweyreed.tools.helper.isNetworkCheap
14-
import com.google.android.material.dialog.MaterialAlertDialogBuilder
1511
import xyz.aprildown.timer.app.base.data.DarkTheme
1612
import xyz.aprildown.timer.app.base.data.PreferenceData.appTheme
17-
import xyz.aprildown.timer.app.base.databinding.DialogWebsiteWarningBinding
1813
import xyz.aprildown.timer.app.base.ui.newDynamicTheme
19-
import xyz.aprildown.tools.helper.safeSharedPreference
2014

2115
private fun Context.openWebsiteWithCustomTabs(url: String) {
2216
val darkTheme = DarkTheme(this)
@@ -80,26 +74,6 @@ private fun Context.openWebsiteWithCustomTabs(url: String) {
8074
}
8175
}
8276

83-
private const val KEY_SHOW_WEBSITE_WARNING = "warning_website"
84-
85-
fun Context.openWebsiteWithWarning(url: String) {
86-
if (isNetworkCheap() || !safeSharedPreference.getBoolean(KEY_SHOW_WEBSITE_WARNING, true)) {
87-
openWebsiteWithCustomTabs(url)
88-
} else {
89-
val binding = DialogWebsiteWarningBinding.inflate(LayoutInflater.from(this))
90-
val dialog = MaterialAlertDialogBuilder(this)
91-
.setView(binding.root)
92-
.setPositiveButton(android.R.string.ok) { _, _ ->
93-
openWebsiteWithCustomTabs(url)
94-
}
95-
.setNegativeButton(android.R.string.cancel, null)
96-
.show()
97-
dialog.setOnDismissListener {
98-
if (binding.check.isChecked) {
99-
safeSharedPreference.edit {
100-
putBoolean(KEY_SHOW_WEBSITE_WARNING, false)
101-
}
102-
}
103-
}
104-
}
77+
fun Context.openLink(url: String) {
78+
openWebsiteWithCustomTabs(url)
10579
}

app-base/src/main/res/layout/dialog_website_warning.xml

-26
This file was deleted.

app-base/src/main/res/values-de/strings.xml

-2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@
2727
<string name="pause">Pause</string>
2828
<string name="stop">Stop</string>
2929
<string name="plus_one_minute">1 Minute hinzufügen</string>
30-
<string name="never_show_again">Nicht wieder anzeigen</string>
3130
<string name="thanks">Danke für Ihre Unterstützung!</string>
32-
<string name="consume_data_warning">Dies wird eine Website öffnen und mobile Daten verbrauchen</string>
3331
<string name="no_action_found">Keine App kann diese Aktion ausführen</string>
3432
<string name="empty">Leer</string>
3533
<string name="delete_confirmation_template">%s löschen?</string>

app-base/src/main/res/values-es/strings.xml

-2
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,6 @@
168168
<string name="start">Iniciar</string>
169169
<string name="pause">Pausar</string>
170170
<string name="plus_one_minute">Añadir 1 minuto</string>
171-
<string name="never_show_again">No mostrar de nuevo</string>
172-
<string name="consume_data_warning">Esto abrirá una web que podría consumir datos móviles</string>
173171
<string name="no_action_found">Ninguna aplicación puede realizar esta acción</string>
174172
<string name="terms_of_service">Términos</string>
175173
<string name="main_action_timers">Temporizadores</string>

app-base/src/main/res/values-fr/strings.xml

-2
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@
3232
<string name="stop">Arrêter</string>
3333
<string name="plus_one_minute">Ajouter 1 minute</string>
3434
<string name="unknown">Inconnu</string>
35-
<string name="never_show_again">Ne plus afficher</string>
3635
<string name="thanks">Merci de votre soutien !</string>
37-
<string name="consume_data_warning">Ceci ouvrira une page web et consommera des données mobiles</string>
3836
<string name="main_action_timers">Minuteries</string>
3937
<string name="main_action_backup">Sauvegarde et restauration</string>
4038
<string name="main_action_dark">Thème sombre</string>

app-base/src/main/res/values-it/strings.xml

-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
<string name="pause">Pausa</string>
3030
<string name="stop">Stop</string>
3131
<string name="plus_one_minute">Aggiungi 1 minuto</string>
32-
<string name="consume_data_warning">L\'applicazione aprirà una pagina web e consumerà dati mobili</string>
3332
<string name="no_action_found">Nessuna applicazione può eseguire questa azione</string>
3433
<string name="empty">Vuoto</string>
3534
<string name="delete_confirmation_template">Cancellare %s?</string>
@@ -144,7 +143,6 @@
144143
<string name="open_menu">Apri menu</string>
145144
<string name="deselect">Deseleziona</string>
146145
<string name="dismiss">Ignora</string>
147-
<string name="never_show_again">Non mostrare più</string>
148146
<string name="thanks">Grazie per il tuo aiuto!</string>
149147
<string name="edit_default_timer_name">Cronometro</string>
150148
<string name="edit_group">Gruppo</string>

app-base/src/main/res/values-nb-rNO/strings.xml

-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323
<string name="stop">Stopp</string>
2424
<string name="plus_one_minute">Legg till ett minutt</string>
2525
<string name="unknown">Ukjent</string>
26-
<string name="never_show_again">Aldri vis igjen</string>
2726
<string name="thanks">Takk for din støtte!</string>
28-
<string name="consume_data_warning">Dette vil åpne en nettside og bruke mobildata</string>
2927
<string name="no_action_found">Ingen programmer kan utføre denne handlingen</string>
3028
<string name="empty">Tom</string>
3129
<string name="delete_confirmation_template">Slett «%s»\?</string>

app-base/src/main/res/values-nl/strings.xml

-2
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@
174174
\n1. Opnieuw importeren.
175175
\n2. App bijwerken naar de nieuwste versie.
176176
\n3. App-gegevens opschonen en deze opnieuw importeren.</string>
177-
<string name="consume_data_warning">Hiermee wordt een webpagina geopend en worden mobiele gegevens gebruikt</string>
178177
<string name="theme_pick_back">Terug</string>
179178
<string name="folder_to_list_view">Lijstweergave</string>
180179
<string name="edit_step">Stap bewerken</string>
@@ -284,7 +283,6 @@
284283
<string name="folder_to_grid_view">Rasterweergave</string>
285284
<string name="intro_start_quick_start_pause">Dit start een timer op een snelle manier. Klik voor nu op de timernaam om de details te zien</string>
286285
<string name="help_tts_desp">Stem- en aftelherinneringen zijn ervan afhankelijk</string>
287-
<string name="never_show_again">Nooit meer tonen</string>
288286
<string name="scheduler_time">Tijd</string>
289287
<string name="behaviour_voice_help">Lees deze stapnaam</string>
290288
<string name="pref_screen_title_dim">Het scherm dimmen</string>

app-base/src/main/res/values-pt/strings.xml

-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@
3434
<string name="stop">Parar</string>
3535
<string name="plus_one_minute">Adicionar 1 minuto</string>
3636
<string name="unknown">Desconhecido</string>
37-
<string name="never_show_again">Não mostrar mais</string>
3837
<string name="thanks">Obrigado pelo seu apoio!</string>
39-
<string name="consume_data_warning">Isso abrirá uma página web e consumirá dados móveis</string>
4038
<string name="no_action_found">Nenhum aplicativo pode realizar esta ação</string>
4139
<string name="empty">Vazio</string>
4240
<string name="delete_confirmation_template">Excluir %s?</string>

app-base/src/main/res/values-ru/strings.xml

-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
<string name="behaviour_add_new">Добавить напоминание</string>
5353
<string name="voice_variable_group_group">Группа</string>
5454
<string name="pause">Пауза</string>
55-
<string name="consume_data_warning">Это откроет веб-страницу и будет потреблять мобильные данные</string>
5655
<string name="folder_to_list_view">Переключить в режим списка</string>
5756
<string name="edit_step">Редактировать Действие</string>
5857
<string name="vibration_count">Отсчет</string>
@@ -90,7 +89,6 @@
9089
<string name="screen_fullscreen">Всегда Полноэкранный режим</string>
9190
<string name="voice_variable_timer_group">Таймер</string>
9291
<string name="folder_to_grid_view">Переключить в режим сетки</string>
93-
<string name="never_show_again">Больше не показывать</string>
9492
<string name="behaviour_voice_help">Озвучить название этого этапа</string>
9593
<string name="ok">Ок</string>
9694
<string name="voice_content_group_variables">* Переменные, описание которых начинается с \"(Группа)\", означают, что когда шаг находится в группе, значение вычисляется на основе группы, а не таймера.</string>

app-base/src/main/res/values-zh-rCN/strings.xml

-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@
3434
<string name="plus_one_minute">增加1分钟</string>
3535
<!--Common-->
3636
<string name="unknown">未知</string>
37-
<string name="never_show_again">不再提示</string>
3837
<string name="thanks">谢谢支持!</string>
39-
<string name="consume_data_warning">此操作将打开一个网页并消耗移动数据</string>
4038
<string name="no_action_found">没有应用可执行此操作</string>
4139
<string name="empty">什么都没有</string>
4240
<string name="delete_confirmation_template">删除 %s?</string>

app-base/src/main/res/values-zh-rHK/strings.xml

-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@
3434
<string name="plus_one_minute">增加 1 分鐘</string>
3535
<!--Common-->
3636
<string name="unknown">不明</string>
37-
<string name="never_show_again">不再提示</string>
3837
<string name="thanks">謝謝支持!</string>
39-
<string name="consume_data_warning">此操作將打開一個網頁並消耗移動數據</string>
4038
<string name="no_action_found">沒有應用可執行此操作</string>
4139
<string name="empty">什麼都沒有</string>
4240
<string name="delete_confirmation_template">刪除 %s?</string>

app-base/src/main/res/values-zh-rTW/strings.xml

-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@
3434
<string name="plus_one_minute">增加 1 分鐘</string>
3535
<!--Common-->
3636
<string name="unknown">不明</string>
37-
<string name="never_show_again">不再提示</string>
3837
<string name="thanks">謝謝支援!</string>
39-
<string name="consume_data_warning">此操作會開啟一個網頁並消耗移動資料</string>
4038
<string name="no_action_found">沒有應用可執行此操作</string>
4139
<string name="empty">什麼都沒有</string>
4240
<string name="delete_confirmation_template">刪除 %s?</string>

app-base/src/main/res/values/strings.xml

-2
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@
3838

3939
<!--Common-->
4040
<string name="unknown">Unknown</string>
41-
<string name="never_show_again">Never show again</string>
4241
<string name="thanks">Thanks for your support!</string>
43-
<string name="consume_data_warning">This will open a web page and consume mobile data</string>
4442
<string name="no_action_found">No apps can perform this action</string>
4543
<string name="empty">Empty</string>
4644
<string name="delete_confirmation_template">Delete %s?</string>

app/src/main/java/io/github/deweyreed/timer/ui/single/AboutFragment.kt

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import com.github.deweyreed.tools.helper.IntentHelper
1111
import com.github.deweyreed.tools.helper.startActivityOrNothing
1212
import io.github.deweyreed.timer.BuildConfig
1313
import io.github.deweyreed.timer.R
14-
import xyz.aprildown.timer.app.base.utils.openWebsiteWithWarning
14+
import xyz.aprildown.timer.app.base.utils.openLink
1515
import xyz.aprildown.timer.app.settings.LogFragment
1616
import xyz.aprildown.timer.domain.utils.AppConfig
1717
import xyz.aprildown.timer.domain.utils.Constants
@@ -40,7 +40,7 @@ class AboutPreferenceFragment : PreferenceFragmentCompat() {
4040
"${BuildConfig.VERSION_NAME}(${BuildConfig.VERSION_CODE})"
4141

4242
findPreference<Preference>("key_about_source_code")?.setOnPreferenceClickListener {
43-
context.openWebsiteWithWarning("https://github.com/timer-machine/timer-machine-android")
43+
context.openLink("https://github.com/timer-machine/timer-machine-android")
4444
true
4545
}
4646

@@ -52,7 +52,7 @@ class AboutPreferenceFragment : PreferenceFragmentCompat() {
5252
}
5353

5454
findPreference<Preference>("key_about_changelog")?.setOnPreferenceClickListener {
55-
context.openWebsiteWithWarning(Constants.getChangeLogLink())
55+
context.openLink(Constants.getChangeLogLink())
5656
true
5757
}
5858

@@ -69,12 +69,12 @@ class AboutPreferenceFragment : PreferenceFragmentCompat() {
6969
}
7070

7171
findPreference<Preference>("key_about_privacy_policy")?.setOnPreferenceClickListener {
72-
context.openWebsiteWithWarning(Constants.getPrivacyPolicyLink())
72+
context.openLink(Constants.getPrivacyPolicyLink())
7373
true
7474
}
7575

7676
findPreference<Preference>("key_about_terms_of_service")?.setOnPreferenceClickListener {
77-
context.openWebsiteWithWarning(Constants.getTermsOfServiceLink())
77+
context.openLink(Constants.getTermsOfServiceLink())
7878
true
7979
}
8080

@@ -87,7 +87,7 @@ class AboutPreferenceFragment : PreferenceFragmentCompat() {
8787
}
8888

8989
findPreference<Preference>("key_about_github")?.setOnPreferenceClickListener {
90-
context.openWebsiteWithWarning("https://github.com/DeweyReed")
90+
context.openLink("https://github.com/DeweyReed")
9191
true
9292
}
9393

app/src/main/java/io/github/deweyreed/timer/ui/single/HelpFragment.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import io.github.deweyreed.timer.databinding.DialogTtsTestBinding
2121
import xyz.aprildown.timer.app.base.data.FlavorData
2222
import xyz.aprildown.timer.app.base.ui.AppNavigator
2323
import xyz.aprildown.timer.app.base.utils.NavigationUtils.subLevelNavigate
24-
import xyz.aprildown.timer.app.base.utils.openWebsiteWithWarning
24+
import xyz.aprildown.timer.app.base.utils.openLink
2525
import xyz.aprildown.timer.domain.utils.Constants
2626
import javax.inject.Inject
2727
import xyz.aprildown.timer.app.base.R as RBase
@@ -45,11 +45,11 @@ class HelpFragment : PreferenceFragmentCompat() {
4545
true
4646
}
4747
findPreference<Preference>(getString(RBase.string.help_key_tips))?.setOnPreferenceClickListener {
48-
context.openWebsiteWithWarning(Constants.getTipsAndTricksLink())
48+
context.openLink(Constants.getTipsAndTricksLink())
4949
true
5050
}
5151
findPreference<Preference>(getString(RBase.string.help_key_qa))?.setOnPreferenceClickListener {
52-
context.openWebsiteWithWarning(Constants.getQaLink())
52+
context.openLink(Constants.getQaLink())
5353
true
5454
}
5555
findPreference<Preference>(getString(RBase.string.help_key_tts))?.setOnPreferenceClickListener {
@@ -103,7 +103,7 @@ class HelpFragment : PreferenceFragmentCompat() {
103103
}
104104

105105
binding.btnReadInstructions.setOnClickListener {
106-
context.openWebsiteWithWarning(Constants.getConfigureTtsLink())
106+
context.openLink(Constants.getConfigureTtsLink())
107107
}
108108
binding.btnSystemSettings.setOnClickListener {
109109
try {

component-main/src/main/java/xyz/aprildown/timer/workshop/WhitelistFragment.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import androidx.preference.Preference
1111
import androidx.preference.PreferenceCategory
1212
import androidx.preference.PreferenceFragmentCompat
1313
import com.github.deweyreed.tools.helper.startActivityOrNothing
14-
import xyz.aprildown.timer.app.base.utils.openWebsiteWithWarning
14+
import xyz.aprildown.timer.app.base.utils.openLink
1515
import xyz.aprildown.timer.app.base.R as RBase
1616

1717
class WhitelistFragment : PreferenceFragmentCompat() {
@@ -26,7 +26,7 @@ class WhitelistFragment : PreferenceFragmentCompat() {
2626
title = "Don't kill my app!"
2727
setSummary(RBase.string.whitelist_don_t_kill_desp)
2828
setOnPreferenceClickListener {
29-
context.openWebsiteWithWarning(
29+
context.openLink(
3030
"https://dontkillmyapp.com?app=${getString(RBase.string.app_name)}"
3131
)
3232
true

flavor-google/src/main/java/xyz/aprildown/timer/flavor/google/BillingFragment.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import com.github.deweyreed.tools.helper.startActivityOrNothing
2626
import com.google.android.material.dialog.MaterialAlertDialogBuilder
2727
import dagger.hilt.android.AndroidEntryPoint
2828
import xyz.aprildown.timer.app.base.data.FlavorData
29-
import xyz.aprildown.timer.app.base.utils.openWebsiteWithWarning
29+
import xyz.aprildown.timer.app.base.utils.openLink
3030
import xyz.aprildown.timer.component.key.PreferenceStyleListFragment
3131
import xyz.aprildown.timer.domain.utils.Constants
3232
import xyz.aprildown.timer.flavor.google.databinding.FragmentBillingBinding
@@ -163,7 +163,7 @@ internal class BillingFragment : Fragment(R.layout.fragment_billing), MenuProvid
163163
spannable.setSpan(
164164
object : ClickableSpan() {
165165
override fun onClick(widget: View) {
166-
context.openWebsiteWithWarning(Constants.getPrivacyPolicyLink())
166+
context.openLink(Constants.getPrivacyPolicyLink())
167167
}
168168
},
169169
privacyPolicyIndex,
@@ -175,7 +175,7 @@ internal class BillingFragment : Fragment(R.layout.fragment_billing), MenuProvid
175175
spannable.setSpan(
176176
object : ClickableSpan() {
177177
override fun onClick(widget: View) {
178-
context.openWebsiteWithWarning(Constants.getTermsOfServiceLink())
178+
context.openLink(Constants.getTermsOfServiceLink())
179179
}
180180
},
181181
termsIndex,

0 commit comments

Comments
 (0)