Skip to content

Commit

Permalink
Rename the current isAutoLogAppEventsEnabled to isAutoLogAppEventsEna…
Browse files Browse the repository at this point in the history
…bledOnClientSide

Summary: Introduce a new internal client side only flag during the transition. The original `isAutoLogAppEventsEnabled` will be delegated to `isAutoLogAppEventsEnabledOnClientSide`. In the next diff, we will be adding new getter and setter for the `isAutoLogAppEventsEnabled` flag.

Reviewed By: dreamolight

Differential Revision: D51330511

fbshipit-source-id: cd63649372861fcdf9d06e0ecd60acae3753490f
  • Loading branch information
Tao Xu authored and facebook-github-bot committed Nov 15, 2023
1 parent 5c38779 commit d18a1db
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
9 changes: 1 addition & 8 deletions FBSDKCoreKit/FBSDKCoreKit/Settings+Logging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ extension Settings {
@warning INTERNAL - DO NOT USE
*/
public func logWarnings() {
// Log warnings for App Event Flags
// swiftformat:disable:next redundantSelf
if self.infoDictionaryProvider?
.fb_object(forInfoDictionaryKey: PersistenceKey.isAutoLogAppEventsEnabled.rawValue) == nil {
print(AppEventFlagWarningMessages.isAutoLogAppEventsEnabledNotSet)
}

// swiftformat:disable:next redundantSelf
if self.infoDictionaryProvider?
.fb_object(forInfoDictionaryKey: PersistenceKey.isAdvertiserIDCollectionEnabled.rawValue) == nil {
Expand Down Expand Up @@ -80,7 +73,7 @@ extension Settings {
var initialBitmask = 0
var usageBitmask = 0
let bits: [(key: PersistenceKey, defaultValue: Bool)] = [
(key: .isAutoLogAppEventsEnabled, defaultValue: true),
(key: .isAutoLogAppEventsEnabledLocally, defaultValue: true),
(key: .isAdvertiserIDCollectionEnabled, defaultValue: true),
]

Expand Down
6 changes: 3 additions & 3 deletions FBSDKCoreKit/FBSDKCoreKit/Settings+PersistedProperties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ extension Settings {
let backingKeyPath: ReferenceWritableKeyPath<Settings, Bool?> // swiftlint:disable:this discouraged_optional_boolean
let defaultValue: Bool

static let isAutoLogAppEventsEnabled = Self(
persistenceKey: .isAutoLogAppEventsEnabled,
backingKeyPath: \._isAutoLogAppEventsEnabled,
static let isAutoLogAppEventsEnabledLocally = Self(
persistenceKey: .isAutoLogAppEventsEnabledLocally,
backingKeyPath: \._isAutoLogAppEventsEnabledLocally,
defaultValue: true
)

Expand Down
2 changes: 1 addition & 1 deletion FBSDKCoreKit/FBSDKCoreKit/Settings+PersistenceKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension Settings {
case clientToken = "FacebookClientToken"
case displayName = "FacebookDisplayName"
case domainPart = "FacebookDomainPart"
case isAutoLogAppEventsEnabled = "FacebookAutoLogAppEventsEnabled"
case isAutoLogAppEventsEnabledLocally = "FacebookAutoLogAppEventsEnabled"
case isAdvertiserIDCollectionEnabled = "FacebookAdvertiserIDCollectionEnabled"
case isCodelessDebugLogEnabled = "FacebookCodelessDebugLogEnabled"
case loggingBehaviors = "FacebookLoggingBehavior"
Expand Down
16 changes: 13 additions & 3 deletions FBSDKCoreKit/FBSDKCoreKit/Settings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,22 @@ public final class Settings: NSObject, SettingsProtocol, SettingsLogging, _Clien
The default value is `true`.
*/
public var isAutoLogAppEventsEnabled: Bool {
get { getPersistedBooleanProperty(.isAutoLogAppEventsEnabled) }
set { setPersistedBooleanProperty(.isAutoLogAppEventsEnabled, to: newValue) }
get { isAutoLogAppEventsEnabledLocally }
set { isAutoLogAppEventsEnabledLocally = newValue }
}

/**
Controls the automatic logging of basic app events on the client side such as `activateApp` and `deactivateApp`.
The default value is `true`.
*/
internal var isAutoLogAppEventsEnabledLocally: Bool {
get { getPersistedBooleanProperty(.isAutoLogAppEventsEnabledLocally) }
set { setPersistedBooleanProperty(.isAutoLogAppEventsEnabledLocally, to: newValue) }
}

// swiftlint:disable:next identifier_name discouraged_optional_boolean
var _isAutoLogAppEventsEnabled: Bool?
internal var _isAutoLogAppEventsEnabledLocally: Bool?

/**
Controls the `fb_codeless_debug` logging event.
Expand Down

0 comments on commit d18a1db

Please sign in to comment.