Skip to content

Commit

Permalink
Merge pull request #3237 from CruGlobal/GT-2188-removeOnboardingLinks
Browse files Browse the repository at this point in the history
GT-2188 Remove links page from onboarding tutorial
  • Loading branch information
frett authored Nov 20, 2023
2 parents 82a9089 + de740c1 commit 2e2cc55
Show file tree
Hide file tree
Showing 68 changed files with 8 additions and 639 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ package org.cru.godtools.tutorial
import androidx.annotation.DrawableRes
import androidx.annotation.RawRes
import androidx.annotation.StringRes
import java.util.Locale
import org.ccci.gto.android.common.util.includeFallbacks

private val ONBOARDING_EXTENDED_LOCALES = setOf(Locale.ENGLISH, Locale.FRENCH, Locale("es"), Locale("lv"), Locale("vi"))

internal enum class Page(
@StringRes val title: Int? = null,
Expand All @@ -15,8 +11,6 @@ internal enum class Page(
@StringRes val action: Int? = null,
@RawRes val animation: Int? = null,
@DrawableRes val image: Int? = null,
private val supportedLocales: Set<Locale> = emptySet(),
private val disabledLocales: Set<Locale> = emptySet(),
val showIndicator: Boolean = true,
val showMenu: Boolean = true
) {
Expand All @@ -37,22 +31,10 @@ internal enum class Page(
animation = R.raw.anim_tutorial_onboarding_dog
),
ONBOARDING_SHARE(
title = R.string.tutorial_onboarding_share_headline,
content = R.string.tutorial_onboarding_share_subhead,
action = R.string.tutorial_onboarding_action_next,
animation = R.raw.anim_tutorial_onboarding_distance,
supportedLocales = ONBOARDING_EXTENDED_LOCALES
),
ONBOARDING_SHARE_FINAL(
title = R.string.tutorial_onboarding_share_headline,
content = R.string.tutorial_onboarding_share_subhead,
action = R.string.tutorial_onboarding_action_start,
animation = R.raw.anim_tutorial_onboarding_distance,
disabledLocales = ONBOARDING_EXTENDED_LOCALES,
showMenu = false
),
ONBOARDING_LINKS(
supportedLocales = ONBOARDING_EXTENDED_LOCALES,
showMenu = false
),
FEATURES_TOOLS(
Expand Down Expand Up @@ -119,9 +101,5 @@ internal enum class Page(
content = R.string.tutorial_tips_start_text,
animation = R.raw.anim_tutorial_tips_light,
showMenu = false
);

fun supportsLocale(locale: Locale) =
(supportedLocales.isEmpty() || sequenceOf(locale).includeFallbacks().any { it in supportedLocales }) &&
(disabledLocales.isEmpty() || sequenceOf(locale).includeFallbacks().none { it in disabledLocales })
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import org.cru.godtools.base.Settings

enum class PageSet(
internal val feature: String? = null,
private val pages: List<Page>,
internal val pages: List<Page>,
private val supportedLocales: Set<Locale> = emptySet(),
internal val menu: List<Pair<AppBarAction, Action>> = emptyList(),
internal val showUpNavigation: Boolean = true,
Expand All @@ -22,9 +22,7 @@ enum class PageSet(
Page.ONBOARDING_WELCOME,
Page.ONBOARDING_CONVERSATIONS,
Page.ONBOARDING_PREPARE,
Page.ONBOARDING_SHARE_FINAL,
Page.ONBOARDING_SHARE,
Page.ONBOARDING_LINKS
)
),
FEATURES(
Expand Down Expand Up @@ -62,8 +60,6 @@ enum class PageSet(
fun supportsLocale(locale: Locale?) =
locale != null && sequenceOf(locale).includeFallbacks().any { supportedLocales.contains(it) }

internal fun pagesFor(locale: Locale) = pages.filter { it.supportsLocale(locale) }

companion object {
val DEFAULT = ONBOARDING
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import org.cru.godtools.tutorial.analytics.model.TutorialAnalyticsScreenEvent
internal fun TutorialLayout(pageSet: PageSet, onTutorialAction: (Action) -> Unit = {}) {
val coroutineScope = rememberCoroutineScope()
val locale = LocalAppLanguage.current
val pages = remember(pageSet, locale) { pageSet.pagesFor(locale) }
val pages = pageSet.pages

val pagerState = rememberPagerState { pages.size }
val currentPage by remember { derivedStateOf { pages[pagerState.currentPage] } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import org.cru.godtools.tutorial.Page
import org.cru.godtools.tutorial.layout.features.TutorialFeaturesLayout
import org.cru.godtools.tutorial.layout.liveshare.TutorialLiveShareLayout
import org.cru.godtools.tutorial.layout.onboarding.TutorialOnboardingLayout
import org.cru.godtools.tutorial.layout.onboarding.TutorialOnboardingLinksLayout
import org.cru.godtools.tutorial.layout.onboarding.TutorialOnboardingWelcomeLayout
import org.cru.godtools.tutorial.layout.tips.TutorialTipsLayout

Expand Down Expand Up @@ -46,17 +45,12 @@ internal fun TutorialPageLayout(
)
Page.ONBOARDING_CONVERSATIONS,
Page.ONBOARDING_PREPARE,
Page.ONBOARDING_SHARE,
Page.ONBOARDING_SHARE_FINAL -> TutorialOnboardingLayout(
Page.ONBOARDING_SHARE -> TutorialOnboardingLayout(
page,
nextPage = nextPage,
onTutorialAction = onTutorialAction,
modifier = modifier,
)
Page.ONBOARDING_LINKS -> TutorialOnboardingLinksLayout(
onTutorialAction = onTutorialAction,
modifier = modifier,
)
Page.TIPS_LEARN,
Page.TIPS_LIGHT,
Page.TIPS_START -> TutorialTipsLayout(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import java.util.Locale
import org.cru.godtools.tutorial.PageSet
import org.cru.godtools.tutorial.layout.TutorialPageLayout

Expand All @@ -16,7 +15,7 @@ import org.cru.godtools.tutorial.layout.TutorialPageLayout
widthDp = 5 * 393
)
private fun FeaturesTutorialPreview() = Row {
PageSet.FEATURES.pagesFor(Locale.ENGLISH).forEach {
PageSet.FEATURES.pages.forEach {
TutorialPageLayout(it, modifier = Modifier.weight(1f))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import java.util.Locale
import org.cru.godtools.tutorial.PageSet
import org.cru.godtools.tutorial.layout.TutorialPageLayout

Expand All @@ -15,20 +14,8 @@ import org.cru.godtools.tutorial.layout.TutorialPageLayout
device = Devices.PIXEL_3A,
widthDp = 4 * 393
)
private fun OnboardingTutorialShort() = Row {
PageSet.ONBOARDING.pagesFor(Locale("tlh")).forEach {
TutorialPageLayout(it, modifier = Modifier.weight(1f))
}
}

@Composable
@Preview(
showBackground = true,
device = Devices.PIXEL_3A,
widthDp = 5 * 393
)
private fun OnboardingTutorialFull() = Row {
PageSet.ONBOARDING.pagesFor(Locale.ENGLISH).forEach {
private fun OnboardingTutorial() = Row {
PageSet.ONBOARDING.pages.forEach {
TutorialPageLayout(it, modifier = Modifier.weight(1f))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ internal fun TutorialOnboardingLayout(
Button(
onClick = {
when (page) {
Page.ONBOARDING_SHARE_FINAL -> onTutorialAction(Action.ONBOARDING_FINISH)
Page.ONBOARDING_SHARE -> onTutorialAction(Action.ONBOARDING_FINISH)
else -> nextPage()
}
},
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
<string name="tutorial_onboarding_prepare_subhead">Leer hoe om gesprekke te voer oor geloof as ’n natuurllike deel van jou lewe</string>
<string name="tutorial_onboarding_share_headline">Help iemand om Jesus te ontdek</string>
<string name="tutorial_onboarding_share_subhead">GodTools is jou gids om die evangelie op duidelike en relevante maniere te kommunikeer.</string>
<string name="tutorial_onboarding_links_headline">Vinnige begin skakels</string>
<string name="tutorial_onboarding_links_articles_subhead">Ek wil Christenskap verken</string>
<string name="tutorial_onboarding_links_articles_action">Lees ons artikels</string>
<string name="tutorial_onboarding_links_lessons_subhead">Ek wil leer om evangelie-gesprekke te hê</string>
<string name="tutorial_onboarding_links_lessons_action">Probeer ons lesse</string>
<string name="tutorial_onboarding_links_tools_subhead">Ek wil die evangelie met iemand deel</string>
<string name="tutorial_onboarding_links_tools_action">Kies een van ons gereedskap</string>
<string name="tutorial_onboarding_action_begin">Begin</string>
<string name="tutorial_onboarding_action_next">Volgende</string>
<string name="tutorial_onboarding_action_skip">Slaan oor</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
<string name="tutorial_onboarding_prepare_subhead">تعلّم كيفية إجراء محادثات عن الإيمان كجزء طبيعي من حياتك.</string>
<string name="tutorial_onboarding_share_headline">ساعد شخصًا على اكتشاف يسوع</string>
<string name="tutorial_onboarding_share_subhead">GodTools هو دليلك على التواصل عبر الكتاب المقدس بطرق واضحة وذات صلة.</string>
<string name="tutorial_onboarding_links_headline">روابط بداية سريعة</string>
<string name="tutorial_onboarding_links_articles_subhead">أريد استكشاف المسيحية</string>
<string name="tutorial_onboarding_links_articles_action">اقرأ مقالاتنا</string>
<string name="tutorial_onboarding_links_lessons_subhead">أريد أن أتعلم كيفية إجراء حوارًا باستخدام الكتاب المقدس</string>
<string name="tutorial_onboarding_links_lessons_action">جرّب دروسنا</string>
<string name="tutorial_onboarding_links_tools_subhead">أريد أن أشارك الكتاب المقدس مع أحد الأشخاص</string>
<string name="tutorial_onboarding_links_tools_action">اختر أحد أدواتنا</string>
<string name="tutorial_onboarding_action_begin">ابدأ</string>
<string name="tutorial_onboarding_action_next">التالي</string>
<string name="tutorial_onboarding_action_skip">تخطي</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
<string name="tutorial_onboarding_prepare_subhead">İnanclar haqqında danışmağı həyatınızın ayrılmaz hissəsinə çevirməyi öyrənin.</string>
<string name="tutorial_onboarding_share_headline">Başqalarına İsanı kəşf etməyə kömək et</string>
<string name="tutorial_onboarding_share_subhead">GodTools İncilin aydın və müvafiq qaydada çatdırılması üçün sizin bələdçinizdir.</string>
<string name="tutorial_onboarding_links_headline">Tez başlama keçidləri</string>
<string name="tutorial_onboarding_links_articles_subhead">Mən xristian dinini öyrənmək istəyirəm</string>
<string name="tutorial_onboarding_links_articles_action">Məqalələrimizi oxu</string>
<string name="tutorial_onboarding_links_lessons_subhead">Mən Incillə bağlı danışmağı öyrənmək istəyirəm</string>
<string name="tutorial_onboarding_links_lessons_action">Dərslərimizi sınayın</string>
<string name="tutorial_onboarding_links_tools_subhead">Mən İncili başqaları ilə paylaşmaq istəyirəm</string>
<string name="tutorial_onboarding_links_tools_action">Alətlərimizdən birini seç</string>
<string name="tutorial_onboarding_action_begin">Başla</string>
<string name="tutorial_onboarding_action_next">Növbəti</string>
<string name="tutorial_onboarding_action_skip">Burax</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
<string name="tutorial_onboarding_prepare_subhead">Научи се как да направиш така, че разговорите за вярата да са естествена час от живота ти.</string>
<string name="tutorial_onboarding_share_headline">Помогни на някого да открие Исус.</string>
<string name="tutorial_onboarding_share_subhead">GodTools ти помага да говориш за Евангелието по ясен и уместен начин.</string>
<string name="tutorial_onboarding_links_headline">Връзки за бързо начало</string>
<string name="tutorial_onboarding_links_articles_subhead">Искам да науча още за християнството</string>
<string name="tutorial_onboarding_links_articles_action">Четете статиите ни</string>
<string name="tutorial_onboarding_links_lessons_subhead">Искам да науча още за разговорите относно Евангелието</string>
<string name="tutorial_onboarding_links_lessons_action">Опитай уроците ни</string>
<string name="tutorial_onboarding_links_tools_subhead">Искам да споделя Евангелието с някого</string>
<string name="tutorial_onboarding_links_tools_action">Избери един от инструментите ни</string>
<string name="tutorial_onboarding_action_begin">Начало</string>
<string name="tutorial_onboarding_action_next">Продължи</string>
<string name="tutorial_onboarding_action_skip">Пропуснете</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
<string name="tutorial_onboarding_prepare_subhead">বিশ্বাস সম্পর্কে কথোপকথন করতে শিখুন যা আপনার জীবনের স্বাভাবিকএকটি অংশ</string>
<string name="tutorial_onboarding_share_headline">"আপনার টুলস পছন্দ করুন I "</string>
<string name="tutorial_onboarding_share_subhead">GodTools স্পষ্ট এবং প্রাসঙ্গিক উপায়ে সুসমাচার প্রচারের জন্য আপনার গাইড।</string>
<string name="tutorial_onboarding_links_headline">দ্রুত শুরু করার লিংক</string>
<string name="tutorial_onboarding_links_articles_subhead">আমি খ্রীস্টীয়ানিটি সম্পর্কে আরো অনুসন্ধান করতে চাই</string>
<string name="tutorial_onboarding_links_articles_action">আমাদের প্রবন্ধটি পড়ুন</string>
<string name="tutorial_onboarding_links_lessons_subhead">আমি সুসমাচার বিষয়ক কথোপকথন সম্পর্কে জানতে চাই</string>
<string name="tutorial_onboarding_links_lessons_action">আমাদের পাঠগুলো একবার দেখুন</string>
<string name="tutorial_onboarding_links_tools_subhead">অন্য কারো সাথে সুসমাচার শেয়ার করতে চাই</string>
<string name="tutorial_onboarding_links_tools_action">আমাদের যেকোন একটি টুল বেছে নিন</string>
<string name="tutorial_onboarding_action_begin">শুরু করুন</string>
<string name="tutorial_onboarding_action_next">পরবর্তী</string>
<string name="tutorial_onboarding_action_skip">এড়িয়ে যান</string>
Expand Down
Loading

0 comments on commit 2e2cc55

Please sign in to comment.