Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions IceCubesApp/App/Tabs/Settings/DisplaySettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ struct DisplaySettingsView: View {
Text(shape.description).tag(shape)
}
}
Toggle("settings.display.avatarAnimated", isOn: $theme.avatarAnimated)
Toggle("settings.display.full-username", isOn: $theme.displayFullUsername)
Picker("settings.display.status.action-buttons", selection: $theme.statusActionsDisplay) {
ForEach(Theme.StatusActionsDisplay.allCases, id: \.rawValue) { buttonStyle in
Expand Down
11 changes: 11 additions & 0 deletions IceCubesApp/Resources/Localization/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -47636,6 +47636,17 @@
}
}
},
"settings.display.avatarAnimated" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Animated Avatars and Headers"
}
}
}
},
"settings.display.colors.apply" : {
"extractionState" : "manual",
"localizations" : {
Expand Down
2 changes: 2 additions & 0 deletions Packages/Account/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ let package = Package(
.package(name: "Models", path: "../Models"),
.package(name: "StatusKit", path: "../StatusKit"),
.package(name: "Env", path: "../Env"),
.package(name: "DesignSystem", path: "../DesignSystem"),
.package(url: "https://github.com/Dean151/ButtonKit", from: "0.6.1"),
.package(url: "https://github.com/dkk/WrappingHStack", from: "2.2.11"),
],
Expand All @@ -32,6 +33,7 @@ let package = Package(
.product(name: "Models", package: "Models"),
.product(name: "StatusKit", package: "StatusKit"),
.product(name: "Env", package: "Env"),
.product(name: "DesignSystem", package: "DesignSystem"),
.product(name: "ButtonKit", package: "ButtonKit"),
.product(name: "WrappingHStack", package: "WrappingHStack"),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Env
import Models
import NukeUI
import SwiftUI
import DesignSystem

struct AccountHeaderImageView: View {
enum Constants {
Expand Down Expand Up @@ -40,17 +41,27 @@ struct AccountHeaderImageView: View {
.accessibilityHidden(true)
} else {
LazyImage(url: account.header) { state in
if let image = state.image {
image
.resizable()
.aspectRatio(contentMode: .fill)
.overlay(account.haveHeader ? .black.opacity(0.50) : .clear)
.frame(height: Constants.headerHeight)
.clipped()
} else {
theme.secondaryBackgroundColor
.frame(height: Constants.headerHeight)
}
if let container = state.imageContainer {
if theme.avatarAnimated && container.type == .gif, let data = container.data {
GifView(data:data)
.aspectRatio(contentMode: .fill)
.overlay(account.haveHeader ? .black.opacity(0.50) : .clear)
.frame(height: Constants.headerHeight)
.clipped()
} else {
if let image = state.image {
image
.resizable()
.aspectRatio(contentMode: .fill)
.overlay(account.haveHeader ? .black.opacity(0.50) : .clear)
.frame(height: Constants.headerHeight)
.clipped()
} else {
theme.secondaryBackgroundColor
.frame(height: Constants.headerHeight)
}
}
}
}
.frame(height: Constants.headerHeight)
}
Expand Down Expand Up @@ -99,4 +110,4 @@ struct AccountHeaderImageView: View {
.padding(8)
}
}
}
}
2 changes: 2 additions & 0 deletions Packages/DesignSystem/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ let package = Package(
.package(name: "Env", path: "../Env"),
.package(url: "https://github.com/kean/Nuke", exact: "12.8.0"),
.package(url: "https://github.com/Dimillian/EmojiText", branch: "fix-ios26"),
.package(url: "https://github.com/kaishin/Gifu.git", from: "4.0.1"),
],
targets: [
.target(
Expand All @@ -31,6 +32,7 @@ let package = Package(
.product(name: "NukeUI", package: "Nuke"),
.product(name: "Nuke", package: "Nuke"),
.product(name: "EmojiText", package: "EmojiText"),
.product(name: "Gifu", package: "Gifu"),
],
swiftSettings: [
.swiftLanguageMode(.v6)
Expand Down
10 changes: 9 additions & 1 deletion Packages/DesignSystem/Sources/DesignSystem/Theme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public final class Theme {
case statusActionSecondary
case contentGradient
case compactLayoutPadding
case avatarAnimated
}

@AppStorage("is_previously_set") public var isThemePreviouslySet: Bool = false
Expand Down Expand Up @@ -42,7 +43,7 @@ public final class Theme {
@AppStorage(ThemeKey.compactLayoutPadding.rawValue) public var compactLayoutPadding: Bool = true
@AppStorage("font_size_scale") public var fontSizeScale: Double = 1
@AppStorage("chosen_font") public var chosenFontData: Data?

@AppStorage(ThemeKey.avatarAnimated.rawValue) public var avatarAnimated: Bool = true
init() {}
}

Expand Down Expand Up @@ -301,6 +302,12 @@ public final class Theme {
themeStorage.compactLayoutPadding = compactLayoutPadding
}
}

public var avatarAnimated: Bool {
didSet {
themeStorage.avatarAnimated = avatarAnimated
}
}

public var selectedSet: ColorSetName = .iceCubeDark

Expand Down Expand Up @@ -342,6 +349,7 @@ public final class Theme {
chosenFontData = themeStorage.chosenFontData
statusActionSecondary = themeStorage.statusActionSecondary
compactLayoutPadding = themeStorage.compactLayoutPadding
avatarAnimated = themeStorage.avatarAnimated
selectedSet = storedSet

computeContrastingTintColor()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@ struct AccountPopoverView: View {
LazyImage(
request: ImageRequest(url: account.header)
) { state in
if let image = state.image {
image.resizable().scaledToFill()
}
if let container = state.imageContainer {
if container.type == .gif, let data = container.data {
GifView(data:data)
.scaledToFill()
} else {
if let image = state.image {
image.resizable().scaledToFill()
}
}
}
}
.frame(width: 500, height: 150)
.clipped()
Expand Down
41 changes: 28 additions & 13 deletions Packages/DesignSystem/Sources/DesignSystem/Views/AvatarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Models
import Nuke
import NukeUI
import SwiftUI
import Env

@MainActor
public struct AvatarView: View {
Expand Down Expand Up @@ -117,6 +118,7 @@ struct AvatarImage: View {

public let avatar: URL
public let config: AvatarView.FrameConfig
@Environment(Theme.self) private var theme

var body: some View {
if reasons == .placeholder {
Expand All @@ -125,19 +127,32 @@ struct AvatarImage: View {
LazyImage(
request: ImageRequest(url: avatar, processors: [.resize(size: config.size)])
) { state in
if let image = state.image {
image
.resizable()
.scaledToFit()
.clipShape(RoundedRectangle(cornerRadius: config.cornerRadius))
.overlay(
RoundedRectangle(cornerRadius: config.cornerRadius)
.stroke(.primary.opacity(0.25), lineWidth: 1)
)
} else {
RoundedRectangle(cornerRadius: config.cornerRadius)
.stroke(.primary.opacity(0.25), lineWidth: 1)
}
if let container = state.imageContainer {
if theme.avatarAnimated && container.type == .gif, let data = container.data {
GifView(data:data)
.frame(width: config.width, height: config.height)
.clipShape(RoundedRectangle(cornerRadius: config.cornerRadius))
.overlay(
RoundedRectangle(cornerRadius: config.cornerRadius)
.stroke(.primary.opacity(0.25), lineWidth: 1)
)
} else {
if let image = state.image {
image
.resizable()
.scaledToFit()
.frame(width: config.width, height: config.height)
.clipShape(RoundedRectangle(cornerRadius: config.cornerRadius))
.overlay(
RoundedRectangle(cornerRadius: config.cornerRadius)
.stroke(.primary.opacity(0.25), lineWidth: 1)
)
} else {
RoundedRectangle(cornerRadius: config.cornerRadius)
.stroke(.primary.opacity(0.25), lineWidth: 1)
}
}
}
}
}
}
Expand Down
46 changes: 46 additions & 0 deletions Packages/DesignSystem/Sources/DesignSystem/Views/GifView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// GifView.swift
// DesignSystem
//
// Created by Robert George on 10/26/25.
//

import SwiftUI
import Gifu
import Env

public struct GifView: UIViewRepresentable {
let animatedView = GIFImageView()
var data : Data
@Environment(UserPreferences.self) private var preferences
@Environment(Theme.self) private var theme

public init(data: Data) {
self.data = data
}

public func makeUIView(context: UIViewRepresentableContext<GifView>) -> UIView {
let view = UIView()

animatedView.prepareForAnimation(withGIFData: data)

animatedView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(animatedView)

if theme.avatarAnimated {
animatedView.startAnimatingGIF()
}

NSLayoutConstraint.activate([
animatedView.heightAnchor.constraint(equalTo: view.heightAnchor),
animatedView.widthAnchor.constraint(equalTo: view.widthAnchor)
])

return view
}

public func updateUIView(_ uiView: UIView, context: Context) {

}

}