diff --git a/RiotSwiftUI/Modules/Common/Extensions/ConditionalViewModifier.swift b/RiotSwiftUI/Modules/Common/Extensions/ConditionalViewModifier.swift deleted file mode 100644 index 14f5245aa..000000000 --- a/RiotSwiftUI/Modules/Common/Extensions/ConditionalViewModifier.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// Copyright 2022 New Vector Ltd -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -import SwiftUI - -extension View { - @ViewBuilder func `if`(_ condition: @autoclosure () -> Bool, transform: (Self) -> Content) -> some View { - if condition() { - transform(self) - } else { - self - } - } -} diff --git a/RiotSwiftUI/Modules/UserSessions/Common/View/UserSessionCardView.swift b/RiotSwiftUI/Modules/UserSessions/Common/View/UserSessionCardView.swift index 460f273b3..a54915e23 100644 --- a/RiotSwiftUI/Modules/UserSessions/Common/View/UserSessionCardView.swift +++ b/RiotSwiftUI/Modules/UserSessions/Common/View/UserSessionCardView.swift @@ -122,10 +122,10 @@ struct UserSessionCardView: View { .background(theme.colors.background) .clipShape(backgroundShape) .shapedBorder(color: theme.colors.quinaryContent, borderWidth: 1.0, shape: backgroundShape) - .if(viewData.isCurrentSessionDisplayMode) { view in - view.onTapGesture { + .onTapGesture { + if viewData.isCurrentSessionDisplayMode { onViewDetailsAction?(viewData.sessionId) - } + } } } }