Skip to content

Commit

Permalink
feat: add onboarding content
Browse files Browse the repository at this point in the history
  • Loading branch information
octera committed Aug 11, 2024
1 parent 646e872 commit fbe04ea
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ class LocalUserManagerImpl(
) : LocalUserManager {
override suspend fun saveAppEntry() {
context.dataStore.edit { setting ->
setting[PreferencesKeys.APP_ENTRY] = true
setting[PreferencesKeys.ONBOARDING] = true
}
}

override fun readAppEntry(): Flow<Boolean> {
return context.dataStore.data.map { preferences ->
preferences[PreferencesKeys.APP_ENTRY] ?: false
preferences[PreferencesKeys.ONBOARDING] ?: false
}
}
}

private val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = Constants.USER_SETTINGS)

private object PreferencesKeys {
val APP_ENTRY = booleanPreferencesKey(name = Constants.APP_ENTRY)
val ONBOARDING = booleanPreferencesKey(name = Constants.ONBOARDING)
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
package info.octera.droidstorybox.presentation.onboarding

import androidx.annotation.DrawableRes
import androidx.compose.ui.res.stringResource
import info.octera.droidstorybox.R

data class Page(
val title: String,
val description: String,
val title: Int,
val description: Int,
@DrawableRes val image: Int,
)

val pages =
listOf(
Page(
title = "Welcome to NewsConnect!",
description = "Stay informed with the latest news from around the world. NewsConnect brings you real-time updates on current events, politics, sports, entertainment, and more.",
image = R.drawable.onboarding1,
title = R.string.onboarding_page1_title,
description = R.string.onboarding_page1_desc,
image = R.drawable.icon_splash,
),
Page(
title = "Stay Updated, Anywhere, Anytime",
description = "Get notifications on breaking news and trending stories. With NewsConnect, you'll never miss an important update, whether you're at home or on the go.",
title = R.string.onboarding_page2_title,
description = R.string.onboarding_page2_desc,
image = R.drawable.onboarding2,
),
Page(
title = "Get Started with NewsConnect",
description = "Dive into a world of news tailored just for you. Tap the button below to begin exploring!",
title = R.string.onboarding_page3_title,
description = R.string.onboarding_page3_desc,
image = R.drawable.onboarding3,
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import info.octera.droidstorybox.R
import info.octera.droidstorybox.presentation.Dimens.MediumPadding1
import info.octera.droidstorybox.presentation.Dimens.MediumPadding2
Expand All @@ -31,20 +33,21 @@ fun OnBoardingPage(
contentDescription = "",
modifier =
modifier
.padding(24.dp)
.fillMaxWidth()
.fillMaxHeight(0.6f),
contentScale = ContentScale.Crop,
contentScale = ContentScale.Fit,
)
Spacer(modifier = modifier.height(MediumPadding1))
Text(
modifier = modifier.padding(horizontal = MediumPadding2),
text = page.title,
text = stringResource(page.title),
style = MaterialTheme.typography.displaySmall.copy(fontWeight = FontWeight.Bold),
color = colorResource(id = R.color.display_small),
)
Text(
modifier = modifier.padding(horizontal = MediumPadding2),
text = page.description,
text = stringResource(page.description),
style = MaterialTheme.typography.bodyMedium,
color = colorResource(id = R.color.text_medium),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package info.octera.droidstorybox.util

object Constants {
const val USER_SETTINGS = "userSettings"
const val APP_ENTRY = "appEntry"
const val API_KEY = "fc4d356d6ec8482a8a788443d262cf10"
const val BASE_URL = "https://newsapi.org/v2/"
const val ONBOARDING = "onboarding"
const val NEW_DATABASE = "news_db"
}
Binary file removed app/src/main/res/drawable-xxxhdpi/onboarding1.jpg
Binary file not shown.
Binary file removed app/src/main/res/drawable-xxxhdpi/onboarding2.jpg
Binary file not shown.
Binary file added app/src/main/res/drawable-xxxhdpi/onboarding2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/drawable-xxxhdpi/onboarding3.jpg
Binary file not shown.
Binary file added app/src/main/res/drawable-xxxhdpi/onboarding3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Nimilou</string>
<string name="onboarding_page1_title">Bienvenue sur Nimilou</string>
<string name="onboarding_page1_desc">Bienvenue sur Nimilou. Cette application vous permet de lire des histoires audio. Elle accepte les format d\'histoire interactifs du type de Telmi, qui permet de naviguer dans les histoire avec simplicité.</string>
<string name="onboarding_page2_title">Ajout des packs d\'histoire</string>
<string name="onboarding_page2_desc">Pour utiliser l\'application vous devez vous rapprocher d\'une communauté qui vous permettra de trouver des packs d\'histoire a ajouter a l\'application. Les listing de packs au format Telmi peuvent être ajouté depuis la page de configuration dans l\'onglet \"Sources de Packs\"</string>
<string name="onboarding_page3_title">Ajout des histoires</string>
<string name="onboarding_page3_desc">Ensuite, vous pourrez télécharger des packs puis les ajouter dans l\'application depuis le bouton \"+\" depuis l\'onglet Pack. Les packs doivent être au format ZIP</string>
</resources>
8 changes: 7 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<resources>
<string name="app_name">Droid StoryBox</string>
<string name="app_name">Nimilou</string>
<string name="onboarding_page1_title">Welcome to Nimilou!</string>
<string name="onboarding_page1_desc">Welcome to Nimilou. This app allows you to listen to audio stories. It supports interactive story formats like Telmi, which lets you navigate through the stories with ease.</string>
<string name="onboarding_page2_title">Add story Pack</string>
<string name="onboarding_page2_desc">To use the app, you need to connect with a community that will help you find story packs to add to the app. Telmi-format pack listings can be added from the configuration page in the "Pack Sources" tab.</string>
<string name="onboarding_page3_title">Add story</string>
<string name="onboarding_page3_desc">After that, you can download packs and add them to the app using the "+" button in the Pack tab. The packs must be in ZIP format.</string>
</resources>

0 comments on commit fbe04ea

Please sign in to comment.