Skip to content

Commit

Permalink
Update Lottie to 4.4.1 (#2631)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/414235014887631/1206751893829139/f

Description:
Update Lottie to version 4.4.1 to align with macOS and comply with Apple's Privacy manifest for 3rd party SDK.
  • Loading branch information
alessandroboron authored Apr 2, 2024
1 parent 23064ad commit a3d14e3
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 64 deletions.
34 changes: 17 additions & 17 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@
4B0295192537BC6700E00CEF /* ConfigurationDebugViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B0295182537BC6700E00CEF /* ConfigurationDebugViewController.swift */; };
4B0F3F502B9BFF2100392892 /* NetworkProtectionFAQView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B0F3F4F2B9BFF2100392892 /* NetworkProtectionFAQView.swift */; };
4B274F602AFEAECC003F0745 /* NetworkProtectionWidgetRefreshModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B274F5F2AFEAECC003F0745 /* NetworkProtectionWidgetRefreshModel.swift */; };
4B2754EC29E8C7DF00394032 /* Lottie in Frameworks */ = {isa = PBXBuildFile; productRef = 4B2754EB29E8C7DF00394032 /* Lottie */; };
4B37E0502B928CA6009E81CA /* vpn-light-mode.json in Resources */ = {isa = PBXBuildFile; fileRef = 4B37E04F2B928CA6009E81CA /* vpn-light-mode.json */; };
4B470ED6299C49800086EBDC /* AppTrackingProtectionDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B470ED5299C49800086EBDC /* AppTrackingProtectionDatabase.swift */; };
4B470ED9299C4AED0086EBDC /* AppTrackingProtectionModel.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 4B470ED7299C4AED0086EBDC /* AppTrackingProtectionModel.xcdatamodeld */; };
Expand Down Expand Up @@ -636,6 +635,7 @@
98F3A1DC217B373E0011A0D4 /* DarkTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98F3A1DB217B373E0011A0D4 /* DarkTheme.swift */; };
98F6EA472863124100720957 /* ContentBlockerRulesLists.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98F6EA462863124100720957 /* ContentBlockerRulesLists.swift */; };
98F78B8E22419093007CACF4 /* ThemableNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98F78B8D22419093007CACF4 /* ThemableNavigationController.swift */; };
9F8FE9492BAE50E50071E372 /* Lottie in Frameworks */ = {isa = PBXBuildFile; productRef = 9F8FE9482BAE50E50071E372 /* Lottie */; };
AA3D854523D9942200788410 /* AppIconSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3D854423D9942200788410 /* AppIconSettingsViewController.swift */; };
AA3D854723D9E88E00788410 /* AppIconSettingsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3D854623D9E88E00788410 /* AppIconSettingsCell.swift */; };
AA3D854923DA1DFB00788410 /* AppIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3D854823DA1DFB00788410 /* AppIcon.swift */; };
Expand Down Expand Up @@ -2737,12 +2737,12 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9F8FE9492BAE50E50071E372 /* Lottie in Frameworks */,
853273B624FFE0BB00E3C778 /* WidgetKit.framework in Frameworks */,
0238E44F29C0FAA100615E30 /* FindInPageIOSJSSupport in Frameworks */,
3760DFED299315EF0045A446 /* Waitlist in Frameworks */,
F1D43AFA2B99C1D300BAB743 /* BareBonesBrowserKit in Frameworks */,
F143C2EB1E4A4CD400CFDE3A /* Core.framework in Frameworks */,
4B2754EC29E8C7DF00394032 /* Lottie in Frameworks */,
31E69A63280F4CB600478327 /* DuckUI in Frameworks */,
CB941A6E2B96AB08000F9E7A /* PrivacyDashboard in Frameworks */,
F42D541D29DCA40B004C4FF1 /* DesignResourcesKit in Frameworks */,
Expand Down Expand Up @@ -5770,9 +5770,9 @@
3760DFEC299315EF0045A446 /* Waitlist */,
F42D541C29DCA40B004C4FF1 /* DesignResourcesKit */,
0238E44E29C0FAA100615E30 /* FindInPageIOSJSSupport */,
4B2754EB29E8C7DF00394032 /* Lottie */,
CB941A6D2B96AB08000F9E7A /* PrivacyDashboard */,
F1D43AF92B99C1D300BAB743 /* BareBonesBrowserKit */,
9F8FE9482BAE50E50071E372 /* Lottie */,
);
productName = DuckDuckGo;
productReference = 84E341921E2F7EFB00BDBA6F /* DuckDuckGo.app */;
Expand Down Expand Up @@ -6082,10 +6082,10 @@
F42D541B29DCA40B004C4FF1 /* XCRemoteSwiftPackageReference "DesignResourcesKit" */,
0202568C29881E4300E694E7 /* XCRemoteSwiftPackageReference "CocoaAsyncSocket" */,
0238E44D29C0FAA100615E30 /* XCRemoteSwiftPackageReference "ios-js-support" */,
4B2754EA29E8C7DF00394032 /* XCRemoteSwiftPackageReference "lottie-ios" */,
854007E52B57FB020001BD98 /* XCRemoteSwiftPackageReference "ZIPFoundation" */,
B6F997C22B8F374300476735 /* XCRemoteSwiftPackageReference "apple-toolbox" */,
F1D43AF82B99C1D300BAB743 /* XCRemoteSwiftPackageReference "BareBonesBrowser" */,
9F8FE9472BAE50E50071E372 /* XCRemoteSwiftPackageReference "lottie-spm" */,
);
productRefGroup = 84E341931E2F7EFB00BDBA6F /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -10012,14 +10012,6 @@
version = 2.0.0;
};
};
4B2754EA29E8C7DF00394032 /* XCRemoteSwiftPackageReference "lottie-ios" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/duckduckgo/lottie-ios.git";
requirement = {
kind = exactVersion;
version = 3.3.0;
};
};
854007E52B57FB020001BD98 /* XCRemoteSwiftPackageReference "ZIPFoundation" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/weichsel/ZIPFoundation.git";
Expand All @@ -10036,6 +10028,14 @@
version = 132.0.1;
};
};
9F8FE9472BAE50E50071E372 /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/airbnb/lottie-spm.git";
requirement = {
kind = exactVersion;
version = 4.4.1;
};
};
B6F997C22B8F374300476735 /* XCRemoteSwiftPackageReference "apple-toolbox" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/duckduckgo/apple-toolbox.git";
Expand Down Expand Up @@ -10151,11 +10151,6 @@
package = 98A16C2928A11BDE00A6C003 /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = SyncDataProviders;
};
4B2754EB29E8C7DF00394032 /* Lottie */ = {
isa = XCSwiftPackageProductDependency;
package = 4B2754EA29E8C7DF00394032 /* XCRemoteSwiftPackageReference "lottie-ios" */;
productName = Lottie;
};
4B948E2529DCCDB9002531FA /* Persistence */ = {
isa = XCSwiftPackageProductDependency;
package = 98A16C2928A11BDE00A6C003 /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
Expand Down Expand Up @@ -10225,6 +10220,11 @@
package = 98A16C2928A11BDE00A6C003 /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = Bookmarks;
};
9F8FE9482BAE50E50071E372 /* Lottie */ = {
isa = XCSwiftPackageProductDependency;
package = 9F8FE9472BAE50E50071E372 /* XCRemoteSwiftPackageReference "lottie-spm" */;
productName = Lottie;
};
B6F997CD2B8F380D00476735 /* SwiftLintPlugin */ = {
isa = XCSwiftPackageProductDependency;
package = B6F997C22B8F374300476735 /* XCRemoteSwiftPackageReference "apple-toolbox" */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@
}
},
{
"identity" : "lottie-ios",
"identity" : "lottie-spm",
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/lottie-ios.git",
"location" : "https://github.com/airbnb/lottie-spm.git",
"state" : {
"revision" : "abf5510e261c85ffddd29de0bca9b72592ea2bdd",
"version" : "3.3.0"
"revision" : "3bd43e12d6fb54654366a61f7cfaca787318b8ce",
"version" : "4.4.1"
}
},
{
Expand Down
18 changes: 9 additions & 9 deletions DuckDuckGo/Base.lproj/OmniBar.xib
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22154" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="ipad12_9rounded" orientation="landscape" layout="fullscreen" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22130"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Expand Down Expand Up @@ -93,13 +93,13 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7qa-DK-tfO" userLabel="Trackers Animation Wrapper">
<rect key="frame" x="-15" y="0.0" width="158" height="40"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="xsT-yZ-wg7" customClass="AnimationView" customModule="Lottie">
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="xsT-yZ-wg7" customClass="LottieAnimationView" customModule="Lottie">
<rect key="frame" x="0.0" y="0.0" width="158" height="40"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jHJ-ya-QS7" customClass="AnimationView" customModule="Lottie">
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jHJ-ya-QS7" customClass="LottieAnimationView" customModule="Lottie">
<rect key="frame" x="0.0" y="0.0" width="158" height="40"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="E8n-8r-JML" customClass="AnimationView" customModule="Lottie">
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="E8n-8r-JML" customClass="LottieAnimationView" customModule="Lottie">
<rect key="frame" x="0.0" y="0.0" width="158" height="40"/>
</view>
</subviews>
Expand Down Expand Up @@ -133,16 +133,16 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TmK-n8-JJZ" userLabel="Shield Animations Wrapper">
<rect key="frame" x="-12" y="0.0" width="158" height="40"/>
<subviews>
<view contentMode="scaleAspectFill" translatesAutoresizingMaskIntoConstraints="NO" id="jQy-me-Afa" customClass="AnimationView" customModule="Lottie">
<view contentMode="scaleAspectFill" translatesAutoresizingMaskIntoConstraints="NO" id="jQy-me-Afa" customClass="LottieAnimationView" customModule="Lottie">
<rect key="frame" x="0.0" y="0.0" width="158" height="40"/>
</view>
<view contentMode="scaleAspectFill" translatesAutoresizingMaskIntoConstraints="NO" id="KE6-Wh-7Yp" customClass="AnimationView" customModule="Lottie">
<view contentMode="scaleAspectFill" translatesAutoresizingMaskIntoConstraints="NO" id="KE6-Wh-7Yp" customClass="LottieAnimationView" customModule="Lottie">
<rect key="frame" x="0.0" y="0.0" width="158" height="40"/>
</view>
<view contentMode="scaleAspectFill" translatesAutoresizingMaskIntoConstraints="NO" id="dqb-pm-Da8" customClass="AnimationView" customModule="Lottie">
<view contentMode="scaleAspectFill" translatesAutoresizingMaskIntoConstraints="NO" id="dqb-pm-Da8" customClass="LottieAnimationView" customModule="Lottie">
<rect key="frame" x="0.0" y="0.0" width="158" height="40"/>
</view>
<view contentMode="center" translatesAutoresizingMaskIntoConstraints="NO" id="D46-aN-352" customClass="AnimationView" customModule="Lottie">
<view contentMode="center" translatesAutoresizingMaskIntoConstraints="NO" id="D46-aN-352" customClass="LottieAnimationView" customModule="Lottie">
<rect key="frame" x="0.0" y="0.0" width="158" height="40"/>
</view>
</subviews>
Expand Down
10 changes: 5 additions & 5 deletions DuckDuckGo/FireButtonAnimator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ enum FireButtonAnimationType: String, CaseIterable, Identifiable, CustomStringCo
}
}

var composition: Animation? {
var composition: LottieAnimation? {
guard let fileName = fileName else { return nil }
return Animation.named(fileName, animationCache: LRUAnimationCache.sharedCache)
return LottieAnimation.named(fileName, animationCache: DefaultAnimationCache.sharedCache)
}

var transition: Double {
Expand Down Expand Up @@ -98,8 +98,8 @@ enum FireButtonAnimationType: String, CaseIterable, Identifiable, CustomStringCo
class FireButtonAnimator {

private let appSettings: AppSettings
private var preLoadedComposition: Animation?
private var preLoadedComposition: LottieAnimation?

init(appSettings: AppSettings) {
self.appSettings = appSettings
reloadPreLoadedComposition()
Expand Down Expand Up @@ -133,7 +133,7 @@ class FireButtonAnimator {

window.addSubview(snapshot)

let animationView = AnimationView(animation: composition)
let animationView = LottieAnimationView(animation: composition)
let currentAnimation = appSettings.currentFireButtonAnimation
let speed = currentAnimation.speed
animationView.contentMode = .scaleAspectFill
Expand Down
8 changes: 4 additions & 4 deletions DuckDuckGo/LottieView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ struct LottieView: UIViewRepresentable {
var isAnimating: Binding<Bool>
private let loopMode: LoopMode

let animationView = AnimationView()
let animationView = LottieAnimationView()

init(lottieFile: String, delay: TimeInterval = 0, loopMode: LoopMode = .mode(.playOnce), isAnimating: Binding<Bool> = .constant(true)) {
self.lottieFile = lottieFile
self.delay = delay
self.isAnimating = isAnimating
self.loopMode = loopMode
}

func makeUIView(context: Context) -> some AnimationView {
animationView.animation = Animation.named(lottieFile)
func makeUIView(context: Context) -> some LottieAnimationView {
animationView.animation = LottieAnimation.named(lottieFile)
animationView.contentMode = .scaleAspectFit
animationView.clipsToBounds = false

Expand Down
6 changes: 3 additions & 3 deletions DuckDuckGo/MenuButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class MenuButton: UIView {

private let bookmarksIconView = UIImageView()

let anim = AnimationView(name: "menu_light")
let anim = LottieAnimationView(name: "menu_light")
let pointerView: UIView = UIView(frame: CGRect(x: 0,
y: 0,
width: Constants.pointerViewWidth,
Expand Down Expand Up @@ -190,9 +190,9 @@ extension MenuButton: Themable {

switch theme.currentImageSet {
case .light:
anim.animation = Animation.named("menu_light")
anim.animation = LottieAnimation.named("menu_light")
case .dark:
anim.animation = Animation.named("menu_dark")
anim.animation = LottieAnimation.named("menu_dark")
}

if currentState == State.closeImage {
Expand Down
20 changes: 10 additions & 10 deletions DuckDuckGo/PrivacyIconView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ enum PrivacyIcon {
class PrivacyIconView: UIView {

@IBOutlet var daxLogoImageView: UIImageView!
@IBOutlet var staticShieldAnimationView: AnimationView!
@IBOutlet var staticShieldDotAnimationView: AnimationView!
@IBOutlet var shieldAnimationView: AnimationView!
@IBOutlet var shieldDotAnimationView: AnimationView!
@IBOutlet var staticShieldAnimationView: LottieAnimationView!
@IBOutlet var staticShieldDotAnimationView: LottieAnimationView!

@IBOutlet var shieldAnimationView: LottieAnimationView!
@IBOutlet var shieldDotAnimationView: LottieAnimationView!

public required init?(coder aDecoder: NSCoder) {
icon = .shield

Expand All @@ -54,15 +54,15 @@ class PrivacyIconView: UIView {
updateAccessibilityLabels(for: icon)
}

func loadAnimations(for theme: Theme, animationCache cache: AnimationCacheProvider = LRUAnimationCache.sharedCache) {
func loadAnimations(for theme: Theme, animationCache cache: AnimationCacheProvider = DefaultAnimationCache.sharedCache) {
let useLightStyle = theme.currentImageSet == .light

let shieldAnimation = Animation.named(useLightStyle ? "shield" : "dark-shield", animationCache: cache)
let shieldAnimation = LottieAnimation.named(useLightStyle ? "shield" : "dark-shield", animationCache: cache)
shieldAnimationView.animation = shieldAnimation
staticShieldAnimationView.animation = shieldAnimation
staticShieldAnimationView.currentProgress = 0.0

let shieldWithDotAnimation = Animation.named(useLightStyle ? "shield-dot" : "dark-shield-dot", animationCache: cache)
let shieldWithDotAnimation = LottieAnimation.named(useLightStyle ? "shield-dot" : "dark-shield-dot", animationCache: cache)
shieldDotAnimationView.animation = shieldWithDotAnimation
staticShieldDotAnimationView.animation = shieldWithDotAnimation
staticShieldDotAnimationView.currentProgress = 1.0
Expand Down Expand Up @@ -128,7 +128,7 @@ class PrivacyIconView: UIView {
daxLogoImageView.isHidden = true
}

func shieldAnimationView(for icon: PrivacyIcon) -> AnimationView? {
func shieldAnimationView(for icon: PrivacyIcon) -> LottieAnimationView? {
switch icon {
case .shield:
return shieldAnimationView
Expand Down
Loading

0 comments on commit a3d14e3

Please sign in to comment.