Skip to content

Commit

Permalink
Reduce log volume from warning about After Effects expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
calda committed Sep 19, 2023
1 parent 4f88cbe commit a9628a3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,14 @@ extension CALayer {
guard !keyframes.isEmpty else { return nil }

// Check if this set of keyframes uses After Effects expressions, which aren't supported.
if let unsupportedAfterEffectsExpression = keyframeGroup.unsupportedAfterEffectsExpression {
// - We only log this once per `CoreAnimationLayer` instance.
if keyframeGroup.unsupportedAfterEffectsExpression != nil, !context.loggingState.hasLoggedAfterEffectsExpressionsWarning {
context.loggingState.hasLoggedAfterEffectsExpressionsWarning = true
context.logger.info("""
`\(property.caLayerKeypath)` animation for "\(context.currentKeypath.fullPath)" \
includes an After Effects expression (https://helpx.adobe.com/after-effects/using/expression-language.html), \
which is not supported by lottie-ios (expressions are only supported by lottie-web). \
This animation may not play correctly.
\(unsupportedAfterEffectsExpression.replacingOccurrences(of: "\n", with: "\n "))
""")
}

Expand Down
2 changes: 2 additions & 0 deletions Sources/Private/CoreAnimation/CoreAnimationLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ final class CoreAnimationLayer: BaseAnimationLayer {
private let valueProviderStore: ValueProviderStore
private let compatibilityTracker: CompatibilityTracker
private let logger: LottieLogger
private let loggingState = LoggingState()

/// The current playback state of the animation that is displayed in this layer
private var currentPlaybackState: PlaybackState? {
Expand Down Expand Up @@ -265,6 +266,7 @@ final class CoreAnimationLayer: BaseAnimationLayer {
valueProviderStore: valueProviderStore,
compatibilityTracker: compatibilityTracker,
logger: logger,
loggingState: loggingState,
currentKeypath: AnimationKeypath(keys: []),
textProvider: textProvider,
recordHierarchyKeypath: configuration.recordHierarchyKeypath)
Expand Down
12 changes: 12 additions & 0 deletions Sources/Private/CoreAnimation/Layers/AnimationLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ struct LayerAnimationContext {
/// The logger that should be used for assertions and warnings
let logger: LottieLogger

/// Mutable state related to log events, stored on the `CoreAnimationLayer`.
let loggingState: LoggingState

/// The AnimationKeypath represented by the current layer
var currentKeypath: AnimationKeypath

Expand Down Expand Up @@ -84,3 +87,12 @@ struct LayerAnimationContext {
return copy
}
}

/// Mutable state related to log events, stored on the `CoreAnimationLayer`.
final class LoggingState {
init() { }

/// Whether or not the warning about unsupported After Effects expressions
/// has been logged yet for this layer.
var hasLoggedAfterEffectsExpressionsWarning = false
}
1 change: 1 addition & 0 deletions Tests/ValueProvidersTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ final class ValueProvidersTests: XCTestCase {
valueProviderStore: store,
compatibilityTracker: .init(mode: .track, logger: .printToConsole),
logger: .printToConsole,
loggingState: LoggingState(),
currentKeypath: .init(keys: []),
textProvider: DictionaryTextProvider([:]))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,49 +1 @@
[info] `transform.rotation.z` animation for "men.man 1.hand 2.Transform" includes an After Effects expression (https://helpx.adobe.com/after-effects/using/expression-language.html), which is not supported by lottie-ios (expressions are only supported by lottie-web). This animation may not play correctly.

var $bm_rt;
$bm_rt = loopOut();

[info] `transform.rotation.z` animation for "men.man 1.hand 3.Transform" includes an After Effects expression (https://helpx.adobe.com/after-effects/using/expression-language.html), which is not supported by lottie-ios (expressions are only supported by lottie-web). This animation may not play correctly.

var $bm_rt;
$bm_rt = loopOut();

[info] `transform.rotation.z` animation for "men.man 1.face.Transform" includes an After Effects expression (https://helpx.adobe.com/after-effects/using/expression-language.html), which is not supported by lottie-ios (expressions are only supported by lottie-web). This animation may not play correctly.

var $bm_rt;
$bm_rt = loopOut();

[info] `transform.translation` animation for "men.man 1.laptop.Transform" includes an After Effects expression (https://helpx.adobe.com/after-effects/using/expression-language.html), which is not supported by lottie-ios (expressions are only supported by lottie-web). This animation may not play correctly.

var $bm_rt;
$bm_rt = content('man 1').content('laptop').transform.position;

[info] `transform.scale.x` animation for "men.man 1.laptop.Transform" includes an After Effects expression (https://helpx.adobe.com/after-effects/using/expression-language.html), which is not supported by lottie-ios (expressions are only supported by lottie-web). This animation may not play correctly.

var $bm_rt;
$bm_rt = loopOut();

[info] `transform.scale.y` animation for "men.man 1.laptop.Transform" includes an After Effects expression (https://helpx.adobe.com/after-effects/using/expression-language.html), which is not supported by lottie-ios (expressions are only supported by lottie-web). This animation may not play correctly.

var $bm_rt;
$bm_rt = loopOut();

[info] `transform.rotation.z` animation for "men.man 1.laptop.Transform" includes an After Effects expression (https://helpx.adobe.com/after-effects/using/expression-language.html), which is not supported by lottie-ios (expressions are only supported by lottie-web). This animation may not play correctly.

var $bm_rt;
$bm_rt = loopOut();

[info] `transform.translation` animation for "men.man 1.Transform" includes an After Effects expression (https://helpx.adobe.com/after-effects/using/expression-language.html), which is not supported by lottie-ios (expressions are only supported by lottie-web). This animation may not play correctly.

var $bm_rt;
$bm_rt = loopOut();

[info] `transform.scale.x` animation for "men.man 1.Transform" includes an After Effects expression (https://helpx.adobe.com/after-effects/using/expression-language.html), which is not supported by lottie-ios (expressions are only supported by lottie-web). This animation may not play correctly.

var $bm_rt;
$bm_rt = content('man 1').transform.scale;

[info] `transform.scale.y` animation for "men.man 1.Transform" includes an After Effects expression (https://helpx.adobe.com/after-effects/using/expression-language.html), which is not supported by lottie-ios (expressions are only supported by lottie-web). This animation may not play correctly.

var $bm_rt;
$bm_rt = content('man 1').transform.scale;
[info] `transform.rotation.z` animation for "men.man 1.hand 2.Transform" includes an After Effects expression (https://helpx.adobe.com/after-effects/using/expression-language.html), which is not supported by lottie-ios (expressions are only supported by lottie-web). This animation may not play correctly.

0 comments on commit a9628a3

Please sign in to comment.