Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add screen for No history - WPB-15227 #2509

Merged
merged 10 commits into from
Feb 12, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@
"verification_code.message" = "Enter the verification code we sent to %@.";
"verification_code.confirm" = "Confirm";
"verification_code.resend_code" = "Resend Code";

"authentication.no_history.title" = "It’s the first time you’re using Wire on this device.";
"authentication.no_history.message" = "For privacy reasons, your conversation history will not appear here.";
"authentication.no_history.confirm" = "OK";
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,36 @@ struct NoHistoryView: View {
@ObservedObject var viewModel: NoHistoryViewModel
KaterinaWire marked this conversation as resolved.
Show resolved Hide resolved

var body: some View {
Color.red
VStack(spacing: 20) {
Text(L10n.Authentication.NoHistory.title)
.multilineTextAlignment(.center)
.font(.textStyle(.h2))
.lineLimit(nil)
.fixedSize(horizontal: false, vertical: true)
Text(L10n.Authentication.NoHistory.message)
.multilineTextAlignment(.center)
.wireTextStyle(.body1)
.lineLimit(nil)
.fixedSize(horizontal: false, vertical: true)
Button(L10n.Authentication.NoHistory.confirm, action: viewModel.confirm)
.wireButtonStyle(.primary)
.bold()
}
.padding()
.presentationDetents([.medium])
.interactiveDismissDisabled()
.presentationDragIndicator(.hidden)
}

}

#Preview {
NoHistoryView(viewModel: NoHistoryViewModel())
}

#Preview("With background") {
BackgroundView()
.sheet(isPresented: .constant(true)) {
NoHistoryView(viewModel: NoHistoryViewModel())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ import SwiftUI
import WireAuthenticationAPI

@MainActor
public final class NoHistoryViewModel: ObservableObject {}
public final class NoHistoryViewModel: ObservableObject {
func confirm() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
//
// 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 Foundation

import SwiftUI
import WireTestingPackage
import XCTest

@testable import WireAuthenticationUI

class NoHistoryViewTests: XCTestCase {

private var snapshotHelper: SnapshotHelper!

override func setUp() {
snapshotHelper = .init()
.withSnapshotDirectory(SnapshotTestReferenceImageDirectory)
}

override func tearDown() {
snapshotHelper = nil
}

@MainActor
func testColorSchemeVariantsEmptyState() {
let screenBounds = UIScreen.main.bounds

let view = NoHistoryView(viewModel: NoHistoryViewModel())
.frame(width: screenBounds.width, height: screenBounds.height)

snapshotHelper
.withUserInterfaceStyle(.light)
.verify(matching: view, named: "light")
snapshotHelper
.withUserInterfaceStyle(.dark)
.verify(matching: view, named: "dark")
}

@MainActor
func testDynamicTypeVariantsEmptyState() {
let screenBounds = UIScreen.main.bounds

let view = NoHistoryView(viewModel: NoHistoryViewModel())
.frame(width: screenBounds.width, height: screenBounds.height)

for dynamicTypeSize in DynamicTypeSize.allCases {
snapshotHelper
.verify(
matching: view.dynamicTypeSize(dynamicTypeSize),
named: "\(dynamicTypeSize)"
)
}
}

}
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