mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-25 11:05:25 +00:00
fix: add legacy config subscription to the home activity to enable showing banner at any time
This commit is contained in:
parent
cd13da647c
commit
c777c05456
@ -13,7 +13,9 @@ import androidx.activity.viewModels
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
@ -204,6 +206,15 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
||||
this.broadcastReceiver = broadcastReceiver
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(broadcastReceiver, IntentFilter("blockedContactsChanged"))
|
||||
|
||||
// subscribe to outdated config updates, this should be removed after long enough time for device migration
|
||||
lifecycleScope.launch {
|
||||
lifecycle.repeatOnLifecycle(Lifecycle.State.STARTED) {
|
||||
TextSecurePreferences.events.filter { it == TextSecurePreferences.HAS_RECEIVED_LEGACY_CONFIG }.collect {
|
||||
updateLegacyConfigView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lifecycleScope.launchWhenStarted {
|
||||
launch(Dispatchers.IO) {
|
||||
// Double check that the long poller is up
|
||||
@ -224,6 +235,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// monitor the global search VM query
|
||||
launch {
|
||||
binding.globalSearchInputLayout.query
|
||||
|
@ -638,6 +638,7 @@ interface TextSecurePreferences {
|
||||
@JvmStatic
|
||||
fun setHasLegacyConfig(context: Context, newValue: Boolean) {
|
||||
setBooleanPreference(context, HAS_RECEIVED_LEGACY_CONFIG, newValue)
|
||||
_events.tryEmit(HAS_RECEIVED_LEGACY_CONFIG)
|
||||
}
|
||||
|
||||
fun setLocalNumber(context: Context, localNumber: String) {
|
||||
@ -1299,7 +1300,8 @@ class AppTextSecurePreferences @Inject constructor(
|
||||
}
|
||||
|
||||
override fun setHasLegacyConfig(newValue: Boolean) {
|
||||
return setBooleanPreference(TextSecurePreferences.HAS_RECEIVED_LEGACY_CONFIG, newValue)
|
||||
setBooleanPreference(TextSecurePreferences.HAS_RECEIVED_LEGACY_CONFIG, newValue)
|
||||
TextSecurePreferences._events.tryEmit(TextSecurePreferences.HAS_RECEIVED_LEGACY_CONFIG)
|
||||
}
|
||||
|
||||
override fun setLocalNumber(localNumber: String) {
|
||||
|
Loading…
Reference in New Issue
Block a user