mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Refactored ContactsView
This commit is contained in:
parent
0bc0eb8e19
commit
cd223dcf06
48 changed files with 384 additions and 420 deletions
|
|
@ -88,7 +88,6 @@ final class ContactsManager: ObservableObject {
|
|||
linphoneFriendList.displayName = self.linphoneAddressBookFriendList
|
||||
core.addFriendList(list: linphoneFriendList)
|
||||
}
|
||||
core.friendListSubscriptionEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -383,17 +382,13 @@ final class ContactsManager: ObservableObject {
|
|||
}
|
||||
|
||||
func addFriendListDelegate() {
|
||||
CoreContext.shared.mCore.friendListSubscriptionEnabled = true
|
||||
|
||||
CoreContext.shared.mCore.friendsLists.forEach { friendList in
|
||||
friendList.updateSubscriptions()
|
||||
}
|
||||
|
||||
if let friendListDelegate = self.friendListDelegate {
|
||||
CoreContext.shared.mCore.friendsLists.forEach { friendList in
|
||||
friendList.removeDelegate(delegate: friendListDelegate)
|
||||
}
|
||||
}
|
||||
|
||||
self.friendListDelegate = FriendListDelegateStub(
|
||||
let friendListDelegateTmp = FriendListDelegateStub(
|
||||
onContactCreated: { (friendList: FriendList, linphoneFriend: Friend) in
|
||||
Log.info("\(ContactsManager.TAG) FriendListDelegateStub onContactCreated")
|
||||
},
|
||||
|
|
@ -438,14 +433,13 @@ final class ContactsManager: ObservableObject {
|
|||
onPresenceReceived: { (friendList: FriendList, friends: [Friend?]) in
|
||||
Log.info("\(ContactsManager.TAG) FriendListDelegateStub onPresenceReceived \(friends.count)")
|
||||
},
|
||||
onNewSipAddressDiscovered: { (_: FriendList, linphoneFriend: Friend, sipUri: String) in
|
||||
onNewSipAddressDiscovered: { (friendList: FriendList, linphoneFriend: Friend, sipUri: String) in
|
||||
Log.info("\(ContactsManager.TAG) FriendListDelegateStub onNewSipAddressDiscovered \(linphoneFriend.name ?? "")")
|
||||
var addedAvatarListModel: [ContactAvatarModel] = []
|
||||
linphoneFriend.phoneNumbers.forEach { _ in
|
||||
let address = try? Factory.Instance.createAddress(addr: sipUri)
|
||||
if address != nil {
|
||||
if !self.avatarListModel.contains(where: {$0.friend?.name == linphoneFriend.name}) {
|
||||
if let address = try? Factory.Instance.createAddress(addr: sipUri) {
|
||||
linphoneFriend.edit()
|
||||
linphoneFriend.addAddress(address: address!)
|
||||
linphoneFriend.addAddress(address: address)
|
||||
linphoneFriend.done()
|
||||
|
||||
let addressTmp = linphoneFriend.address?.clone()?.asStringUriOnly() ?? ""
|
||||
|
|
@ -458,7 +452,12 @@ final class ContactsManager: ObservableObject {
|
|||
)
|
||||
)
|
||||
|
||||
addedAvatarListModel += self.avatarListModel
|
||||
addedAvatarListModel = addedAvatarListModel.sorted { $0.name < $1.name }
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.avatarListModel = addedAvatarListModel
|
||||
|
||||
NotificationCenter.default.post(
|
||||
name: NSNotification.Name("ContactAdded"),
|
||||
object: nil,
|
||||
|
|
@ -467,16 +466,11 @@ final class ContactsManager: ObservableObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.avatarListModel += addedAvatarListModel
|
||||
self.avatarListModel = self.avatarListModel.sorted { $0.name < $1.name }
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
CoreContext.shared.mCore.friendsLists.forEach { friendList in
|
||||
friendList.addDelegate(delegate: self.friendListDelegate!)
|
||||
friendList.addDelegate(delegate: friendListDelegateTmp)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import Firebase
|
|||
final class CoreContext: ObservableObject {
|
||||
|
||||
static let shared = CoreContext()
|
||||
private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
var pipViewModel = PIPViewModel()
|
||||
|
||||
var coreVersion: String = Core.getVersion
|
||||
|
|
@ -151,7 +150,7 @@ final class CoreContext: ObservableObject {
|
|||
let appName = Bundle.main.infoDictionary?["CFBundleName"] as? String
|
||||
let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
|
||||
|
||||
let userAgent = "\(appName ?? "Linphone")iOS/\(version ?? "6.0.0") Beta (\(UIDevice.current.localizedModel.replacingOccurrences(of: "'", with: ""))) LinphoneSDK"
|
||||
let userAgent = "LinphoneiOS/\(version ?? "6.0.0") Beta (\(UIDevice.current.localizedModel.replacingOccurrences(of: "'", with: ""))) LinphoneSDK"
|
||||
self.mCore.setUserAgent(name: userAgent, version: self.coreVersion)
|
||||
self.mCore.videoCaptureEnabled = true
|
||||
self.mCore.videoDisplayEnabled = true
|
||||
|
|
@ -372,7 +371,7 @@ final class CoreContext: ObservableObject {
|
|||
DispatchQueue.main.async {
|
||||
self.accounts = accountModels
|
||||
}
|
||||
}, onAccountRemoved: { (_: Core, _: Account) in
|
||||
}, onAccountRemoved: { (_: Core, acc: Account) in
|
||||
var accountModels: [AccountModel] = []
|
||||
for account in self.mCore.accountList {
|
||||
accountModels.append(AccountModel(account: account, core: self.mCore))
|
||||
|
|
|
|||
|
|
@ -128,11 +128,10 @@ struct LinphoneApp: App {
|
|||
@StateObject var navigationManager = NavigationManager()
|
||||
|
||||
@ObservedObject private var coreContext = CoreContext.shared
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@State var index: Int = 0
|
||||
|
||||
@State private var contactViewModel: ContactViewModel?
|
||||
/*
|
||||
@State private var editContactViewModel: EditContactViewModel?
|
||||
@State private var historyViewModel: HistoryViewModel?
|
||||
@State private var historyListViewModel: HistoryListViewModel?
|
||||
|
|
@ -146,6 +145,7 @@ struct LinphoneApp: App {
|
|||
@State private var meetingViewModel: MeetingViewModel?
|
||||
@State private var conversationForwardMessageViewModel: ConversationForwardMessageViewModel?
|
||||
@State private var accountProfileViewModel: AccountProfileViewModel?
|
||||
*/
|
||||
|
||||
@State private var pendingURL: URL?
|
||||
|
||||
|
|
@ -153,55 +153,40 @@ struct LinphoneApp: App {
|
|||
WindowGroup {
|
||||
if coreContext.coreHasStartedOnce {
|
||||
ZStack {
|
||||
if !sharedMainViewModel.welcomeViewDisplayed {
|
||||
if !SharedMainViewModel.shared.welcomeViewDisplayed {
|
||||
ZStack {
|
||||
WelcomeView()
|
||||
|
||||
ToastView()
|
||||
.zIndex(3)
|
||||
}
|
||||
} else if coreContext.accounts.isEmpty || sharedMainViewModel.displayProfileMode {
|
||||
} else if (coreContext.coreIsStarted && coreContext.accounts.isEmpty) || SharedMainViewModel.shared.displayProfileMode {
|
||||
ZStack {
|
||||
AssistantView()
|
||||
|
||||
ToastView()
|
||||
.zIndex(3)
|
||||
}
|
||||
} else if !coreContext.accounts.isEmpty
|
||||
&& contactViewModel != nil
|
||||
&& editContactViewModel != nil
|
||||
&& historyViewModel != nil
|
||||
&& historyListViewModel != nil
|
||||
&& startCallViewModel != nil
|
||||
&& startConversationViewModel != nil
|
||||
&& callViewModel != nil
|
||||
&& meetingWaitingRoomViewModel != nil
|
||||
&& conversationsListViewModel != nil
|
||||
&& conversationViewModel != nil
|
||||
&& meetingsListViewModel != nil
|
||||
&& meetingViewModel != nil
|
||||
&& conversationForwardMessageViewModel != nil
|
||||
&& accountProfileViewModel != nil {
|
||||
} else {
|
||||
ContentView(
|
||||
contactViewModel: contactViewModel!,
|
||||
editContactViewModel: editContactViewModel!,
|
||||
historyViewModel: historyViewModel!,
|
||||
historyListViewModel: historyListViewModel!,
|
||||
startCallViewModel: startCallViewModel!,
|
||||
startConversationViewModel: startConversationViewModel!,
|
||||
callViewModel: callViewModel!,
|
||||
meetingWaitingRoomViewModel: meetingWaitingRoomViewModel!,
|
||||
conversationsListViewModel: conversationsListViewModel!,
|
||||
conversationViewModel: conversationViewModel!,
|
||||
meetingsListViewModel: meetingsListViewModel!,
|
||||
meetingViewModel: meetingViewModel!,
|
||||
conversationForwardMessageViewModel: conversationForwardMessageViewModel!,
|
||||
accountProfileViewModel: accountProfileViewModel!,
|
||||
//editContactViewModel: editContactViewModel!,
|
||||
//historyViewModel: historyViewModel!,
|
||||
//historyListViewModel: historyListViewModel!,
|
||||
//startCallViewModel: startCallViewModel!,
|
||||
//startConversationViewModel: startConversationViewModel!,
|
||||
//callViewModel: callViewModel!,
|
||||
//meetingWaitingRoomViewModel: meetingWaitingRoomViewModel!,
|
||||
//conversationsListViewModel: conversationsListViewModel!,
|
||||
//conversationViewModel: conversationViewModel!,
|
||||
//meetingsListViewModel: meetingsListViewModel!,
|
||||
//meetingViewModel: meetingViewModel!,
|
||||
//conversationForwardMessageViewModel: conversationForwardMessageViewModel!,
|
||||
//accountProfileViewModel: accountProfileViewModel!,
|
||||
index: $index
|
||||
)
|
||||
.environmentObject(navigationManager)
|
||||
.onAppear {
|
||||
index = sharedMainViewModel.indexView
|
||||
index = SharedMainViewModel.shared.indexView
|
||||
// Link the navigation manager to the AppDelegate
|
||||
delegate.navigationManager = navigationManager
|
||||
|
||||
|
|
@ -211,10 +196,8 @@ struct LinphoneApp: App {
|
|||
navigationManager.openChatRoom(callId: callId, peerAddr: peerAddr, localAddr: localAddr)
|
||||
}
|
||||
|
||||
accountProfileViewModel!.setAvatarModel()
|
||||
//accountProfileViewModel!.setAvatarModel()
|
||||
}
|
||||
} else {
|
||||
SplashScreen()
|
||||
}
|
||||
|
||||
if coreContext.coreIsStarted {
|
||||
|
|
@ -238,22 +221,6 @@ struct LinphoneApp: App {
|
|||
}
|
||||
} else {
|
||||
SplashScreen()
|
||||
.onDisappear {
|
||||
contactViewModel = ContactViewModel()
|
||||
editContactViewModel = EditContactViewModel()
|
||||
historyViewModel = HistoryViewModel()
|
||||
historyListViewModel = HistoryListViewModel()
|
||||
startCallViewModel = StartCallViewModel()
|
||||
startConversationViewModel = StartConversationViewModel()
|
||||
callViewModel = CallViewModel()
|
||||
meetingWaitingRoomViewModel = MeetingWaitingRoomViewModel()
|
||||
conversationsListViewModel = ConversationsListViewModel()
|
||||
conversationViewModel = ConversationViewModel()
|
||||
meetingsListViewModel = MeetingsListViewModel()
|
||||
meetingViewModel = MeetingViewModel()
|
||||
conversationForwardMessageViewModel = ConversationForwardMessageViewModel()
|
||||
accountProfileViewModel = AccountProfileViewModel()
|
||||
}
|
||||
}
|
||||
}.onChange(of: scenePhase) { newPhase in
|
||||
if !TelecomManager.shared.callInProgress {
|
||||
|
|
|
|||
|
|
@ -21,11 +21,10 @@ import SwiftUI
|
|||
|
||||
struct AssistantView: View {
|
||||
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
@ObservedObject private var coreContext = CoreContext.shared
|
||||
|
||||
var body: some View {
|
||||
if sharedMainViewModel.displayProfileMode && coreContext.loggedIn {
|
||||
if SharedMainViewModel.shared.displayProfileMode && coreContext.loggedIn {
|
||||
ProfileModeFragment()
|
||||
} else {
|
||||
LoginFragment(accountLoginViewModel: AccountLoginViewModel())
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import SwiftUI
|
|||
struct LoginFragment: View {
|
||||
|
||||
@ObservedObject private var coreContext = CoreContext.shared
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
@ObservedObject var accountLoginViewModel: AccountLoginViewModel
|
||||
|
||||
@State private var isSecured: Bool = true
|
||||
|
|
@ -203,7 +202,7 @@ struct LoginFragment: View {
|
|||
.padding(.bottom)
|
||||
|
||||
Button(action: {
|
||||
sharedMainViewModel.changeDisplayProfileMode()
|
||||
SharedMainViewModel.shared.changeDisplayProfileMode()
|
||||
self.accountLoginViewModel.login()
|
||||
coreContext.loggingInProgress = true
|
||||
}, label: {
|
||||
|
|
@ -278,7 +277,7 @@ struct LoginFragment: View {
|
|||
.frame(maxWidth: .infinity)
|
||||
|
||||
})
|
||||
.disabled(!sharedMainViewModel.generalTermsAccepted)
|
||||
.disabled(!SharedMainViewModel.shared.generalTermsAccepted)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.cornerRadius(60)
|
||||
|
|
@ -291,7 +290,7 @@ struct LoginFragment: View {
|
|||
.simultaneousGesture(
|
||||
TapGesture().onEnded {
|
||||
self.linkActive = "SIP"
|
||||
if !sharedMainViewModel.generalTermsAccepted {
|
||||
if !SharedMainViewModel.shared.generalTermsAccepted {
|
||||
withAnimation {
|
||||
self.isShowPopup.toggle()
|
||||
}
|
||||
|
|
@ -301,7 +300,7 @@ struct LoginFragment: View {
|
|||
}
|
||||
)
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.padding(.horizontal, 20)
|
||||
|
||||
Spacer()
|
||||
|
|
@ -319,7 +318,7 @@ struct LoginFragment: View {
|
|||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
})
|
||||
.disabled(!sharedMainViewModel.generalTermsAccepted)
|
||||
.disabled(!SharedMainViewModel.shared.generalTermsAccepted)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background(Color.orangeMain500)
|
||||
|
|
@ -328,7 +327,7 @@ struct LoginFragment: View {
|
|||
.simultaneousGesture(
|
||||
TapGesture().onEnded {
|
||||
self.linkActive = "REG"
|
||||
if !sharedMainViewModel.generalTermsAccepted {
|
||||
if !SharedMainViewModel.shared.generalTermsAccepted {
|
||||
withAnimation {
|
||||
self.isShowPopup.toggle()
|
||||
}
|
||||
|
|
@ -352,7 +351,7 @@ struct LoginFragment: View {
|
|||
}
|
||||
|
||||
func acceptGeneralTerms() {
|
||||
sharedMainViewModel.changeGeneralTerms()
|
||||
SharedMainViewModel.shared.changeGeneralTerms()
|
||||
self.isShowPopup.toggle()
|
||||
switch linkActive {
|
||||
case "SIP":
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@ import SwiftUI
|
|||
|
||||
struct PermissionsFragment: View {
|
||||
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
var permissionManager = PermissionManager.shared
|
||||
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
|
@ -47,7 +45,7 @@ struct PermissionsFragment: View {
|
|||
.onReceive(permissionManager.$allPermissionsHaveBeenDisplayed, perform: { (granted) in
|
||||
if granted {
|
||||
withAnimation {
|
||||
sharedMainViewModel.changeWelcomeView()
|
||||
SharedMainViewModel.shared.changeWelcomeView()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -156,7 +154,7 @@ struct PermissionsFragment: View {
|
|||
}
|
||||
.padding(.bottom)
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.frame(maxHeight: .infinity)
|
||||
.padding(.horizontal, 20)
|
||||
|
||||
|
|
@ -164,7 +162,7 @@ struct PermissionsFragment: View {
|
|||
|
||||
Button(action: {
|
||||
withAnimation {
|
||||
sharedMainViewModel.changeWelcomeView()
|
||||
SharedMainViewModel.shared.changeWelcomeView()
|
||||
}
|
||||
}, label: {
|
||||
Text("assistant_permissions_skip_permissions")
|
||||
|
|
@ -180,7 +178,7 @@ struct PermissionsFragment: View {
|
|||
.inset(by: 0.5)
|
||||
.stroke(Color.orangeMain500, lineWidth: 1)
|
||||
)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.padding(.horizontal)
|
||||
|
||||
Button {
|
||||
|
|
@ -195,7 +193,7 @@ struct PermissionsFragment: View {
|
|||
.padding(.vertical, 10)
|
||||
.background(Color.orangeMain500)
|
||||
.cornerRadius(60)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.padding(.horizontal)
|
||||
.padding(.bottom)
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import SwiftUI
|
|||
|
||||
struct ProfileModeFragment: View {
|
||||
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@State var options: Int = 1
|
||||
@State private var isShowPopup = false
|
||||
|
|
@ -116,13 +115,13 @@ struct ProfileModeFragment: View {
|
|||
.background(Color.gray100)
|
||||
.cornerRadius(15)
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.padding()
|
||||
|
||||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
sharedMainViewModel.changeHideProfileMode()
|
||||
SharedMainViewModel.shared.changeHideProfileMode()
|
||||
}, label: {
|
||||
Text("dialog_continue")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
|
|
@ -135,14 +134,14 @@ struct ProfileModeFragment: View {
|
|||
.cornerRadius(60)
|
||||
.padding(.horizontal)
|
||||
.padding(.bottom, geometry.safeAreaInsets.bottom.isEqual(to: 0.0) ? 20 : 0)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
}
|
||||
.frame(minHeight: geometry.size.height)
|
||||
}
|
||||
.onAppear {
|
||||
UserDefaults.standard.set(false, forKey: "display_profile_mode")
|
||||
// Skip this view
|
||||
sharedMainViewModel.changeHideProfileMode()
|
||||
SharedMainViewModel.shared.changeHideProfileMode()
|
||||
}
|
||||
|
||||
if self.isShowPopup {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import SwiftUI
|
|||
struct QrCodeScannerFragment: View {
|
||||
|
||||
@ObservedObject private var coreContext = CoreContext.shared
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import SwiftUI
|
|||
|
||||
// swiftlint:disable line_length
|
||||
struct RegisterCodeConfirmationFragment: View {
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@ObservedObject var registerViewModel: RegisterViewModel
|
||||
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
|
@ -163,7 +163,7 @@ struct RegisterCodeConfirmationFragment: View {
|
|||
Spacer()
|
||||
Spacer()
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.padding(.horizontal, 20)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
import SwiftUI
|
||||
|
||||
struct RegisterFragment: View {
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@ObservedObject var registerViewModel: RegisterViewModel
|
||||
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
|
@ -307,7 +307,7 @@ struct RegisterFragment: View {
|
|||
.padding(.bottom)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.padding(.horizontal, 20)
|
||||
|
||||
Spacer()
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import SwiftUI
|
|||
|
||||
struct ThirdPartySipAccountLoginFragment: View {
|
||||
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
@ObservedObject private var coreContext = CoreContext.shared
|
||||
@ObservedObject var accountLoginViewModel: AccountLoginViewModel
|
||||
|
||||
|
|
@ -214,7 +213,7 @@ struct ThirdPartySipAccountLoginFragment: View {
|
|||
)
|
||||
.padding(.bottom)
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.padding(.horizontal, 20)
|
||||
|
||||
Spacer()
|
||||
|
|
@ -235,7 +234,7 @@ struct ThirdPartySipAccountLoginFragment: View {
|
|||
: Color.orangeMain500)
|
||||
.cornerRadius(60)
|
||||
.disabled(accountLoginViewModel.username.isEmpty || accountLoginViewModel.passwd.isEmpty || accountLoginViewModel.domain.isEmpty)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.padding(.horizontal)
|
||||
.padding(.bottom)
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import SwiftUI
|
|||
|
||||
struct ThirdPartySipAccountWarningFragment: View {
|
||||
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
@ObservedObject private var coreContext = CoreContext.shared
|
||||
@ObservedObject var accountLoginViewModel: AccountLoginViewModel
|
||||
|
||||
|
|
@ -135,7 +134,7 @@ struct ThirdPartySipAccountWarningFragment: View {
|
|||
}
|
||||
.padding(.vertical)
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.padding(.horizontal, 20)
|
||||
|
||||
Spacer()
|
||||
|
|
@ -156,7 +155,7 @@ struct ThirdPartySipAccountWarningFragment: View {
|
|||
.inset(by: 0.5)
|
||||
.stroke(Color.orangeMain500, lineWidth: 1)
|
||||
)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.padding(.horizontal)
|
||||
|
||||
NavigationLink(destination: {
|
||||
|
|
@ -172,7 +171,7 @@ struct ThirdPartySipAccountWarningFragment: View {
|
|||
.padding(.vertical, 10)
|
||||
.background(Color.orangeMain500)
|
||||
.cornerRadius(60)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.padding(.horizontal)
|
||||
.padding(.bottom)
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ struct QRScanner: UIViewControllerRepresentable {
|
|||
class Coordinator: NSObject, AVCaptureMetadataOutputObjectsDelegate {
|
||||
|
||||
private var coreContext = CoreContext.shared
|
||||
private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@Binding var scanResult: String
|
||||
private var lastResult: String = ""
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ struct CallView: View {
|
|||
}
|
||||
}
|
||||
|
||||
if isShowConversationFragment && conversationViewModel.displayedConversation != nil {
|
||||
if isShowConversationFragment && SharedMainViewModel.shared.displayedConversation != nil {
|
||||
ConversationFragment(
|
||||
conversationViewModel: conversationViewModel,
|
||||
conversationsListViewModel: conversationsListViewModel,
|
||||
|
|
@ -225,7 +225,7 @@ struct CallView: View {
|
|||
.zIndex(4)
|
||||
.transition(.move(edge: .bottom))
|
||||
.onDisappear {
|
||||
conversationViewModel.displayedConversation = nil
|
||||
SharedMainViewModel.shared.displayedConversation = nil
|
||||
isShowConversationFragment = false
|
||||
}
|
||||
}
|
||||
|
|
@ -2277,10 +2277,10 @@ struct CallView: View {
|
|||
.progressViewStyle(CircularProgressViewStyle(tint: .white))
|
||||
.frame(width: 32, height: 32, alignment: .center)
|
||||
.onDisappear {
|
||||
if callViewModel.displayedConversation != nil {
|
||||
if SharedMainViewModel.shared.displayedConversation != nil {
|
||||
indexPage = 2
|
||||
self.conversationViewModel.changeDisplayedChatRoom(conversationModel: callViewModel.displayedConversation!)
|
||||
callViewModel.displayedConversation = nil
|
||||
self.conversationViewModel.changeDisplayedChatRoom(conversationModel: SharedMainViewModel.shared.displayedConversation!)
|
||||
SharedMainViewModel.shared.displayedConversation = nil
|
||||
withAnimation {
|
||||
telecomManager.callDisplayed = false
|
||||
}
|
||||
|
|
@ -2648,8 +2648,8 @@ struct CallView: View {
|
|||
.progressViewStyle(CircularProgressViewStyle(tint: .white))
|
||||
.frame(width: 32, height: 32, alignment: .center)
|
||||
.onDisappear {
|
||||
if callViewModel.displayedConversation != nil {
|
||||
conversationViewModel.changeDisplayedChatRoom(conversationModel: callViewModel.displayedConversation!)
|
||||
if SharedMainViewModel.shared.displayedConversation != nil {
|
||||
conversationViewModel.changeDisplayedChatRoom(conversationModel: SharedMainViewModel.shared.displayedConversation!)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import Foundation
|
|||
struct ZRTPPopup: View {
|
||||
|
||||
@ObservedObject private var telecomManager = TelecomManager.shared
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@ObservedObject var callViewModel: CallViewModel
|
||||
|
||||
|
|
@ -293,7 +292,7 @@ struct ZRTPPopup: View {
|
|||
.padding(.horizontal, 2)
|
||||
.frame(maxHeight: .infinity)
|
||||
.shadow(color: callViewModel.cacheMismatch ? Color.orangeWarning600 : Color.blueInfo500, radius: 0, x: 0, y: 2)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth * 1.2)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth * 1.2)
|
||||
.position(x: geometry.size.width / 2, y: geometry.size.height / 2)
|
||||
.onAppear {
|
||||
callViewModel.remoteAuthenticationTokens()
|
||||
|
|
@ -388,7 +387,7 @@ struct ZRTPPopup: View {
|
|||
.padding(.horizontal, 2)
|
||||
.frame(maxHeight: .infinity)
|
||||
.shadow(color: Color.redDanger500, radius: 0, x: 0, y: 2)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth * 1.2)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth * 1.2)
|
||||
.position(x: geometry.size.width / 2, y: geometry.size.height / 2)
|
||||
.onAppear {
|
||||
callViewModel.remoteAuthenticationTokens()
|
||||
|
|
|
|||
|
|
@ -86,7 +86,6 @@ class CallViewModel: ObservableObject {
|
|||
@Published var letters4: String = "DD"
|
||||
|
||||
@Published var operationInProgress: Bool = false
|
||||
@Published var displayedConversation: ConversationModel?
|
||||
|
||||
private var chatRoomDelegate: ChatRoomDelegate?
|
||||
|
||||
|
|
@ -1176,7 +1175,7 @@ class CallViewModel: ObservableObject {
|
|||
|
||||
let model = ConversationModel(chatRoom: existingConversation!)
|
||||
DispatchQueue.main.async {
|
||||
self.displayedConversation = model
|
||||
SharedMainViewModel.shared.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1237,7 +1236,7 @@ class CallViewModel: ObservableObject {
|
|||
Log.info("\(CallViewModel.TAG) 1-1 conversation \(chatRoomId) has been created")
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
DispatchQueue.main.async {
|
||||
self.displayedConversation = model
|
||||
SharedMainViewModel.shared.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1250,7 +1249,7 @@ class CallViewModel: ObservableObject {
|
|||
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
DispatchQueue.main.async {
|
||||
self.displayedConversation = model
|
||||
SharedMainViewModel.shared.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
|
||||
|
|
@ -1332,12 +1331,12 @@ class CallViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
self.displayedConversation = model
|
||||
SharedMainViewModel.shared.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
self.displayedConversation = model
|
||||
SharedMainViewModel.shared.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
}
|
||||
|
|
@ -1373,12 +1372,12 @@ class CallViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
self.displayedConversation = model
|
||||
SharedMainViewModel.shared.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
self.displayedConversation = model
|
||||
SharedMainViewModel.shared.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,9 +21,7 @@ import SwiftUI
|
|||
|
||||
struct ContactsView: View {
|
||||
|
||||
@ObservedObject var contactViewModel: ContactViewModel
|
||||
@ObservedObject var historyViewModel: HistoryViewModel
|
||||
@ObservedObject var editContactViewModel: EditContactViewModel
|
||||
@EnvironmentObject var contactViewModel: ContactViewModel
|
||||
|
||||
@Binding var isShowEditContactFragment: Bool
|
||||
@Binding var isShowDeletePopup: Bool
|
||||
|
|
@ -36,8 +34,8 @@ struct ContactsView: View {
|
|||
|
||||
Button {
|
||||
withAnimation {
|
||||
editContactViewModel.selectedEditFriend = nil
|
||||
editContactViewModel.resetValues()
|
||||
contactViewModel.selectedEditFriend = nil
|
||||
//editContactViewModel.resetValues()
|
||||
isShowEditContactFragment.toggle()
|
||||
}
|
||||
} label: {
|
||||
|
|
@ -63,9 +61,9 @@ struct ContactsView: View {
|
|||
|
||||
#Preview {
|
||||
ContactsView(
|
||||
contactViewModel: ContactViewModel(),
|
||||
historyViewModel: HistoryViewModel(),
|
||||
editContactViewModel: EditContactViewModel(),
|
||||
//contactViewModel: ContactViewModel(),
|
||||
//historyViewModel: HistoryViewModel(),
|
||||
//editContactViewModel: EditContactViewModel(),
|
||||
isShowEditContactFragment: .constant(false),
|
||||
isShowDeletePopup: .constant(false),
|
||||
text: .constant("")
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ struct ContactFragment: View {
|
|||
@State private var showShareSheet = false
|
||||
|
||||
var body: some View {
|
||||
let indexDisplayed = contactViewModel.indexDisplayedFriend != nil ? contactViewModel.indexDisplayedFriend! : 0
|
||||
let indexDisplayed = SharedMainViewModel.shared.indexDisplayedFriend != nil ? SharedMainViewModel.shared.indexDisplayedFriend! : 0
|
||||
if ContactsManager.shared.avatarListModel.count > indexDisplayed {
|
||||
if #available(iOS 16.0, *), idiom != .pad {
|
||||
ContactInnerFragment(
|
||||
|
|
@ -58,7 +58,7 @@ struct ContactFragment: View {
|
|||
.presentationDetents([.fraction(0.2)])
|
||||
}
|
||||
.sheet(isPresented: $showShareSheet) {
|
||||
ShareSheet(friendToShare: ContactsManager.shared.lastSearch[contactViewModel.indexDisplayedFriend!].friend!)
|
||||
ShareSheet(friendToShare: ContactsManager.shared.lastSearch[SharedMainViewModel.shared.indexDisplayedFriend!].friend!)
|
||||
.presentationDetents([.medium])
|
||||
.edgesIgnoringSafeArea(.bottom)
|
||||
}
|
||||
|
|
@ -80,7 +80,7 @@ struct ContactFragment: View {
|
|||
ContactListBottomSheet(contactViewModel: contactViewModel, showingSheet: $showingSheet)
|
||||
} onDismiss: {}
|
||||
.sheet(isPresented: $showShareSheet) {
|
||||
ShareSheet(friendToShare: ContactsManager.shared.lastSearch[contactViewModel.indexDisplayedFriend!].friend!)
|
||||
ShareSheet(friendToShare: ContactsManager.shared.lastSearch[SharedMainViewModel.shared.indexDisplayedFriend!].friend!)
|
||||
.edgesIgnoringSafeArea(.bottom)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import linphonesw
|
|||
|
||||
struct ContactInnerFragment: View {
|
||||
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
@ObservedObject var contactsManager = ContactsManager.shared
|
||||
@ObservedObject private var telecomManager = TelecomManager.shared
|
||||
|
||||
|
|
@ -67,7 +66,7 @@ struct ContactInnerFragment: View {
|
|||
.padding(.leading, -10)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
contactViewModel.indexDisplayedFriend = nil
|
||||
SharedMainViewModel.shared.indexDisplayedFriend = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -118,7 +117,7 @@ struct ContactInnerFragment: View {
|
|||
VStack(spacing: 0) {
|
||||
VStack(spacing: 0) {
|
||||
VStack(spacing: 0) {
|
||||
if contactViewModel.indexDisplayedFriend != nil {
|
||||
if SharedMainViewModel.shared.indexDisplayedFriend != nil {
|
||||
Avatar(contactAvatarModel: contactAvatarModel, avatarSize: 100)
|
||||
|
||||
Text(contactAvatarModel.name)
|
||||
|
|
@ -258,7 +257,7 @@ struct ContactInnerFragment: View {
|
|||
actionEditButton: editNativeContact
|
||||
)
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@ struct ContactListBottomSheet: View {
|
|||
|
||||
private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom }
|
||||
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@ObservedObject var contactViewModel: ContactViewModel
|
||||
|
||||
@State private var orientation = UIDevice.current.orientation
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ struct ContactsListFragment: View {
|
|||
.background(.white)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
contactViewModel.indexDisplayedFriend = index
|
||||
SharedMainViewModel.shared.indexDisplayedFriend = index
|
||||
}
|
||||
|
||||
if index < contactsManager.lastSearch.count && contactsManager.lastSearch[index].friend != nil
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import linphonesw
|
|||
struct EditContactFragment: View {
|
||||
|
||||
@ObservedObject var editContactViewModel: EditContactViewModel
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
||||
|
|
@ -460,7 +459,7 @@ struct EditContactFragment: View {
|
|||
.focused($isJobTitleFocused)
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.padding(.horizontal)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
|
|
@ -536,7 +535,7 @@ struct EditContactFragment: View {
|
|||
let result = ContactsManager.shared.lastSearch.firstIndex(where: {
|
||||
$0.friend!.name == newContact.firstName + " " + newContact.lastName
|
||||
})
|
||||
contactViewModel.indexDisplayedFriend = result
|
||||
SharedMainViewModel.shared.indexDisplayedFriend = result
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ struct FavoriteContactsListFragment: View {
|
|||
.background(.white)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
contactViewModel.indexDisplayedFriend = index
|
||||
SharedMainViewModel.shared.indexDisplayedFriend = index
|
||||
}
|
||||
}
|
||||
.onLongPressGesture(minimumDuration: 0.2) {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import linphonesw
|
|||
struct SipAddressesPopup: View {
|
||||
|
||||
@ObservedObject private var telecomManager = TelecomManager.shared
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@ObservedObject var contactAvatarModel: ContactAvatarModel
|
||||
@ObservedObject var contactViewModel: ContactViewModel
|
||||
|
|
@ -97,7 +96,7 @@ struct SipAddressesPopup: View {
|
|||
.cornerRadius(20)
|
||||
.frame(maxHeight: .infinity)
|
||||
.shadow(color: Color.orangeMain500, radius: 0, x: 0, y: 2)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.position(x: geometry.size.width / 2, y: geometry.size.height / 2)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,7 @@ import SwiftUI
|
|||
|
||||
// swiftlint:disable line_length
|
||||
class ContactViewModel: ObservableObject {
|
||||
|
||||
@Published var indexDisplayedFriend: Int?
|
||||
@Published var selectedEditFriend: Friend?
|
||||
|
||||
var stringToCopy: String = ""
|
||||
|
||||
|
|
|
|||
|
|
@ -30,26 +30,25 @@ struct ContentView: View {
|
|||
@EnvironmentObject var navigationManager: NavigationManager
|
||||
|
||||
@ObservedObject private var coreContext = CoreContext.shared
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
@ObservedObject private var telecomManager = TelecomManager.shared
|
||||
|
||||
@ObservedObject var contactsManager = ContactsManager.shared
|
||||
var magicSearch = MagicSearchSingleton.shared
|
||||
|
||||
@ObservedObject var contactViewModel: ContactViewModel
|
||||
@ObservedObject var editContactViewModel: EditContactViewModel
|
||||
@ObservedObject var historyViewModel: HistoryViewModel
|
||||
@ObservedObject var historyListViewModel: HistoryListViewModel
|
||||
@ObservedObject var startCallViewModel: StartCallViewModel
|
||||
@ObservedObject var startConversationViewModel: StartConversationViewModel
|
||||
@ObservedObject var callViewModel: CallViewModel
|
||||
@ObservedObject var meetingWaitingRoomViewModel: MeetingWaitingRoomViewModel
|
||||
@ObservedObject var conversationsListViewModel: ConversationsListViewModel
|
||||
@ObservedObject var conversationViewModel: ConversationViewModel
|
||||
@ObservedObject var meetingsListViewModel: MeetingsListViewModel
|
||||
@ObservedObject var meetingViewModel: MeetingViewModel
|
||||
@ObservedObject var conversationForwardMessageViewModel: ConversationForwardMessageViewModel
|
||||
@ObservedObject var accountProfileViewModel: AccountProfileViewModel
|
||||
//@ObservedObject var editContactViewModel: EditContactViewModel
|
||||
|
||||
//@ObservedObject var historyViewModel: HistoryViewModel
|
||||
//@ObservedObject var historyListViewModel: HistoryListViewModel
|
||||
//@ObservedObject var startCallViewModel: StartCallViewModel
|
||||
//@ObservedObject var startConversationViewModel: StartConversationViewModel
|
||||
//@ObservedObject var callViewModel: CallViewModel
|
||||
//@ObservedObject var meetingWaitingRoomViewModel: MeetingWaitingRoomViewModel
|
||||
//@ObservedObject var conversationsListViewModel: ConversationsListViewModel
|
||||
//@ObservedObject var conversationViewModel: ConversationViewModel
|
||||
//@ObservedObject var meetingsListViewModel: MeetingsListViewModel
|
||||
//@ObservedObject var meetingViewModel: MeetingViewModel
|
||||
//@ObservedObject var conversationForwardMessageViewModel: ConversationForwardMessageViewModel
|
||||
//@ObservedObject var accountProfileViewModel: AccountProfileViewModel
|
||||
|
||||
@Binding var index: Int
|
||||
@State private var orientation = UIDevice.current.orientation
|
||||
|
|
@ -96,6 +95,7 @@ struct ContentView: View {
|
|||
.publisher(for: NSNotification.Name("CoreStarted"))
|
||||
GeometryReader { geometry in
|
||||
VStack(spacing: 0) {
|
||||
/*
|
||||
if (telecomManager.callInProgress && !fullscreenVideo && ((!telecomManager.callDisplayed && callViewModel.callsCounter == 1) || callViewModel.callsCounter > 1)) || isShowConversationFragment {
|
||||
HStack {
|
||||
Image("phone")
|
||||
|
|
@ -130,7 +130,7 @@ struct ContentView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
ZStack {
|
||||
VStack(spacing: 0) {
|
||||
HStack(spacing: 0) {
|
||||
|
|
@ -143,10 +143,10 @@ struct ContentView: View {
|
|||
|
||||
Button(action: {
|
||||
self.index = 0
|
||||
sharedMainViewModel.changeIndexView(indexViewInt: 0)
|
||||
historyViewModel.displayedCall = nil
|
||||
conversationViewModel.displayedConversation = nil
|
||||
meetingViewModel.displayedMeeting = nil
|
||||
SharedMainViewModel.shared.changeIndexView(indexViewInt: 0)
|
||||
SharedMainViewModel.shared.displayedCall = nil
|
||||
SharedMainViewModel.shared.displayedConversation = nil
|
||||
SharedMainViewModel.shared.displayedMeeting = nil
|
||||
}, label: {
|
||||
VStack {
|
||||
Image("address-book")
|
||||
|
|
@ -167,6 +167,7 @@ struct ContentView: View {
|
|||
.frame(height: geometry.size.height/4)
|
||||
|
||||
ZStack {
|
||||
/*
|
||||
if historyListViewModel.missedCallsCount > 0 {
|
||||
VStack {
|
||||
HStack {
|
||||
|
|
@ -186,16 +187,18 @@ struct ContentView: View {
|
|||
.padding(.bottom, 30)
|
||||
.padding(.leading, 30)
|
||||
}
|
||||
|
||||
*/
|
||||
Button(action: {
|
||||
self.index = 1
|
||||
sharedMainViewModel.changeIndexView(indexViewInt: 1)
|
||||
contactViewModel.indexDisplayedFriend = nil
|
||||
conversationViewModel.displayedConversation = nil
|
||||
meetingViewModel.displayedMeeting = nil
|
||||
SharedMainViewModel.shared.changeIndexView(indexViewInt: 1)
|
||||
SharedMainViewModel.shared.indexDisplayedFriend = nil
|
||||
SharedMainViewModel.shared.displayedConversation = nil
|
||||
SharedMainViewModel.shared.displayedMeeting = nil
|
||||
/*
|
||||
if historyListViewModel.missedCallsCount > 0 {
|
||||
historyListViewModel.resetMissedCallsCount()
|
||||
}
|
||||
*/
|
||||
}, label: {
|
||||
VStack {
|
||||
Image("phone")
|
||||
|
|
@ -217,6 +220,7 @@ struct ContentView: View {
|
|||
.frame(height: geometry.size.height/4)
|
||||
|
||||
ZStack {
|
||||
/*
|
||||
if conversationsListViewModel.unreadMessages > 0 {
|
||||
VStack {
|
||||
HStack {
|
||||
|
|
@ -236,13 +240,13 @@ struct ContentView: View {
|
|||
.padding(.bottom, 30)
|
||||
.padding(.leading, 30)
|
||||
}
|
||||
|
||||
*/
|
||||
Button(action: {
|
||||
self.index = 2
|
||||
sharedMainViewModel.changeIndexView(indexViewInt: 2)
|
||||
historyViewModel.displayedCall = nil
|
||||
contactViewModel.indexDisplayedFriend = nil
|
||||
meetingViewModel.displayedMeeting = nil
|
||||
SharedMainViewModel.shared.changeIndexView(indexViewInt: 2)
|
||||
SharedMainViewModel.shared.indexDisplayedFriend = nil
|
||||
SharedMainViewModel.shared.displayedCall = nil
|
||||
SharedMainViewModel.shared.displayedMeeting = nil
|
||||
}, label: {
|
||||
VStack {
|
||||
Image("chat-teardrop-text")
|
||||
|
|
@ -266,10 +270,10 @@ struct ContentView: View {
|
|||
|
||||
Button(action: {
|
||||
self.index = 3
|
||||
sharedMainViewModel.changeIndexView(indexViewInt: 3)
|
||||
contactViewModel.indexDisplayedFriend = nil
|
||||
historyViewModel.displayedCall = nil
|
||||
conversationViewModel.displayedConversation = nil
|
||||
SharedMainViewModel.shared.changeIndexView(indexViewInt: 3)
|
||||
SharedMainViewModel.shared.indexDisplayedFriend = nil
|
||||
SharedMainViewModel.shared.displayedCall = nil
|
||||
SharedMainViewModel.shared.displayedConversation = nil
|
||||
}, label: {
|
||||
VStack {
|
||||
Image("video-conference")
|
||||
|
|
@ -323,6 +327,7 @@ struct ContentView: View {
|
|||
VStack(spacing: 0) {
|
||||
if searchIsActive == false {
|
||||
HStack {
|
||||
/*
|
||||
if let accountModelIndex = accountProfileViewModel.accountModelIndex,
|
||||
accountModelIndex < CoreContext.shared.accounts.count {
|
||||
AsyncImage(url: imagePath) { image in
|
||||
|
|
@ -378,7 +383,7 @@ struct ContentView: View {
|
|||
if !username.isEmpty {
|
||||
let imagePathTmp = CoreContext.shared.accounts[accountModelIndex].getImagePath()
|
||||
if !(imagePathTmp.lastPathComponent.isEmpty || imagePathTmp.lastPathComponent == "Error" || imagePathTmp.lastPathComponent == "ImageError.png") {
|
||||
sharedMainViewModel.changeDefaultAvatar(defaultAvatarURL: imagePathTmp)
|
||||
SharedMainViewModel.shared.changeDefaultAvatar(defaultAvatarURL: imagePathTmp)
|
||||
imagePath = imagePathTmp
|
||||
}
|
||||
}
|
||||
|
|
@ -386,12 +391,12 @@ struct ContentView: View {
|
|||
.onReceive(imageChanged) { _ in
|
||||
if !CoreContext.shared.accounts[accountModelIndex].usernaneAvatar.isEmpty {
|
||||
let imagePathTmp = CoreContext.shared.accounts[accountModelIndex].getImagePath()
|
||||
sharedMainViewModel.changeDefaultAvatar(defaultAvatarURL: imagePathTmp)
|
||||
SharedMainViewModel.shared.changeDefaultAvatar(defaultAvatarURL: imagePathTmp)
|
||||
imagePath = imagePathTmp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
Text(String(localized: index == 0 ? "bottom_navigation_contacts_label" : (index == 1 ? "bottom_navigation_calls_label" : (index == 2 ? "bottom_navigation_conversations_label" : "bottom_navigation_meetings_label"))))
|
||||
.default_text_style_white_800(styleSize: 20)
|
||||
.padding(.leading, 10)
|
||||
|
|
@ -428,7 +433,7 @@ struct ContentView: View {
|
|||
Menu {
|
||||
if index == 0 {
|
||||
Button {
|
||||
contactViewModel.indexDisplayedFriend = nil
|
||||
SharedMainViewModel.shared.indexDisplayedFriend = nil
|
||||
isMenuOpen = false
|
||||
magicSearch.allContact = true
|
||||
MagicSearchSingleton.shared.searchForContacts(
|
||||
|
|
@ -447,7 +452,7 @@ struct ContentView: View {
|
|||
}
|
||||
|
||||
Button {
|
||||
contactViewModel.indexDisplayedFriend = nil
|
||||
SharedMainViewModel.shared.indexDisplayedFriend = nil
|
||||
isMenuOpen = false
|
||||
magicSearch.allContact = false
|
||||
MagicSearchSingleton.shared.searchForContacts(
|
||||
|
|
@ -515,12 +520,12 @@ struct ContentView: View {
|
|||
MagicSearchSingleton.shared.searchForContacts(
|
||||
sourceFlags: MagicSearch.Source.Friends.rawValue | MagicSearch.Source.LdapServers.rawValue)
|
||||
} else if index == 1 {
|
||||
historyListViewModel.resetFilterCallLogs()
|
||||
//historyListViewModel.resetFilterCallLogs()
|
||||
} else if index == 2 {
|
||||
conversationsListViewModel.resetFilterConversations()
|
||||
//conversationsListViewModel.resetFilterConversations()
|
||||
} else if index == 3 {
|
||||
meetingsListViewModel.currentFilter = ""
|
||||
meetingsListViewModel.computeMeetingsList()
|
||||
//meetingsListViewModel.currentFilter = ""
|
||||
//meetingsListViewModel.computeMeetingsList()
|
||||
}
|
||||
} label: {
|
||||
Image("caret-left")
|
||||
|
|
@ -562,19 +567,19 @@ struct ContentView: View {
|
|||
sourceFlags: MagicSearch.Source.Friends.rawValue | MagicSearch.Source.LdapServers.rawValue)
|
||||
} else if index == 1 {
|
||||
if text.isEmpty {
|
||||
historyListViewModel.resetFilterCallLogs()
|
||||
//historyListViewModel.resetFilterCallLogs()
|
||||
} else {
|
||||
historyListViewModel.filterCallLogs(filter: text)
|
||||
//historyListViewModel.filterCallLogs(filter: text)
|
||||
}
|
||||
} else if index == 2 {
|
||||
if text.isEmpty {
|
||||
conversationsListViewModel.resetFilterConversations()
|
||||
//conversationsListViewModel.resetFilterConversations()
|
||||
} else {
|
||||
conversationsListViewModel.filterConversations(filter: text)
|
||||
//conversationsListViewModel.filterConversations(filter: text)
|
||||
}
|
||||
} else if index == 3 {
|
||||
meetingsListViewModel.currentFilter = text
|
||||
meetingsListViewModel.computeMeetingsList()
|
||||
//meetingsListViewModel.currentFilter = text
|
||||
//meetingsListViewModel.computeMeetingsList()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -604,12 +609,12 @@ struct ContentView: View {
|
|||
MagicSearchSingleton.shared.searchForContacts(
|
||||
sourceFlags: MagicSearch.Source.Friends.rawValue | MagicSearch.Source.LdapServers.rawValue)
|
||||
} else if index == 1 {
|
||||
historyListViewModel.filterCallLogs(filter: text)
|
||||
//historyListViewModel.filterCallLogs(filter: text)
|
||||
} else if index == 2 {
|
||||
conversationsListViewModel.filterConversations(filter: text)
|
||||
//conversationsListViewModel.filterConversations(filter: text)
|
||||
} else if index == 3 {
|
||||
meetingsListViewModel.currentFilter = text
|
||||
meetingsListViewModel.computeMeetingsList()
|
||||
//meetingsListViewModel.currentFilter = text
|
||||
//meetingsListViewModel.computeMeetingsList()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -636,13 +641,14 @@ struct ContentView: View {
|
|||
|
||||
if self.index == 0 {
|
||||
ContactsView(
|
||||
contactViewModel: contactViewModel,
|
||||
historyViewModel: historyViewModel,
|
||||
editContactViewModel: editContactViewModel,
|
||||
//contactViewModel: contactViewModel,
|
||||
//historyViewModel: historyViewModel,
|
||||
//editContactViewModel: editContactViewModel,
|
||||
isShowEditContactFragment: $isShowEditContactFragment,
|
||||
isShowDeletePopup: $isShowDeleteContactPopup,
|
||||
text: $text
|
||||
)
|
||||
.environmentObject(ContactViewModel())
|
||||
.roundedCorner(25, corners: [.topRight, .topLeft])
|
||||
.shadow(
|
||||
color: (orientation == .landscapeLeft
|
||||
|
|
@ -653,6 +659,13 @@ struct ContentView: View {
|
|||
radius: 25
|
||||
)
|
||||
} else if self.index == 1 {
|
||||
//TODO a changer
|
||||
NavigationView {
|
||||
ZStack(alignment: .bottomTrailing) {
|
||||
}
|
||||
}
|
||||
.navigationViewStyle(.stack)
|
||||
/*
|
||||
HistoryView(
|
||||
historyListViewModel: historyListViewModel,
|
||||
historyViewModel: historyViewModel,
|
||||
|
|
@ -672,7 +685,15 @@ struct ContentView: View {
|
|||
: .black.opacity(0.2),
|
||||
radius: 25
|
||||
)
|
||||
*/
|
||||
} else if self.index == 2 {
|
||||
//TODO a changer
|
||||
NavigationView {
|
||||
ZStack(alignment: .bottomTrailing) {
|
||||
}
|
||||
}
|
||||
.navigationViewStyle(.stack)
|
||||
/*
|
||||
ConversationsView(
|
||||
conversationViewModel: conversationViewModel,
|
||||
conversationsListViewModel: conversationsListViewModel,
|
||||
|
|
@ -688,7 +709,15 @@ struct ContentView: View {
|
|||
: .black.opacity(0.2),
|
||||
radius: 25
|
||||
)
|
||||
*/
|
||||
} else if self.index == 3 {
|
||||
//TODO a changer
|
||||
NavigationView {
|
||||
ZStack(alignment: .bottomTrailing) {
|
||||
}
|
||||
}
|
||||
.navigationViewStyle(.stack)
|
||||
/*
|
||||
MeetingsView(
|
||||
meetingsListViewModel: meetingsListViewModel,
|
||||
meetingViewModel: meetingViewModel,
|
||||
|
|
@ -705,6 +734,7 @@ struct ContentView: View {
|
|||
: .black.opacity(0.2),
|
||||
radius: 25
|
||||
)
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -737,10 +767,10 @@ struct ContentView: View {
|
|||
Spacer()
|
||||
Button(action: {
|
||||
self.index = 0
|
||||
sharedMainViewModel.changeIndexView(indexViewInt: 0)
|
||||
historyViewModel.displayedCall = nil
|
||||
conversationViewModel.displayedConversation = nil
|
||||
meetingViewModel.displayedMeeting = nil
|
||||
SharedMainViewModel.shared.changeIndexView(indexViewInt: 0)
|
||||
SharedMainViewModel.shared.displayedCall = nil
|
||||
SharedMainViewModel.shared.displayedConversation = nil
|
||||
SharedMainViewModel.shared.displayedMeeting = nil
|
||||
}, label: {
|
||||
VStack {
|
||||
Image("address-book")
|
||||
|
|
@ -763,6 +793,7 @@ struct ContentView: View {
|
|||
Spacer()
|
||||
|
||||
ZStack {
|
||||
/*
|
||||
if historyListViewModel.missedCallsCount > 0 {
|
||||
VStack {
|
||||
HStack {
|
||||
|
|
@ -782,16 +813,18 @@ struct ContentView: View {
|
|||
.padding(.bottom, 30)
|
||||
.padding(.leading, 30)
|
||||
}
|
||||
|
||||
*/
|
||||
Button(action: {
|
||||
self.index = 1
|
||||
sharedMainViewModel.changeIndexView(indexViewInt: 1)
|
||||
contactViewModel.indexDisplayedFriend = nil
|
||||
conversationViewModel.displayedConversation = nil
|
||||
meetingViewModel.displayedMeeting = nil
|
||||
SharedMainViewModel.shared.changeIndexView(indexViewInt: 1)
|
||||
SharedMainViewModel.shared.indexDisplayedFriend = nil
|
||||
SharedMainViewModel.shared.displayedConversation = nil
|
||||
SharedMainViewModel.shared.displayedMeeting = nil
|
||||
/*
|
||||
if historyListViewModel.missedCallsCount > 0 {
|
||||
historyListViewModel.resetMissedCallsCount()
|
||||
}
|
||||
*/
|
||||
}, label: {
|
||||
VStack {
|
||||
Image("phone")
|
||||
|
|
@ -815,6 +848,7 @@ struct ContentView: View {
|
|||
Spacer()
|
||||
|
||||
ZStack {
|
||||
/*
|
||||
if conversationsListViewModel.unreadMessages > 0 {
|
||||
VStack {
|
||||
HStack {
|
||||
|
|
@ -834,13 +868,13 @@ struct ContentView: View {
|
|||
.padding(.bottom, 30)
|
||||
.padding(.leading, 30)
|
||||
}
|
||||
|
||||
*/
|
||||
Button(action: {
|
||||
self.index = 2
|
||||
sharedMainViewModel.changeIndexView(indexViewInt: 2)
|
||||
historyViewModel.displayedCall = nil
|
||||
contactViewModel.indexDisplayedFriend = nil
|
||||
meetingViewModel.displayedMeeting = nil
|
||||
SharedMainViewModel.shared.changeIndexView(indexViewInt: 2)
|
||||
SharedMainViewModel.shared.indexDisplayedFriend = nil
|
||||
SharedMainViewModel.shared.displayedCall = nil
|
||||
SharedMainViewModel.shared.displayedMeeting = nil
|
||||
}, label: {
|
||||
VStack {
|
||||
Image("chat-teardrop-text")
|
||||
|
|
@ -865,10 +899,10 @@ struct ContentView: View {
|
|||
Spacer()
|
||||
Button(action: {
|
||||
self.index = 3
|
||||
sharedMainViewModel.changeIndexView(indexViewInt: 3)
|
||||
contactViewModel.indexDisplayedFriend = nil
|
||||
historyViewModel.displayedCall = nil
|
||||
conversationViewModel.displayedConversation = nil
|
||||
SharedMainViewModel.shared.changeIndexView(indexViewInt: 3)
|
||||
SharedMainViewModel.shared.indexDisplayedFriend = nil
|
||||
SharedMainViewModel.shared.displayedCall = nil
|
||||
SharedMainViewModel.shared.displayedConversation = nil
|
||||
}, label: {
|
||||
VStack {
|
||||
Image("video-conference")
|
||||
|
|
@ -900,8 +934,8 @@ struct ContentView: View {
|
|||
}
|
||||
}
|
||||
|
||||
if contactViewModel.indexDisplayedFriend != nil || historyViewModel.displayedCall != nil || conversationViewModel.displayedConversation != nil ||
|
||||
meetingViewModel.displayedMeeting != nil {
|
||||
if SharedMainViewModel.shared.indexDisplayedFriend != nil || SharedMainViewModel.shared.displayedCall != nil || SharedMainViewModel.shared.displayedConversation != nil ||
|
||||
SharedMainViewModel.shared.displayedMeeting != nil {
|
||||
HStack(spacing: 0) {
|
||||
Spacer()
|
||||
.frame(maxWidth:
|
||||
|
|
@ -912,6 +946,7 @@ struct ContentView: View {
|
|||
: 0
|
||||
)
|
||||
if self.index == 0 {
|
||||
/*
|
||||
ContactFragment(
|
||||
contactViewModel: contactViewModel,
|
||||
editContactViewModel: editContactViewModel,
|
||||
|
|
@ -924,10 +959,12 @@ struct ContentView: View {
|
|||
.frame(maxWidth: .infinity)
|
||||
.background(Color.gray100)
|
||||
.ignoresSafeArea(.keyboard)
|
||||
*/
|
||||
} else if self.index == 1 {
|
||||
if historyViewModel.displayedCall != nil && historyViewModel.displayedCall!.avatarModel != nil {
|
||||
/*
|
||||
if SharedMainViewModel.shared.displayedCall != nil && SharedMainViewModel.shared.displayedCall!.avatarModel != nil {
|
||||
HistoryContactFragment(
|
||||
contactAvatarModel: historyViewModel.displayedCall!.avatarModel!,
|
||||
contactAvatarModel: SharedMainViewModel.shared.displayedCall!.avatarModel!,
|
||||
historyViewModel: historyViewModel,
|
||||
historyListViewModel: historyListViewModel,
|
||||
contactViewModel: contactViewModel,
|
||||
|
|
@ -940,7 +977,9 @@ struct ContentView: View {
|
|||
.background(Color.gray100)
|
||||
.ignoresSafeArea(.keyboard)
|
||||
}
|
||||
*/
|
||||
} else if self.index == 2 {
|
||||
/*
|
||||
ConversationFragment(
|
||||
conversationViewModel: conversationViewModel,
|
||||
conversationsListViewModel: conversationsListViewModel,
|
||||
|
|
@ -958,11 +997,14 @@ struct ContentView: View {
|
|||
.frame(maxWidth: .infinity)
|
||||
.background(Color.gray100)
|
||||
.ignoresSafeArea(.keyboard)
|
||||
*/
|
||||
} else if self.index == 3 {
|
||||
/*
|
||||
MeetingFragment(meetingViewModel: meetingViewModel, meetingsListViewModel: meetingsListViewModel, isShowScheduleMeetingFragment: $isShowScheduleMeetingFragment, isShowSendCancelMeetingNotificationPopup: $isShowSendCancelMeetingNotificationPopup)
|
||||
.frame(maxWidth: .infinity)
|
||||
.background(Color.gray100)
|
||||
.ignoresSafeArea(.keyboard)
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -990,6 +1032,7 @@ struct ContentView: View {
|
|||
.zIndex(1)
|
||||
}
|
||||
|
||||
/*
|
||||
SideMenu(
|
||||
accountProfileViewModel: accountProfileViewModel,
|
||||
width: geometry.size.width / 5 * 4,
|
||||
|
|
@ -1029,7 +1072,7 @@ struct ContentView: View {
|
|||
.zIndex(3)
|
||||
.transition(.opacity.combined(with: .move(edge: .bottom)))
|
||||
.onAppear {
|
||||
contactViewModel.indexDisplayedFriend = nil
|
||||
SharedMainViewModel.shared.indexDisplayedFriend = nil
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1091,8 +1134,8 @@ struct ContentView: View {
|
|||
PopupView(isShowPopup: $isShowDeleteContactPopup,
|
||||
title: Text(String(format: String(localized: "contact_dialog_delete_title"),contactViewModel.selectedFriend != nil
|
||||
? contactViewModel.selectedFriend!.name!
|
||||
: (contactViewModel.indexDisplayedFriend != nil
|
||||
? contactsManager.lastSearch[contactViewModel.indexDisplayedFriend!].friend!.name!
|
||||
: (SharedMainViewModel.shared.indexDisplayedFriend != nil
|
||||
? contactsManager.lastSearch[SharedMainViewModel.shared.indexDisplayedFriend!].friend!.name!
|
||||
: "Error Name"))),
|
||||
content: Text("contact_dialog_delete_message"),
|
||||
titleFirstButton: Text("dialog_cancel"),
|
||||
|
|
@ -1101,16 +1144,16 @@ struct ContentView: View {
|
|||
titleSecondButton: Text("dialog_ok"),
|
||||
actionSecondButton: {
|
||||
if contactViewModel.selectedFriendToDelete != nil {
|
||||
if contactViewModel.indexDisplayedFriend != nil {
|
||||
if SharedMainViewModel.shared.indexDisplayedFriend != nil {
|
||||
withAnimation {
|
||||
contactViewModel.indexDisplayedFriend = nil
|
||||
SharedMainViewModel.shared.indexDisplayedFriend = nil
|
||||
}
|
||||
}
|
||||
contactViewModel.selectedFriendToDelete!.remove()
|
||||
} else if contactViewModel.indexDisplayedFriend != nil {
|
||||
let tmpIndex = contactViewModel.indexDisplayedFriend
|
||||
} else if SharedMainViewModel.shared.indexDisplayedFriend != nil {
|
||||
let tmpIndex = SharedMainViewModel.shared.indexDisplayedFriend
|
||||
withAnimation {
|
||||
contactViewModel.indexDisplayedFriend = nil
|
||||
SharedMainViewModel.shared.indexDisplayedFriend = nil
|
||||
}
|
||||
contactsManager.lastSearch[tmpIndex!].friend!.remove()
|
||||
}
|
||||
|
|
@ -1141,7 +1184,7 @@ struct ContentView: View {
|
|||
actionSecondButton: {
|
||||
historyListViewModel.removeCallLogs()
|
||||
self.isShowDeleteAllHistoryPopup.toggle()
|
||||
historyViewModel.displayedCall = nil
|
||||
SharedMainViewModel.shared.displayedCall = nil
|
||||
|
||||
ToastViewModel.shared.toastMessage = "Success_remove_call_logs"
|
||||
ToastViewModel.shared.displayToast.toggle()
|
||||
|
|
@ -1185,7 +1228,7 @@ struct ContentView: View {
|
|||
|
||||
if isShowSipAddressesPopup {
|
||||
SipAddressesPopup(
|
||||
contactAvatarModel: ContactsManager.shared.avatarListModel[contactViewModel.indexDisplayedFriend != nil ? contactViewModel.indexDisplayedFriend! : 0],
|
||||
contactAvatarModel: ContactsManager.shared.avatarListModel[SharedMainViewModel.shared.indexDisplayedFriend != nil ? SharedMainViewModel.shared.indexDisplayedFriend! : 0],
|
||||
contactViewModel: contactViewModel,
|
||||
isShowSipAddressesPopup: $isShowSipAddressesPopup,
|
||||
isShowSipAddressesPopupType: $isShowSipAddressesPopupType
|
||||
|
|
@ -1203,10 +1246,10 @@ struct ContentView: View {
|
|||
.zIndex(3)
|
||||
.onDisappear {
|
||||
if contactViewModel.displayedConversation != nil {
|
||||
contactViewModel.indexDisplayedFriend = nil
|
||||
historyViewModel.displayedCall = nil
|
||||
SharedMainViewModel.shared.indexDisplayedFriend = nil
|
||||
SharedMainViewModel.shared.displayedCall = nil
|
||||
index = 2
|
||||
sharedMainViewModel.changeIndexView(indexViewInt: 2)
|
||||
SharedMainViewModel.shared.changeIndexView(indexViewInt: 2)
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
withAnimation {
|
||||
self.conversationViewModel.changeDisplayedChatRoom(conversationModel: contactViewModel.displayedConversation!)
|
||||
|
|
@ -1263,13 +1306,13 @@ struct ContentView: View {
|
|||
content: Text("meeting_schedule_cancel_dialog_message"),
|
||||
titleFirstButton: Text("dialog_cancel"),
|
||||
actionFirstButton: {
|
||||
meetingViewModel.displayedMeeting = nil
|
||||
SharedMainViewModel.shared.displayedMeeting = nil
|
||||
meetingsListViewModel.deleteSelectedMeeting()
|
||||
self.isShowSendCancelMeetingNotificationPopup.toggle(
|
||||
) },
|
||||
titleSecondButton: Text("dialog_ok"),
|
||||
actionSecondButton: {
|
||||
meetingViewModel.displayedMeeting = nil
|
||||
SharedMainViewModel.shared.displayedMeeting = nil
|
||||
if let meetingToDelete = self.meetingsListViewModel.selectedMeetingToDelete {
|
||||
self.meetingViewModel.cancelMeetingWithNotifications(meeting: meetingToDelete)
|
||||
meetingsListViewModel.deleteSelectedMeeting()
|
||||
|
|
@ -1294,8 +1337,8 @@ struct ContentView: View {
|
|||
},
|
||||
titleSecondButton: Text("dialog_ok"),
|
||||
actionSecondButton: {
|
||||
if conversationViewModel.displayedConversation != nil {
|
||||
conversationViewModel.displayedConversation!.createGroupCall()
|
||||
if SharedMainViewModel.shared.displayedConversation != nil {
|
||||
SharedMainViewModel.shared.displayedConversation!.createGroupCall()
|
||||
}
|
||||
self.isShowStartCallGroupPopup.toggle()
|
||||
}
|
||||
|
|
@ -1318,8 +1361,8 @@ struct ContentView: View {
|
|||
},
|
||||
titleSecondButton: Text("dialog_ok"),
|
||||
actionSecondButton: {
|
||||
if conversationViewModel.displayedConversation != nil {
|
||||
conversationViewModel.displayedConversation!.createGroupCall()
|
||||
if SharedMainViewModel.shared.displayedConversation != nil {
|
||||
SharedMainViewModel.shared.displayedConversation!.createGroupCall()
|
||||
}
|
||||
self.isShowStartCallGroupPopup.toggle()
|
||||
}
|
||||
|
|
@ -1382,7 +1425,7 @@ struct ContentView: View {
|
|||
UIApplication.shared.isIdleTimerDisabled = false
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
ToastView()
|
||||
.zIndex(6)
|
||||
}
|
||||
|
|
@ -1390,18 +1433,18 @@ struct ContentView: View {
|
|||
.onChange(of: navigationManager.selectedCallId) { newCallId in
|
||||
if newCallId != nil {
|
||||
self.index = 2
|
||||
sharedMainViewModel.changeIndexView(indexViewInt: 2)
|
||||
SharedMainViewModel.shared.changeIndexView(indexViewInt: 2)
|
||||
}
|
||||
}
|
||||
.onReceive(contactLoaded) { _ in
|
||||
conversationsListViewModel.updateChatRoomsList()
|
||||
historyListViewModel.refreshHistoryAvatarModel()
|
||||
//conversationsListViewModel.updateChatRoomsList()
|
||||
//historyListViewModel.refreshHistoryAvatarModel()
|
||||
}
|
||||
.onReceive(contactAdded) { address in
|
||||
conversationsListViewModel.updateChatRoom(address: address)
|
||||
//conversationsListViewModel.updateChatRoom(address: address)
|
||||
}
|
||||
.onReceive(coreStarted) { _ in
|
||||
accountProfileViewModel.setAvatarModel()
|
||||
//accountProfileViewModel.setAvatarModel()
|
||||
}
|
||||
}
|
||||
.overlay {
|
||||
|
|
@ -1415,17 +1458,19 @@ struct ContentView: View {
|
|||
}
|
||||
}
|
||||
.onRotate { newOrientation in
|
||||
if (contactViewModel.indexDisplayedFriend != nil || historyViewModel.displayedCall != nil || conversationViewModel.displayedConversation != nil) && searchIsActive {
|
||||
/*
|
||||
if (SharedMainViewModel.shared.indexDisplayedFriend != nil || SharedMainViewModel.shared.displayedCall != nil || SharedMainViewModel.shared.displayedConversation != nil) && searchIsActive {
|
||||
self.focusedField = false
|
||||
} else if searchIsActive {
|
||||
self.focusedField = true
|
||||
}
|
||||
*/
|
||||
orientation = newOrientation
|
||||
}
|
||||
.onChange(of: scenePhase) { newPhase in
|
||||
orientation = UIDevice.current.orientation
|
||||
if newPhase == .active {
|
||||
conversationsListViewModel.computeChatRoomsList()
|
||||
//conversationsListViewModel.computeChatRoomsList()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1451,20 +1496,20 @@ class NavigationManager: ObservableObject {
|
|||
|
||||
#Preview {
|
||||
ContentView(
|
||||
contactViewModel: ContactViewModel(),
|
||||
editContactViewModel: EditContactViewModel(),
|
||||
historyViewModel: HistoryViewModel(),
|
||||
historyListViewModel: HistoryListViewModel(),
|
||||
startCallViewModel: StartCallViewModel(),
|
||||
startConversationViewModel: StartConversationViewModel(),
|
||||
callViewModel: CallViewModel(),
|
||||
meetingWaitingRoomViewModel: MeetingWaitingRoomViewModel(),
|
||||
conversationsListViewModel: ConversationsListViewModel(),
|
||||
conversationViewModel: ConversationViewModel(),
|
||||
meetingsListViewModel: MeetingsListViewModel(),
|
||||
meetingViewModel: MeetingViewModel(),
|
||||
conversationForwardMessageViewModel: ConversationForwardMessageViewModel(),
|
||||
accountProfileViewModel: AccountProfileViewModel(),
|
||||
//contactViewModel: ContactViewModel(),
|
||||
//editContactViewModel: EditContactViewModel(),
|
||||
//historyViewModel: HistoryViewModel(),
|
||||
//historyListViewModel: HistoryListViewModel(),
|
||||
//startCallViewModel: StartCallViewModel(),
|
||||
//startConversationViewModel: StartConversationViewModel(),
|
||||
//callViewModel: CallViewModel(),
|
||||
//meetingWaitingRoomViewModel: MeetingWaitingRoomViewModel(),
|
||||
//conversationsListViewModel: ConversationsListViewModel(),
|
||||
//conversationViewModel: ConversationViewModel(),
|
||||
//meetingsListViewModel: MeetingsListViewModel(),
|
||||
//meetingViewModel: MeetingViewModel(),
|
||||
//conversationForwardMessageViewModel: ConversationForwardMessageViewModel(),
|
||||
//accountProfileViewModel: AccountProfileViewModel(),
|
||||
index: .constant(0)
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,6 @@ struct ChatBubbleView: View {
|
|||
|
||||
private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom }
|
||||
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@ObservedObject var conversationViewModel: ConversationViewModel
|
||||
|
||||
let eventLogMessage: EventLogMessage
|
||||
|
|
@ -58,7 +56,7 @@ struct ChatBubbleView: View {
|
|||
if eventLogMessage.message.isOutgoing {
|
||||
Spacer()
|
||||
}
|
||||
if conversationViewModel.displayedConversation != nil && conversationViewModel.displayedConversation!.isGroup
|
||||
if SharedMainViewModel.shared.displayedConversation != nil && SharedMainViewModel.shared.displayedConversation!.isGroup
|
||||
&& !eventLogMessage.message.isOutgoing && eventLogMessage.message.isFirstMessage {
|
||||
VStack {
|
||||
Avatar(
|
||||
|
|
@ -68,15 +66,15 @@ struct ChatBubbleView: View {
|
|||
)
|
||||
.padding(.top, 30)
|
||||
}
|
||||
} else if conversationViewModel.displayedConversation != nil
|
||||
&& conversationViewModel.displayedConversation!.isGroup && !eventLogMessage.message.isOutgoing {
|
||||
} else if SharedMainViewModel.shared.displayedConversation != nil
|
||||
&& SharedMainViewModel.shared.displayedConversation!.isGroup && !eventLogMessage.message.isOutgoing {
|
||||
VStack {
|
||||
}
|
||||
.padding(.leading, 43)
|
||||
}
|
||||
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
if conversationViewModel.displayedConversation != nil && conversationViewModel.displayedConversation!.isGroup
|
||||
if SharedMainViewModel.shared.displayedConversation != nil && SharedMainViewModel.shared.displayedConversation!.isGroup
|
||||
&& !eventLogMessage.message.isOutgoing && eventLogMessage.message.isFirstMessage {
|
||||
Text(conversationViewModel.participantConversationModel.first(where: {$0.address == eventLogMessage.message.address})?.name ?? "")
|
||||
.default_text_style(styleSize: 12)
|
||||
|
|
@ -332,7 +330,7 @@ struct ChatBubbleView: View {
|
|||
.padding(.top, 1)
|
||||
.padding(.trailing, -4)
|
||||
|
||||
if (conversationViewModel.displayedConversation != nil && conversationViewModel.displayedConversation!.isGroup)
|
||||
if (SharedMainViewModel.shared.displayedConversation != nil && SharedMainViewModel.shared.displayedConversation!.isGroup)
|
||||
|| eventLogMessage.message.isOutgoing {
|
||||
if eventLogMessage.message.status == .sending {
|
||||
ProgressView()
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import SwiftUI
|
|||
import linphonesw
|
||||
|
||||
struct ConversationForwardMessageFragment: View {
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@ObservedObject var contactsManager = ContactsManager.shared
|
||||
@ObservedObject var magicSearch = MagicSearchSingleton.shared
|
||||
|
|
@ -210,7 +209,7 @@ struct ConversationForwardMessageFragment: View {
|
|||
isShowConversationForwardMessageFragment = false
|
||||
|
||||
if conversationForwardMessageViewModel.displayedConversation != nil {
|
||||
if conversationViewModel.displayedConversation != nil {
|
||||
if SharedMainViewModel.shared.displayedConversation != nil {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
self.conversationViewModel.changeDisplayedChatRoom(conversationModel: conversationForwardMessageViewModel.displayedConversation!)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ struct ConversationFragment: View {
|
|||
@EnvironmentObject var navigationManager: NavigationManager
|
||||
|
||||
@ObservedObject var contactsManager = ContactsManager.shared
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@ObservedObject var conversationViewModel: ConversationViewModel
|
||||
@ObservedObject var conversationsListViewModel: ConversationsListViewModel
|
||||
|
|
@ -89,7 +88,7 @@ struct ConversationFragment: View {
|
|||
orientation = newOrientation
|
||||
}
|
||||
.onAppear {
|
||||
displayedChatroomPeerAddr = conversationViewModel.displayedConversation?.remoteSipUri
|
||||
displayedChatroomPeerAddr = SharedMainViewModel.shared.displayedConversation?.remoteSipUri
|
||||
}
|
||||
.onDisappear {
|
||||
displayedChatroomPeerAddr = nil
|
||||
|
|
@ -150,7 +149,7 @@ struct ConversationFragment: View {
|
|||
orientation = newOrientation
|
||||
}
|
||||
.onAppear {
|
||||
displayedChatroomPeerAddr = conversationViewModel.displayedConversation?.remoteSipUri
|
||||
displayedChatroomPeerAddr = SharedMainViewModel.shared.displayedConversation?.remoteSipUri
|
||||
}
|
||||
.onDisappear {
|
||||
displayedChatroomPeerAddr = nil
|
||||
|
|
@ -187,7 +186,7 @@ struct ConversationFragment: View {
|
|||
}
|
||||
.onChange(of: scenePhase) { newPhase in
|
||||
if newPhase == .active {
|
||||
if conversationViewModel.displayedConversation != nil && (navigationManager.peerAddr == nil || navigationManager.peerAddr!.contains(conversationViewModel.displayedConversation!.remoteSipUri)) {
|
||||
if SharedMainViewModel.shared.displayedConversation != nil && (navigationManager.peerAddr == nil || navigationManager.peerAddr!.contains(SharedMainViewModel.shared.displayedConversation!.remoteSipUri)) {
|
||||
conversationViewModel.resetDisplayedChatRoom()
|
||||
}
|
||||
}
|
||||
|
|
@ -202,7 +201,7 @@ struct ConversationFragment: View {
|
|||
func innerView(geometry: GeometryProxy) -> some View {
|
||||
ZStack {
|
||||
VStack(spacing: 1) {
|
||||
if conversationViewModel.displayedConversation != nil {
|
||||
if SharedMainViewModel.shared.displayedConversation != nil {
|
||||
Rectangle()
|
||||
.foregroundColor(Color.orangeMain500)
|
||||
.edgesIgnoringSafeArea(.top)
|
||||
|
|
@ -224,16 +223,16 @@ struct ConversationFragment: View {
|
|||
if isShowConversationFragment {
|
||||
isShowConversationFragment = false
|
||||
}
|
||||
conversationViewModel.displayedConversation = nil
|
||||
SharedMainViewModel.shared.displayedConversation = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Avatar(contactAvatarModel: conversationViewModel.displayedConversation!.avatarModel, avatarSize: 50)
|
||||
Avatar(contactAvatarModel: SharedMainViewModel.shared.displayedConversation!.avatarModel, avatarSize: 50)
|
||||
.padding(.top, 4)
|
||||
|
||||
VStack(spacing: 1) {
|
||||
Text(conversationViewModel.displayedConversation!.subject)
|
||||
Text(SharedMainViewModel.shared.displayedConversation!.subject)
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding(.top, 4)
|
||||
|
|
@ -277,12 +276,12 @@ struct ConversationFragment: View {
|
|||
|
||||
Spacer()
|
||||
|
||||
if !conversationViewModel.displayedConversation!.isReadOnly {
|
||||
if !SharedMainViewModel.shared.displayedConversation!.isReadOnly {
|
||||
Button {
|
||||
if conversationViewModel.displayedConversation!.isGroup {
|
||||
if SharedMainViewModel.shared.displayedConversation!.isGroup {
|
||||
isShowStartCallGroupPopup.toggle()
|
||||
} else {
|
||||
conversationViewModel.displayedConversation!.call()
|
||||
SharedMainViewModel.shared.displayedConversation!.call()
|
||||
}
|
||||
} label: {
|
||||
Image("phone")
|
||||
|
|
@ -314,10 +313,10 @@ struct ConversationFragment: View {
|
|||
}
|
||||
}
|
||||
|
||||
if !conversationViewModel.displayedConversation!.isReadOnly {
|
||||
if !SharedMainViewModel.shared.displayedConversation!.isReadOnly {
|
||||
Button {
|
||||
isMenuOpen = false
|
||||
conversationViewModel.displayedConversation!.toggleMute()
|
||||
SharedMainViewModel.shared.displayedConversation!.toggleMute()
|
||||
isMuted = !isMuted
|
||||
} label: {
|
||||
HStack {
|
||||
|
|
@ -360,7 +359,7 @@ struct ConversationFragment: View {
|
|||
.padding(.top, 4)
|
||||
.onChange(of: isMuted) { _ in }
|
||||
.onAppear {
|
||||
isMuted = conversationViewModel.displayedConversation!.isMuted
|
||||
isMuted = SharedMainViewModel.shared.displayedConversation!.isMuted
|
||||
}
|
||||
}
|
||||
.onTapGesture {
|
||||
|
|
@ -503,7 +502,7 @@ struct ConversationFragment: View {
|
|||
.transition(.move(edge: .bottom))
|
||||
}
|
||||
|
||||
if conversationViewModel.displayedConversation != nil && !conversationViewModel.displayedConversation!.isReadOnly {
|
||||
if SharedMainViewModel.shared.displayedConversation != nil && !SharedMainViewModel.shared.displayedConversation!.isReadOnly {
|
||||
if conversationViewModel.messageToReply != nil {
|
||||
ZStack(alignment: .top) {
|
||||
HStack {
|
||||
|
|
@ -845,8 +844,8 @@ struct ConversationFragment: View {
|
|||
}
|
||||
.blur(radius: conversationViewModel.selectedMessage != nil ? 8 : 0)
|
||||
|
||||
if conversationViewModel.selectedMessage != nil && conversationViewModel.displayedConversation != nil {
|
||||
let iconSize = ((geometry.size.width - (conversationViewModel.displayedConversation!.isGroup ? 43 : 10) - 10) / 6) - 30
|
||||
if conversationViewModel.selectedMessage != nil && SharedMainViewModel.shared.displayedConversation != nil {
|
||||
let iconSize = ((geometry.size.width - (SharedMainViewModel.shared.displayedConversation!.isGroup ? 43 : 10) - 10) / 6) - 30
|
||||
|
||||
ScrollView {
|
||||
VStack {
|
||||
|
|
@ -932,7 +931,7 @@ struct ConversationFragment: View {
|
|||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.horizontal, 10)
|
||||
.padding(.leading, conversationViewModel.displayedConversation!.isGroup ? 43 : 0)
|
||||
.padding(.leading, SharedMainViewModel.shared.displayedConversation!.isGroup ? 43 : 0)
|
||||
.shadow(color: .black.opacity(0.1), radius: 10)
|
||||
|
||||
ChatBubbleView(conversationViewModel: conversationViewModel, eventLogMessage: conversationViewModel.selectedMessage!, geometryProxy: geometry)
|
||||
|
|
@ -1044,7 +1043,7 @@ struct ConversationFragment: View {
|
|||
.frame(maxWidth: .infinity)
|
||||
.padding(.horizontal, 10)
|
||||
.padding(.bottom, 20)
|
||||
.padding(.leading, conversationViewModel.displayedConversation!.isGroup ? 43 : 0)
|
||||
.padding(.leading, SharedMainViewModel.shared.displayedConversation!.isGroup ? 43 : 0)
|
||||
.shadow(color: .black.opacity(0.1), radius: 10)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ struct ConversationInfoFragment: View {
|
|||
@State private var orientation = UIDevice.current.orientation
|
||||
|
||||
@ObservedObject var contactsManager = ContactsManager.shared
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@ObservedObject var conversationViewModel: ConversationViewModel
|
||||
@ObservedObject var conversationsListViewModel: ConversationsListViewModel
|
||||
|
|
@ -50,7 +49,7 @@ struct ConversationInfoFragment: View {
|
|||
let accountModel = CoreContext.shared.accounts[accountProfileViewModel.accountModelIndex ?? 0]
|
||||
NavigationView {
|
||||
GeometryReader { geometry in
|
||||
if conversationViewModel.displayedConversation != nil {
|
||||
if SharedMainViewModel.shared.displayedConversation != nil {
|
||||
VStack(spacing: 1) {
|
||||
Rectangle()
|
||||
.foregroundColor(Color.orangeMain500)
|
||||
|
|
@ -90,12 +89,12 @@ struct ConversationInfoFragment: View {
|
|||
}
|
||||
|
||||
VStack(spacing: 0) {
|
||||
if conversationViewModel.displayedConversation != nil && !conversationViewModel.displayedConversation!.isGroup {
|
||||
if SharedMainViewModel.shared.displayedConversation != nil && !SharedMainViewModel.shared.displayedConversation!.isGroup {
|
||||
|
||||
Avatar(contactAvatarModel: conversationViewModel.displayedConversation!.avatarModel, avatarSize: 100)
|
||||
Avatar(contactAvatarModel: SharedMainViewModel.shared.displayedConversation!.avatarModel, avatarSize: 100)
|
||||
.padding(.top, 4)
|
||||
|
||||
Text(conversationViewModel.displayedConversation!.avatarModel.name)
|
||||
Text(SharedMainViewModel.shared.displayedConversation!.avatarModel.name)
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.multilineTextAlignment(.center)
|
||||
.default_text_style(styleSize: 14)
|
||||
|
|
@ -109,9 +108,9 @@ struct ConversationInfoFragment: View {
|
|||
.frame(maxWidth: .infinity)
|
||||
.padding(.top, 5)
|
||||
|
||||
if !conversationViewModel.displayedConversation!.avatarModel.lastPresenceInfo.isEmpty {
|
||||
Text(conversationViewModel.displayedConversation!.avatarModel.lastPresenceInfo)
|
||||
.foregroundStyle(conversationViewModel.displayedConversation!.avatarModel.lastPresenceInfo == "Online"
|
||||
if !SharedMainViewModel.shared.displayedConversation!.avatarModel.lastPresenceInfo.isEmpty {
|
||||
Text(SharedMainViewModel.shared.displayedConversation!.avatarModel.lastPresenceInfo)
|
||||
.foregroundStyle(SharedMainViewModel.shared.displayedConversation!.avatarModel.lastPresenceInfo == "Online"
|
||||
? Color.greenSuccess500
|
||||
: Color.orangeWarning600)
|
||||
.multilineTextAlignment(.center)
|
||||
|
|
@ -127,11 +126,11 @@ struct ConversationInfoFragment: View {
|
|||
.frame(height: 20)
|
||||
}
|
||||
} else {
|
||||
Avatar(contactAvatarModel: conversationViewModel.displayedConversation!.avatarModel, avatarSize: 100)
|
||||
Avatar(contactAvatarModel: SharedMainViewModel.shared.displayedConversation!.avatarModel, avatarSize: 100)
|
||||
.padding(.top, 4)
|
||||
|
||||
HStack {
|
||||
Text(conversationViewModel.displayedConversation!.avatarModel.name)
|
||||
Text(SharedMainViewModel.shared.displayedConversation!.avatarModel.name)
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.multilineTextAlignment(.center)
|
||||
.default_text_style(styleSize: 14)
|
||||
|
|
@ -162,12 +161,12 @@ struct ConversationInfoFragment: View {
|
|||
.padding(.bottom, 2)
|
||||
.background(Color.gray100)
|
||||
|
||||
if !conversationViewModel.displayedConversation!.isReadOnly {
|
||||
if !SharedMainViewModel.shared.displayedConversation!.isReadOnly {
|
||||
HStack {
|
||||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
conversationViewModel.displayedConversation!.toggleMute()
|
||||
SharedMainViewModel.shared.displayedConversation!.toggleMute()
|
||||
isMuted = !isMuted
|
||||
}, label: {
|
||||
VStack {
|
||||
|
|
@ -193,10 +192,10 @@ struct ConversationInfoFragment: View {
|
|||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
if conversationViewModel.displayedConversation!.isGroup {
|
||||
if SharedMainViewModel.shared.displayedConversation!.isGroup {
|
||||
isShowStartCallGroupPopup.toggle()
|
||||
} else {
|
||||
conversationViewModel.displayedConversation!.call()
|
||||
SharedMainViewModel.shared.displayedConversation!.call()
|
||||
}
|
||||
}, label: {
|
||||
VStack {
|
||||
|
|
@ -222,10 +221,10 @@ struct ConversationInfoFragment: View {
|
|||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
if conversationViewModel.displayedConversation != nil {
|
||||
meetingViewModel.subject = conversationViewModel.displayedConversation!.subject
|
||||
if SharedMainViewModel.shared.displayedConversation != nil {
|
||||
meetingViewModel.subject = SharedMainViewModel.shared.displayedConversation!.subject
|
||||
meetingViewModel.participants = conversationViewModel.participants
|
||||
conversationViewModel.displayedConversation = nil
|
||||
SharedMainViewModel.shared.displayedConversation = nil
|
||||
indexPage = 3
|
||||
withAnimation {
|
||||
isShowScheduleMeetingFragment = true
|
||||
|
|
@ -260,7 +259,7 @@ struct ConversationInfoFragment: View {
|
|||
.background(Color.gray100)
|
||||
}
|
||||
|
||||
if conversationViewModel.displayedConversation!.isGroup {
|
||||
if SharedMainViewModel.shared.displayedConversation!.isGroup {
|
||||
HStack(alignment: .center) {
|
||||
Text("conversation_info_participants_list_title")
|
||||
.default_text_style_800(styleSize: 18)
|
||||
|
|
@ -354,13 +353,13 @@ struct ConversationInfoFragment: View {
|
|||
where: {$0.friend!.addresses.contains(where: {$0.asStringUriOnly() == addressConv})})
|
||||
if friendIndex != nil {
|
||||
withAnimation {
|
||||
conversationViewModel.displayedConversation = nil
|
||||
SharedMainViewModel.shared.displayedConversation = nil
|
||||
indexPage = 0
|
||||
contactViewModel.indexDisplayedFriend = friendIndex
|
||||
SharedMainViewModel.shared.indexDisplayedFriend = friendIndex
|
||||
}
|
||||
} else {
|
||||
withAnimation {
|
||||
conversationViewModel.displayedConversation = nil
|
||||
SharedMainViewModel.shared.displayedConversation = nil
|
||||
indexPage = 0
|
||||
|
||||
isShowEditContactFragment.toggle()
|
||||
|
|
@ -522,11 +521,11 @@ struct ConversationInfoFragment: View {
|
|||
.padding(.top, 20)
|
||||
|
||||
VStack(spacing: 0) {
|
||||
if !conversationViewModel.displayedConversation!.isReadOnly {
|
||||
if !conversationViewModel.displayedConversation!.isGroup {
|
||||
if !SharedMainViewModel.shared.displayedConversation!.isReadOnly {
|
||||
if !SharedMainViewModel.shared.displayedConversation!.isGroup {
|
||||
Button(
|
||||
action: {
|
||||
if conversationViewModel.displayedConversation != nil {
|
||||
if SharedMainViewModel.shared.displayedConversation != nil {
|
||||
|
||||
let addressConv = conversationViewModel.participantConversationModel.first?.address ?? ""
|
||||
|
||||
|
|
@ -534,13 +533,13 @@ struct ConversationInfoFragment: View {
|
|||
where: {$0.friend!.addresses.contains(where: {$0.asStringUriOnly() == addressConv})})
|
||||
if friendIndex != nil {
|
||||
withAnimation {
|
||||
conversationViewModel.displayedConversation = nil
|
||||
SharedMainViewModel.shared.displayedConversation = nil
|
||||
indexPage = 0
|
||||
contactViewModel.indexDisplayedFriend = friendIndex
|
||||
SharedMainViewModel.shared.indexDisplayedFriend = friendIndex
|
||||
}
|
||||
} else {
|
||||
withAnimation {
|
||||
conversationViewModel.displayedConversation = nil
|
||||
SharedMainViewModel.shared.displayedConversation = nil
|
||||
indexPage = 0
|
||||
|
||||
isShowEditContactFragment.toggle()
|
||||
|
|
@ -614,11 +613,11 @@ struct ConversationInfoFragment: View {
|
|||
|
||||
Divider()
|
||||
|
||||
if conversationViewModel.displayedConversation!.isGroup {
|
||||
if SharedMainViewModel.shared.displayedConversation!.isGroup {
|
||||
Button(
|
||||
action: {
|
||||
conversationViewModel.displayedConversation!.leave()
|
||||
conversationViewModel.displayedConversation!.isReadOnly = true
|
||||
SharedMainViewModel.shared.displayedConversation!.leave()
|
||||
SharedMainViewModel.shared.displayedConversation!.isReadOnly = true
|
||||
isShowInfoConversationFragment = false
|
||||
},
|
||||
label: {
|
||||
|
|
@ -645,8 +644,8 @@ struct ConversationInfoFragment: View {
|
|||
|
||||
Button(
|
||||
action: {
|
||||
conversationViewModel.displayedConversation!.deleteChatRoom()
|
||||
conversationViewModel.displayedConversation = nil
|
||||
SharedMainViewModel.shared.displayedConversation!.deleteChatRoom()
|
||||
SharedMainViewModel.shared.displayedConversation = nil
|
||||
},
|
||||
label: {
|
||||
HStack {
|
||||
|
|
@ -673,7 +672,7 @@ struct ConversationInfoFragment: View {
|
|||
.cornerRadius(15)
|
||||
.padding(.all)
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.top, 2)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import linphonesw
|
|||
|
||||
// swiftlint:disable type_body_length
|
||||
struct StartConversationFragment: View {
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@ObservedObject var contactsManager = ContactsManager.shared
|
||||
@ObservedObject var magicSearch = MagicSearchSingleton.shared
|
||||
|
|
@ -388,7 +387,7 @@ struct StartConversationFragment: View {
|
|||
.padding(.horizontal)
|
||||
.frame(maxHeight: .infinity)
|
||||
.shadow(color: Color.orangeMain500, radius: 0, x: 0, y: 2)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.position(x: geometry.size.width / 2, y: geometry.size.height / 2)
|
||||
.onDisappear {
|
||||
startConversationViewModel.messageText = ""
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@ import SwiftUI
|
|||
|
||||
struct PopupLoadingView: View {
|
||||
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
var body: some View {
|
||||
GeometryReader { geometry in
|
||||
VStack(alignment: .leading) {
|
||||
|
|
@ -47,7 +45,7 @@ struct PopupLoadingView: View {
|
|||
.frame(maxHeight: .infinity)
|
||||
.frame(maxWidth: .infinity)
|
||||
.shadow(color: Color.orangeMain500, radius: 0, x: 0, y: 2)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.position(x: geometry.size.width / 2, y: geometry.size.height / 2)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@ import Photos
|
|||
|
||||
struct PopupView: View {
|
||||
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
var permissionManager = PermissionManager.shared
|
||||
|
||||
@Binding var isShowPopup: Bool
|
||||
|
|
@ -93,7 +91,7 @@ struct PopupView: View {
|
|||
.padding(.horizontal)
|
||||
.frame(maxHeight: .infinity)
|
||||
.shadow(color: Color.orangeMain500, radius: 0, x: 0, y: 2)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.position(x: geometry.size.width / 2, y: geometry.size.height / 2)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ import SwiftUI
|
|||
|
||||
struct PopupViewWithTextField: View {
|
||||
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@ObservedObject var conversationViewModel: ConversationViewModel
|
||||
|
||||
@FocusState var isMessageTextFocused: Bool
|
||||
|
|
@ -76,7 +74,7 @@ struct PopupViewWithTextField: View {
|
|||
.padding(.horizontal)
|
||||
.frame(maxHeight: .infinity)
|
||||
.shadow(color: Color.orangeMain500, radius: 0, x: 0, y: 2)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.position(x: geometry.size.width / 2, y: geometry.size.height / 2)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@ import SwiftUI
|
|||
|
||||
struct HelpFragment: View {
|
||||
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@ObservedObject var helpViewModel: HelpViewModel
|
||||
|
||||
@Binding var isShowHelpFragment: Bool
|
||||
|
|
@ -234,7 +232,7 @@ struct HelpFragment: View {
|
|||
}
|
||||
})
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.padding(.all, 20)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ struct DialerBottomSheet: View {
|
|||
private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom }
|
||||
|
||||
@ObservedObject private var magicSearch = MagicSearchSingleton.shared
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
@ObservedObject var contactsManager = ContactsManager.shared
|
||||
@ObservedObject private var telecomManager = TelecomManager.shared
|
||||
|
||||
|
|
@ -91,7 +90,7 @@ struct DialerBottomSheet: View {
|
|||
}
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.top, 10)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
|
||||
Spacer()
|
||||
} else {
|
||||
|
|
@ -173,7 +172,7 @@ struct DialerBottomSheet: View {
|
|||
}
|
||||
}
|
||||
.padding(.horizontal, 60)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
|
||||
HStack {
|
||||
Button {
|
||||
|
|
@ -251,7 +250,7 @@ struct DialerBottomSheet: View {
|
|||
}
|
||||
.padding(.horizontal, 60)
|
||||
.padding(.top, 10)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
|
||||
HStack {
|
||||
Button {
|
||||
|
|
@ -329,7 +328,7 @@ struct DialerBottomSheet: View {
|
|||
}
|
||||
.padding(.horizontal, 60)
|
||||
.padding(.top, 10)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
|
||||
HStack {
|
||||
Button {
|
||||
|
|
@ -440,7 +439,7 @@ struct DialerBottomSheet: View {
|
|||
}
|
||||
.padding(.horizontal, 60)
|
||||
.padding(.top, 10)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
|
||||
if currentCall == nil {
|
||||
HStack {
|
||||
|
|
@ -526,7 +525,7 @@ struct DialerBottomSheet: View {
|
|||
}
|
||||
.padding(.horizontal, 60)
|
||||
.padding(.top, 20)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ struct HistoryContactFragment: View {
|
|||
|
||||
@ObservedObject var contactsManager = ContactsManager.shared
|
||||
@ObservedObject private var telecomManager = TelecomManager.shared
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@ObservedObject var contactAvatarModel: ContactAvatarModel
|
||||
@ObservedObject var historyViewModel: HistoryViewModel
|
||||
|
|
@ -44,7 +43,7 @@ struct HistoryContactFragment: View {
|
|||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
if historyViewModel.displayedCall != nil {
|
||||
if SharedMainViewModel.shared.displayedCall != nil {
|
||||
VStack(spacing: 1) {
|
||||
Rectangle()
|
||||
.foregroundColor(Color.orangeMain500)
|
||||
|
|
@ -64,7 +63,7 @@ struct HistoryContactFragment: View {
|
|||
.padding(.leading, -10)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
historyViewModel.displayedCall = nil
|
||||
SharedMainViewModel.shared.displayedCall = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -75,42 +74,42 @@ struct HistoryContactFragment: View {
|
|||
Spacer()
|
||||
|
||||
Menu {
|
||||
if historyViewModel.displayedCall != nil && !historyViewModel.displayedCall!.isConf {
|
||||
if SharedMainViewModel.shared.displayedCall != nil && !SharedMainViewModel.shared.displayedCall!.isConf {
|
||||
Button {
|
||||
isMenuOpen = false
|
||||
|
||||
if historyViewModel.displayedCall != nil && historyViewModel.displayedCall!.addressFriend != nil {
|
||||
let addressCall = historyViewModel.displayedCall!.addressFriend!.address
|
||||
if SharedMainViewModel.shared.displayedCall != nil && SharedMainViewModel.shared.displayedCall!.addressFriend != nil {
|
||||
let addressCall = SharedMainViewModel.shared.displayedCall!.addressFriend!.address
|
||||
|
||||
if addressCall != nil {
|
||||
let friendIndex = contactsManager.lastSearch.firstIndex(
|
||||
where: {$0.friend!.addresses.contains(where: {$0.asStringUriOnly() == addressCall!.asStringUriOnly()})})
|
||||
if friendIndex != nil {
|
||||
withAnimation {
|
||||
historyViewModel.displayedCall = nil
|
||||
SharedMainViewModel.shared.displayedCall = nil
|
||||
indexPage = 0
|
||||
|
||||
contactViewModel.indexDisplayedFriend = friendIndex
|
||||
SharedMainViewModel.shared.indexDisplayedFriend = friendIndex
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
withAnimation {
|
||||
historyViewModel.displayedCall = nil
|
||||
SharedMainViewModel.shared.displayedCall = nil
|
||||
indexPage = 0
|
||||
|
||||
isShowEditContactFragment.toggle()
|
||||
editContactViewModel.sipAddresses.removeAll()
|
||||
editContactViewModel.sipAddresses.append(String(historyViewModel.displayedCall?.address.dropFirst(4) ?? ""))
|
||||
editContactViewModel.sipAddresses.append(String(SharedMainViewModel.shared.displayedCall?.address.dropFirst(4) ?? ""))
|
||||
editContactViewModel.sipAddresses.append("")
|
||||
}
|
||||
}
|
||||
|
||||
} label: {
|
||||
HStack {
|
||||
Text(historyViewModel.displayedCall!.addressFriend != nil ? "menu_see_existing_contact" : "menu_add_address_to_contacts")
|
||||
Text(SharedMainViewModel.shared.displayedCall!.addressFriend != nil ? "menu_see_existing_contact" : "menu_add_address_to_contacts")
|
||||
Spacer()
|
||||
Image(historyViewModel.displayedCall!.addressFriend != nil ? "user-circle" : "plus-circle")
|
||||
Image(SharedMainViewModel.shared.displayedCall!.addressFriend != nil ? "user-circle" : "plus-circle")
|
||||
.resizable()
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
|
|
@ -121,14 +120,14 @@ struct HistoryContactFragment: View {
|
|||
Button {
|
||||
isMenuOpen = false
|
||||
|
||||
if historyViewModel.displayedCall != nil && historyViewModel.displayedCall!.isOutgoing {
|
||||
if SharedMainViewModel.shared.displayedCall != nil && SharedMainViewModel.shared.displayedCall!.isOutgoing {
|
||||
UIPasteboard.general.setValue(
|
||||
historyViewModel.displayedCall!.address.dropFirst(4),
|
||||
SharedMainViewModel.shared.displayedCall!.address.dropFirst(4),
|
||||
forPasteboardType: UTType.plainText.identifier
|
||||
)
|
||||
} else {
|
||||
UIPasteboard.general.setValue(
|
||||
historyViewModel.displayedCall!.address.dropFirst(4),
|
||||
SharedMainViewModel.shared.displayedCall!.address.dropFirst(4),
|
||||
forPasteboardType: UTType.plainText.identifier
|
||||
)
|
||||
}
|
||||
|
|
@ -150,10 +149,10 @@ struct HistoryContactFragment: View {
|
|||
Button(role: .destructive) {
|
||||
isMenuOpen = false
|
||||
|
||||
if historyViewModel.displayedCall != nil && historyViewModel.displayedCall!.isOutgoing {
|
||||
historyListViewModel.callLogsAddressToDelete = historyViewModel.displayedCall!.address
|
||||
if SharedMainViewModel.shared.displayedCall != nil && SharedMainViewModel.shared.displayedCall!.isOutgoing {
|
||||
historyListViewModel.callLogsAddressToDelete = SharedMainViewModel.shared.displayedCall!.address
|
||||
} else {
|
||||
historyListViewModel.callLogsAddressToDelete = historyViewModel.displayedCall!.address
|
||||
historyListViewModel.callLogsAddressToDelete = SharedMainViewModel.shared.displayedCall!.address
|
||||
}
|
||||
|
||||
isShowDeleteAllHistoryPopup.toggle()
|
||||
|
|
@ -197,26 +196,26 @@ struct HistoryContactFragment: View {
|
|||
}
|
||||
|
||||
VStack(spacing: 0) {
|
||||
if historyViewModel.displayedCall != nil && !historyViewModel.displayedCall!.isConf {
|
||||
if historyViewModel.displayedCall!.avatarModel != nil {
|
||||
Avatar(contactAvatarModel: historyViewModel.displayedCall!.avatarModel!, avatarSize: 100)
|
||||
if SharedMainViewModel.shared.displayedCall != nil && !SharedMainViewModel.shared.displayedCall!.isConf {
|
||||
if SharedMainViewModel.shared.displayedCall!.avatarModel != nil {
|
||||
Avatar(contactAvatarModel: SharedMainViewModel.shared.displayedCall!.avatarModel!, avatarSize: 100)
|
||||
}
|
||||
|
||||
Text(historyViewModel.displayedCall!.addressName)
|
||||
Text(SharedMainViewModel.shared.displayedCall!.addressName)
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.multilineTextAlignment(.center)
|
||||
.default_text_style(styleSize: 14)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.top, 10)
|
||||
|
||||
Text(historyViewModel.displayedCall!.address)
|
||||
Text(SharedMainViewModel.shared.displayedCall!.address)
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.multilineTextAlignment(.center)
|
||||
.default_text_style(styleSize: 14)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.top, 5)
|
||||
|
||||
if historyViewModel.displayedCall!.avatarModel != nil {
|
||||
if SharedMainViewModel.shared.displayedCall!.avatarModel != nil {
|
||||
Text(contactAvatarModel.lastPresenceInfo)
|
||||
.foregroundStyle(contactAvatarModel.lastPresenceInfo == "Online"
|
||||
? Color.greenSuccess500
|
||||
|
|
@ -245,7 +244,7 @@ struct HistoryContactFragment: View {
|
|||
.background(Color.grayMain2c200)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(historyViewModel.displayedCall!.subject)
|
||||
Text(SharedMainViewModel.shared.displayedCall!.subject)
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.multilineTextAlignment(.center)
|
||||
.default_text_style(styleSize: 14)
|
||||
|
|
@ -262,9 +261,9 @@ struct HistoryContactFragment: View {
|
|||
HStack {
|
||||
Spacer()
|
||||
|
||||
if historyViewModel.displayedCall != nil && !historyViewModel.displayedCall!.isConf {
|
||||
if SharedMainViewModel.shared.displayedCall != nil && !SharedMainViewModel.shared.displayedCall!.isConf {
|
||||
Button(action: {
|
||||
telecomManager.doCallOrJoinConf(address: historyViewModel.displayedCall!.addressLinphone)
|
||||
telecomManager.doCallOrJoinConf(address: SharedMainViewModel.shared.displayedCall!.addressLinphone)
|
||||
}, label: {
|
||||
VStack {
|
||||
HStack(alignment: .center) {
|
||||
|
|
@ -287,7 +286,7 @@ struct HistoryContactFragment: View {
|
|||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
contactViewModel.createOneToOneChatRoomWith(remote: historyViewModel.displayedCall!.addressLinphone)
|
||||
contactViewModel.createOneToOneChatRoomWith(remote: SharedMainViewModel.shared.displayedCall!.addressLinphone)
|
||||
}, label: {
|
||||
VStack {
|
||||
HStack(alignment: .center) {
|
||||
|
|
@ -310,7 +309,7 @@ struct HistoryContactFragment: View {
|
|||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
telecomManager.doCallOrJoinConf(address: historyViewModel.displayedCall!.addressLinphone, isVideo: true)
|
||||
telecomManager.doCallOrJoinConf(address: SharedMainViewModel.shared.displayedCall!.addressLinphone, isVideo: true)
|
||||
}, label: {
|
||||
VStack {
|
||||
HStack(alignment: .center) {
|
||||
|
|
@ -332,15 +331,15 @@ struct HistoryContactFragment: View {
|
|||
} else {
|
||||
Button(action: {
|
||||
withAnimation {
|
||||
if historyViewModel.displayedCall != nil && historyViewModel.displayedCall!.address.hasPrefix("sip:conference-focus@sip.linphone.org") {
|
||||
if SharedMainViewModel.shared.displayedCall != nil && SharedMainViewModel.shared.displayedCall!.address.hasPrefix("sip:conference-focus@sip.linphone.org") {
|
||||
do {
|
||||
let meetingAddress = try Factory.Instance.createAddress(addr: historyViewModel.displayedCall!.address)
|
||||
let meetingAddress = try Factory.Instance.createAddress(addr: SharedMainViewModel.shared.displayedCall!.address)
|
||||
|
||||
telecomManager.meetingWaitingRoomDisplayed = true
|
||||
telecomManager.meetingWaitingRoomSelected = meetingAddress
|
||||
} catch {}
|
||||
} else {
|
||||
telecomManager.doCallOrJoinConf(address: historyViewModel.displayedCall!.addressLinphone)
|
||||
telecomManager.doCallOrJoinConf(address: SharedMainViewModel.shared.displayedCall!.addressLinphone)
|
||||
}
|
||||
}
|
||||
}, label: {
|
||||
|
|
@ -372,8 +371,8 @@ struct HistoryContactFragment: View {
|
|||
|
||||
VStack(spacing: 0) {
|
||||
|
||||
let addressFriend = historyViewModel.displayedCall != nil
|
||||
? historyViewModel.displayedCall!.address : nil
|
||||
let addressFriend = SharedMainViewModel.shared.displayedCall != nil
|
||||
? SharedMainViewModel.shared.displayedCall!.address : nil
|
||||
|
||||
let callLogsFilter = historyListViewModel.callLogs.filter({ $0.address == addressFriend})
|
||||
|
||||
|
|
@ -430,7 +429,7 @@ struct HistoryContactFragment: View {
|
|||
.cornerRadius(15)
|
||||
.padding(.all)
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.top, 2)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ struct HistoryListBottomSheet: View {
|
|||
|
||||
private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom }
|
||||
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
@ObservedObject var contactsManager = ContactsManager.shared
|
||||
|
||||
@ObservedObject var historyViewModel: HistoryViewModel
|
||||
|
|
@ -83,7 +82,7 @@ struct HistoryListBottomSheet: View {
|
|||
let friendIndex = contactsManager.lastSearch.firstIndex(where: {$0.friend!.addresses.contains(where: {$0.asStringUriOnly() == addressCall})})
|
||||
if friendIndex != nil {
|
||||
withAnimation {
|
||||
contactViewModel.indexDisplayedFriend = friendIndex
|
||||
SharedMainViewModel.shared.indexDisplayedFriend = friendIndex
|
||||
}
|
||||
}
|
||||
} else if historyViewModel.selectedCall != nil {
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ struct HistoryListFragment: View {
|
|||
.onEnded { _ in
|
||||
withAnimation {
|
||||
doCall(index: index)
|
||||
historyViewModel.displayedCall = nil
|
||||
SharedMainViewModel.shared.displayedCall = nil
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
@ -133,7 +133,7 @@ struct HistoryListFragment: View {
|
|||
.background(.white)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
historyViewModel.displayedCall = historyListViewModel.callLogs[index]
|
||||
SharedMainViewModel.shared.displayedCall = historyListViewModel.callLogs[index]
|
||||
}
|
||||
}
|
||||
.onLongPressGesture(minimumDuration: 0.2) {
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@ import linphonesw
|
|||
// swiftlint:disable type_body_length
|
||||
struct StartCallFragment: View {
|
||||
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@ObservedObject var contactsManager = ContactsManager.shared
|
||||
@ObservedObject var magicSearch = MagicSearchSingleton.shared
|
||||
@ObservedObject private var telecomManager = TelecomManager.shared
|
||||
|
|
@ -495,7 +493,7 @@ struct StartCallFragment: View {
|
|||
.padding(.horizontal)
|
||||
.frame(maxHeight: .infinity)
|
||||
.shadow(color: Color.orangeMain500, radius: 0, x: 0, y: 2)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.position(x: geometry.size.width / 2, y: geometry.size.height / 2)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@ import Combine
|
|||
|
||||
class HistoryViewModel: ObservableObject {
|
||||
|
||||
@Published var displayedCall: HistoryModel?
|
||||
|
||||
var selectedCall: HistoryModel?
|
||||
|
||||
init() {}
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ struct MeetingFragment: View {
|
|||
.padding(.leading, -10)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
meetingViewModel.displayedMeeting = nil
|
||||
SharedMainViewModel.shared.displayedMeeting = nil
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
|
|
@ -129,12 +129,12 @@ struct MeetingFragment: View {
|
|||
}
|
||||
Button(role: .destructive) {
|
||||
withAnimation {
|
||||
meetingsListViewModel.selectedMeetingToDelete = meetingViewModel.displayedMeeting
|
||||
meetingsListViewModel.selectedMeetingToDelete = SharedMainViewModel.shared.displayedMeeting
|
||||
if let myself = meetingViewModel.myself, myself.isOrganizer == true {
|
||||
isShowSendCancelMeetingNotificationPopup.toggle()
|
||||
} else {
|
||||
// If we're not organizer, directly delete the conference
|
||||
meetingViewModel.displayedMeeting = nil
|
||||
SharedMainViewModel.shared.displayedMeeting = nil
|
||||
meetingsListViewModel.deleteSelectedMeeting()
|
||||
}
|
||||
}
|
||||
|
|
@ -299,7 +299,7 @@ struct MeetingFragment: View {
|
|||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
meetingViewModel.joinMeeting(addressUri: meetingViewModel.displayedMeeting?.address ?? "")
|
||||
meetingViewModel.joinMeeting(addressUri: SharedMainViewModel.shared.displayedMeeting?.address ?? "")
|
||||
}, label: {
|
||||
Text("meeting_info_join_title")
|
||||
.bold()
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ struct ScheduleMeetingFragment: View {
|
|||
.padding(.leading, -10)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
if let meeting = meetingViewModel.displayedMeeting {
|
||||
if let meeting = SharedMainViewModel.shared.displayedMeeting {
|
||||
// reload meeting to cancel change from edit
|
||||
meetingViewModel.loadExistingMeeting(meeting: meeting)
|
||||
}
|
||||
|
|
@ -83,7 +83,7 @@ struct ScheduleMeetingFragment: View {
|
|||
}
|
||||
}
|
||||
|
||||
Text(meetingViewModel.displayedMeeting != nil ? "meeting_schedule_edit_title" : "meeting_schedule_title" )
|
||||
Text(SharedMainViewModel.shared.displayedMeeting != nil ? "meeting_schedule_edit_title" : "meeting_schedule_title" )
|
||||
.multilineTextAlignment(.leading)
|
||||
.default_text_style_orange_800(styleSize: 16)
|
||||
|
||||
|
|
@ -463,7 +463,7 @@ struct ScheduleMeetingFragment: View {
|
|||
.padding(.horizontal)
|
||||
.frame(maxHeight: .infinity)
|
||||
.shadow(color: Color.orangeMain500, radius: 0, x: 0, y: 2)
|
||||
// .frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
// .frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.position(x: geometry.size.width / 2, y: geometry.size.height / 2)
|
||||
}
|
||||
.background(.black.opacity(0.65))
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ class MeetingViewModel: ObservableObject {
|
|||
var conferenceScheduler: ConferenceScheduler?
|
||||
private var mSchedulerDelegate: ConferenceSchedulerDelegate?
|
||||
var conferenceInfoToEdit: ConferenceInfo?
|
||||
@Published var displayedMeeting: MeetingModel? // if nil, then we are currently creating a new meeting
|
||||
@Published var myself: SelectedAddressModel?
|
||||
@Published var fromDate: Date
|
||||
@Published var toDate: Date
|
||||
|
|
@ -180,8 +179,8 @@ class MeetingViewModel: ObservableObject {
|
|||
if state == ConferenceScheduler.State.Error {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
self.errorMsg = (self.displayedMeeting != nil) ? "Could not edit conference" : "Could not create conference"
|
||||
ToastViewModel.shared.toastMessage = (self.displayedMeeting != nil) ? "meeting_failed_to_edit_toast" : "meeting_failed_to_schedule_toast"
|
||||
self.errorMsg = (SharedMainViewModel.shared.displayedMeeting != nil) ? "Could not edit conference" : "Could not create conference"
|
||||
ToastViewModel.shared.toastMessage = (SharedMainViewModel.shared.displayedMeeting != nil) ? "meeting_failed_to_edit_toast" : "meeting_failed_to_schedule_toast"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
} else if state == ConferenceScheduler.State.Ready {
|
||||
|
|
@ -271,7 +270,7 @@ class MeetingViewModel: ObservableObject {
|
|||
CoreContext.shared.doOnCoreQueue { core in
|
||||
Log.info("\(MeetingViewModel.TAG) Scheduling \(self.isBroadcastSelected ? "broadcast" : "meeting")")
|
||||
|
||||
if let conferenceInfo = (self.displayedMeeting != nil ? self.displayedMeeting!.confInfo : try? Factory.Instance.createConferenceInfo()) {
|
||||
if let conferenceInfo = (SharedMainViewModel.shared.displayedMeeting != nil ? SharedMainViewModel.shared.displayedMeeting!.confInfo : try? Factory.Instance.createConferenceInfo()) {
|
||||
let localAccount = core.defaultAccount
|
||||
conferenceInfo.organizer = localAccount?.params?.identityAddress
|
||||
|
||||
|
|
@ -362,7 +361,7 @@ class MeetingViewModel: ObservableObject {
|
|||
self.conferenceUri = meeting.confInfo.uri?.asStringUriOnly() ?? ""
|
||||
self.computeDateLabels()
|
||||
self.computeTimeLabels()
|
||||
self.displayedMeeting = meeting
|
||||
SharedMainViewModel.shared.displayedMeeting = meeting
|
||||
}
|
||||
|
||||
func cancelMeetingWithNotifications(meeting: MeetingModel) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import UniformTypeIdentifiers
|
|||
struct AccountProfileFragment: View {
|
||||
|
||||
@ObservedObject var contactsManager = ContactsManager.shared
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@ObservedObject var accountProfileViewModel: AccountProfileViewModel
|
||||
@ObservedObject var registerViewModel: RegisterViewModel
|
||||
|
|
@ -592,7 +591,7 @@ struct AccountProfileFragment: View {
|
|||
.cornerRadius(15)
|
||||
.padding(.horizontal)
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.onAppear {
|
||||
accountModel.requestDevicesList()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@ import SwiftUI
|
|||
// swiftlint:disable type_body_length
|
||||
struct AccountSettingsFragment: View {
|
||||
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@StateObject private var accountSettingsViewModel: AccountSettingsViewModel
|
||||
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
|
@ -482,7 +480,7 @@ struct AccountSettingsFragment: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,11 @@ class SharedMainViewModel: ObservableObject {
|
|||
@Published var defaultAvatar: URL?
|
||||
@Published var indexView: Int = 0
|
||||
|
||||
@Published var indexDisplayedFriend: Int?
|
||||
@Published var displayedCall: HistoryModel?
|
||||
@Published var displayedConversation: ConversationModel?
|
||||
@Published var displayedMeeting: MeetingModel?
|
||||
|
||||
let welcomeViewKey = "welcome_view"
|
||||
let generalTermsKey = "general_terms"
|
||||
let displayProfileModeKey = "display_profile_mode"
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@ import SwiftUI
|
|||
|
||||
struct WelcomeView: View {
|
||||
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@State private var index = 0
|
||||
|
||||
var body: some View {
|
||||
|
|
@ -123,7 +121,7 @@ struct WelcomeView: View {
|
|||
.cornerRadius(60)
|
||||
.padding(.horizontal)
|
||||
.padding(.bottom, geometry.safeAreaInsets.bottom.isEqual(to: 0.0) ? 20 : 0)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
} else {
|
||||
Button(action: {
|
||||
withAnimation {
|
||||
|
|
@ -141,7 +139,7 @@ struct WelcomeView: View {
|
|||
.cornerRadius(60)
|
||||
.padding(.horizontal)
|
||||
.padding(.bottom, geometry.safeAreaInsets.bottom.isEqual(to: 0.0) ? 20 : 0)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
}
|
||||
|
||||
Image("mountain2")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue