Merge pull request #895 from vector-im/feature/bma/fixDarkWelcome
Fix dark welcome
This commit is contained in:
1
.idea/dictionaries/shared.xml
generated
1
.idea/dictionaries/shared.xml
generated
@@ -2,6 +2,7 @@
|
||||
<dictionary name="shared">
|
||||
<words>
|
||||
<w>backstack</w>
|
||||
<w>ftue</w>
|
||||
<w>homeserver</w>
|
||||
<w>kover</w>
|
||||
<w>measurables</w>
|
||||
|
||||
@@ -135,7 +135,7 @@ private fun AnalyticsOptInHeader(
|
||||
@Composable
|
||||
private fun CheckIcon(modifier: Modifier = Modifier) {
|
||||
Icon(
|
||||
modifier = Modifier
|
||||
modifier = modifier
|
||||
.size(20.dp)
|
||||
.background(color = MaterialTheme.colorScheme.background, shape = CircleShape)
|
||||
.padding(2.dp),
|
||||
|
||||
@@ -67,4 +67,8 @@ class FakeAnalyticsService(
|
||||
|
||||
override fun trackError(throwable: Throwable) {
|
||||
}
|
||||
|
||||
override suspend fun reset() {
|
||||
didAskUserConsentFlow.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,4 +20,6 @@ import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
interface FtueState {
|
||||
val shouldDisplayFlow: StateFlow<Boolean>
|
||||
|
||||
suspend fun reset()
|
||||
}
|
||||
|
||||
@@ -39,6 +39,11 @@ class DefaultFtueState @Inject constructor(
|
||||
|
||||
override val shouldDisplayFlow = MutableStateFlow(isAnyStepIncomplete())
|
||||
|
||||
override suspend fun reset() {
|
||||
welcomeScreenState.reset()
|
||||
analyticsService.reset()
|
||||
}
|
||||
|
||||
init {
|
||||
analyticsService.didAskUserConsent()
|
||||
.onEach { updateState() }
|
||||
|
||||
@@ -75,13 +75,15 @@ fun WelcomeView(
|
||||
Text(
|
||||
modifier = Modifier.testTag(TestTags.welcomeScreenTitle),
|
||||
text = stringResource(R.string.screen_welcome_title, applicationName),
|
||||
style = ElementTheme.typography.fontHeadingLgBold,
|
||||
style = ElementTheme.typography.fontHeadingMdBold,
|
||||
color = ElementTheme.colors.textPrimary,
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
Text(
|
||||
text = stringResource(R.string.screen_welcome_subtitle),
|
||||
style = ElementTheme.typography.fontBodyMdRegular,
|
||||
color = ElementTheme.colors.textPrimary,
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
Spacer(modifier = Modifier.height(40.dp))
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package io.element.android.features.ftue.impl.welcome.state
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import androidx.core.content.edit
|
||||
import com.squareup.anvil.annotations.ContributesBinding
|
||||
import io.element.android.libraries.di.AppScope
|
||||
import io.element.android.libraries.di.DefaultPreferences
|
||||
@@ -27,7 +28,7 @@ import javax.inject.Inject
|
||||
@SingleIn(AppScope::class)
|
||||
class AndroidWelcomeScreenState @Inject constructor(
|
||||
@DefaultPreferences private val sharedPreferences: SharedPreferences,
|
||||
): WelcomeScreenState {
|
||||
) : WelcomeScreenState {
|
||||
|
||||
companion object {
|
||||
private const val IS_WELCOME_SCREEN_SHOWN = "is_welcome_screen_shown"
|
||||
@@ -40,4 +41,10 @@ class AndroidWelcomeScreenState @Inject constructor(
|
||||
override fun setWelcomeScreenShown() {
|
||||
sharedPreferences.edit().putBoolean(IS_WELCOME_SCREEN_SHOWN, true).apply()
|
||||
}
|
||||
|
||||
override fun reset() {
|
||||
sharedPreferences.edit {
|
||||
remove(IS_WELCOME_SCREEN_SHOWN)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,4 +19,5 @@ package io.element.android.features.ftue.impl.welcome.state
|
||||
interface WelcomeScreenState {
|
||||
fun isWelcomeScreenNeeded(): Boolean
|
||||
fun setWelcomeScreenShown()
|
||||
fun reset()
|
||||
}
|
||||
|
||||
@@ -27,4 +27,8 @@ class FakeWelcomeState : WelcomeScreenState {
|
||||
override fun setWelcomeScreenShown() {
|
||||
isWelcomeScreenNeeded = false
|
||||
}
|
||||
|
||||
override fun reset() {
|
||||
isWelcomeScreenNeeded = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ dependencies {
|
||||
implementation(projects.libraries.uiStrings)
|
||||
implementation(projects.features.rageshake.api)
|
||||
implementation(projects.features.analytics.api)
|
||||
implementation(projects.features.ftue.api)
|
||||
implementation(projects.libraries.matrixui)
|
||||
implementation(projects.features.logout.api)
|
||||
implementation(projects.services.toolbox.api)
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.content.Context
|
||||
import coil.Coil
|
||||
import coil.annotation.ExperimentalCoilApi
|
||||
import com.squareup.anvil.annotations.ContributesBinding
|
||||
import io.element.android.features.ftue.api.state.FtueState
|
||||
import io.element.android.features.preferences.impl.DefaultCacheService
|
||||
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
|
||||
import io.element.android.libraries.di.ApplicationContext
|
||||
@@ -43,6 +44,7 @@ class DefaultClearCacheUseCase @Inject constructor(
|
||||
private val coroutineDispatchers: CoroutineDispatchers,
|
||||
private val defaultCacheIndexProvider: DefaultCacheService,
|
||||
private val okHttpClient: Provider<OkHttpClient>,
|
||||
private val ftueState: FtueState,
|
||||
) : ClearCacheUseCase {
|
||||
override suspend fun invoke() = withContext(coroutineDispatchers.io) {
|
||||
// Clear Matrix cache
|
||||
@@ -56,6 +58,8 @@ class DefaultClearCacheUseCase @Inject constructor(
|
||||
okHttpClient.get().cache?.delete()
|
||||
// Clear app cache
|
||||
context.cacheDir.deleteRecursively()
|
||||
// Clear some settings
|
||||
ftueState.reset()
|
||||
// Ensure the app is restarted
|
||||
defaultCacheIndexProvider.onClearedCache(matrixClient.sessionId)
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ fun ElementLogoAtom(
|
||||
ElementLogoAtomSize.Large -> 110.dp
|
||||
ElementLogoAtomSize.Medium -> 83.5.dp
|
||||
}
|
||||
val cornerRadius = when(size) {
|
||||
val cornerRadius = when (size) {
|
||||
ElementLogoAtomSize.Large -> 44.dp
|
||||
ElementLogoAtomSize.Medium -> 33.dp
|
||||
}
|
||||
@@ -125,9 +125,12 @@ internal fun ElementLogoAtomPreview() {
|
||||
ElementPreview {
|
||||
Box(
|
||||
Modifier
|
||||
.size(170.dp)
|
||||
.background(ElementTheme.colors.bgSubtlePrimary))
|
||||
ElementLogoAtom(ElementLogoAtomSize.Large)
|
||||
.size(180.dp)
|
||||
.background(ElementTheme.colors.bgSubtlePrimary),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
ElementLogoAtom(ElementLogoAtomSize.Large)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import io.element.android.libraries.designsystem.atomic.atoms.InfoListItemMolecu
|
||||
import io.element.android.libraries.designsystem.atomic.atoms.InfoListItemPosition
|
||||
import io.element.android.libraries.designsystem.theme.components.Icon
|
||||
import io.element.android.libraries.designsystem.theme.components.Text
|
||||
import io.element.android.libraries.theme.ElementTheme
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
||||
@Composable
|
||||
@@ -54,7 +55,13 @@ fun InfoListOrganism(
|
||||
else -> InfoListItemPosition.Middle
|
||||
}
|
||||
InfoListItemMolecule(
|
||||
message = { Text(item.message, style = textStyle) },
|
||||
message = {
|
||||
Text(
|
||||
text = item.message,
|
||||
style = textStyle,
|
||||
color = ElementTheme.colors.textPrimary,
|
||||
)
|
||||
},
|
||||
icon = {
|
||||
if (item.iconId != null) {
|
||||
Icon(resourceId = item.iconId, contentDescription = null, tint = iconTint)
|
||||
|
||||
@@ -58,4 +58,9 @@ interface AnalyticsService: AnalyticsTracker, ErrorTracker {
|
||||
* To be called when a session is destroyed.
|
||||
*/
|
||||
suspend fun onSignOut()
|
||||
|
||||
/**
|
||||
* Reset the analytics service (will ask for user consent again).
|
||||
*/
|
||||
suspend fun reset()
|
||||
}
|
||||
|
||||
@@ -78,6 +78,10 @@ class DefaultAnalyticsService @Inject constructor(
|
||||
analyticsStore.setDidAskUserConsent()
|
||||
}
|
||||
|
||||
override suspend fun reset() {
|
||||
analyticsStore.setDidAskUserConsent(false)
|
||||
}
|
||||
|
||||
override fun getAnalyticsId(): Flow<String> {
|
||||
return analyticsStore.analyticsIdFlow
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user