Show tada emoji empty screen on new account

This commit is contained in:
Andrew 2024-04-08 11:36:09 +09:30
parent d65915af0e
commit b5af8de4f9
8 changed files with 109 additions and 8 deletions

View File

@ -212,6 +212,9 @@ public class ApplicationContext extends Application implements DefaultLifecycleO
DatabaseModule.init(this);
MessagingModuleConfiguration.configure(this);
super.onCreate();
textSecurePreferences.setNewAccount(false);
messagingModuleConfiguration = new MessagingModuleConfiguration(
this,
storage,

View File

@ -22,7 +22,6 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.requiredWidth
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.material.Divider
import androidx.compose.material.Icon
import androidx.compose.material.MaterialTheme
@ -103,7 +102,6 @@ import org.thoughtcrime.securesms.ui.OutlineButton
import org.thoughtcrime.securesms.ui.PreviewTheme
import org.thoughtcrime.securesms.ui.SessionShieldIcon
import org.thoughtcrime.securesms.ui.ThemeResPreviewParameterProvider
import org.thoughtcrime.securesms.ui.contentDescription
import org.thoughtcrime.securesms.ui.h8
import org.thoughtcrime.securesms.ui.small
import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities
@ -226,7 +224,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
}
// Set up empty state view
binding.emptyStateContainer.setContent { EmptyView() }
binding.emptyStateContainer.setContent { EmptyView(textSecurePreferences.isNewAccount()) }
IP2Country.configureIfNeeded(this@HomeActivity)
startObservingUpdates()
@ -381,7 +379,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
}
@Composable
private fun EmptyView() {
private fun EmptyView(newAccount: Boolean) {
AppTheme {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
@ -391,10 +389,13 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
) {
Spacer(modifier = Modifier.weight(1f))
Icon(
painter = painterResource(id = R.drawable.ic_logo_large),
painter = painterResource(id = if (newAccount) R.drawable.emoji_tada_large else R.drawable.ic_logo_large),
contentDescription = null,
tint = Color.Unspecified
)
if (newAccount) Text(stringResource(R.string.onboardingAccountCreated), style = MaterialTheme.typography.h4, textAlign = TextAlign.Center)
if (newAccount) Text(stringResource(R.string.onboardingBubbleWelcomeToSession), color = MaterialTheme.colors.secondary, textAlign = TextAlign.Center)
Divider(modifier = Modifier.padding(vertical = 16.dp))
Text(
stringResource(R.string.conversationsNone),

View File

@ -23,6 +23,7 @@ import androidx.lifecycle.lifecycleScope
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
import network.loki.messenger.R
import org.session.libsession.utilities.AppTextSecurePreferences
import org.session.libsession.utilities.TextSecurePreferences
import org.thoughtcrime.securesms.BaseActionBarActivity
import org.thoughtcrime.securesms.dependencies.ConfigFactory
@ -65,6 +66,8 @@ class LoadingActivity: BaseActionBarActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
prefs.setNewAccount(false)
ComposeView(this)
.apply { setContent { LoadingScreen() } }
.let(::setContentView)

View File

@ -31,8 +31,8 @@ data class State(val duration: Duration)
private val DONE_TIME = 1.seconds
private val DONE_ANIMATE_TIME = 500.milliseconds
private val TOTAL_ANIMATE_TIME = 44.seconds
private val TOTAL_TIME = 45.seconds
private val TOTAL_ANIMATE_TIME = 14.seconds
private val TOTAL_TIME = 15.seconds
@HiltViewModel
class LoadingViewModel @Inject constructor(

View File

@ -31,6 +31,7 @@ import androidx.lifecycle.lifecycleScope
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
import network.loki.messenger.R
import org.session.libsession.utilities.AppTextSecurePreferences
import org.thoughtcrime.securesms.BaseActionBarActivity
import org.thoughtcrime.securesms.onboarding.messagenotifications.startPNModeActivity
import org.thoughtcrime.securesms.ui.AppTheme
@ -137,6 +138,8 @@ class PickDisplayNameActivity : BaseActionBarActivity() {
}
fun Context.startPickDisplayNameActivity(failedToLoad: Boolean = false, flags: Int = 0) {
AppTextSecurePreferences(this).setNewAccount(!failedToLoad)
Intent(this, PickDisplayNameActivity::class.java)
.apply { putExtra(EXTRA_PICK_NEW_NAME, failedToLoad) }
.also { it.flags = flags }

View File

@ -0,0 +1,80 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="96dp"
android:height="97dp"
android:viewportWidth="96"
android:viewportHeight="97">
<path
android:pathData="M5.586,92.751C7.289,94.596 14.301,91.379 19.836,88.799C23.984,86.871 40.581,80.061 48.831,76.529C51.059,75.576 54.299,74.331 56.631,71.264C58.701,68.534 64.191,56.939 53.136,45.194C41.916,33.269 30.359,36.561 26.039,39.621C23.496,41.421 21.426,45.479 20.496,47.541C16.566,56.256 10.964,72.224 8.684,78.501C7.011,83.129 3.899,90.921 5.586,92.751Z"
android:fillColor="#FFC107"/>
<path
android:pathData="M19.386,50.166C19.491,51.471 19.753,53.594 20.653,57.681C21.268,60.486 22.273,63.426 23.091,65.369C25.543,71.211 28.986,73.566 32.473,75.456C38.398,78.666 42.426,79.266 42.426,79.266L37.596,81.239C37.596,81.239 34.671,80.631 30.681,78.666C26.878,76.791 22.918,73.619 20.023,67.409C18.771,64.716 18.043,62.106 17.623,60.036C17.106,57.471 17.023,56.016 17.023,56.016L19.386,50.166Z"
android:fillColor="#FF8F00"/>
<path
android:pathData="M13.453,65.376C13.453,65.376 14.053,70.244 18.073,76.386C22.783,83.571 29.36,84.749 29.36,84.749L24.988,86.549C24.988,86.549 20.105,85.056 15.463,78.719C12.568,74.766 11.758,70.041 11.758,70.041L13.453,65.376Z"
android:fillColor="#FF8F00"/>
<path
android:pathData="M9.291,76.911C9.291,76.911 10.386,81.111 12.786,84.246C15.644,87.989 19.281,89.076 19.281,89.076L15.929,90.561C15.929,90.561 13.386,90.029 10.604,86.504C8.489,83.826 7.889,80.751 7.889,80.751L9.291,76.911Z"
android:fillColor="#FF8F00"/>
<path
android:pathData="M7.469,87.576C7.319,87.239 7.319,86.856 7.477,86.526L26.579,46.911L29.722,58.724L9.622,87.756C9.082,88.566 7.866,88.461 7.469,87.576Z"
android:strokeAlpha="0.44"
android:fillColor="#FFFDE7"
android:fillAlpha="0.44"/>
<path
android:pathData="M31.237,62.691C40.162,73.131 50.324,71.826 53.707,69.186C57.097,66.539 59.774,57.441 50.887,47.174C41.572,36.419 31.027,39.486 28.589,41.811C26.152,44.136 23.047,53.114 31.237,62.691Z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="55.787"
android:startY="46.678"
android:endX="33.462"
android:endY="60.073"
android:type="linear">
<item android:offset="0.024" android:color="#FF8F4700"/>
<item android:offset="1" android:color="#FF703E2D"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M61.888,66.989C58.633,64.259 56.901,64.746 54.576,65.714C51.576,66.959 46.858,67.881 40.453,65.714L42.381,61.071C46.183,62.354 48.936,61.731 51.313,60.329C54.373,58.529 58.558,56.061 65.068,61.529C67.783,63.809 70.566,65.324 72.606,64.634C74.091,64.139 74.878,61.926 75.276,60.164C75.313,60.006 75.373,59.556 75.418,59.159C75.778,56.406 76.378,50.466 80.803,47.429C85.536,44.181 90.508,44.181 90.508,44.181L91.408,53.121C89.121,52.784 87.531,53.249 86.188,53.991C81.133,56.804 85.536,67.604 77.668,71.234C70.101,74.751 63.913,68.684 61.888,66.989Z"
android:fillColor="#03A9F4"/>
<path
android:pathData="M34.048,55.589L30.793,52.671C36.771,45.996 35.195,41.091 34.048,37.521C33.815,36.801 33.598,36.119 33.456,35.466C32.945,33.156 32.84,31.146 32.998,29.391C30.703,26.534 29.691,23.541 29.623,23.339C28.228,19.116 29.278,14.999 31.685,11.136C36.553,3.299 45.366,3.299 45.366,3.299L48.306,11.166C46.07,11.076 38.743,11.189 36.493,14.736C33.651,19.206 35.518,21.966 35.653,22.281C36.201,21.569 36.756,20.999 37.25,20.556C40.843,17.369 43.963,16.911 45.951,17.091C48.186,17.294 50.21,18.419 51.658,20.264C53.241,22.289 53.893,24.921 53.39,27.314C52.903,29.646 51.35,31.619 49.018,32.871C44.945,35.061 41.556,34.761 39.283,34.004C39.298,34.056 39.306,34.116 39.32,34.169C39.403,34.544 39.568,35.069 39.763,35.676C41.09,39.786 43.558,46.311 34.048,55.589ZM39.561,27.441C39.995,27.756 40.453,28.019 40.925,28.206C42.5,28.836 44.218,28.626 46.168,27.576C47.315,26.961 47.451,26.301 47.495,26.084C47.631,25.431 47.405,24.599 46.918,23.976C46.491,23.429 45.995,23.144 45.403,23.084C44.278,22.986 42.756,23.699 41.233,25.056C40.506,25.709 39.951,26.511 39.561,27.441Z"
android:fillColor="#F44336"/>
<path
android:pathData="M47.076,56.811L42.418,56.684C42.418,56.684 44.631,44.189 51.793,42.089C53.136,41.699 54.605,41.301 56.083,41.084C56.96,40.949 58.348,40.746 59.03,40.491C59.188,39.314 58.693,37.814 58.138,36.111C57.703,34.791 57.253,33.434 57.013,31.949C56.548,29.054 57.32,26.496 59.188,24.734C61.468,22.596 65.15,21.914 69.305,22.859C71.675,23.399 73.423,24.561 74.961,25.581C77.158,27.044 78.44,27.786 81.126,25.979C84.373,23.789 80.128,15.216 77.87,10.266L86.293,6.756C87.425,9.231 92.893,21.966 89.285,29.234C88.071,31.679 85.978,33.299 83.233,33.906C77.263,35.241 73.768,32.916 71.218,31.221C70.01,30.419 68.953,29.789 67.805,29.459C59.833,27.186 70.963,38.916 65.751,44.189C62.623,47.346 54.98,48.179 54.486,48.299C49.565,49.484 47.076,56.811 47.076,56.811Z"
android:fillColor="#F48FB1"/>
<path
android:pathData="M32.992,29.391C32.849,31.041 32.782,32.024 33.209,34.169C35.272,35.684 39.764,35.684 39.764,35.684C39.569,35.076 39.397,34.551 39.322,34.176C39.307,34.124 39.299,34.064 39.284,34.011C34.717,31.731 32.992,29.391 32.992,29.391Z"
android:fillColor="#C92B27"/>
<path
android:pathData="M23.648,36.779L15.893,32.976L19.755,27.396L25.838,31.424L23.648,36.779Z"
android:fillColor="#FFC107"/>
<path
android:pathData="M12.217,26.249C8.257,25.716 4.222,22.356 3.779,21.974L7.672,17.406C8.849,18.404 11.347,20.076 13.019,20.301L12.217,26.249Z"
android:fillColor="#FB8C00"/>
<path
android:pathData="M19.206,16.251L13.506,14.384C14.158,12.389 14.331,10.236 13.993,8.159L19.918,7.206C20.406,10.221 20.158,13.349 19.206,16.251Z"
android:fillColor="#03A9F4"/>
<path
android:pathData="M60.666,10.51L54.805,11.792L56.497,19.53L62.359,18.247L60.666,10.51Z"
android:fillColor="#FB8C00"/>
<path
android:pathData="M69.344,13.626L65.219,9.269C67.379,7.221 67.874,4.544 67.874,4.514L73.799,5.481C73.724,5.954 72.966,10.199 69.344,13.626Z"
android:fillColor="#FFC107"/>
<path
android:pathData="M76.877,35.097L71.637,36.735L73.426,42.462L78.667,40.824L76.877,35.097Z"
android:fillColor="#FB8C00"/>
<path
android:pathData="M73.162,85.071L67.2,84.366C67.455,82.244 65.872,79.641 65.438,79.064L70.238,75.464C70.598,75.936 73.725,80.264 73.162,85.071Z"
android:fillColor="#F44336"/>
<path
android:pathData="M90.276,77.466C88.034,77.129 85.739,76.994 83.474,77.076L83.271,71.076C85.904,70.986 88.566,71.136 91.169,71.534L90.276,77.466Z"
android:fillColor="#FB8C00"/>
<path
android:pathData="M86.425,81.456L82.209,85.725L88.01,91.453L92.226,87.184L86.425,81.456Z"
android:fillColor="#F48FB1"/>
<path
android:pathData="M74.159,52.754L69.824,47.797L64.868,52.132L69.203,57.089L74.159,52.754Z"
android:fillColor="#F44336"/>
</vector>

View File

@ -1058,7 +1058,7 @@
<string name="auto_deletes_in">Auto-deletes in %1$s</string>
<string name="onboardingBubblePrivacyInYourPocket">Privacy in your pocket.</string>
<string name="onboardingBubbleWelcomeToSession">Welcome to Session 👋</string>
<string name="onboardingBubbleWelcomeToSession">Welcome to Session</string>
<string name="onboardingBubbleSessionIsEngineered">Session is engineered to protect your privacy.</string>
<string name="onboardingBubbleNoPhoneNumber">"You dont even need a phone number to sign up. "</string>
<string name="onboardingBubbleCreatingAnAccountIsEasy">Creating an account is \ninstant, free, and \nanonymous 👇</string>
@ -1100,4 +1100,5 @@
<string name="hide_message_requests">Hide message requests?</string>
<string name="save_your_recovery_password">Save your recovery password</string>
<string name="save_your_recovery_password_to_make_sure_you_don_t_lose_access_to_your_account">Save your recovery password to make sure you don\'t lose access to your account.</string>
<string name="onboardingAccountCreated">Account Created</string>
</resources>

View File

@ -19,6 +19,7 @@ import org.session.libsession.utilities.TextSecurePreferences.Companion.CLASSIC_
import org.session.libsession.utilities.TextSecurePreferences.Companion.CLASSIC_LIGHT
import org.session.libsession.utilities.TextSecurePreferences.Companion.FOLLOW_SYSTEM_SETTINGS
import org.session.libsession.utilities.TextSecurePreferences.Companion.HIDE_PASSWORD
import org.session.libsession.utilities.TextSecurePreferences.Companion.NEW_ACCOUNT
import org.session.libsession.utilities.TextSecurePreferences.Companion.LAST_VACUUM_TIME
import org.session.libsession.utilities.TextSecurePreferences.Companion.LEGACY_PREF_KEY_SELECTED_UI_MODE
import org.session.libsession.utilities.TextSecurePreferences.Companion.OCEAN_DARK
@ -186,6 +187,8 @@ interface TextSecurePreferences {
fun clearAll()
fun getHidePassword(): Boolean
fun setHidePassword(value: Boolean)
fun isNewAccount(): Boolean
fun setNewAccount(value: Boolean)
companion object {
val TAG = TextSecurePreferences::class.simpleName
@ -288,6 +291,7 @@ interface TextSecurePreferences {
const val SELECTED_STYLE = "pref_selected_style" // classic_dark/light, ocean_dark/light
const val FOLLOW_SYSTEM_SETTINGS = "pref_follow_system" // follow system day/night
const val HIDE_PASSWORD = "pref_hide_password"
const val NEW_ACCOUNT = "new_account"
const val LEGACY_PREF_KEY_SELECTED_UI_MODE = "SELECTED_UI_MODE" // this will be cleared upon launching app, for users migrating to theming build
const val CLASSIC_DARK = "classic.dark"
@ -1722,4 +1726,10 @@ class AppTextSecurePreferences @Inject constructor(
override fun setHidePassword(value: Boolean) {
setBooleanPreference(HIDE_PASSWORD, value)
}
override fun isNewAccount(): Boolean = getBooleanPreference(NEW_ACCOUNT, false)
override fun setNewAccount(value: Boolean) {
setBooleanPreference(NEW_ACCOUNT, value)
}
}