mirror of
https://github.com/zhigang1992/facebook-ios-sdk.git
synced 2026-01-12 17:22:28 +08:00
Fix setPersistedBooleanProperty
Summary: WE should update the var in memory in setters. This line was somehow overlooked. Reviewed By: dreamolight Differential Revision: D51333425 fbshipit-source-id: cdf8bd5f0d97fe5a2b900c2d1ce0e198c65636c9
This commit is contained in:
committed by
Facebook GitHub Bot
parent
fbb60846ad
commit
5c38779876
@@ -97,6 +97,7 @@ extension Settings {
|
||||
|
||||
func setPersistedBooleanProperty(_ property: PersistedBooleanValue, to value: Bool) {
|
||||
validateConfiguration()
|
||||
self[keyPath: property.backingKeyPath] = value
|
||||
// swiftformat:disable:next redundantSelf
|
||||
self.dataStore?.fb_setObject(value, forKey: property.persistenceKey.rawValue)
|
||||
logIfSDKSettingsChanged()
|
||||
|
||||
@@ -981,6 +981,20 @@ final class SettingsTests: XCTestCase {
|
||||
|
||||
// MARK: - Auto Log App Events Enabled
|
||||
|
||||
func testAutoLogAppEventsEnabledFromKeyPath() {
|
||||
configureSettings()
|
||||
settings.isAutoLogAppEventsEnabled = false
|
||||
XCTAssertFalse(
|
||||
settings.isAutoLogAppEventsEnabled,
|
||||
"Auto logging should pick up the correct value from KeyPath"
|
||||
)
|
||||
settings.isAutoLogAppEventsEnabled = true
|
||||
XCTAssertTrue(
|
||||
settings.isAutoLogAppEventsEnabled,
|
||||
"Auto logging should pick up the correct value from KeyPath when value changed"
|
||||
)
|
||||
}
|
||||
|
||||
func testAutoLogAppEventsEnabledFromPlist() {
|
||||
bundle = TestBundle(infoDictionary: ["FacebookAutoLogAppEventsEnabled": false])
|
||||
configureSettings()
|
||||
|
||||
Reference in New Issue
Block a user