diff --git a/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java b/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java index 5a8b03fdf8..79c98e6b99 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java +++ b/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java @@ -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, diff --git a/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt index 71e830cc08..d81f279e3d 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt @@ -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), diff --git a/app/src/main/java/org/thoughtcrime/securesms/onboarding/LoadingActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/onboarding/LoadingActivity.kt index 523bc17888..90bf14ad56 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/onboarding/LoadingActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/onboarding/LoadingActivity.kt @@ -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) diff --git a/app/src/main/java/org/thoughtcrime/securesms/onboarding/LoadingViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/onboarding/LoadingViewModel.kt index e1eeaa560b..bf50baa736 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/onboarding/LoadingViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/onboarding/LoadingViewModel.kt @@ -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( diff --git a/app/src/main/java/org/thoughtcrime/securesms/onboarding/pickname/PickDisplayNameActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/onboarding/pickname/PickDisplayNameActivity.kt index 07ed9f7d22..fc31cec2aa 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/onboarding/pickname/PickDisplayNameActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/onboarding/pickname/PickDisplayNameActivity.kt @@ -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 } diff --git a/app/src/main/res/drawable/emoji_tada_large.xml b/app/src/main/res/drawable/emoji_tada_large.xml new file mode 100644 index 0000000000..ed802646ff --- /dev/null +++ b/app/src/main/res/drawable/emoji_tada_large.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 28ed1a7e82..d6383e0ae8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1058,7 +1058,7 @@ Auto-deletes in %1$s Privacy in your pocket. - Welcome to Session πŸ‘‹ + Welcome to Session Session is engineered to protect your privacy. "You don’t even need a phone number to sign up. " Creating an account is \ninstant, free, and \nanonymous πŸ‘‡ @@ -1100,4 +1100,5 @@ Hide message requests? Save your recovery password Save your recovery password to make sure you don\'t lose access to your account. + Account Created diff --git a/libsession/src/main/java/org/session/libsession/utilities/TextSecurePreferences.kt b/libsession/src/main/java/org/session/libsession/utilities/TextSecurePreferences.kt index ce5564fb0c..8feb00f6aa 100644 --- a/libsession/src/main/java/org/session/libsession/utilities/TextSecurePreferences.kt +++ b/libsession/src/main/java/org/session/libsession/utilities/TextSecurePreferences.kt @@ -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) + } }