mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Remove unnecessary shared pref
This commit is contained in:
parent
7d7d2b89bd
commit
ac97529c73
@ -154,6 +154,8 @@ public class ApplicationContext extends Application implements DefaultLifecycleO
|
|||||||
|
|
||||||
private volatile boolean isAppVisible;
|
private volatile boolean isAppVisible;
|
||||||
|
|
||||||
|
public boolean newAccount = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getSystemService(String name) {
|
public Object getSystemService(String name) {
|
||||||
if (MessagingModuleConfiguration.MESSAGING_MODULE_SERVICE.equals(name)) {
|
if (MessagingModuleConfiguration.MESSAGING_MODULE_SERVICE.equals(name)) {
|
||||||
@ -213,8 +215,6 @@ public class ApplicationContext extends Application implements DefaultLifecycleO
|
|||||||
MessagingModuleConfiguration.configure(this);
|
MessagingModuleConfiguration.configure(this);
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
|
||||||
textSecurePreferences.setNewAccount(false);
|
|
||||||
|
|
||||||
messagingModuleConfiguration = new MessagingModuleConfiguration(
|
messagingModuleConfiguration = new MessagingModuleConfiguration(
|
||||||
this,
|
this,
|
||||||
storage,
|
storage,
|
||||||
|
@ -225,7 +225,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set up empty state view
|
// Set up empty state view
|
||||||
binding.emptyStateContainer.setContent { EmptyView(textSecurePreferences.isNewAccount()) }
|
binding.emptyStateContainer.setContent { EmptyView(ApplicationContext.getInstance(this).newAccount) }
|
||||||
|
|
||||||
IP2Country.configureIfNeeded(this@HomeActivity)
|
IP2Country.configureIfNeeded(this@HomeActivity)
|
||||||
startObservingUpdates()
|
startObservingUpdates()
|
||||||
|
@ -25,6 +25,7 @@ import kotlinx.coroutines.launch
|
|||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
import org.session.libsession.utilities.AppTextSecurePreferences
|
import org.session.libsession.utilities.AppTextSecurePreferences
|
||||||
import org.session.libsession.utilities.TextSecurePreferences
|
import org.session.libsession.utilities.TextSecurePreferences
|
||||||
|
import org.thoughtcrime.securesms.ApplicationContext
|
||||||
import org.thoughtcrime.securesms.BaseActionBarActivity
|
import org.thoughtcrime.securesms.BaseActionBarActivity
|
||||||
import org.thoughtcrime.securesms.dependencies.ConfigFactory
|
import org.thoughtcrime.securesms.dependencies.ConfigFactory
|
||||||
import org.thoughtcrime.securesms.onboarding.messagenotifications.startPNModeActivity
|
import org.thoughtcrime.securesms.onboarding.messagenotifications.startPNModeActivity
|
||||||
@ -67,7 +68,7 @@ class LoadingActivity: BaseActionBarActivity() {
|
|||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
prefs.setNewAccount(false)
|
ApplicationContext.getInstance(this).newAccount = false
|
||||||
|
|
||||||
ComposeView(this)
|
ComposeView(this)
|
||||||
.apply { setContent { LoadingScreen() } }
|
.apply { setContent { LoadingScreen() } }
|
||||||
|
@ -32,6 +32,7 @@ import dagger.hilt.android.AndroidEntryPoint
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
import org.session.libsession.utilities.AppTextSecurePreferences
|
import org.session.libsession.utilities.AppTextSecurePreferences
|
||||||
|
import org.thoughtcrime.securesms.ApplicationContext
|
||||||
import org.thoughtcrime.securesms.BaseActionBarActivity
|
import org.thoughtcrime.securesms.BaseActionBarActivity
|
||||||
import org.thoughtcrime.securesms.onboarding.messagenotifications.startPNModeActivity
|
import org.thoughtcrime.securesms.onboarding.messagenotifications.startPNModeActivity
|
||||||
import org.thoughtcrime.securesms.ui.AppTheme
|
import org.thoughtcrime.securesms.ui.AppTheme
|
||||||
@ -138,7 +139,7 @@ class PickDisplayNameActivity : BaseActionBarActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun Context.startPickDisplayNameActivity(failedToLoad: Boolean = false, flags: Int = 0) {
|
fun Context.startPickDisplayNameActivity(failedToLoad: Boolean = false, flags: Int = 0) {
|
||||||
AppTextSecurePreferences(this).setNewAccount(!failedToLoad)
|
ApplicationContext.getInstance(this).newAccount = !failedToLoad
|
||||||
|
|
||||||
Intent(this, PickDisplayNameActivity::class.java)
|
Intent(this, PickDisplayNameActivity::class.java)
|
||||||
.apply { putExtra(EXTRA_PICK_NEW_NAME, failedToLoad) }
|
.apply { putExtra(EXTRA_PICK_NEW_NAME, failedToLoad) }
|
||||||
|
@ -19,7 +19,6 @@ import org.session.libsession.utilities.TextSecurePreferences.Companion.CLASSIC_
|
|||||||
import org.session.libsession.utilities.TextSecurePreferences.Companion.CLASSIC_LIGHT
|
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.FOLLOW_SYSTEM_SETTINGS
|
||||||
import org.session.libsession.utilities.TextSecurePreferences.Companion.HIDE_PASSWORD
|
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.LAST_VACUUM_TIME
|
||||||
import org.session.libsession.utilities.TextSecurePreferences.Companion.LEGACY_PREF_KEY_SELECTED_UI_MODE
|
import org.session.libsession.utilities.TextSecurePreferences.Companion.LEGACY_PREF_KEY_SELECTED_UI_MODE
|
||||||
import org.session.libsession.utilities.TextSecurePreferences.Companion.OCEAN_DARK
|
import org.session.libsession.utilities.TextSecurePreferences.Companion.OCEAN_DARK
|
||||||
@ -187,8 +186,6 @@ interface TextSecurePreferences {
|
|||||||
fun clearAll()
|
fun clearAll()
|
||||||
fun getHidePassword(): Boolean
|
fun getHidePassword(): Boolean
|
||||||
fun setHidePassword(value: Boolean)
|
fun setHidePassword(value: Boolean)
|
||||||
fun isNewAccount(): Boolean
|
|
||||||
fun setNewAccount(value: Boolean)
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val TAG = TextSecurePreferences::class.simpleName
|
val TAG = TextSecurePreferences::class.simpleName
|
||||||
@ -291,7 +288,6 @@ interface TextSecurePreferences {
|
|||||||
const val SELECTED_STYLE = "pref_selected_style" // classic_dark/light, ocean_dark/light
|
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 FOLLOW_SYSTEM_SETTINGS = "pref_follow_system" // follow system day/night
|
||||||
const val HIDE_PASSWORD = "pref_hide_password"
|
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 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"
|
const val CLASSIC_DARK = "classic.dark"
|
||||||
@ -1726,10 +1722,4 @@ class AppTextSecurePreferences @Inject constructor(
|
|||||||
override fun setHidePassword(value: Boolean) {
|
override fun setHidePassword(value: Boolean) {
|
||||||
setBooleanPreference(HIDE_PASSWORD, value)
|
setBooleanPreference(HIDE_PASSWORD, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun isNewAccount(): Boolean = getBooleanPreference(NEW_ACCOUNT, false)
|
|
||||||
|
|
||||||
override fun setNewAccount(value: Boolean) {
|
|
||||||
setBooleanPreference(NEW_ACCOUNT, value)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user