Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,30 @@ extension View {
}

private struct NavigationBarThemeViewModifier<T: ToolbarContent>: ViewModifier {
@Environment(\.streamLiquidGlassEffectsEnabled) private var glassEffectsEnabled
@Injected(\.colors) var colors

let toolbarContent: () -> T

func body(content: Content) -> some View {
#if compiler(>=6.2)
if #available(iOS 26.0, *), !glassEffectsEnabled {
content
.accentColor(Color(colors.accentPrimary))
.modifier(NavigationBarBackgroundViewModifier())
.toolbar {
toolbarContent()
.sharedBackgroundVisibility(.hidden)
}
} else {
themedContent(content)
}
#else
themedContent(content)
#endif
}

private func themedContent(_ content: Content) -> some View {
content
.accentColor(Color(colors.accentPrimary))
.modifier(NavigationBarBackgroundViewModifier())
Expand Down
16 changes: 16 additions & 0 deletions Sources/StreamChatSwiftUI/Utils/LiquidGlassEnvironment.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Copyright © 2026 Stream.io Inc. All rights reserved.
//

import SwiftUI

private struct StreamLiquidGlassEffectsEnabledKey: EnvironmentKey {
static let defaultValue = true
}

extension EnvironmentValues {
var streamLiquidGlassEffectsEnabled: Bool {
get { self[StreamLiquidGlassEffectsEnabledKey.self] }
set { self[StreamLiquidGlassEffectsEnabledKey.self] = newValue }
}
}
8 changes: 6 additions & 2 deletions Sources/StreamChatSwiftUI/Utils/LiquidGlassModifiers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import SwiftUI

public struct LiquidGlassModifier<BackgroundShape: Shape>: ViewModifier {
@Environment(\.streamLiquidGlassEffectsEnabled) private var glassEffectsEnabled

var shape: BackgroundShape
var isInteractive: Bool

Expand All @@ -18,7 +20,7 @@ public struct LiquidGlassModifier<BackgroundShape: Shape>: ViewModifier {

public func body(content: Content) -> some View {
#if swift(>=6.2)
if #available(iOS 26.0, *) {
if #available(iOS 26.0, *), glassEffectsEnabled {
content
.contentShape(shape)
.modifier(BorderModifier(shape: shape))
Expand All @@ -33,6 +35,8 @@ public struct LiquidGlassModifier<BackgroundShape: Shape>: ViewModifier {
}

public struct LiquidGlassBorderlessModifier<BackgroundShape: Shape>: ViewModifier {
@Environment(\.streamLiquidGlassEffectsEnabled) private var glassEffectsEnabled

var shape: BackgroundShape
var isInteractive: Bool

Expand All @@ -46,7 +50,7 @@ public struct LiquidGlassBorderlessModifier<BackgroundShape: Shape>: ViewModifie

public func body(content: Content) -> some View {
#if swift(>=6.2)
if #available(iOS 26.0, *) {
if #available(iOS 26.0, *), glassEffectsEnabled {
content
.contentShape(shape)
.clipShape(shape)
Expand Down
18 changes: 9 additions & 9 deletions StreamChatSwiftUI.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@
INFOPLIST_FILE = Sources/StreamChatSwiftUI/Info.plist;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_GENERATE_MAP_FILE = YES;
LD_MAP_FILE_PATH = "linkmaps/$(PRODUCT_NAME)-$(CURRENT_ARCH)-LinkMap.txt";
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -1007,7 +1007,7 @@
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 15;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -1028,7 +1028,7 @@
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = EHV7XZLAHA;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 15;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = io.getstream.iOS.StreamChatSwiftUITestsAppTests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -1047,7 +1047,7 @@
DEVELOPMENT_TEAM = EHV7XZLAHA;
GCC_OPTIMIZATION_LEVEL = s;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 15;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = io.getstream.iOS.StreamChatSwiftUITestsAppTests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -1066,7 +1066,7 @@
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = EHV7XZLAHA;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 15;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = io.getstream.iOS.StreamChatSwiftUITestsAppTests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -1099,7 +1099,7 @@
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 15;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1135,7 +1135,7 @@
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 15;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1286,7 +1286,7 @@
INFOPLIST_FILE = Sources/StreamChatSwiftUI/Info.plist;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_GENERATE_MAP_FILE = YES;
LD_MAP_FILE_PATH = "linkmaps/$(PRODUCT_NAME)-$(CURRENT_ARCH)-LinkMap.txt";
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -1323,7 +1323,7 @@
INFOPLIST_FILE = Sources/StreamChatSwiftUI/Info.plist;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_GENERATE_MAP_FILE = YES;
LD_MAP_FILE_PATH = "linkmaps/$(PRODUCT_NAME)-$(CURRENT_ARCH)-LinkMap.txt";
LD_RUNPATH_SEARCH_PATHS = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import XCTest
}.applyDefaultSize()

// Then
AssertSnapshot(view)
assertSnapshotWithoutVisualEffects(view)
}

func test_chatChannelInfoView_rtlSnapshot() {
Expand All @@ -59,7 +59,7 @@ import XCTest
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: precision), named: "rtl")
assertSnapshotWithoutVisualEffects(view, named: "rtl")
}

func test_chatChannelInfoView_directChannelOfflineSnapshot() {
Expand Down Expand Up @@ -315,7 +315,7 @@ import XCTest
.applyDefaultSize()

// Then
assertSnapshot(matching: navigationView, as: .image(perceptualPrecision: precision))
assertSnapshotWithoutVisualEffects(navigationView, named: nil)
}

func test_chatChannelInfoView_addUsersShownSnapshot() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import XCTest
.applyDefaultSize()

// Then
AssertSnapshot(view)
assertSnapshotWithoutVisualEffects(view)
}

func test_editGroupView_uploadingSnapshot() {
Expand All @@ -47,7 +47,7 @@ import XCTest
.applyDefaultSize()

// Then
AssertSnapshot(view, variants: [.rightToLeftLayout])
assertSnapshotWithoutVisualEffects(view, variants: [.rightToLeftLayout])
}

// MARK: - GroupAvatarPickerSheetView snapshots
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import XCTest
.applyDefaultSize()

// Then
AssertSnapshot(view)
assertSnapshotWithoutVisualEffects(view)
}

func test_memberAddView_selectedUsersSnapshot() {
Expand All @@ -46,7 +46,7 @@ import XCTest
.applyDefaultSize()

// Then
AssertSnapshot(view)
assertSnapshotWithoutVisualEffects(view)
}

func test_memberAddView_alreadyMemberSnapshot() {
Expand All @@ -65,6 +65,6 @@ import XCTest
.applyDefaultSize()

// Then
AssertSnapshot(view)
assertSnapshotWithoutVisualEffects(view)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import XCTest
.applyDefaultSize()

// Then
AssertSnapshot(view)
assertSnapshotWithoutVisualEffects(view)
}

func test_memberListView_withMutedMemberSnapshot() {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class CreatePollView_Tests: StreamChatTestCase {

func test_createPollView_snapshot() {
let view = makeCreatePollView().applyDefaultSize()
AssertSnapshot(view, variants: .onlyUserInterfaceStyles)
assertSnapshotWithoutVisualEffects(view, variants: .onlyUserInterfaceStyles)
}

func test_createPollView_allOptionsDisabledSnapshot() {
Expand All @@ -26,7 +26,7 @@ final class CreatePollView_Tests: StreamChatTestCase {
maxVotesPerPerson: hidden
)
let view = makeCreatePollView().applyDefaultSize()
AssertSnapshot(view, variants: .onlyUserInterfaceStyles)
assertSnapshotWithoutVisualEffects(view, variants: .onlyUserInterfaceStyles)
}

func test_createPollView_allOptionsEnabledSnapshot() {
Expand All @@ -39,7 +39,7 @@ final class CreatePollView_Tests: StreamChatTestCase {
maxVotesPerPerson: enabled
)
let view = makeCreatePollView().applyDefaultSize()
AssertSnapshot(view, variants: .onlyUserInterfaceStyles)
assertSnapshotWithoutVisualEffects(view, variants: .onlyUserInterfaceStyles)
}

func test_createPollView_multipleVotesWithoutMaxVotesSnapshot() {
Expand All @@ -53,7 +53,7 @@ final class CreatePollView_Tests: StreamChatTestCase {
maxVotesPerPerson: hidden
)
let view = makeCreatePollView().applyDefaultSize()
AssertSnapshot(view, variants: .onlyUserInterfaceStyles)
assertSnapshotWithoutVisualEffects(view, variants: .onlyUserInterfaceStyles)
}

func test_createPollView_mixedOptionsSnapshot() {
Expand All @@ -68,7 +68,7 @@ final class CreatePollView_Tests: StreamChatTestCase {
maxVotesPerPerson: enabled
)
let view = makeCreatePollView().applyDefaultSize()
AssertSnapshot(view, variants: .onlyUserInterfaceStyles)
assertSnapshotWithoutVisualEffects(view, variants: .onlyUserInterfaceStyles)
}

// MARK: - Filled State
Expand All @@ -78,23 +78,23 @@ final class CreatePollView_Tests: StreamChatTestCase {
question: "What's your favorite color?",
options: ["Red", "Blue", "Green", ""]
).applyDefaultSize()
AssertSnapshot(view, variants: .onlyUserInterfaceStyles)
assertSnapshotWithoutVisualEffects(view, variants: .onlyUserInterfaceStyles)
}

func test_createPollView_duplicateOptionsSnapshot() {
let view = makeCreatePollView(
question: "Pick a number",
options: ["One", "Two", "One", ""]
).applyDefaultSize()
AssertSnapshot(view, variants: .onlyUserInterfaceStyles)
assertSnapshotWithoutVisualEffects(view, variants: .onlyUserInterfaceStyles)
}

func test_createPollView_manyOptionsSnapshot() {
let view = makeCreatePollView(
question: "Best programming language?",
options: ["Swift", "Kotlin", "TypeScript", "Rust", "Go", ""]
).applyDefaultSize()
AssertSnapshot(view, variants: .onlyUserInterfaceStyles)
assertSnapshotWithoutVisualEffects(view, variants: .onlyUserInterfaceStyles)
}

// MARK: - RTL
Expand All @@ -104,15 +104,15 @@ final class CreatePollView_Tests: StreamChatTestCase {
question: "ما هي مدينتك المفضلة؟",
options: ["برشلونة", "لشبونة", "أمستردام"]
).applyDefaultSize()
AssertSnapshot(view, variants: [.rightToLeftLayout])
assertSnapshotWithoutVisualEffects(view, variants: [.rightToLeftLayout])
}

func test_createPollView_duplicateOptionsRightToLeft_snapshot() {
let view = makeCreatePollView(
question: "اختر رقماً",
options: ["واحد", "اثنان", "واحد"]
).applyDefaultSize()
AssertSnapshot(view, variants: [.rightToLeftLayout])
assertSnapshotWithoutVisualEffects(view, variants: [.rightToLeftLayout])
}

// MARK: - Helpers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ import XCTest
)
.applyDefaultSize()

AssertSnapshot(view, variants: .onlyUserInterfaceStyles)
assertSnapshotWithoutVisualEffects(view, variants: .onlyUserInterfaceStyles)
}

// MARK: - RTL
Expand Down
Loading
Loading