Skip to content

Commit 18545f0

Browse files
committed
IOS-5425 unify nil Coalescing Logic
1 parent 9b23cfd commit 18545f0

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

Modules/Services/Sources/Models/Extensions/DetailsLayoutExtension.swift

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,22 @@ public extension DetailsLayout {
2929

3030
public extension DetailsLayout {
3131
static func visibleLayouts(spaceUxType: SpaceUxType?) -> [DetailsLayout] {
32-
let spaceUxType = spaceUxType ?? .data
33-
guard !spaceUxType.showsChatLayouts else { return visibleLayoutsBase }
32+
guard !(spaceUxType?.showsChatLayouts ?? true) else { return visibleLayoutsBase }
3433
return visibleLayoutsBase.filter { $0 != .chatDerived }
3534
}
3635

3736
static func visibleLayoutsWithFiles(spaceUxType: SpaceUxType?) -> [DetailsLayout] {
38-
let spaceUxType = spaceUxType ?? .data
39-
guard !spaceUxType.showsChatLayouts else { return visibleLayoutsWithFilesBase }
37+
guard !(spaceUxType?.showsChatLayouts ?? true) else { return visibleLayoutsWithFilesBase }
4038
return visibleLayoutsWithFilesBase.filter { $0 != .chatDerived }
4139
}
4240

4341
static func supportedForCreation(spaceUxType: SpaceUxType?) -> [DetailsLayout] {
44-
let spaceUxType = spaceUxType ?? .data
45-
guard !spaceUxType.showsChatLayouts else { return supportedForCreationBase }
42+
guard !(spaceUxType?.showsChatLayouts ?? true) else { return supportedForCreationBase }
4643
return supportedForCreationBase.filter { $0 != .chatDerived }
4744
}
4845

4946
static func widgetTypeLayouts(spaceUxType: SpaceUxType?) -> [DetailsLayout] {
50-
let spaceUxType = spaceUxType ?? .data
51-
guard !spaceUxType.showsChatLayouts else { return widgetTypeLayoutsBase }
47+
guard !(spaceUxType?.showsChatLayouts ?? true) else { return widgetTypeLayoutsBase }
5248
return widgetTypeLayoutsBase.filter { $0 != .chatDerived }
5349
}
5450
}

0 commit comments

Comments
 (0)