-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add views preview in Debug menu - WPB-15523 (#2415)
- Loading branch information
Showing
5 changed files
with
119 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
WireUI/Sources/WireViewsDebugUI/WireAuthenticationUIDebugView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// | ||
// Wire | ||
// Copyright (C) 2025 Wire Swiss GmbH | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see http://www.gnu.org/licenses/. | ||
// | ||
|
||
import SwiftUI | ||
import WireAuthenticationUI | ||
|
||
public struct WireAuthenticationUIDebugView: View { | ||
|
||
enum PresentationItem: String, Identifiable { | ||
var id: String { rawValue } | ||
|
||
case background | ||
} | ||
|
||
@State private var presentedItem: PresentationItem? | ||
|
||
public init() {} | ||
|
||
public var body: some View { | ||
List { | ||
Button( | ||
action: { presentedItem = .background }, | ||
label: { Text("Background") } | ||
) | ||
} | ||
.fullScreenCover(item: $presentedItem, content: { item in | ||
switch item { | ||
case .background: | ||
fullscreenCover(content: { BackgroundView() }) | ||
} | ||
}) | ||
} | ||
|
||
@ViewBuilder | ||
private func fullscreenCover(content: () -> some View) -> some View { | ||
content() | ||
.overlay { | ||
HStack { | ||
Spacer() | ||
VStack { | ||
Button( | ||
action: { presentedItem = nil }, | ||
label: { | ||
Image(systemName: "xmark.circle.fill") | ||
.foregroundStyle(.white) | ||
.font(.largeTitle) | ||
} | ||
) | ||
.frame(width: 50, height: 50) | ||
Spacer() | ||
} | ||
} | ||
.padding(.top, 40) | ||
.padding(.trailing, 20) | ||
} | ||
} | ||
} | ||
|
||
#Preview { | ||
NavigationView { | ||
WireAuthenticationUIDebugView() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters