2022-02-01 17:34:06 +00:00
//
// C h a t L i s t V i e w . s w i f t
// S i m p l e X
//
// C r e a t e d b y E v g e n y P o b e r e z k i n o n 2 7 / 0 1 / 2 0 2 2 .
// C o p y r i g h t © 2 0 2 2 S i m p l e X C h a t . A l l r i g h t s r e s e r v e d .
//
import SwiftUI
2022-05-31 07:55:13 +01:00
import SimpleXChat
2022-02-01 17:34:06 +00:00
2024-09-10 09:31:53 +01:00
enum UserPickerSheet : Identifiable {
case address
case chatPreferences
case chatProfiles
case currentProfile
case useFromDesktop
case settings
var id : Self { self }
2024-10-07 20:30:17 +03:00
var navigationTitle : LocalizedStringKey {
switch self {
case . address : " SimpleX address "
case . chatPreferences : " Your preferences "
case . chatProfiles : " Your chat profiles "
case . currentProfile : " Your current profile "
case . useFromDesktop : " Connect to desktop "
case . settings : " Your settings "
}
}
}
2024-12-19 10:48:26 +00:00
enum PresetTag : Int , Identifiable , CaseIterable , Equatable {
2025-01-11 17:39:39 +07:00
case groupReports = 0
case favorites = 1
case contacts = 2
case groups = 3
case business = 4
case notes = 5
2024-12-19 10:48:26 +00:00
var id : Int { rawValue }
2025-01-11 17:39:39 +07:00
var с ollapse : Bool {
self != . groupReports
}
2024-12-19 10:48:26 +00:00
}
enum ActiveFilter : Identifiable , Equatable {
case presetTag ( PresetTag )
case userTag ( ChatTag )
case unread
var id : String {
switch self {
case let . presetTag ( tag ) : " preset \( tag . id ) "
case let . userTag ( tag ) : " user \( tag . chatTagId ) "
case . unread : " unread "
}
}
}
2024-11-20 17:58:13 +04:00
class SaveableSettings : ObservableObject {
@ Published var servers : ServerSettings = ServerSettings ( currUserServers : [ ] , userServers : [ ] , serverErrors : [ ] )
}
struct ServerSettings {
public var currUserServers : [ UserOperatorServers ]
public var userServers : [ UserOperatorServers ]
public var serverErrors : [ UserServersError ]
}
2024-10-07 20:30:17 +03:00
struct UserPickerSheetView : View {
let sheet : UserPickerSheet
@ EnvironmentObject var chatModel : ChatModel
2024-11-20 17:58:13 +04:00
@ StateObject private var ss = SaveableSettings ( )
2024-10-07 20:30:17 +03:00
2024-11-20 17:58:13 +04:00
@ State private var loaded = false
2024-11-19 15:37:00 +04:00
2024-10-07 20:30:17 +03:00
var body : some View {
NavigationView {
ZStack {
if loaded , let currentUser = chatModel . currentUser {
switch sheet {
case . address :
UserAddressView ( shareViaProfile : currentUser . addressShared )
case . chatPreferences :
PreferencesView (
profile : currentUser . profile ,
preferences : currentUser . fullPreferences ,
currentPreferences : currentUser . fullPreferences
)
case . chatProfiles :
UserProfilesView ( )
case . currentProfile :
UserProfile ( )
case . useFromDesktop :
ConnectDesktopView ( )
case . settings :
2024-11-20 17:58:13 +04:00
SettingsView ( )
2024-10-07 20:30:17 +03:00
}
}
Color . clear // R e q u i r e d f o r l i s t b a c k g r o u n d t o b e r e n d e r e d d u r i n g l o a d i n g
}
. navigationTitle ( sheet . navigationTitle )
. navigationBarTitleDisplayMode ( . large )
. modifier ( ThemedBackground ( grouped : true ) )
}
. overlay {
if let la = chatModel . laRequest {
LocalAuthView ( authRequest : la )
}
}
. task {
withAnimation (
. easeOut ( duration : 0.1 ) ,
{ loaded = true }
)
}
2024-11-19 15:37:00 +04:00
. onDisappear {
2024-11-20 17:58:13 +04:00
if serversCanBeSaved (
ss . servers . currUserServers ,
ss . servers . userServers ,
ss . servers . serverErrors
) {
2024-11-19 15:37:00 +04:00
showAlert (
title : NSLocalizedString ( " Save servers? " , comment : " alert title " ) ,
buttonTitle : NSLocalizedString ( " Save " , comment : " alert button " ) ,
2024-11-20 17:58:13 +04:00
buttonAction : { saveServers ( $ ss . servers . currUserServers , $ ss . servers . userServers ) } ,
2024-11-19 15:37:00 +04:00
cancelButton : true
)
}
}
2024-11-20 17:58:13 +04:00
. environmentObject ( ss )
2024-10-07 20:30:17 +03:00
}
2024-09-10 09:31:53 +01:00
}
2022-02-01 17:34:06 +00:00
struct ChatListView : View {
@ EnvironmentObject var chatModel : ChatModel
2024-07-03 22:42:13 +01:00
@ EnvironmentObject var theme : AppTheme
2024-10-07 20:30:17 +03:00
@ Binding var activeUserPickerSheet : UserPickerSheet ?
ios: rework UX of creating new connection (#3482)
* ios: connection UI (wip)
* custom search
* rework invite
* connect paste link ui
* scan rework, process errors, other fixes
* scan layout
* clear link on cancel
* improved search
* further improve search
* animation
* connect on paste in search
* layout
* layout
* layout
* layout, add conn
* delete unused invitation, create used invitation chat
* remove old views
* regular paste button
* new chat menu
* previews
* increase spacing
* animation, fix alerts
* swipe
* change text
* less sensitive gesture
* layout
* search cancel button transition
* slow down chat list animation (uses deprecated modifiers)
* icons
* update code scanner, layout
* manage camera permissions
* ask to delete unused invitation
* comment
* remove onDismiss
* don't filter chats on link in search, allow to paste text with link
* cleanup link after connection
* filter chat by link
* revert change
* show link descr
* disabled search
* underline
* filter own group
* simplify
* no animation
* add delay, move createInvitation
* update library
* possible fix for ios 15
* add explicit frame to qr code
* update library
* Revert "add explicit frame to qr code"
This reverts commit 95c7d31e47b3da39b5985cd57638885c45b77de1.
* remove comment
* fix pasteboardHasURLs, disable paste button based on it
* align help texts with changed button names
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
* update library
* Revert "fix pasteboardHasURLs, disable paste button based on it"
This reverts commit 46f63572e90dbf460faab9ce694181209712bd00.
* remove unused var
* restore disabled
* export localizations
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
2023-12-29 16:29:49 +04:00
@ State private var searchMode = false
@ FocusState private var searchFocussed
2022-02-13 08:45:08 +00:00
@ State private var searchText = " "
ios: rework UX of creating new connection (#3482)
* ios: connection UI (wip)
* custom search
* rework invite
* connect paste link ui
* scan rework, process errors, other fixes
* scan layout
* clear link on cancel
* improved search
* further improve search
* animation
* connect on paste in search
* layout
* layout
* layout
* layout, add conn
* delete unused invitation, create used invitation chat
* remove old views
* regular paste button
* new chat menu
* previews
* increase spacing
* animation, fix alerts
* swipe
* change text
* less sensitive gesture
* layout
* search cancel button transition
* slow down chat list animation (uses deprecated modifiers)
* icons
* update code scanner, layout
* manage camera permissions
* ask to delete unused invitation
* comment
* remove onDismiss
* don't filter chats on link in search, allow to paste text with link
* cleanup link after connection
* filter chat by link
* revert change
* show link descr
* disabled search
* underline
* filter own group
* simplify
* no animation
* add delay, move createInvitation
* update library
* possible fix for ios 15
* add explicit frame to qr code
* update library
* Revert "add explicit frame to qr code"
This reverts commit 95c7d31e47b3da39b5985cd57638885c45b77de1.
* remove comment
* fix pasteboardHasURLs, disable paste button based on it
* align help texts with changed button names
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
* update library
* Revert "fix pasteboardHasURLs, disable paste button based on it"
This reverts commit 46f63572e90dbf460faab9ce694181209712bd00.
* remove unused var
* restore disabled
* export localizations
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
2023-12-29 16:29:49 +04:00
@ State private var searchShowingSimplexLink = false
@ State private var searchChatFilteredBySimplexLink : String ? = nil
2024-08-08 01:00:16 +03:00
@ State private var scrollToSearchBar = false
2024-09-10 09:31:53 +01:00
@ State private var userPickerShown : Bool = false
2024-12-19 10:48:26 +00:00
@ State private var sheet : SomeSheet < AnyView > ? = nil
@ StateObject private var chatTagsModel = ChatTagsModel . shared
2025-03-04 18:20:14 +07:00
// i O S 1 5 i s r e q u i r e d i t t o s h o w / h i d e t o o l b a r w h i l e c h a t i s h i d d e n / v i s i b l e
@ State private var viewOnScreen = true
2024-08-07 01:33:48 +04:00
@ AppStorage ( GROUP_DEFAULT_ONE_HAND_UI , store : groupDefaults ) private var oneHandUI = true
@ AppStorage ( DEFAULT_ONE_HAND_UI_CARD_SHOWN ) private var oneHandUICardShown = false
2024-11-19 15:37:00 +04:00
@ AppStorage ( DEFAULT_ADDRESS_CREATION_CARD_SHOWN ) private var addressCreationCardShown = false
2024-08-09 17:26:11 +01:00
@ AppStorage ( DEFAULT_TOOLBAR_MATERIAL ) private var toolbarMaterial = ToolbarMaterial . defaultMaterial
2024-12-19 10:48:26 +00:00
2022-02-01 17:34:06 +00:00
var body : some View {
2023-07-10 13:53:46 +01:00
if #available ( iOS 16.0 , * ) {
viewBody . scrollDismissesKeyboard ( . immediately )
} else {
viewBody
}
}
2024-12-19 10:48:26 +00:00
2023-07-10 13:53:46 +01:00
private var viewBody : some View {
2024-08-07 01:33:48 +04:00
ZStack ( alignment : oneHandUI ? . bottomLeading : . topLeading ) {
2023-01-23 18:45:24 +00:00
NavStackCompat (
isActive : Binding (
2023-10-31 09:44:57 +00:00
get : { chatModel . chatId != nil } ,
2024-08-11 00:23:56 +03:00
set : { active in
if ! active { chatModel . chatId = nil }
}
2023-01-23 18:45:24 +00:00
) ,
destination : chatView
2024-08-07 01:33:48 +04:00
) { chatListView }
2024-09-10 09:31:53 +01:00
}
2024-10-07 20:30:17 +03:00
. modifier (
Sheet ( isPresented : $ userPickerShown ) {
UserPicker ( userPickerShown : $ userPickerShown , activeSheet : $ activeUserPickerSheet )
}
)
2024-10-16 21:55:59 +03:00
. appSheet (
item : $ activeUserPickerSheet ,
onDismiss : { chatModel . laRequest = nil } ,
content : { UserPickerSheetView ( sheet : $0 ) }
)
2024-10-07 20:30:17 +03:00
. onChange ( of : activeUserPickerSheet ) {
if $0 != nil {
DispatchQueue . main . asyncAfter ( deadline : . now ( ) + 0.3 ) {
userPickerShown = false
2022-09-24 21:02:01 +01:00
}
2024-10-07 20:30:17 +03:00
}
2022-09-21 15:11:52 +01:00
}
2024-12-19 10:48:26 +00:00
. environmentObject ( chatTagsModel )
2022-09-21 15:11:52 +01:00
}
2024-12-19 10:48:26 +00:00
2023-05-26 15:49:26 +04:00
private var chatListView : some View {
2024-08-08 17:25:45 +01:00
let tm = ToolbarMaterial . material ( toolbarMaterial )
return withToolbar ( tm ) {
ios: rework UX of creating new connection (#3482)
* ios: connection UI (wip)
* custom search
* rework invite
* connect paste link ui
* scan rework, process errors, other fixes
* scan layout
* clear link on cancel
* improved search
* further improve search
* animation
* connect on paste in search
* layout
* layout
* layout
* layout, add conn
* delete unused invitation, create used invitation chat
* remove old views
* regular paste button
* new chat menu
* previews
* increase spacing
* animation, fix alerts
* swipe
* change text
* less sensitive gesture
* layout
* search cancel button transition
* slow down chat list animation (uses deprecated modifiers)
* icons
* update code scanner, layout
* manage camera permissions
* ask to delete unused invitation
* comment
* remove onDismiss
* don't filter chats on link in search, allow to paste text with link
* cleanup link after connection
* filter chat by link
* revert change
* show link descr
* disabled search
* underline
* filter own group
* simplify
* no animation
* add delay, move createInvitation
* update library
* possible fix for ios 15
* add explicit frame to qr code
* update library
* Revert "add explicit frame to qr code"
This reverts commit 95c7d31e47b3da39b5985cd57638885c45b77de1.
* remove comment
* fix pasteboardHasURLs, disable paste button based on it
* align help texts with changed button names
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
* update library
* Revert "fix pasteboardHasURLs, disable paste button based on it"
This reverts commit 46f63572e90dbf460faab9ce694181209712bd00.
* remove unused var
* restore disabled
* export localizations
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
2023-12-29 16:29:49 +04:00
chatList
2024-08-07 01:33:48 +04:00
. background ( theme . colors . background )
. navigationBarTitleDisplayMode ( . inline )
. navigationBarHidden ( searchMode || oneHandUI )
2022-09-21 15:11:52 +01:00
}
2024-08-05 12:58:24 +01:00
. scaleEffect ( x : 1 , y : oneHandUI ? - 1 : 1 , anchor : . center )
2025-03-04 18:20:14 +07:00
. onAppear {
if # unavailable ( iOS 16.0 ) , ! viewOnScreen {
viewOnScreen = true
}
}
. onDisappear {
activeUserPickerSheet = nil
if # unavailable ( iOS 16.0 ) {
viewOnScreen = false
}
}
2023-07-05 09:09:56 +01:00
. refreshable {
AlertManager . shared . showAlert ( Alert (
title : Text ( " Reconnect servers? " ) ,
message : Text ( " Reconnect all connected servers to force message delivery. It uses additional traffic. " ) ,
primaryButton : . default ( Text ( " Ok " ) ) {
Task {
do {
try await reconnectAllServers ( )
} catch let error {
AlertManager . shared . showAlertMsg ( title : " Error " , message : " \( responseError ( error ) ) " )
}
}
} ,
secondaryButton : . cancel ( )
) )
}
2024-08-07 01:33:48 +04:00
. safeAreaInset ( edge : . top ) {
2024-08-08 17:25:45 +01:00
if oneHandUI { Divider ( ) . background ( tm ) }
2024-08-07 01:33:48 +04:00
}
2024-08-07 18:24:15 +03:00
. safeAreaInset ( edge : . bottom ) {
if oneHandUI {
2024-08-08 17:25:45 +01:00
Divider ( ) . padding ( . bottom , Self . hasHomeIndicator ? 0 : 8 ) . background ( tm )
2024-08-07 18:24:15 +03:00
}
}
2024-12-19 10:48:26 +00:00
. sheet ( item : $ sheet ) { sheet in
if #available ( iOS 16.0 , * ) {
sheet . content . presentationDetents ( [ . fraction ( sheet . fraction ) ] )
} else {
sheet . content
}
}
2024-08-05 12:58:24 +01:00
}
2024-12-19 10:48:26 +00:00
2024-08-07 18:24:15 +03:00
static var hasHomeIndicator : Bool = {
if let windowScene = UIApplication . shared . connectedScenes . first as ? UIWindowScene ,
let window = windowScene . windows . first {
window . safeAreaInsets . bottom > 0
} else { false }
} ( )
2024-12-19 10:48:26 +00:00
2024-08-08 17:25:45 +01:00
@ ViewBuilder func withToolbar ( _ material : Material , content : ( ) -> some View ) -> some View {
2024-08-07 01:33:48 +04:00
if #available ( iOS 16.0 , * ) {
if oneHandUI {
content ( )
2024-08-07 18:24:15 +03:00
. toolbarBackground ( . hidden , for : . bottomBar )
2024-08-07 01:33:48 +04:00
. toolbar { bottomToolbar }
} else {
content ( )
. toolbarBackground ( . automatic , for : . navigationBar )
2024-08-08 17:25:45 +01:00
. toolbarBackground ( material )
2024-08-07 01:33:48 +04:00
. toolbar { topToolbar }
2022-09-21 15:11:52 +01:00
}
2024-08-07 01:33:48 +04:00
} else {
if oneHandUI {
2025-03-04 18:20:14 +07:00
content ( ) . toolbar { bottomToolbarGroup ( ) }
2024-08-07 01:33:48 +04:00
} else {
content ( ) . toolbar { topToolbar }
}
}
}
2024-12-19 10:48:26 +00:00
2024-08-07 01:33:48 +04:00
@ ToolbarContentBuilder var topToolbar : some ToolbarContent {
ToolbarItem ( placement : . topBarLeading ) { leadingToolbarItem }
2024-08-07 18:24:15 +03:00
ToolbarItem ( placement : . principal ) { SubsStatusIndicator ( ) }
2024-08-07 01:33:48 +04:00
ToolbarItem ( placement : . topBarTrailing ) { trailingToolbarItem }
}
2024-12-19 10:48:26 +00:00
2024-08-07 01:33:48 +04:00
@ ToolbarContentBuilder var bottomToolbar : some ToolbarContent {
2024-08-08 01:00:16 +03:00
let padding : Double = Self . hasHomeIndicator ? 0 : 14
ToolbarItem ( placement : . bottomBar ) {
HStack {
leadingToolbarItem . padding ( . bottom , padding )
Spacer ( )
SubsStatusIndicator ( ) . padding ( . bottom , padding )
Spacer ( )
trailingToolbarItem . padding ( . bottom , padding )
}
. contentShape ( Rectangle ( ) )
. onTapGesture { scrollToSearchBar = true }
}
}
2024-12-19 10:48:26 +00:00
2025-03-04 18:20:14 +07:00
@ ToolbarContentBuilder func bottomToolbarGroup ( ) -> some ToolbarContent {
2024-08-07 18:24:15 +03:00
let padding : Double = Self . hasHomeIndicator ? 0 : 14
2025-03-04 18:20:14 +07:00
ToolbarItemGroup ( placement : viewOnScreen ? . bottomBar : . principal ) {
2024-08-07 18:24:15 +03:00
leadingToolbarItem . padding ( . bottom , padding )
Spacer ( )
SubsStatusIndicator ( ) . padding ( . bottom , padding )
Spacer ( )
trailingToolbarItem . padding ( . bottom , padding )
2024-08-07 01:33:48 +04:00
}
}
2024-12-19 10:48:26 +00:00
2024-08-07 01:33:48 +04:00
@ ViewBuilder var leadingToolbarItem : some View {
let user = chatModel . currentUser ? ? User . sampleData
ZStack ( alignment : . topTrailing ) {
ProfileImage ( imageStr : user . image , size : 32 , color : Color ( uiColor : . quaternaryLabel ) )
2024-09-10 09:31:53 +01:00
. padding ( [ . top , . trailing ] , 3 )
2024-08-07 01:33:48 +04:00
let allRead = chatModel . users
. filter { u in ! u . user . activeUser && ! u . user . hidden }
. allSatisfy { u in u . unreadCount = = 0 }
if ! allRead {
unreadBadge ( size : 12 )
}
}
. onTapGesture {
2024-09-10 09:31:53 +01:00
userPickerShown = true
2022-02-01 17:34:06 +00:00
}
2024-08-07 01:33:48 +04:00
}
2024-12-19 10:48:26 +00:00
2024-08-07 01:33:48 +04:00
@ ViewBuilder var trailingToolbarItem : some View {
switch chatModel . chatRunning {
case . some ( true ) : NewChatMenuButton ( )
case . some ( false ) : chatStoppedIcon ( )
case . none : EmptyView ( )
2024-08-05 12:58:24 +01:00
}
2022-09-21 15:11:52 +01:00
}
2024-12-19 10:48:26 +00:00
2025-05-11 14:15:14 +01:00
private var chatList : some View {
2023-06-27 10:28:47 +01:00
let cs = filteredChats ( )
2025-05-11 14:15:14 +01:00
return ZStack {
2024-08-08 01:00:16 +03:00
ScrollViewReader { scrollProxy in
List {
if ! chatModel . chats . isEmpty {
ChatListSearchBar (
searchMode : $ searchMode ,
searchFocussed : $ searchFocussed ,
searchText : $ searchText ,
searchShowingSimplexLink : $ searchShowingSimplexLink ,
2024-12-19 10:48:26 +00:00
searchChatFilteredBySimplexLink : $ searchChatFilteredBySimplexLink ,
parentSheet : $ sheet
2024-08-08 01:00:16 +03:00
)
2024-08-05 12:58:24 +01:00
. scaleEffect ( x : 1 , y : oneHandUI ? - 1 : 1 , anchor : . center )
ios: rework UX of creating new connection (#3482)
* ios: connection UI (wip)
* custom search
* rework invite
* connect paste link ui
* scan rework, process errors, other fixes
* scan layout
* clear link on cancel
* improved search
* further improve search
* animation
* connect on paste in search
* layout
* layout
* layout
* layout, add conn
* delete unused invitation, create used invitation chat
* remove old views
* regular paste button
* new chat menu
* previews
* increase spacing
* animation, fix alerts
* swipe
* change text
* less sensitive gesture
* layout
* search cancel button transition
* slow down chat list animation (uses deprecated modifiers)
* icons
* update code scanner, layout
* manage camera permissions
* ask to delete unused invitation
* comment
* remove onDismiss
* don't filter chats on link in search, allow to paste text with link
* cleanup link after connection
* filter chat by link
* revert change
* show link descr
* disabled search
* underline
* filter own group
* simplify
* no animation
* add delay, move createInvitation
* update library
* possible fix for ios 15
* add explicit frame to qr code
* update library
* Revert "add explicit frame to qr code"
This reverts commit 95c7d31e47b3da39b5985cd57638885c45b77de1.
* remove comment
* fix pasteboardHasURLs, disable paste button based on it
* align help texts with changed button names
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
* update library
* Revert "fix pasteboardHasURLs, disable paste button based on it"
This reverts commit 46f63572e90dbf460faab9ce694181209712bd00.
* remove unused var
* restore disabled
* export localizations
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
2023-12-29 16:29:49 +04:00
. listRowSeparator ( . hidden )
2024-07-03 22:42:13 +01:00
. listRowBackground ( Color . clear )
2024-08-08 01:00:16 +03:00
. frame ( maxWidth : . infinity )
. padding ( . top , oneHandUI ? 8 : 0 )
. id ( " searchBar " )
}
2024-08-20 15:54:52 +03:00
if #available ( iOS 16.0 , * ) {
ForEach ( cs , id : \ . viewId ) { chat in
2024-12-19 10:48:26 +00:00
ChatListNavLink ( chat : chat , parentSheet : $ sheet )
2024-08-20 15:54:52 +03:00
. scaleEffect ( x : 1 , y : oneHandUI ? - 1 : 1 , anchor : . center )
. padding ( . trailing , - 16 )
. disabled ( chatModel . chatRunning != true || chatModel . deletedChats . contains ( chat . chatInfo . id ) )
. listRowBackground ( Color . clear )
}
. offset ( x : - 8 )
} else {
ForEach ( cs , id : \ . viewId ) { chat in
VStack ( spacing : . zero ) {
Divider ( )
. padding ( . leading , 16 )
2024-12-19 10:48:26 +00:00
ChatListNavLink ( chat : chat , parentSheet : $ sheet )
2024-08-20 15:54:52 +03:00
. padding ( . horizontal , 8 )
. padding ( . vertical , 6 )
}
2024-08-08 01:00:16 +03:00
. scaleEffect ( x : 1 , y : oneHandUI ? - 1 : 1 , anchor : . center )
2024-08-20 15:54:52 +03:00
. listRowSeparator ( . hidden )
. listRowInsets ( EdgeInsets ( ) )
. background { theme . colors . background } // H i d e s d e f a u l t l i s t s e l e c t i o n c o l o u r
2024-08-08 01:00:16 +03:00
. disabled ( chatModel . chatRunning != true || chatModel . deletedChats . contains ( chat . chatInfo . id ) )
2024-08-20 15:54:52 +03:00
}
2024-08-08 01:00:16 +03:00
}
2024-11-22 18:19:49 +00:00
if ! oneHandUICardShown {
OneHandUICard ( )
. padding ( . vertical , 6 )
. scaleEffect ( x : 1 , y : oneHandUI ? - 1 : 1 , anchor : . center )
. listRowSeparator ( . hidden )
. listRowBackground ( Color . clear )
}
if ! addressCreationCardShown {
AddressCreationCard ( )
. padding ( . vertical , 6 )
. scaleEffect ( x : 1 , y : oneHandUI ? - 1 : 1 , anchor : . center )
. listRowSeparator ( . hidden )
. listRowBackground ( Color . clear )
}
2023-06-27 10:28:47 +01:00
}
2024-08-08 01:00:16 +03:00
. listStyle ( . plain )
2024-08-10 14:04:37 +01:00
. onChange ( of : chatModel . chatId ) { currentChatId in
if let chatId = chatModel . chatToTop , currentChatId != chatId {
2024-08-08 01:00:16 +03:00
chatModel . chatToTop = nil
chatModel . popChat ( chatId )
}
stopAudioPlayer ( )
2024-08-07 01:33:48 +04:00
}
2024-08-08 01:00:16 +03:00
. onChange ( of : chatModel . currentUser ? . userId ) { _ in
stopAudioPlayer ( )
}
. onChange ( of : scrollToSearchBar ) { scrollToSearchBar in
if scrollToSearchBar {
Task { self . scrollToSearchBar = false }
withAnimation { scrollProxy . scrollTo ( " searchBar " ) }
}
2023-06-27 10:28:47 +01:00
}
}
if cs . isEmpty && ! chatModel . chats . isEmpty {
2024-12-19 10:48:26 +00:00
noChatsView ( )
2024-08-05 12:58:24 +01:00
. scaleEffect ( x : 1 , y : oneHandUI ? - 1 : 1 , anchor : . center )
. foregroundColor ( . secondary )
2023-05-26 15:49:26 +04:00
}
}
}
2024-12-19 10:48:26 +00:00
@ ViewBuilder private func noChatsView ( ) -> some View {
if searchString ( ) . isEmpty {
switch chatTagsModel . activeFilter {
case . presetTag : Text ( " No filtered chats " ) // t h i s s h o u l d n o t h a p p e n
case let . userTag ( tag ) : Text ( " No chats in list \( tag . chatTagText ) " )
case . unread :
Button {
chatTagsModel . activeFilter = nil
} label : {
HStack {
Image ( systemName : " line.3.horizontal.decrease " )
Text ( " No unread chats " )
}
}
case . none : Text ( " No chats " )
}
} else {
Text ( " No chats found " )
}
}
2023-05-26 15:49:26 +04:00
2024-12-19 10:48:26 +00:00
2024-09-10 09:31:53 +01:00
private func unreadBadge ( size : CGFloat = 18 ) -> some View {
2023-01-20 13:17:41 +00:00
Circle ( )
. frame ( width : size , height : size )
2024-07-03 22:42:13 +01:00
. foregroundColor ( theme . colors . primary )
2023-01-20 13:17:41 +00:00
}
2024-12-19 10:48:26 +00:00
2022-12-30 21:47:11 +04:00
@ ViewBuilder private func chatView ( ) -> some View {
if let chatId = chatModel . chatId , let chat = chatModel . getChat ( chatId ) {
2024-07-03 10:24:26 +01:00
ChatView ( chat : chat )
2022-08-29 14:08:46 +01:00
}
}
2024-12-19 10:48:26 +00:00
2024-07-24 00:11:42 +07:00
func stopAudioPlayer ( ) {
VoiceItemState . smallView . values . forEach { $0 . audioPlayer ? . stop ( ) }
VoiceItemState . smallView = [ : ]
}
2024-12-19 10:48:26 +00:00
2022-02-13 08:45:08 +00:00
private func filteredChats ( ) -> [ Chat ] {
ios: rework UX of creating new connection (#3482)
* ios: connection UI (wip)
* custom search
* rework invite
* connect paste link ui
* scan rework, process errors, other fixes
* scan layout
* clear link on cancel
* improved search
* further improve search
* animation
* connect on paste in search
* layout
* layout
* layout
* layout, add conn
* delete unused invitation, create used invitation chat
* remove old views
* regular paste button
* new chat menu
* previews
* increase spacing
* animation, fix alerts
* swipe
* change text
* less sensitive gesture
* layout
* search cancel button transition
* slow down chat list animation (uses deprecated modifiers)
* icons
* update code scanner, layout
* manage camera permissions
* ask to delete unused invitation
* comment
* remove onDismiss
* don't filter chats on link in search, allow to paste text with link
* cleanup link after connection
* filter chat by link
* revert change
* show link descr
* disabled search
* underline
* filter own group
* simplify
* no animation
* add delay, move createInvitation
* update library
* possible fix for ios 15
* add explicit frame to qr code
* update library
* Revert "add explicit frame to qr code"
This reverts commit 95c7d31e47b3da39b5985cd57638885c45b77de1.
* remove comment
* fix pasteboardHasURLs, disable paste button based on it
* align help texts with changed button names
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
* update library
* Revert "fix pasteboardHasURLs, disable paste button based on it"
This reverts commit 46f63572e90dbf460faab9ce694181209712bd00.
* remove unused var
* restore disabled
* export localizations
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
2023-12-29 16:29:49 +04:00
if let linkChatId = searchChatFilteredBySimplexLink {
return chatModel . chats . filter { $0 . id = = linkChatId }
} else {
let s = searchString ( )
2024-12-19 10:48:26 +00:00
return s = = " "
2024-08-05 12:58:24 +01:00
? chatModel . chats . filter { chat in
2024-12-19 10:48:26 +00:00
! chat . chatInfo . chatDeleted && ! chat . chatInfo . contactCard && filtered ( chat )
2024-08-05 12:58:24 +01:00
}
2022-08-25 17:36:26 +04:00
: chatModel . chats . filter { chat in
2023-06-27 10:28:47 +01:00
let cInfo = chat . chatInfo
2024-12-19 10:48:26 +00:00
return switch cInfo {
2022-08-25 17:36:26 +04:00
case let . direct ( contact ) :
2024-12-19 10:48:26 +00:00
! contact . chatDeleted && ! chat . chatInfo . contactCard && (
( viewNameContains ( cInfo , s ) ||
contact . profile . displayName . localizedLowercase . contains ( s ) ||
contact . fullName . localizedLowercase . contains ( s )
)
2024-08-05 12:58:24 +01:00
)
2024-12-19 10:48:26 +00:00
case . group : viewNameContains ( cInfo , s )
case . local : viewNameContains ( cInfo , s )
case . contactRequest : viewNameContains ( cInfo , s )
case let . contactConnection ( conn ) : conn . localAlias . localizedLowercase . contains ( s )
case . invalidJSON : false
2022-08-25 17:36:26 +04:00
}
2022-04-25 10:39:28 +01:00
}
ios: rework UX of creating new connection (#3482)
* ios: connection UI (wip)
* custom search
* rework invite
* connect paste link ui
* scan rework, process errors, other fixes
* scan layout
* clear link on cancel
* improved search
* further improve search
* animation
* connect on paste in search
* layout
* layout
* layout
* layout, add conn
* delete unused invitation, create used invitation chat
* remove old views
* regular paste button
* new chat menu
* previews
* increase spacing
* animation, fix alerts
* swipe
* change text
* less sensitive gesture
* layout
* search cancel button transition
* slow down chat list animation (uses deprecated modifiers)
* icons
* update code scanner, layout
* manage camera permissions
* ask to delete unused invitation
* comment
* remove onDismiss
* don't filter chats on link in search, allow to paste text with link
* cleanup link after connection
* filter chat by link
* revert change
* show link descr
* disabled search
* underline
* filter own group
* simplify
* no animation
* add delay, move createInvitation
* update library
* possible fix for ios 15
* add explicit frame to qr code
* update library
* Revert "add explicit frame to qr code"
This reverts commit 95c7d31e47b3da39b5985cd57638885c45b77de1.
* remove comment
* fix pasteboardHasURLs, disable paste button based on it
* align help texts with changed button names
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
* update library
* Revert "fix pasteboardHasURLs, disable paste button based on it"
This reverts commit 46f63572e90dbf460faab9ce694181209712bd00.
* remove unused var
* restore disabled
* export localizations
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
2023-12-29 16:29:49 +04:00
}
2024-12-19 10:48:26 +00:00
2023-06-27 10:28:47 +01:00
func filtered ( _ chat : Chat ) -> Bool {
2024-12-19 10:48:26 +00:00
switch chatTagsModel . activeFilter {
2025-01-11 17:39:39 +07:00
case let . presetTag ( tag ) : presetTagMatchesChat ( tag , chat . chatInfo , chat . chatStats )
2024-12-19 10:48:26 +00:00
case let . userTag ( tag ) : chat . chatInfo . chatTags ? . contains ( tag . chatTagId ) = = true
2025-02-03 20:47:32 +00:00
case . unread : chat . unreadTag
2024-12-19 10:48:26 +00:00
case . none : true
}
2023-06-27 10:28:47 +01:00
}
2024-12-19 10:48:26 +00:00
2023-06-27 10:28:47 +01:00
func viewNameContains ( _ cInfo : ChatInfo , _ s : String ) -> Bool {
cInfo . chatViewName . localizedLowercase . contains ( s )
}
2022-02-01 17:34:06 +00:00
}
2024-12-19 10:48:26 +00:00
func searchString ( ) -> String {
searchShowingSimplexLink ? " " : searchText . trimmingCharacters ( in : . whitespaces ) . localizedLowercase
}
2022-02-01 17:34:06 +00:00
}
2024-07-03 16:59:46 +04:00
struct SubsStatusIndicator : View {
2024-07-22 19:32:54 +04:00
@ State private var subs : SMPServerSubs = SMPServerSubs . newSMPServerSubs
@ State private var hasSess : Bool = false
2024-08-17 15:26:56 +03:00
@ State private var task : Task < Void , Never > ?
2024-07-03 16:59:46 +04:00
@ State private var showServersSummary = false
2024-07-03 22:42:13 +01:00
2024-07-03 16:59:46 +04:00
@ AppStorage ( DEFAULT_SHOW_SUBSCRIPTION_PERCENTAGE ) private var showSubscriptionPercentage = false
var body : some View {
2024-08-06 20:31:45 +04:00
Button {
showServersSummary = true
} label : {
HStack ( spacing : 4 ) {
2024-08-07 18:24:15 +03:00
Text ( " Chats " ) . foregroundStyle ( Color . primary ) . fixedSize ( ) . font ( . headline )
2024-08-06 20:31:45 +04:00
SubscriptionStatusIndicatorView ( subs : subs , hasSess : hasSess )
if showSubscriptionPercentage {
SubscriptionStatusPercentageView ( subs : subs , hasSess : hasSess )
2024-07-03 16:59:46 +04:00
}
}
}
2024-08-13 13:14:27 +04:00
. disabled ( ChatModel . shared . chatRunning != true )
2024-07-03 16:59:46 +04:00
. onAppear {
2024-08-17 15:26:56 +03:00
startTask ( )
2024-07-03 16:59:46 +04:00
}
. onDisappear {
2024-08-17 15:26:56 +03:00
stopTask ( )
2024-07-03 16:59:46 +04:00
}
2024-08-06 12:03:25 +04:00
. appSheet ( isPresented : $ showServersSummary ) {
2024-07-22 19:32:54 +04:00
ServersSummaryView ( )
2024-08-06 12:03:25 +04:00
. environment ( \ EnvironmentValues . refresh as ! WritableKeyPath < EnvironmentValues , RefreshAction ? > , nil )
2024-07-03 16:59:46 +04:00
}
}
2024-08-17 15:26:56 +03:00
private func startTask ( ) {
task = Task {
while ! Task . isCancelled {
2024-10-10 18:55:37 +01:00
if AppChatState . shared . value = = . active , ChatModel . shared . chatRunning = = true {
2024-08-17 15:26:56 +03:00
do {
let ( subs , hasSess ) = try await getAgentSubsTotal ( )
await MainActor . run {
self . subs = subs
self . hasSess = hasSess
}
} catch let error {
logger . error ( " getSubsTotal error: \( responseError ( error ) ) " )
}
}
try ? await Task . sleep ( nanoseconds : 1_000_000_000 ) // S l e e p f o r 1 s e c o n d
2024-07-03 16:59:46 +04:00
}
}
}
2024-08-17 15:26:56 +03:00
func stopTask ( ) {
task ? . cancel ( )
task = nil
2024-07-03 16:59:46 +04:00
}
}
ios: rework UX of creating new connection (#3482)
* ios: connection UI (wip)
* custom search
* rework invite
* connect paste link ui
* scan rework, process errors, other fixes
* scan layout
* clear link on cancel
* improved search
* further improve search
* animation
* connect on paste in search
* layout
* layout
* layout
* layout, add conn
* delete unused invitation, create used invitation chat
* remove old views
* regular paste button
* new chat menu
* previews
* increase spacing
* animation, fix alerts
* swipe
* change text
* less sensitive gesture
* layout
* search cancel button transition
* slow down chat list animation (uses deprecated modifiers)
* icons
* update code scanner, layout
* manage camera permissions
* ask to delete unused invitation
* comment
* remove onDismiss
* don't filter chats on link in search, allow to paste text with link
* cleanup link after connection
* filter chat by link
* revert change
* show link descr
* disabled search
* underline
* filter own group
* simplify
* no animation
* add delay, move createInvitation
* update library
* possible fix for ios 15
* add explicit frame to qr code
* update library
* Revert "add explicit frame to qr code"
This reverts commit 95c7d31e47b3da39b5985cd57638885c45b77de1.
* remove comment
* fix pasteboardHasURLs, disable paste button based on it
* align help texts with changed button names
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
* update library
* Revert "fix pasteboardHasURLs, disable paste button based on it"
This reverts commit 46f63572e90dbf460faab9ce694181209712bd00.
* remove unused var
* restore disabled
* export localizations
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
2023-12-29 16:29:49 +04:00
struct ChatListSearchBar : View {
@ EnvironmentObject var m : ChatModel
2024-07-03 22:42:13 +01:00
@ EnvironmentObject var theme : AppTheme
2024-12-19 10:48:26 +00:00
@ EnvironmentObject var chatTagsModel : ChatTagsModel
ios: rework UX of creating new connection (#3482)
* ios: connection UI (wip)
* custom search
* rework invite
* connect paste link ui
* scan rework, process errors, other fixes
* scan layout
* clear link on cancel
* improved search
* further improve search
* animation
* connect on paste in search
* layout
* layout
* layout
* layout, add conn
* delete unused invitation, create used invitation chat
* remove old views
* regular paste button
* new chat menu
* previews
* increase spacing
* animation, fix alerts
* swipe
* change text
* less sensitive gesture
* layout
* search cancel button transition
* slow down chat list animation (uses deprecated modifiers)
* icons
* update code scanner, layout
* manage camera permissions
* ask to delete unused invitation
* comment
* remove onDismiss
* don't filter chats on link in search, allow to paste text with link
* cleanup link after connection
* filter chat by link
* revert change
* show link descr
* disabled search
* underline
* filter own group
* simplify
* no animation
* add delay, move createInvitation
* update library
* possible fix for ios 15
* add explicit frame to qr code
* update library
* Revert "add explicit frame to qr code"
This reverts commit 95c7d31e47b3da39b5985cd57638885c45b77de1.
* remove comment
* fix pasteboardHasURLs, disable paste button based on it
* align help texts with changed button names
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
* update library
* Revert "fix pasteboardHasURLs, disable paste button based on it"
This reverts commit 46f63572e90dbf460faab9ce694181209712bd00.
* remove unused var
* restore disabled
* export localizations
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
2023-12-29 16:29:49 +04:00
@ Binding var searchMode : Bool
@ FocusState . Binding var searchFocussed : Bool
@ Binding var searchText : String
@ Binding var searchShowingSimplexLink : Bool
@ Binding var searchChatFilteredBySimplexLink : String ?
2024-12-19 10:48:26 +00:00
@ Binding var parentSheet : SomeSheet < AnyView > ?
ios: rework UX of creating new connection (#3482)
* ios: connection UI (wip)
* custom search
* rework invite
* connect paste link ui
* scan rework, process errors, other fixes
* scan layout
* clear link on cancel
* improved search
* further improve search
* animation
* connect on paste in search
* layout
* layout
* layout
* layout, add conn
* delete unused invitation, create used invitation chat
* remove old views
* regular paste button
* new chat menu
* previews
* increase spacing
* animation, fix alerts
* swipe
* change text
* less sensitive gesture
* layout
* search cancel button transition
* slow down chat list animation (uses deprecated modifiers)
* icons
* update code scanner, layout
* manage camera permissions
* ask to delete unused invitation
* comment
* remove onDismiss
* don't filter chats on link in search, allow to paste text with link
* cleanup link after connection
* filter chat by link
* revert change
* show link descr
* disabled search
* underline
* filter own group
* simplify
* no animation
* add delay, move createInvitation
* update library
* possible fix for ios 15
* add explicit frame to qr code
* update library
* Revert "add explicit frame to qr code"
This reverts commit 95c7d31e47b3da39b5985cd57638885c45b77de1.
* remove comment
* fix pasteboardHasURLs, disable paste button based on it
* align help texts with changed button names
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
* update library
* Revert "fix pasteboardHasURLs, disable paste button based on it"
This reverts commit 46f63572e90dbf460faab9ce694181209712bd00.
* remove unused var
* restore disabled
* export localizations
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
2023-12-29 16:29:49 +04:00
@ State private var ignoreSearchTextChange = false
@ State private var alert : PlanAndConnectAlert ?
@ State private var sheet : PlanAndConnectActionSheet ?
var body : some View {
VStack ( spacing : 12 ) {
2025-01-11 10:49:53 +00:00
ScrollView ( [ . horizontal ] , showsIndicators : false ) { TagsView ( parentSheet : $ parentSheet , searchText : $ searchText ) }
ios: rework UX of creating new connection (#3482)
* ios: connection UI (wip)
* custom search
* rework invite
* connect paste link ui
* scan rework, process errors, other fixes
* scan layout
* clear link on cancel
* improved search
* further improve search
* animation
* connect on paste in search
* layout
* layout
* layout
* layout, add conn
* delete unused invitation, create used invitation chat
* remove old views
* regular paste button
* new chat menu
* previews
* increase spacing
* animation, fix alerts
* swipe
* change text
* less sensitive gesture
* layout
* search cancel button transition
* slow down chat list animation (uses deprecated modifiers)
* icons
* update code scanner, layout
* manage camera permissions
* ask to delete unused invitation
* comment
* remove onDismiss
* don't filter chats on link in search, allow to paste text with link
* cleanup link after connection
* filter chat by link
* revert change
* show link descr
* disabled search
* underline
* filter own group
* simplify
* no animation
* add delay, move createInvitation
* update library
* possible fix for ios 15
* add explicit frame to qr code
* update library
* Revert "add explicit frame to qr code"
This reverts commit 95c7d31e47b3da39b5985cd57638885c45b77de1.
* remove comment
* fix pasteboardHasURLs, disable paste button based on it
* align help texts with changed button names
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
* update library
* Revert "fix pasteboardHasURLs, disable paste button based on it"
This reverts commit 46f63572e90dbf460faab9ce694181209712bd00.
* remove unused var
* restore disabled
* export localizations
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
2023-12-29 16:29:49 +04:00
HStack ( spacing : 12 ) {
HStack ( spacing : 4 ) {
Image ( systemName : " magnifyingglass " )
TextField ( " Search or paste SimpleX link " , text : $ searchText )
2024-07-03 22:42:13 +01:00
. foregroundColor ( searchShowingSimplexLink ? theme . colors . secondary : theme . colors . onBackground )
ios: rework UX of creating new connection (#3482)
* ios: connection UI (wip)
* custom search
* rework invite
* connect paste link ui
* scan rework, process errors, other fixes
* scan layout
* clear link on cancel
* improved search
* further improve search
* animation
* connect on paste in search
* layout
* layout
* layout
* layout, add conn
* delete unused invitation, create used invitation chat
* remove old views
* regular paste button
* new chat menu
* previews
* increase spacing
* animation, fix alerts
* swipe
* change text
* less sensitive gesture
* layout
* search cancel button transition
* slow down chat list animation (uses deprecated modifiers)
* icons
* update code scanner, layout
* manage camera permissions
* ask to delete unused invitation
* comment
* remove onDismiss
* don't filter chats on link in search, allow to paste text with link
* cleanup link after connection
* filter chat by link
* revert change
* show link descr
* disabled search
* underline
* filter own group
* simplify
* no animation
* add delay, move createInvitation
* update library
* possible fix for ios 15
* add explicit frame to qr code
* update library
* Revert "add explicit frame to qr code"
This reverts commit 95c7d31e47b3da39b5985cd57638885c45b77de1.
* remove comment
* fix pasteboardHasURLs, disable paste button based on it
* align help texts with changed button names
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
* update library
* Revert "fix pasteboardHasURLs, disable paste button based on it"
This reverts commit 46f63572e90dbf460faab9ce694181209712bd00.
* remove unused var
* restore disabled
* export localizations
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
2023-12-29 16:29:49 +04:00
. disabled ( searchShowingSimplexLink )
. focused ( $ searchFocussed )
. frame ( maxWidth : . infinity )
2023-12-30 14:09:07 +00:00
if ! searchText . isEmpty {
ios: rework UX of creating new connection (#3482)
* ios: connection UI (wip)
* custom search
* rework invite
* connect paste link ui
* scan rework, process errors, other fixes
* scan layout
* clear link on cancel
* improved search
* further improve search
* animation
* connect on paste in search
* layout
* layout
* layout
* layout, add conn
* delete unused invitation, create used invitation chat
* remove old views
* regular paste button
* new chat menu
* previews
* increase spacing
* animation, fix alerts
* swipe
* change text
* less sensitive gesture
* layout
* search cancel button transition
* slow down chat list animation (uses deprecated modifiers)
* icons
* update code scanner, layout
* manage camera permissions
* ask to delete unused invitation
* comment
* remove onDismiss
* don't filter chats on link in search, allow to paste text with link
* cleanup link after connection
* filter chat by link
* revert change
* show link descr
* disabled search
* underline
* filter own group
* simplify
* no animation
* add delay, move createInvitation
* update library
* possible fix for ios 15
* add explicit frame to qr code
* update library
* Revert "add explicit frame to qr code"
This reverts commit 95c7d31e47b3da39b5985cd57638885c45b77de1.
* remove comment
* fix pasteboardHasURLs, disable paste button based on it
* align help texts with changed button names
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
* update library
* Revert "fix pasteboardHasURLs, disable paste button based on it"
This reverts commit 46f63572e90dbf460faab9ce694181209712bd00.
* remove unused var
* restore disabled
* export localizations
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
2023-12-29 16:29:49 +04:00
Image ( systemName : " xmark.circle.fill " )
. onTapGesture {
searchText = " "
}
}
}
. padding ( EdgeInsets ( top : 7 , leading : 7 , bottom : 7 , trailing : 7 ) )
2024-07-03 22:42:13 +01:00
. foregroundColor ( theme . colors . secondary )
ios: rework UX of creating new connection (#3482)
* ios: connection UI (wip)
* custom search
* rework invite
* connect paste link ui
* scan rework, process errors, other fixes
* scan layout
* clear link on cancel
* improved search
* further improve search
* animation
* connect on paste in search
* layout
* layout
* layout
* layout, add conn
* delete unused invitation, create used invitation chat
* remove old views
* regular paste button
* new chat menu
* previews
* increase spacing
* animation, fix alerts
* swipe
* change text
* less sensitive gesture
* layout
* search cancel button transition
* slow down chat list animation (uses deprecated modifiers)
* icons
* update code scanner, layout
* manage camera permissions
* ask to delete unused invitation
* comment
* remove onDismiss
* don't filter chats on link in search, allow to paste text with link
* cleanup link after connection
* filter chat by link
* revert change
* show link descr
* disabled search
* underline
* filter own group
* simplify
* no animation
* add delay, move createInvitation
* update library
* possible fix for ios 15
* add explicit frame to qr code
* update library
* Revert "add explicit frame to qr code"
This reverts commit 95c7d31e47b3da39b5985cd57638885c45b77de1.
* remove comment
* fix pasteboardHasURLs, disable paste button based on it
* align help texts with changed button names
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
* update library
* Revert "fix pasteboardHasURLs, disable paste button based on it"
This reverts commit 46f63572e90dbf460faab9ce694181209712bd00.
* remove unused var
* restore disabled
* export localizations
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
2023-12-29 16:29:49 +04:00
. background ( Color ( . tertiarySystemFill ) )
. cornerRadius ( 10.0 )
if searchFocussed {
Text ( " Cancel " )
2024-07-03 22:42:13 +01:00
. foregroundColor ( theme . colors . primary )
ios: rework UX of creating new connection (#3482)
* ios: connection UI (wip)
* custom search
* rework invite
* connect paste link ui
* scan rework, process errors, other fixes
* scan layout
* clear link on cancel
* improved search
* further improve search
* animation
* connect on paste in search
* layout
* layout
* layout
* layout, add conn
* delete unused invitation, create used invitation chat
* remove old views
* regular paste button
* new chat menu
* previews
* increase spacing
* animation, fix alerts
* swipe
* change text
* less sensitive gesture
* layout
* search cancel button transition
* slow down chat list animation (uses deprecated modifiers)
* icons
* update code scanner, layout
* manage camera permissions
* ask to delete unused invitation
* comment
* remove onDismiss
* don't filter chats on link in search, allow to paste text with link
* cleanup link after connection
* filter chat by link
* revert change
* show link descr
* disabled search
* underline
* filter own group
* simplify
* no animation
* add delay, move createInvitation
* update library
* possible fix for ios 15
* add explicit frame to qr code
* update library
* Revert "add explicit frame to qr code"
This reverts commit 95c7d31e47b3da39b5985cd57638885c45b77de1.
* remove comment
* fix pasteboardHasURLs, disable paste button based on it
* align help texts with changed button names
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
* update library
* Revert "fix pasteboardHasURLs, disable paste button based on it"
This reverts commit 46f63572e90dbf460faab9ce694181209712bd00.
* remove unused var
* restore disabled
* export localizations
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
2023-12-29 16:29:49 +04:00
. onTapGesture {
searchText = " "
searchFocussed = false
}
2024-07-03 16:59:46 +04:00
} else if m . chats . count > 0 {
toggleFilterButton ( )
ios: rework UX of creating new connection (#3482)
* ios: connection UI (wip)
* custom search
* rework invite
* connect paste link ui
* scan rework, process errors, other fixes
* scan layout
* clear link on cancel
* improved search
* further improve search
* animation
* connect on paste in search
* layout
* layout
* layout
* layout, add conn
* delete unused invitation, create used invitation chat
* remove old views
* regular paste button
* new chat menu
* previews
* increase spacing
* animation, fix alerts
* swipe
* change text
* less sensitive gesture
* layout
* search cancel button transition
* slow down chat list animation (uses deprecated modifiers)
* icons
* update code scanner, layout
* manage camera permissions
* ask to delete unused invitation
* comment
* remove onDismiss
* don't filter chats on link in search, allow to paste text with link
* cleanup link after connection
* filter chat by link
* revert change
* show link descr
* disabled search
* underline
* filter own group
* simplify
* no animation
* add delay, move createInvitation
* update library
* possible fix for ios 15
* add explicit frame to qr code
* update library
* Revert "add explicit frame to qr code"
This reverts commit 95c7d31e47b3da39b5985cd57638885c45b77de1.
* remove comment
* fix pasteboardHasURLs, disable paste button based on it
* align help texts with changed button names
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
* update library
* Revert "fix pasteboardHasURLs, disable paste button based on it"
This reverts commit 46f63572e90dbf460faab9ce694181209712bd00.
* remove unused var
* restore disabled
* export localizations
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
2023-12-29 16:29:49 +04:00
}
}
}
. onChange ( of : searchFocussed ) { sf in
withAnimation { searchMode = sf }
}
. onChange ( of : searchText ) { t in
if ignoreSearchTextChange {
ignoreSearchTextChange = false
} else {
if let link = strHasSingleSimplexLink ( t . trimmingCharacters ( in : . whitespaces ) ) { // i f S i m p l e X l i n k i s p a s t e d , s h o w c o n n e c t i o n d i a l o g u e
searchFocussed = false
if case let . simplexLink ( linkType , _ , smpHosts ) = link . format {
ignoreSearchTextChange = true
searchText = simplexLinkText ( linkType , smpHosts )
}
searchShowingSimplexLink = true
searchChatFilteredBySimplexLink = nil
connect ( link . text )
} else {
if t != " " { // i f s o m e o t h e r t e x t i s p a s t e d , e n t e r s e a r c h m o d e
searchFocussed = true
}
searchShowingSimplexLink = false
searchChatFilteredBySimplexLink = nil
}
}
}
2025-01-01 23:12:12 +00:00
. onChange ( of : chatTagsModel . activeFilter ) { _ in
searchText = " "
}
ios: rework UX of creating new connection (#3482)
* ios: connection UI (wip)
* custom search
* rework invite
* connect paste link ui
* scan rework, process errors, other fixes
* scan layout
* clear link on cancel
* improved search
* further improve search
* animation
* connect on paste in search
* layout
* layout
* layout
* layout, add conn
* delete unused invitation, create used invitation chat
* remove old views
* regular paste button
* new chat menu
* previews
* increase spacing
* animation, fix alerts
* swipe
* change text
* less sensitive gesture
* layout
* search cancel button transition
* slow down chat list animation (uses deprecated modifiers)
* icons
* update code scanner, layout
* manage camera permissions
* ask to delete unused invitation
* comment
* remove onDismiss
* don't filter chats on link in search, allow to paste text with link
* cleanup link after connection
* filter chat by link
* revert change
* show link descr
* disabled search
* underline
* filter own group
* simplify
* no animation
* add delay, move createInvitation
* update library
* possible fix for ios 15
* add explicit frame to qr code
* update library
* Revert "add explicit frame to qr code"
This reverts commit 95c7d31e47b3da39b5985cd57638885c45b77de1.
* remove comment
* fix pasteboardHasURLs, disable paste button based on it
* align help texts with changed button names
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
* update library
* Revert "fix pasteboardHasURLs, disable paste button based on it"
This reverts commit 46f63572e90dbf460faab9ce694181209712bd00.
* remove unused var
* restore disabled
* export localizations
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
2023-12-29 16:29:49 +04:00
. alert ( item : $ alert ) { a in
planAndConnectAlert ( a , dismiss : true , cleanup : { searchText = " " } )
}
. actionSheet ( item : $ sheet ) { s in
planAndConnectActionSheet ( s , dismiss : true , cleanup : { searchText = " " } )
}
}
2024-07-03 16:59:46 +04:00
private func toggleFilterButton ( ) -> some View {
2024-12-19 10:48:26 +00:00
let showUnread = chatTagsModel . activeFilter = = . unread
return ZStack {
2024-07-03 16:59:46 +04:00
Color . clear
. frame ( width : 22 , height : 22 )
2024-12-19 10:48:26 +00:00
Image ( systemName : showUnread ? " line.3.horizontal.decrease.circle.fill " : " line.3.horizontal.decrease " )
2024-07-03 16:59:46 +04:00
. resizable ( )
. scaledToFit ( )
2024-12-19 10:48:26 +00:00
. foregroundColor ( showUnread ? theme . colors . primary : theme . colors . secondary )
. frame ( width : showUnread ? 22 : 16 , height : showUnread ? 22 : 16 )
2024-07-03 16:59:46 +04:00
. onTapGesture {
2024-12-19 10:48:26 +00:00
if chatTagsModel . activeFilter = = . unread {
chatTagsModel . activeFilter = nil
} else {
chatTagsModel . activeFilter = . unread
}
2024-07-03 16:59:46 +04:00
}
}
}
ios: rework UX of creating new connection (#3482)
* ios: connection UI (wip)
* custom search
* rework invite
* connect paste link ui
* scan rework, process errors, other fixes
* scan layout
* clear link on cancel
* improved search
* further improve search
* animation
* connect on paste in search
* layout
* layout
* layout
* layout, add conn
* delete unused invitation, create used invitation chat
* remove old views
* regular paste button
* new chat menu
* previews
* increase spacing
* animation, fix alerts
* swipe
* change text
* less sensitive gesture
* layout
* search cancel button transition
* slow down chat list animation (uses deprecated modifiers)
* icons
* update code scanner, layout
* manage camera permissions
* ask to delete unused invitation
* comment
* remove onDismiss
* don't filter chats on link in search, allow to paste text with link
* cleanup link after connection
* filter chat by link
* revert change
* show link descr
* disabled search
* underline
* filter own group
* simplify
* no animation
* add delay, move createInvitation
* update library
* possible fix for ios 15
* add explicit frame to qr code
* update library
* Revert "add explicit frame to qr code"
This reverts commit 95c7d31e47b3da39b5985cd57638885c45b77de1.
* remove comment
* fix pasteboardHasURLs, disable paste button based on it
* align help texts with changed button names
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
* update library
* Revert "fix pasteboardHasURLs, disable paste button based on it"
This reverts commit 46f63572e90dbf460faab9ce694181209712bd00.
* remove unused var
* restore disabled
* export localizations
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
Co-authored-by: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com>
2023-12-29 16:29:49 +04:00
private func connect ( _ link : String ) {
planAndConnect (
link ,
showAlert : { alert = $0 } ,
showActionSheet : { sheet = $0 } ,
dismiss : false ,
incognito : nil ,
filterKnownContact : { searchChatFilteredBySimplexLink = $0 . id } ,
filterKnownGroup : { searchChatFilteredBySimplexLink = $0 . id }
)
}
}
2025-01-11 10:49:53 +00:00
struct TagsView : View {
2024-12-19 10:48:26 +00:00
@ EnvironmentObject var chatTagsModel : ChatTagsModel
@ EnvironmentObject var chatModel : ChatModel
2024-12-20 11:43:11 +00:00
@ EnvironmentObject var theme : AppTheme
2024-12-19 10:48:26 +00:00
@ Binding var parentSheet : SomeSheet < AnyView > ?
2025-01-01 23:12:12 +00:00
@ Binding var searchText : String
2024-12-19 10:48:26 +00:00
var body : some View {
HStack {
tagsView ( )
}
}
@ ViewBuilder private func tagsView ( ) -> some View {
if chatTagsModel . presetTags . count > 1 {
if chatTagsModel . presetTags . count + chatTagsModel . userTags . count <= 3 {
expandedPresetTagsFiltersView ( )
} else {
collapsedTagsFilterView ( )
2025-01-11 17:39:39 +07:00
ForEach ( PresetTag . allCases , id : \ . id ) { ( tag : PresetTag ) in
if ! tag . с ollapse && ( chatTagsModel . presetTags [ tag ] ? ? 0 ) > 0 {
expandedTagFilterView ( tag )
}
}
2024-12-19 10:48:26 +00:00
}
}
2024-12-20 11:43:11 +00:00
let selectedTag : ChatTag ? = if case let . userTag ( tag ) = chatTagsModel . activeFilter {
tag
} else {
nil
}
2024-12-19 10:48:26 +00:00
ForEach ( chatTagsModel . userTags , id : \ . id ) { tag in
2024-12-20 11:43:11 +00:00
let current = tag = = selectedTag
2024-12-19 10:48:26 +00:00
let color : Color = current ? . accentColor : . secondary
ZStack {
HStack ( spacing : 4 ) {
if let emoji = tag . chatTagEmoji {
Text ( emoji )
} else {
Image ( systemName : current ? " tag.fill " : " tag " )
. foregroundColor ( color )
}
ZStack {
2024-12-20 11:43:11 +00:00
let badge = Text ( verbatim : ( chatTagsModel . unreadTags [ tag . chatTagId ] ? ? 0 ) > 0 ? " ● " : " " ) . font ( . footnote )
( Text ( tag . chatTagText ) . fontWeight ( . semibold ) + badge ) . foregroundColor ( . clear )
Text ( tag . chatTagText ) . fontWeight ( current ? . semibold : . regular ) . foregroundColor ( color ) + badge . foregroundColor ( theme . colors . primary )
2024-12-19 10:48:26 +00:00
}
}
. onTapGesture {
setActiveFilter ( filter : . userTag ( tag ) )
}
. onLongPressGesture {
let screenHeight = UIScreen . main . bounds . height
let reservedSpace : Double = 4 * 44 // 2 f o r p a d d i n g , 1 f o r " C r e a t e l i s t " a n d a n o t h e r f o r e x t r a t a g
let tagsSpace = Double ( max ( chatTagsModel . userTags . count , 3 ) ) * 44
let fraction = min ( ( reservedSpace + tagsSpace ) / screenHeight , 0.62 )
parentSheet = SomeSheet (
content : {
AnyView (
NavigationView {
2025-01-11 10:49:53 +00:00
TagListView ( chat : nil )
2024-12-19 10:48:26 +00:00
. modifier ( ThemedBackground ( grouped : true ) )
}
)
} ,
id : " tag list " ,
fraction : fraction
)
}
}
}
Button {
parentSheet = SomeSheet (
content : {
AnyView (
NavigationView {
2025-01-11 10:49:53 +00:00
TagListEditor ( )
2024-12-19 10:48:26 +00:00
}
)
} ,
id : " tag create "
)
} label : {
if chatTagsModel . userTags . isEmpty {
HStack ( spacing : 4 ) {
Image ( systemName : " plus " )
Text ( " Add list " )
}
} else {
Image ( systemName : " plus " )
}
}
. foregroundColor ( . secondary )
}
2025-01-11 17:39:39 +07:00
@ ViewBuilder private func expandedTagFilterView ( _ tag : PresetTag ) -> some View {
2024-12-19 10:48:26 +00:00
let selectedPresetTag : PresetTag ? = if case let . presetTag ( tag ) = chatTagsModel . activeFilter {
tag
} else {
nil
}
2025-01-11 17:39:39 +07:00
let active = tag = = selectedPresetTag
let ( icon , text ) = presetTagLabel ( tag : tag , active : active )
let color : Color = active ? . accentColor : . secondary
HStack ( spacing : 4 ) {
Image ( systemName : icon )
. foregroundColor ( color )
ZStack {
Text ( text ) . fontWeight ( . semibold ) . foregroundColor ( . clear )
Text ( text ) . fontWeight ( active ? . semibold : . regular ) . foregroundColor ( color )
}
}
. onTapGesture {
setActiveFilter ( filter : . presetTag ( tag ) )
}
}
2025-05-11 14:15:14 +01:00
private func expandedPresetTagsFiltersView ( ) -> some View {
2024-12-20 11:43:11 +00:00
ForEach ( PresetTag . allCases , id : \ . id ) { tag in
if ( chatTagsModel . presetTags [ tag ] ? ? 0 ) > 0 {
2025-01-11 17:39:39 +07:00
expandedTagFilterView ( tag )
2024-12-19 10:48:26 +00:00
}
}
}
@ ViewBuilder private func collapsedTagsFilterView ( ) -> some View {
let selectedPresetTag : PresetTag ? = if case let . presetTag ( tag ) = chatTagsModel . activeFilter {
tag
} else {
nil
}
Menu {
2025-01-01 23:12:12 +00:00
if chatTagsModel . activeFilter != nil || ! searchText . isEmpty {
2024-12-19 10:48:26 +00:00
Button {
chatTagsModel . activeFilter = nil
2025-01-01 23:12:12 +00:00
searchText = " "
2024-12-19 10:48:26 +00:00
} label : {
HStack {
Image ( systemName : " list.bullet " )
Text ( " All " )
}
}
}
2024-12-20 11:43:11 +00:00
ForEach ( PresetTag . allCases , id : \ . id ) { tag in
2025-01-11 17:39:39 +07:00
if ( chatTagsModel . presetTags [ tag ] ? ? 0 ) > 0 && tag . с ollapse {
2024-12-20 11:43:11 +00:00
Button {
setActiveFilter ( filter : . presetTag ( tag ) )
} label : {
let ( systemName , text ) = presetTagLabel ( tag : tag , active : tag = = selectedPresetTag )
HStack {
Image ( systemName : systemName )
Text ( text )
}
2024-12-19 10:48:26 +00:00
}
}
}
} label : {
2025-01-11 17:39:39 +07:00
if let tag = selectedPresetTag , tag . с ollapse {
2024-12-19 10:48:26 +00:00
let ( systemName , _ ) = presetTagLabel ( tag : tag , active : true )
Image ( systemName : systemName )
. foregroundColor ( . accentColor )
} else {
Image ( systemName : " list.bullet " )
. foregroundColor ( . secondary )
}
}
. frame ( minWidth : 28 )
}
private func presetTagLabel ( tag : PresetTag , active : Bool ) -> ( String , LocalizedStringKey ) {
switch tag {
2025-01-11 17:39:39 +07:00
case . groupReports : ( active ? " flag.fill " : " flag " , " Reports " )
2024-12-19 10:48:26 +00:00
case . favorites : ( active ? " star.fill " : " star " , " Favorites " )
case . contacts : ( active ? " person.fill " : " person " , " Contacts " )
case . groups : ( active ? " person.2.fill " : " person.2 " , " Groups " )
case . business : ( active ? " briefcase.fill " : " briefcase " , " Businesses " )
2025-01-01 23:12:12 +00:00
case . notes : ( active ? " folder.fill " : " folder " , " Notes " )
2024-12-19 10:48:26 +00:00
}
}
2025-01-11 17:39:39 +07:00
2024-12-19 10:48:26 +00:00
private func setActiveFilter ( filter : ActiveFilter ) {
if filter != chatTagsModel . activeFilter {
chatTagsModel . activeFilter = filter
} else {
chatTagsModel . activeFilter = nil
}
}
}
2022-06-24 13:52:20 +01:00
func chatStoppedIcon ( ) -> some View {
Button {
AlertManager . shared . showAlertMsg (
title : " Chat is stopped " ,
message : " You can start chat via app Settings / Database or by restarting the app "
)
} label : {
Image ( systemName : " exclamationmark.octagon.fill " ) . foregroundColor ( . red )
}
}
2025-01-11 17:39:39 +07:00
func presetTagMatchesChat ( _ tag : PresetTag , _ chatInfo : ChatInfo , _ chatStats : ChatStats ) -> Bool {
2024-12-19 10:48:26 +00:00
switch tag {
2025-01-11 17:39:39 +07:00
case . groupReports :
chatStats . reportsCount > 0
2024-12-19 10:48:26 +00:00
case . favorites :
2024-12-20 11:43:11 +00:00
chatInfo . chatSettings ? . favorite = = true
2024-12-19 10:48:26 +00:00
case . contacts :
2024-12-20 11:43:11 +00:00
switch chatInfo {
2024-12-19 10:48:26 +00:00
case let . direct ( contact ) : ! ( contact . activeConn = = nil && contact . profile . contactLink != nil && contact . active ) && ! contact . chatDeleted
case . contactRequest : true
case . contactConnection : true
case let . group ( groupInfo ) : groupInfo . businessChat ? . chatType = = . customer
default : false
}
case . groups :
2024-12-20 11:43:11 +00:00
switch chatInfo {
2024-12-19 10:48:26 +00:00
case let . group ( groupInfo ) : groupInfo . businessChat = = nil
default : false
}
case . business :
2024-12-20 11:43:11 +00:00
chatInfo . groupInfo ? . businessChat ? . chatType = = . business
2025-01-01 23:12:12 +00:00
case . notes :
switch chatInfo {
case . local : true
default : false
}
2024-12-19 10:48:26 +00:00
}
}
2022-02-01 17:34:06 +00:00
struct ChatListView_Previews : PreviewProvider {
2024-10-07 20:30:17 +03:00
@ State static var userPickerSheet : UserPickerSheet ? = . none
2022-02-01 17:34:06 +00:00
static var previews : some View {
let chatModel = ChatModel ( )
2024-08-20 09:29:52 +01:00
chatModel . updateChats ( [
ChatData (
2022-02-08 09:19:25 +00:00
chatInfo : ChatInfo . sampleData . direct ,
chatItems : [ ChatItem . getSample ( 1 , . directSnd , . now , " hello " ) ]
2022-02-01 17:34:06 +00:00
) ,
2024-08-20 09:29:52 +01:00
ChatData (
2022-02-08 09:19:25 +00:00
chatInfo : ChatInfo . sampleData . group ,
chatItems : [ ChatItem . getSample ( 1 , . directSnd , . now , " Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. " ) ]
2022-02-01 17:34:06 +00:00
) ,
2024-08-20 09:29:52 +01:00
ChatData (
2022-02-08 09:19:25 +00:00
chatInfo : ChatInfo . sampleData . contactRequest ,
2022-02-01 17:34:06 +00:00
chatItems : [ ]
)
2024-08-20 09:29:52 +01:00
] )
2022-02-11 07:42:00 +00:00
return Group {
2024-10-07 20:30:17 +03:00
ChatListView ( activeUserPickerSheet : $ userPickerSheet )
2022-02-11 07:42:00 +00:00
. environmentObject ( chatModel )
2024-10-07 20:30:17 +03:00
ChatListView ( activeUserPickerSheet : $ userPickerSheet )
2022-02-11 07:42:00 +00:00
. environmentObject ( ChatModel ( ) )
}
2022-02-01 17:34:06 +00:00
}
}