mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-11-12 13:47:53 +00:00
* ios: snapshot tests render all previews at fixed dates * ios: previews of your servers and terminal render without errors * ios: snapshots fill the screen height for lists, skip device migration * ios: snapshots show the sample user, secondary chat preview has items * ios: snapshots skip previews of live prices, profiles and console * ci: references of all iOS previews * ci: snapshot docs state window height, exclusions and timing * ios: snapshots skip previews with a blinking caret or a spinner * ios: snapshots end editing and stop animations, restoring 8 previews * ci: references of the restored cursor and spinner previews * ios: chat item previews clip items to bubbles as the chat view does * ci: references of chat item previews with bubbles
50 lines
1.5 KiB
Swift
50 lines
1.5 KiB
Swift
//
|
|
// SecondaryChatView.swift
|
|
// SimpleX (iOS)
|
|
//
|
|
// Created by spaced4ndy on 29.04.2025.
|
|
// Copyright © 2025 SimpleX Chat. All rights reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
import SimpleXChat
|
|
|
|
struct SecondaryChatView: View {
|
|
@Environment(\.dismiss) var dismiss
|
|
@EnvironmentObject var chatModel: ChatModel
|
|
@ObservedObject var chat: Chat
|
|
@Binding var scrollToItemId: ChatItem.ID?
|
|
|
|
var body: some View {
|
|
if let im = chatModel.secondaryIM {
|
|
ChatView(
|
|
chat: chat,
|
|
im: im,
|
|
mergedItems: BoxedValue(MergedItems.create(im, [])),
|
|
floatingButtonModel: FloatingButtonModel(im: im),
|
|
scrollToItemId: $scrollToItemId
|
|
)
|
|
.modifier(BackButton(disabled: Binding.constant(false)) {
|
|
chatModel.secondaryIM = nil
|
|
dismiss()
|
|
})
|
|
}
|
|
}
|
|
}
|
|
|
|
struct SecondaryChatView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
let chatModel = ChatModel()
|
|
chatModel.secondaryIM = ItemsModel(secondaryIMFilter: .groupChatScopeContext(groupScopeInfo: .memberSupport(groupMember_: GroupMember.sampleData)))
|
|
return SecondaryChatView(
|
|
chat: Chat(
|
|
chatInfo: .group(groupInfo: GroupInfo.sampleData, groupChatScope: .memberSupport(groupMember_: GroupMember.sampleData)),
|
|
chatItems: [],
|
|
chatStats: ChatStats()
|
|
),
|
|
scrollToItemId: Binding.constant(nil)
|
|
)
|
|
.environmentObject(chatModel)
|
|
}
|
|
}
|