kopia lustrzana https://github.com/ryukoposting/Signal-Android
rodzic
9941ffe79c
commit
dfdf68b7b5
|
@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.components
|
|||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.DefaultLifecycleObserver
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import kotlin.reflect.KProperty
|
||||
|
@ -17,14 +18,13 @@ open class ViewBinderDelegate<T : ViewBinding>(
|
|||
) : DefaultLifecycleObserver {
|
||||
|
||||
private var binding: T? = null
|
||||
private var isBindingDestroyed = false
|
||||
|
||||
operator fun getValue(thisRef: Fragment, property: KProperty<*>): T {
|
||||
if (isBindingDestroyed) {
|
||||
error("Binding has been destroyed.")
|
||||
}
|
||||
|
||||
if (binding == null) {
|
||||
if (!thisRef.viewLifecycleOwner.lifecycle.currentState.isAtLeast(Lifecycle.State.INITIALIZED)) {
|
||||
error("Invalid state to create a binding.")
|
||||
}
|
||||
|
||||
thisRef.viewLifecycleOwner.lifecycle.addObserver(this@ViewBinderDelegate)
|
||||
binding = bindingFactory(thisRef.requireView())
|
||||
}
|
||||
|
@ -38,6 +38,5 @@ open class ViewBinderDelegate<T : ViewBinding>(
|
|||
}
|
||||
|
||||
binding = null
|
||||
isBindingDestroyed = true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -67,7 +67,9 @@ internal class StoryValues(store: KeyValueStore) : SignalStoreValues(store) {
|
|||
HAS_DOWNLOADED_ONBOARDING_STORY,
|
||||
USER_HAS_SEEN_BETA_DIALOG,
|
||||
STORY_VIEWED_RECEIPTS,
|
||||
USER_HAS_READ_ONBOARDING_STORY
|
||||
USER_HAS_READ_ONBOARDING_STORY,
|
||||
USER_HAS_SEEN_BETA_DIALOG,
|
||||
STORY_VIEWED_RECEIPTS
|
||||
)
|
||||
|
||||
var isFeatureDisabled: Boolean by booleanValue(MANUAL_FEATURE_DISABLE, false)
|
||||
|
|
|
@ -188,6 +188,12 @@ public final class StorageSyncHelper {
|
|||
SignalStore.storyValues().setViewedReceiptsEnabled(update.getNew().getStoryViewReceiptsState() == OptionalBool.ENABLED);
|
||||
}
|
||||
|
||||
if (update.getNew().getStoryViewReceiptsState() == OptionalBool.UNSET) {
|
||||
SignalStore.storyValues().setViewedReceiptsEnabled(update.getNew().isReadReceiptsEnabled());
|
||||
} else {
|
||||
SignalStore.storyValues().setViewedReceiptsEnabled(update.getNew().getStoryViewReceiptsState() == OptionalBool.ENABLED);
|
||||
}
|
||||
|
||||
if (update.getNew().isSubscriptionManuallyCancelled()) {
|
||||
SignalStore.donationsValues().updateLocalStateForManualCancellation();
|
||||
} else {
|
||||
|
|
Ładowanie…
Reference in New Issue