mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Fix most warnings (remaining: @sendables and deprecated calls)
This commit is contained in:
parent
923c290fa0
commit
e95045dab4
55 changed files with 356 additions and 299 deletions
|
|
@ -7,7 +7,7 @@
|
|||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
4ED1F0A881A9ACB5977A8987 /* (null) in Frameworks */ = {isa = PBXBuildFile; };
|
||||
4ED1F0A881A9ACB5977A8987 /* BuildFile in Frameworks */ = {isa = PBXBuildFile; };
|
||||
660AAF7F2B839272004C0FA6 /* msgNotificationService.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 660AAF7B2B839271004C0FA6 /* msgNotificationService.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
660D8A712B517D260092694D /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 660D8A702B517D260092694D /* GoogleService-Info.plist */; };
|
||||
6613A0AE2BAEB7DF008923A4 /* MeetingFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6613A0AD2BAEB7DF008923A4 /* MeetingFragment.swift */; };
|
||||
|
|
@ -364,7 +364,7 @@
|
|||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
4ED1F0A881A9ACB5977A8987 /* (null) in Frameworks */,
|
||||
4ED1F0A881A9ACB5977A8987 /* BuildFile in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
@ -986,6 +986,7 @@
|
|||
/* Begin PBXShellScriptBuildPhase section */
|
||||
6677CE082C73D71A0020FD0E /* Crashlytics */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
|
|
@ -1009,6 +1010,7 @@
|
|||
};
|
||||
66BF2D4B2B558A3100A5F2E3 /* Crashlytics */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
|
|
@ -1226,7 +1228,7 @@
|
|||
CODE_SIGN_ENTITLEMENTS = msgNotificationService/msgNotificationService.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
CURRENT_PROJECT_VERSION = 38;
|
||||
DEVELOPMENT_TEAM = Z2V957B3D6;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
|
|
@ -1245,7 +1247,7 @@
|
|||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
MARKETING_VERSION = 6.0.0;
|
||||
OTHER_SWIFT_FLAGS = "$(inherited)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.linphone.phone.msgNotificationService;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
|
@ -1268,7 +1270,7 @@
|
|||
CODE_SIGN_ENTITLEMENTS = msgNotificationService/msgNotificationService.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
CURRENT_PROJECT_VERSION = 38;
|
||||
DEVELOPMENT_TEAM = Z2V957B3D6;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
|
|
@ -1284,7 +1286,7 @@
|
|||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
MARKETING_VERSION = 6.0.0;
|
||||
OTHER_SWIFT_FLAGS = "$(inherited)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.linphone.phone.msgNotificationService;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
|
@ -1422,7 +1424,7 @@
|
|||
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
|
||||
CODE_SIGN_ENTITLEMENTS = Linphone/Linphone.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 36;
|
||||
CURRENT_PROJECT_VERSION = 38;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEVELOPMENT_ASSET_PATHS = "\"Linphone/Preview Content\"";
|
||||
|
|
@ -1478,7 +1480,7 @@
|
|||
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
|
||||
CODE_SIGN_ENTITLEMENTS = Linphone/Linphone.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 36;
|
||||
CURRENT_PROJECT_VERSION = 38;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"Linphone/Preview Content\"";
|
||||
DEVELOPMENT_TEAM = Z2V957B3D6;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// swiftlint:disable line_length
|
||||
// swiftlint:disable large_tuple
|
||||
// swiftlint:disable function_parameter_count
|
||||
|
||||
import linphonesw
|
||||
import Contacts
|
||||
import SwiftUI
|
||||
|
|
@ -135,26 +139,22 @@ final class ContactsManager: ObservableObject {
|
|||
|
||||
var addedAvatarListModel: [ContactAvatarModel] = []
|
||||
cbValue.linphoneFriend.phoneNumbers.forEach { phone in
|
||||
do {
|
||||
let address = core.interpretUrl(url: phone, applyInternationalPrefix: true)
|
||||
let address = core.interpretUrl(url: phone, applyInternationalPrefix: true)
|
||||
|
||||
let presence = cbValue.linphoneFriend.getPresenceModelForUriOrTel(uriOrTel: address?.asStringUriOnly() ?? "")
|
||||
if address != nil && presence != nil {
|
||||
cbValue.linphoneFriend.edit()
|
||||
cbValue.linphoneFriend.addAddress(address: address!)
|
||||
cbValue.linphoneFriend.done()
|
||||
|
||||
let presence = cbValue.linphoneFriend.getPresenceModelForUriOrTel(uriOrTel: address?.asStringUriOnly() ?? "")
|
||||
if address != nil && presence != nil {
|
||||
cbValue.linphoneFriend.edit()
|
||||
cbValue.linphoneFriend.addAddress(address: address!)
|
||||
cbValue.linphoneFriend.done()
|
||||
|
||||
addedAvatarListModel.append(
|
||||
ContactAvatarModel(
|
||||
friend: cbValue.linphoneFriend,
|
||||
name: cbValue.linphoneFriend.name ?? "",
|
||||
address: cbValue.linphoneFriend.address?.clone()?.asStringUriOnly() ?? "",
|
||||
withPresence: true
|
||||
)
|
||||
addedAvatarListModel.append(
|
||||
ContactAvatarModel(
|
||||
friend: cbValue.linphoneFriend,
|
||||
name: cbValue.linphoneFriend.name ?? "",
|
||||
address: cbValue.linphoneFriend.address?.clone()?.asStringUriOnly() ?? "",
|
||||
withPresence: true
|
||||
)
|
||||
}
|
||||
} catch let error {
|
||||
print("\(#function) - Failed to create friend phone number for \(phone):", error)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -361,7 +361,7 @@ final class ContactsManager: ObservableObject {
|
|||
}
|
||||
|
||||
func getFriendWithAddressInCoreQueue(address: Address?, completion: @escaping (Friend?) -> Void) {
|
||||
self.coreContext.doOnCoreQueue { core in
|
||||
self.coreContext.doOnCoreQueue { _ in
|
||||
completion(self.getFriendWithAddress(address: address))
|
||||
}
|
||||
}
|
||||
|
|
@ -384,3 +384,7 @@ struct Contact: Identifiable {
|
|||
var phoneNumbers: [PhoneNumber] = []
|
||||
var imageData: String
|
||||
}
|
||||
|
||||
// swiftlint:enable line_length
|
||||
// swiftlint:enable large_tuple
|
||||
// swiftlint:enable function_parameter_count
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
// swiftlint:disable large_tuple
|
||||
// swiftlint:disable line_length
|
||||
// swiftlint:disable cyclomatic_complexity
|
||||
// swiftlint:disable identifier_name
|
||||
|
||||
import linphonesw
|
||||
import linphone // needed for unwrapped function linphone_core_set_push_and_app_delegate_dispatch_queue
|
||||
|
|
@ -46,14 +48,14 @@ final class CoreContext: ObservableObject {
|
|||
private var mIterateSuscription: AnyCancellable?
|
||||
private var mCoreSuscriptions = Set<AnyCancellable?>()
|
||||
|
||||
var bearerAuthInfoPendingPasswordUpdate: AuthInfo? = nil
|
||||
var bearerAuthInfoPendingPasswordUpdate: AuthInfo?
|
||||
|
||||
let monitor = NWPathMonitor()
|
||||
|
||||
private var mCorePushIncomingDelegate: CoreDelegate!
|
||||
private var actionsToPerformOnCoreQueueWhenCoreIsStarted : [((Core)->Void)] = []
|
||||
private var callStateCallBacks : [((Call.State)->Void)] = []
|
||||
private var configuringStateCallBacks : [((ConfiguringState)->Void)] = []
|
||||
private var actionsToPerformOnCoreQueueWhenCoreIsStarted: [((Core) -> Void)] = []
|
||||
private var callStateCallBacks: [((Call.State) -> Void)] = []
|
||||
private var configuringStateCallBacks: [((ConfiguringState) -> Void)] = []
|
||||
|
||||
private init() {
|
||||
do {
|
||||
|
|
@ -128,7 +130,6 @@ final class CoreContext: ObservableObject {
|
|||
self.mCore.maxSizeForAutoDownloadIncomingFiles = 0
|
||||
self.mCore.config!.setBool(section: "sip", key: "auto_answer_replacing_calls", value: false)
|
||||
self.mCore.config!.setBool(section: "sip", key: "deliver_imdn", value: false)
|
||||
|
||||
self.mCoreSuscriptions.insert(self.mCore.publisher?.onGlobalStateChanged?.postOnCoreQueue { (cbVal: (core: Core, state: GlobalState, message: String)) in
|
||||
if cbVal.state == GlobalState.On {
|
||||
#if DEBUG
|
||||
|
|
@ -236,7 +237,7 @@ final class CoreContext: ObservableObject {
|
|||
TelecomManager.shared.onCallStateChanged(core: cbVal.core, call: cbVal.call, state: cbVal.state, message: cbVal.message)
|
||||
})
|
||||
|
||||
self.mCorePushIncomingDelegate = CoreDelegateStub(onCallStateChanged: { (core: Core, call: Call, cstate: Call.State, message: String) in
|
||||
self.mCorePushIncomingDelegate = CoreDelegateStub(onCallStateChanged: { (_, call: Call, cstate: Call.State, _) in
|
||||
if cstate == .PushIncomingReceived {
|
||||
let callLog = call.callLog
|
||||
let callId = callLog?.callId ?? ""
|
||||
|
|
@ -260,9 +261,9 @@ final class CoreContext: ObservableObject {
|
|||
}
|
||||
})
|
||||
|
||||
self.mCoreSuscriptions.insert(self.mCore.publisher?.onTransferStateChanged?.postOnCoreQueue { (cbValue: (_: Core, transfered: Call, callState: Call.State)) in
|
||||
self.mCoreSuscriptions.insert(self.mCore.publisher?.onTransferStateChanged?.postOnCoreQueue { (cbValue: (_: Core, transferred: Call, callState: Call.State)) in
|
||||
Log.info(
|
||||
"[CoreContext] Transferred call \(cbValue.transfered.remoteAddress!.asStringUriOnly()) state changed \(cbValue.callState)"
|
||||
"[CoreContext] Transferred call \(cbValue.transferred.remoteAddress!.asStringUriOnly()) state changed \(cbValue.callState)"
|
||||
)
|
||||
|
||||
DispatchQueue.main.async {
|
||||
|
|
@ -362,8 +363,8 @@ final class CoreContext: ObservableObject {
|
|||
fatalError("Crashing app to test crashlytics")
|
||||
}
|
||||
|
||||
func performActionOnCoreQueueWhenCoreIsStarted(action: @escaping (_ core: Core)->Void ) {
|
||||
if (coreIsStarted) {
|
||||
func performActionOnCoreQueueWhenCoreIsStarted(action: @escaping (_ core: Core) -> Void ) {
|
||||
if coreIsStarted {
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
action(core)
|
||||
}
|
||||
|
|
@ -387,3 +388,5 @@ final class CoreContext: ObservableObject {
|
|||
|
||||
// swiftlint:enable large_tuple
|
||||
// swiftlint:enable line_length
|
||||
// swiftlint:enable cyclomatic_complexity
|
||||
// swiftlint:enable identifier_name
|
||||
|
|
|
|||
|
|
@ -70,21 +70,19 @@ class ProviderDelegate: NSObject {
|
|||
}
|
||||
|
||||
static var providerConfiguration: CXProviderConfiguration {
|
||||
get {
|
||||
let providerConfiguration = CXProviderConfiguration()
|
||||
// providerConfiguration.ringtoneSound = ConfigManager.instance().lpConfigBoolForKey(key: "use_device_ringtone") ? nil : "notes_of_the_optimistic.caf"
|
||||
providerConfiguration.supportsVideo = true
|
||||
providerConfiguration.iconTemplateImageData = UIImage(named: "linphone")?.pngData()
|
||||
providerConfiguration.supportedHandleTypes = [.generic, .phoneNumber, .emailAddress]
|
||||
|
||||
providerConfiguration.maximumCallsPerCallGroup = 10
|
||||
providerConfiguration.maximumCallGroups = 10
|
||||
|
||||
// not show app's calls in tel's history
|
||||
// providerConfiguration.includesCallsInRecents = YES;
|
||||
|
||||
return providerConfiguration
|
||||
}
|
||||
let providerConfiguration = CXProviderConfiguration()
|
||||
// providerConfiguration.ringtoneSound = ConfigManager.instance().lpConfigBoolForKey(key: "use_device_ringtone") ? nil : "notes_of_the_optimistic.caf"
|
||||
providerConfiguration.supportsVideo = true
|
||||
providerConfiguration.iconTemplateImageData = UIImage(named: "linphone")?.pngData()
|
||||
providerConfiguration.supportedHandleTypes = [.generic, .phoneNumber, .emailAddress]
|
||||
|
||||
providerConfiguration.maximumCallsPerCallGroup = 10
|
||||
providerConfiguration.maximumCallGroups = 10
|
||||
|
||||
// not show app's calls in tel's history
|
||||
// providerConfiguration.includesCallsInRecents = YES;
|
||||
|
||||
return providerConfiguration
|
||||
}
|
||||
|
||||
func reportIncomingCall(call: Call?, uuid: UUID, handle: String, hasVideo: Bool, displayName: String) {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// swiftlint:disable cyclomatic_complexity
|
||||
// swiftlint:disable line_length
|
||||
// swiftlint:disable type_body_length
|
||||
|
||||
import Foundation
|
||||
import linphonesw
|
||||
|
|
@ -33,7 +35,6 @@ class CallAppData: NSObject {
|
|||
|
||||
}
|
||||
|
||||
// swiftlint:disable type_body_length
|
||||
class TelecomManager: ObservableObject {
|
||||
static let shared = TelecomManager()
|
||||
static var uuidReplacedCall: String?
|
||||
|
|
@ -127,7 +128,7 @@ class TelecomManager: ObservableObject {
|
|||
|
||||
func setHeldOtherCalls(core: Core, exceptCallid: String) {
|
||||
for call in core.calls {
|
||||
if (call.callLog?.callId != exceptCallid && call.state != .Paused && call.state != .Pausing && call.state != .PausedByRemote) {
|
||||
if call.callLog?.callId != exceptCallid && call.state != .Paused && call.state != .Pausing && call.state != .PausedByRemote {
|
||||
setHeld(call: call, hold: true)
|
||||
} else if call.callLog?.callId == exceptCallid && (call.state == .Paused || call.state == .Pausing || call.state == .PausedByRemote) {
|
||||
setHeld(call: call, hold: true)
|
||||
|
|
@ -138,7 +139,7 @@ class TelecomManager: ObservableObject {
|
|||
func setHeld(call: Call, hold: Bool) {
|
||||
|
||||
#if targetEnvironment(simulator)
|
||||
if (hold) {
|
||||
if hold {
|
||||
try?call.pause()
|
||||
} else {
|
||||
try?call.resume()
|
||||
|
|
@ -146,7 +147,7 @@ class TelecomManager: ObservableObject {
|
|||
#else
|
||||
let callid = call.callLog?.callId ?? ""
|
||||
let uuid = providerDelegate.uuids["\(callid)"]
|
||||
if (uuid == nil) {
|
||||
if uuid == nil {
|
||||
Log.error("Can not find correspondant call to set held.")
|
||||
return
|
||||
}
|
||||
|
|
@ -352,9 +353,8 @@ class TelecomManager: ObservableObject {
|
|||
providerDelegate.reportIncomingCall(call: call, uuid: uuid, handle: handle, hasVideo: hasVideo, displayName: displayName)
|
||||
}
|
||||
|
||||
|
||||
func incomingDisplayName(call: Call, completion: @escaping (String) -> Void) {
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
CoreContext.shared.doOnCoreQueue { _ in
|
||||
ContactsManager.shared.getFriendWithAddressInCoreQueue(address: call.remoteAddress!) { friendResult in
|
||||
if call.remoteAddress != nil {
|
||||
if friendResult != nil && friendResult!.address != nil && friendResult!.address!.displayName != nil {
|
||||
|
|
@ -377,8 +377,9 @@ class TelecomManager: ObservableObject {
|
|||
static func callKitEnabled(core: Core) -> Bool {
|
||||
#if !targetEnvironment(simulator)
|
||||
return core.callkitEnabled
|
||||
#endif
|
||||
#else
|
||||
return false
|
||||
#endif
|
||||
}
|
||||
|
||||
func requestTransaction(_ transaction: CXTransaction, action: String) {
|
||||
|
|
@ -417,7 +418,7 @@ class TelecomManager: ObservableObject {
|
|||
if cstate == .PushIncomingReceived {
|
||||
Log.info("PushIncomingReceived on TelecomManager -- Ignore, should be processed by a the dedicated CoreDelegate for callkit display")
|
||||
} else {
|
||||
let oldRemoteConfVideo = self.remoteConfVideo
|
||||
// let oldRemoteConfVideo = self.remoteConfVideo
|
||||
|
||||
if call.conference != nil {
|
||||
if call.conference!.activeSpeakerParticipantDevice != nil {
|
||||
|
|
@ -595,9 +596,9 @@ class TelecomManager: ObservableObject {
|
|||
}
|
||||
*/
|
||||
let uuid = self.providerDelegate.uuids["\(callId)"]
|
||||
//if call.replacedCall == nil {
|
||||
// if call.replacedCall == nil {
|
||||
TelecomManager.uuidReplacedCall = callId
|
||||
//}
|
||||
// }
|
||||
|
||||
if uuid != nil {
|
||||
// Tha app is now registered, updated the call already existed.
|
||||
|
|
@ -692,7 +693,7 @@ class TelecomManager: ObservableObject {
|
|||
// bluetoothEnabled = false
|
||||
}
|
||||
|
||||
//if core.callsNb == 0 {
|
||||
// if core.callsNb == 0 {
|
||||
self.incomingDisplayName(call: call) { displayNameResult in
|
||||
var displayName = "Unknown"
|
||||
if call.dir == .Incoming {
|
||||
|
|
@ -744,7 +745,7 @@ class TelecomManager: ObservableObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
// }
|
||||
|
||||
if TelecomManager.callKitEnabled(core: core) {
|
||||
var uuid = providerDelegate.uuids["\(callId)"]
|
||||
|
|
@ -795,5 +796,7 @@ class TelecomManager: ObservableObject {
|
|||
])
|
||||
}
|
||||
}
|
||||
|
||||
// swiftlint:enable type_body_length
|
||||
// swiftlint:enable cyclomatic_complexity
|
||||
// swiftlint:enable line_length
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ struct ProfileModeFragment: View {
|
|||
}
|
||||
.onAppear {
|
||||
UserDefaults.standard.set(false, forKey: "display_profile_mode")
|
||||
//Skip this view
|
||||
// Skip this view
|
||||
sharedMainViewModel.changeHideProfileMode()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
import SwiftUI
|
||||
|
||||
// swiftlint:disable line_length
|
||||
struct RegisterCodeConfirmationFragment: View {
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
@ObservedObject var registerViewModel: RegisterViewModel
|
||||
|
|
@ -196,3 +197,4 @@ struct RegisterCodeConfirmationFragment: View {
|
|||
#Preview {
|
||||
RegisterCodeConfirmationFragment(registerViewModel: RegisterViewModel())
|
||||
}
|
||||
// swiftlint:enable line_length
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// swiftlint:disable line_length
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct RegisterFragment: View {
|
||||
|
|
@ -343,3 +345,5 @@ struct RegisterFragment: View {
|
|||
#Preview {
|
||||
RegisterFragment(registerViewModel: RegisterViewModel())
|
||||
}
|
||||
|
||||
// swiftlint:enable line_length
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ import Foundation
|
|||
import linphonesw
|
||||
import Combine
|
||||
|
||||
// swiftlint:disable line_length
|
||||
// swiftlint:disable type_body_length
|
||||
class RegisterViewModel: ObservableObject {
|
||||
|
||||
static let TAG = "[RegisterViewModel]"
|
||||
|
|
@ -119,8 +121,7 @@ class RegisterViewModel: ObservableObject {
|
|||
}
|
||||
func addDelegate(request: AccountManagerServicesRequest) {
|
||||
coreContext.doOnCoreQueue { core in
|
||||
self.accountManagerServicesSuscriptions.insert(request.publisher?.onRequestSuccessful?.postOnCoreQueue {
|
||||
(request: AccountManagerServicesRequest, data: String) in
|
||||
self.accountManagerServicesSuscriptions.insert(request.publisher?.onRequestSuccessful?.postOnCoreQueue { (request: AccountManagerServicesRequest, data: String) in
|
||||
Log.info("\(RegisterViewModel.TAG) Request \(request) was successful, data is \(data)")
|
||||
switch request.type {
|
||||
case .CreateAccountUsingToken:
|
||||
|
|
@ -142,9 +143,7 @@ class RegisterViewModel: ObservableObject {
|
|||
case .LinkPhoneNumberUsingCode:
|
||||
let account = self.accountCreated
|
||||
if account != nil {
|
||||
Log.info(
|
||||
"\(RegisterViewModel.TAG) Account \(account?.params?.identityAddress?.asStringUriOnly()) has been created & activated, setting it as default"
|
||||
)
|
||||
Log.info( "\(RegisterViewModel.TAG) Account \(account?.params?.identityAddress?.asStringUriOnly() ?? "NIL") has been created & activated, setting it as default")
|
||||
|
||||
if let assistantLinphone = Bundle.main.path(forResource: "assistant_linphone_default_values", ofType: nil) {
|
||||
core.loadConfigFromXml(xmlUri: assistantLinphone)
|
||||
|
|
@ -166,8 +165,7 @@ class RegisterViewModel: ObservableObject {
|
|||
}
|
||||
})
|
||||
|
||||
self.accountManagerServicesSuscriptions.insert(request.publisher?.onRequestError?.postOnCoreQueue {
|
||||
(request: AccountManagerServicesRequest, statusCode: Int, errorMessage: String, parameterErrors: Dictionary?) in
|
||||
self.accountManagerServicesSuscriptions.insert(request.publisher?.onRequestError?.postOnCoreQueue { (request: AccountManagerServicesRequest, statusCode: Int, errorMessage: String, parameterErrors: Dictionary?) in
|
||||
Log.error(
|
||||
"\(RegisterViewModel.TAG) Request \(request) returned an error with status code \(statusCode) and message \(errorMessage)"
|
||||
)
|
||||
|
|
@ -371,9 +369,7 @@ class RegisterViewModel: ObservableObject {
|
|||
|
||||
let identity = account!.params!.identityAddress
|
||||
if identity != nil {
|
||||
Log.info(
|
||||
"\(RegisterViewModel.TAG) Account \(identity!.asStringUriOnly()) should now be created, asking account manager to send a confirmation code by SMS to \(phoneNumberValue ?? "")"
|
||||
)
|
||||
Log.info("\(RegisterViewModel.TAG) Account \(identity!.asStringUriOnly()) should now be created, asking account manager to send a confirmation code by SMS to \(phoneNumberValue ?? "")")
|
||||
do {
|
||||
let request = try accountManagerServices?.createSendPhoneNumberLinkingCodeBySmsRequest(
|
||||
sipIdentity: identity!,
|
||||
|
|
@ -404,9 +400,7 @@ class RegisterViewModel: ObservableObject {
|
|||
return
|
||||
}
|
||||
|
||||
Log.info(
|
||||
"\(RegisterViewModel.TAG) Account creation token is \(token ?? "Error token"), creating account with username \(username) and algorithm \(HASHALGORITHM)"
|
||||
)
|
||||
Log.info( "\(RegisterViewModel.TAG) Account creation token is \(token ?? "Error token"), creating account with username \(username) and algorithm \(HASHALGORITHM)")
|
||||
|
||||
do {
|
||||
let request = try accountManagerServices!.createNewAccountUsingTokenRequest(
|
||||
|
|
@ -441,9 +435,7 @@ class RegisterViewModel: ObservableObject {
|
|||
|
||||
let number = self.phoneNumber
|
||||
let formattedPhoneNumber = dialPlan?.formatPhoneNumber(phoneNumber: number, escapePlus: false)
|
||||
Log.info(
|
||||
"\(RegisterViewModel.TAG) Formatted phone number \(number) using dial plan \(dialPlan?.country ?? "Error country") is \(formattedPhoneNumber ?? "Error phone number")"
|
||||
)
|
||||
Log.info( "\(RegisterViewModel.TAG) Formatted phone number \(number) using dial plan \(dialPlan?.country ?? "Error country") is \(formattedPhoneNumber ?? "Error phone number")")
|
||||
|
||||
self.normalizedPhoneNumber = formattedPhoneNumber
|
||||
} else {
|
||||
|
|
@ -481,3 +473,6 @@ class RegisterViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// swiftlint:enable line_length
|
||||
// swiftlint:enable type_body_length
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import AVFAudio
|
|||
import linphonesw
|
||||
import UniformTypeIdentifiers
|
||||
|
||||
// swiftlint:disable function_body_length
|
||||
// swiftlint:disable type_body_length
|
||||
// swiftlint:disable line_length
|
||||
// swiftlint:disable file_length
|
||||
|
|
@ -73,28 +74,28 @@ struct CallView: View {
|
|||
innerView(geometry: geo)
|
||||
.sheet(isPresented: $mediaEncryptedSheet, onDismiss: {
|
||||
mediaEncryptedSheet = false
|
||||
}) {
|
||||
}, content: {
|
||||
MediaEncryptedSheetBottomSheet(callViewModel: callViewModel, mediaEncryptedSheet: $mediaEncryptedSheet)
|
||||
.presentationDetents([.medium])
|
||||
}
|
||||
})
|
||||
.sheet(isPresented: $callStatisticsSheet, onDismiss: {
|
||||
callStatisticsSheet = false
|
||||
}) {
|
||||
}, content: {
|
||||
CallStatisticsSheetBottomSheet(callViewModel: callViewModel, callStatisticsSheet: $callStatisticsSheet)
|
||||
.presentationDetents(!callViewModel.callStatsModel.isVideoEnabled ? [.fraction(0.3)] : [.medium])
|
||||
}
|
||||
})
|
||||
.sheet(isPresented: $audioRouteSheet, onDismiss: {
|
||||
audioRouteSheet = false
|
||||
}) {
|
||||
}, content: {
|
||||
AudioRouteBottomSheet(callViewModel: callViewModel, optionsAudioRoute: $optionsAudioRoute)
|
||||
.presentationDetents([.fraction(0.3)])
|
||||
}
|
||||
})
|
||||
.sheet(isPresented: $changeLayoutSheet, onDismiss: {
|
||||
changeLayoutSheet = false
|
||||
}) {
|
||||
}, content: {
|
||||
ChangeLayoutBottomSheet(callViewModel: callViewModel, changeLayoutSheet: $changeLayoutSheet, optionsChangeLayout: $optionsChangeLayout)
|
||||
.presentationDetents([.fraction(0.3)])
|
||||
}
|
||||
})
|
||||
.sheet(isPresented: $showingDialer) {
|
||||
DialerBottomSheet(
|
||||
startCallViewModel: StartCallViewModel(),
|
||||
|
|
@ -110,28 +111,28 @@ struct CallView: View {
|
|||
innerView(geometry: geo)
|
||||
.sheet(isPresented: $mediaEncryptedSheet, onDismiss: {
|
||||
mediaEncryptedSheet = false
|
||||
}) {
|
||||
}, content: {
|
||||
MediaEncryptedSheetBottomSheet(callViewModel: callViewModel, mediaEncryptedSheet: $mediaEncryptedSheet)
|
||||
.presentationDetents([.medium])
|
||||
}
|
||||
})
|
||||
.sheet(isPresented: $callStatisticsSheet, onDismiss: {
|
||||
callStatisticsSheet = false
|
||||
}) {
|
||||
}, content: {
|
||||
CallStatisticsSheetBottomSheet(callViewModel: callViewModel, callStatisticsSheet: $callStatisticsSheet)
|
||||
.presentationDetents(!callViewModel.callStatsModel.isVideoEnabled ? [.fraction(0.3)] : [.medium])
|
||||
}
|
||||
})
|
||||
.sheet(isPresented: $audioRouteSheet, onDismiss: {
|
||||
audioRouteSheet = false
|
||||
}) {
|
||||
}, content: {
|
||||
AudioRouteBottomSheet(callViewModel: callViewModel, optionsAudioRoute: $optionsAudioRoute)
|
||||
.presentationDetents([.fraction(0.3)])
|
||||
}
|
||||
})
|
||||
.sheet(isPresented: $changeLayoutSheet, onDismiss: {
|
||||
changeLayoutSheet = false
|
||||
}) {
|
||||
}, content: {
|
||||
ChangeLayoutBottomSheet(callViewModel: callViewModel, changeLayoutSheet: $changeLayoutSheet, optionsChangeLayout: $optionsChangeLayout)
|
||||
.presentationDetents([.fraction(0.3)])
|
||||
}
|
||||
})
|
||||
.sheet(isPresented: $showingDialer) {
|
||||
DialerBottomSheet(
|
||||
startCallViewModel: StartCallViewModel(),
|
||||
|
|
@ -237,7 +238,6 @@ struct CallView: View {
|
|||
}
|
||||
|
||||
@ViewBuilder
|
||||
// swiftlint:disable:next cyclomatic_complexity
|
||||
func innerView(geometry: GeometryProxy) -> some View {
|
||||
ZStack {
|
||||
VStack {
|
||||
|
|
@ -432,8 +432,7 @@ struct CallView: View {
|
|||
.frame(height: geometry.size.height)
|
||||
.frame(maxWidth: .infinity)
|
||||
.background(Color.gray900)
|
||||
|
||||
|
||||
|
||||
if !fullscreenVideo || (fullscreenVideo && telecomManager.isPausedByRemote) {
|
||||
if telecomManager.callStarted {
|
||||
let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene
|
||||
|
|
@ -451,7 +450,7 @@ struct CallView: View {
|
|||
currentOffset = (minBottomSheetHeight * geometry.size.height > 80 ? minBottomSheetHeight * geometry.size.height : 78)
|
||||
pointingUp = -(((currentOffset - (minBottomSheetHeight * geometry.size.height > 80 ? minBottomSheetHeight * geometry.size.height : 78)) / ((maxBottomSheetHeight * geometry.size.height) - (minBottomSheetHeight * geometry.size.height > 80 ? minBottomSheetHeight * geometry.size.height : 78))) - 0.5) * 2
|
||||
}
|
||||
.onChange(of: optionsChangeLayout) { optionsChangeLayoutValue in
|
||||
.onChange(of: optionsChangeLayout) { _ in
|
||||
currentOffset = (minBottomSheetHeight * geometry.size.height > 80 ? minBottomSheetHeight * geometry.size.height : 78)
|
||||
pointingUp = -(((currentOffset - (minBottomSheetHeight * geometry.size.height > 80 ? minBottomSheetHeight * geometry.size.height : 78)) / ((maxBottomSheetHeight * geometry.size.height) - (minBottomSheetHeight * geometry.size.height > 80 ? minBottomSheetHeight * geometry.size.height : 78))) - 0.5) * 2
|
||||
}
|
||||
|
|
@ -461,7 +460,6 @@ struct CallView: View {
|
|||
}
|
||||
}
|
||||
|
||||
// swiftlint:disable function_body_length
|
||||
// swiftlint:disable:next cyclomatic_complexity
|
||||
func simpleCallView(geometry: GeometryProxy) -> some View {
|
||||
ZStack {
|
||||
|
|
@ -748,7 +746,6 @@ struct CallView: View {
|
|||
callViewModel.orientationUpdate(orientation: orientation)
|
||||
}
|
||||
}
|
||||
// swiftlint:enable function_body_length
|
||||
|
||||
// swiftlint:disable:next cyclomatic_complexity
|
||||
func activeSpeakerMode(geometry: GeometryProxy) -> some View {
|
||||
|
|
@ -1821,7 +1818,7 @@ struct CallView: View {
|
|||
}
|
||||
}
|
||||
|
||||
// swiftlint:disable function_body_length
|
||||
// swiftlint:disable:next cyclomatic_complexity
|
||||
func bottomSheetContent(geo: GeometryProxy) -> some View {
|
||||
GeometryReader { _ in
|
||||
VStack(spacing: 0) {
|
||||
|
|
@ -2689,7 +2686,6 @@ struct CallView: View {
|
|||
.frame(maxHeight: .infinity, alignment: .top)
|
||||
}
|
||||
}
|
||||
// swiftlint:enable function_body_length
|
||||
|
||||
func getAudioRouteImage() {
|
||||
if !AVAudioSession.sharedInstance().currentRoute.outputs.filter({ $0.portType.rawValue == "Speaker" }).isEmpty {
|
||||
|
|
@ -2810,4 +2806,5 @@ struct PressedButtonStyle: ButtonStyle {
|
|||
}
|
||||
// swiftlint:enable type_body_length
|
||||
// swiftlint:enable line_length
|
||||
// swiftlint:enable function_body_length
|
||||
// swiftlint:enable file_length
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ struct AudioRouteBottomSheet: View {
|
|||
do {
|
||||
try AVAudioSession.sharedInstance().overrideOutputAudioPort(.none)
|
||||
if callViewModel.isHeadPhoneAvailable() {
|
||||
try AVAudioSession.sharedInstance().setPreferredInput(AVAudioSession.sharedInstance().availableInputs?.filter({ $0.portType.rawValue.contains("Receiver") }).first)
|
||||
try AVAudioSession.sharedInstance().setPreferredInput(
|
||||
AVAudioSession.sharedInstance().availableInputs?.filter({ $0.portType.rawValue.contains("Receiver") }).first)
|
||||
} else {
|
||||
try AVAudioSession.sharedInstance().setPreferredInput(AVAudioSession.sharedInstance().availableInputs?.first)
|
||||
}
|
||||
|
|
@ -106,7 +107,8 @@ struct AudioRouteBottomSheet: View {
|
|||
|
||||
do {
|
||||
try AVAudioSession.sharedInstance().overrideOutputAudioPort(.none)
|
||||
try AVAudioSession.sharedInstance().setPreferredInput(AVAudioSession.sharedInstance().availableInputs?.filter({ $0.portType.rawValue.contains("Bluetooth") }).first)
|
||||
try AVAudioSession.sharedInstance().setPreferredInput(
|
||||
AVAudioSession.sharedInstance().availableInputs?.filter({ $0.portType.rawValue.contains("Bluetooth") }).first)
|
||||
} catch _ {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
import SwiftUI
|
||||
import linphonesw
|
||||
|
||||
// swiftlint:disable type_body_length
|
||||
struct CallsListFragment: View {
|
||||
|
||||
@ObservedObject private var coreContext = CoreContext.shared
|
||||
|
|
@ -88,10 +89,10 @@ struct CallsListFragment: View {
|
|||
if #available(iOS 16.0, *), idiom != .pad {
|
||||
callsList
|
||||
.sheet(isPresented: $isShowCallsListBottomSheet, onDismiss: {
|
||||
}) {
|
||||
}, content: {
|
||||
innerBottomSheet()
|
||||
.presentationDetents([.fraction(0.2)])
|
||||
}
|
||||
})
|
||||
} else {
|
||||
callsList
|
||||
.halfSheet(showSheet: $isShowCallsListBottomSheet) {
|
||||
|
|
@ -382,3 +383,4 @@ struct CallsListFragment: View {
|
|||
#Preview {
|
||||
CallsListFragment(callViewModel: CallViewModel(), isShowCallsListFragment: .constant(true))
|
||||
}
|
||||
// swiftlint:enable type_body_length
|
||||
|
|
|
|||
|
|
@ -265,5 +265,7 @@ struct ParticipantsListFragment: View {
|
|||
}
|
||||
|
||||
#Preview {
|
||||
ParticipantsListFragment(callViewModel: CallViewModel(), addParticipantsViewModel: AddParticipantsViewModel(), isShowParticipantsListFragment: .constant(true))
|
||||
ParticipantsListFragment(callViewModel: CallViewModel(),
|
||||
addParticipantsViewModel: AddParticipantsViewModel(),
|
||||
isShowParticipantsListFragment: .constant(true))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
import SwiftUI
|
||||
import Foundation
|
||||
|
||||
// swiftlint:disable:next type_body_length
|
||||
struct ZRTPPopup: View {
|
||||
|
||||
@ObservedObject private var telecomManager = TelecomManager.shared
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ import SwiftUI
|
|||
import linphonesw
|
||||
import AVFAudio
|
||||
|
||||
// swiftlint:disable type_body_length
|
||||
// swiftlint:disable cyclomatic_complexity
|
||||
|
||||
struct MeetingWaitingRoomFragment: View {
|
||||
|
||||
@ObservedObject private var coreContext = CoreContext.shared
|
||||
|
|
@ -44,10 +47,9 @@ struct MeetingWaitingRoomFragment: View {
|
|||
innerView(geometry: geometry)
|
||||
.sheet(isPresented: $audioRouteSheet, onDismiss: {
|
||||
audioRouteSheet = false
|
||||
}) {
|
||||
innerBottomSheet()
|
||||
.presentationDetents([.fraction(0.3)])
|
||||
}
|
||||
}, content: {
|
||||
innerBottomSheet().presentationDetents([.fraction(0.3)])
|
||||
})
|
||||
.onAppear {
|
||||
meetingWaitingRoomViewModel.enableAVAudioSession()
|
||||
if AVAudioSession.sharedInstance().currentRoute.outputs.filter({ $0.portType.rawValue.contains("Bluetooth") }).isEmpty {
|
||||
|
|
@ -87,6 +89,7 @@ struct MeetingWaitingRoomFragment: View {
|
|||
}
|
||||
|
||||
@ViewBuilder
|
||||
// swiftlint:disable:next function_body_length
|
||||
func innerView(geometry: GeometryProxy) -> some View {
|
||||
VStack {
|
||||
if #available(iOS 16.0, *) {
|
||||
|
|
@ -261,7 +264,8 @@ struct MeetingWaitingRoomFragment: View {
|
|||
Spacer()
|
||||
|
||||
Button {
|
||||
!meetingWaitingRoomViewModel.videoDisplayed ? meetingWaitingRoomViewModel.enableVideoPreview() : meetingWaitingRoomViewModel.disableVideoPreview()
|
||||
!meetingWaitingRoomViewModel.videoDisplayed
|
||||
? meetingWaitingRoomViewModel.enableVideoPreview() : meetingWaitingRoomViewModel.disableVideoPreview()
|
||||
} label: {
|
||||
HStack {
|
||||
Image(meetingWaitingRoomViewModel.videoDisplayed ? "video-camera" : "video-camera-slash")
|
||||
|
|
@ -302,13 +306,9 @@ struct MeetingWaitingRoomFragment: View {
|
|||
} else {
|
||||
do {
|
||||
try AVAudioSession.sharedInstance().overrideOutputAudioPort(
|
||||
AVAudioSession.sharedInstance().currentRoute.outputs.filter(
|
||||
{ $0.portType.rawValue == "Speaker" }
|
||||
).isEmpty ? .speaker : .none
|
||||
)
|
||||
} catch _ {
|
||||
|
||||
}
|
||||
AVAudioSession.sharedInstance().currentRoute
|
||||
.outputs.filter({ $0.portType.rawValue == "Speaker" }).isEmpty ? .speaker : .none)
|
||||
} catch _ {}
|
||||
}
|
||||
} label: {
|
||||
HStack {
|
||||
|
|
@ -378,13 +378,11 @@ struct MeetingWaitingRoomFragment: View {
|
|||
.multilineTextAlignment(.center)
|
||||
.padding(.bottom, 10)
|
||||
|
||||
|
||||
Text("Vous allez rejoindre la réunion dans quelques instants...")
|
||||
.default_text_style_white(styleSize: 16)
|
||||
.multilineTextAlignment(.center)
|
||||
.padding(.bottom, 20)
|
||||
|
||||
|
||||
ActivityIndicator(color: Color.orangeMain500)
|
||||
.frame(width: 35, height: 35)
|
||||
|
||||
|
|
@ -411,7 +409,6 @@ struct MeetingWaitingRoomFragment: View {
|
|||
}
|
||||
.background(Color.gray900)
|
||||
.onRotate { newOrientation in
|
||||
let oldOrientation = orientation
|
||||
orientation = newOrientation
|
||||
if orientation == .portrait || orientation == .portraitUpsideDown {
|
||||
angleDegree = 0
|
||||
|
|
@ -453,7 +450,8 @@ struct MeetingWaitingRoomFragment: View {
|
|||
do {
|
||||
try AVAudioSession.sharedInstance().overrideOutputAudioPort(.none)
|
||||
if meetingWaitingRoomViewModel.isHeadPhoneAvailable() {
|
||||
try AVAudioSession.sharedInstance().setPreferredInput(AVAudioSession.sharedInstance().availableInputs?.filter({ $0.portType.rawValue.contains("Receiver") }).first)
|
||||
try AVAudioSession.sharedInstance().setPreferredInput(AVAudioSession.sharedInstance()
|
||||
.availableInputs?.filter({ $0.portType.rawValue.contains("Receiver") }).first)
|
||||
} else {
|
||||
try AVAudioSession.sharedInstance().setPreferredInput(AVAudioSession.sharedInstance().availableInputs?.first)
|
||||
}
|
||||
|
|
@ -521,7 +519,8 @@ struct MeetingWaitingRoomFragment: View {
|
|||
|
||||
do {
|
||||
try AVAudioSession.sharedInstance().overrideOutputAudioPort(.none)
|
||||
try AVAudioSession.sharedInstance().setPreferredInput(AVAudioSession.sharedInstance().availableInputs?.filter({ $0.portType.rawValue.contains("Bluetooth") }).first)
|
||||
try AVAudioSession.sharedInstance().setPreferredInput(AVAudioSession.sharedInstance().availableInputs?
|
||||
.filter({ $0.portType.rawValue.contains("Bluetooth") }).first)
|
||||
} catch _ {
|
||||
|
||||
}
|
||||
|
|
@ -571,3 +570,5 @@ struct MeetingWaitingRoomFragment: View {
|
|||
#Preview {
|
||||
MeetingWaitingRoomFragment(meetingWaitingRoomViewModel: MeetingWaitingRoomViewModel())
|
||||
}
|
||||
// swiftlint:enable type_body_length
|
||||
// swiftlint:enable cyclomatic_complexity
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ class CallMediaEncryptionModel: ObservableObject {
|
|||
@Published var zrtpAuthSas = ""
|
||||
|
||||
func update(call: Call) {
|
||||
coreContext.doOnCoreQueue { core in
|
||||
var stats = call.getStats(type: StreamType.Audio)
|
||||
coreContext.doOnCoreQueue { _ in
|
||||
let stats = call.getStats(type: StreamType.Audio)
|
||||
if stats != nil {
|
||||
// ZRTP stats are only available when authentication token isn't null !
|
||||
if call.currentParams!.mediaEncryption == .ZRTP && call.authenticationToken != nil {
|
||||
|
|
@ -82,7 +82,7 @@ class CallMediaEncryptionModel: ObservableObject {
|
|||
self.zrtpAuthSas = zrtpAuthSasTmp
|
||||
}
|
||||
} else {
|
||||
let mediaEncryptionTmp = "Media encryption: " + call.currentParams!.mediaEncryption.rawValue.description //call.currentParams.mediaEncryption
|
||||
let mediaEncryptionTmp = "Media encryption: " + call.currentParams!.mediaEncryption.rawValue.description // call.currentParams.mediaEncryption
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.mediaEncryption = mediaEncryptionTmp
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class CallStatsModel: ObservableObject {
|
|||
@Published var videoFps = ""
|
||||
|
||||
func update(call: Call, stats: CallStats) {
|
||||
coreContext.doOnCoreQueue { core in
|
||||
coreContext.doOnCoreQueue { _ in
|
||||
if call.params != nil {
|
||||
self.isVideoEnabled = call.params!.videoEnabled && call.currentParams != nil && call.currentParams!.videoDirection != .Inactive
|
||||
switch stats.type {
|
||||
|
|
@ -43,7 +43,8 @@ class CallStatsModel: ObservableObject {
|
|||
let clockRate = (payloadType?.clockRate != nil ? payloadType!.clockRate : 0) / 1000
|
||||
let codecLabel = "Codec: " + "\(payloadType != nil ? payloadType!.mimeType : "")/\(clockRate) kHz"
|
||||
|
||||
if stats.uploadBandwidth.rounded().isNaN || stats.uploadBandwidth.rounded().isInfinite || stats.downloadBandwidth.rounded().isNaN || stats.downloadBandwidth.rounded().isInfinite {
|
||||
if stats.uploadBandwidth.rounded().isNaN || stats.uploadBandwidth.rounded().isInfinite
|
||||
|| stats.downloadBandwidth.rounded().isNaN || stats.downloadBandwidth.rounded().isInfinite {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -62,7 +63,8 @@ class CallStatsModel: ObservableObject {
|
|||
let clockRate = (payloadType?.clockRate != nil ? payloadType!.clockRate : 0) / 1000
|
||||
let codecLabel = "Codec: " + "\(payloadType != nil ? payloadType!.mimeType : "null")/\(clockRate) kHz"
|
||||
|
||||
if stats.uploadBandwidth.rounded().isNaN || stats.uploadBandwidth.rounded().isInfinite || stats.downloadBandwidth.rounded().isNaN || stats.downloadBandwidth.rounded().isInfinite {
|
||||
if stats.uploadBandwidth.rounded().isNaN || stats.uploadBandwidth.rounded().isInfinite
|
||||
|| stats.downloadBandwidth.rounded().isNaN || stats.downloadBandwidth.rounded().isInfinite {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,10 @@ import linphonesw
|
|||
import AVFAudio
|
||||
import Combine
|
||||
|
||||
// swiftlint:disable line_length
|
||||
// swiftlint:disable type_body_length
|
||||
// swiftlint:disable cyclomatic_complexity
|
||||
// swiftlint:disable large_tuple
|
||||
class CallViewModel: ObservableObject {
|
||||
|
||||
static let TAG = "[CallViewModel]"
|
||||
|
|
@ -154,8 +157,6 @@ class CallViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.displayName = displayNameTmp
|
||||
}
|
||||
|
|
@ -230,7 +231,7 @@ class CallViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
|
||||
self.callSuscriptions.insert(self.currentCall!.publisher?.onEncryptionChanged?.postOnCoreQueue {(cbVal: (call: Call, on: Bool, authenticationToken: String?)) in
|
||||
self.callSuscriptions.insert(self.currentCall!.publisher?.onEncryptionChanged?.postOnCoreQueue { _ in
|
||||
self.updateEncryption(withToast: false)
|
||||
if self.currentCall != nil {
|
||||
self.callMediaEncryptionModel.update(call: self.currentCall!)
|
||||
|
|
@ -246,7 +247,7 @@ class CallViewModel: ObservableObject {
|
|||
})
|
||||
|
||||
self.callSuscriptions.insert(
|
||||
self.currentCall!.publisher?.onAuthenticationTokenVerified?.postOnCoreQueue {(call: Call, verified: Bool) in
|
||||
self.currentCall!.publisher?.onAuthenticationTokenVerified?.postOnCoreQueue {(_, verified: Bool) in
|
||||
Log.warn("[CallViewModel][ZRTPPopup] Notified that authentication token is \(verified ? "verified" : "not verified!")")
|
||||
if verified {
|
||||
self.updateEncryption(withToast: true)
|
||||
|
|
@ -293,20 +294,20 @@ class CallViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
func getConference() {
|
||||
coreContext.doOnCoreQueue { core in
|
||||
coreContext.doOnCoreQueue { _ in
|
||||
if self.currentCall?.conference != nil {
|
||||
let conf = self.currentCall!.conference!
|
||||
|
||||
let displayNameTmp = conf.subject ?? ""
|
||||
|
||||
var myParticipantModelTmp: ParticipantModel? = nil
|
||||
var myParticipantModelTmp: ParticipantModel?
|
||||
if conf.me?.address != nil {
|
||||
myParticipantModelTmp = ParticipantModel(address: conf.me!.address!, isJoining: false, onPause: false, isMuted: false, isAdmin: conf.me!.isAdmin)
|
||||
} else if self.currentCall?.callLog?.localAddress != nil {
|
||||
myParticipantModelTmp = ParticipantModel(address: self.currentCall!.callLog!.localAddress!, isJoining: false, onPause: false, isMuted: false, isAdmin: conf.me!.isAdmin)
|
||||
}
|
||||
|
||||
var activeSpeakerParticipantTmp: ParticipantModel? = nil
|
||||
var activeSpeakerParticipantTmp: ParticipantModel?
|
||||
if conf.activeSpeakerParticipantDevice?.address != nil {
|
||||
activeSpeakerParticipantTmp = ParticipantModel(
|
||||
address: conf.activeSpeakerParticipantDevice!.address!,
|
||||
|
|
@ -385,8 +386,8 @@ class CallViewModel: ObservableObject {
|
|||
|
||||
func waitingForCreatedStateConference() {
|
||||
self.mConferenceSuscriptions.insert(
|
||||
self.currentCall?.conference?.publisher?.onStateChanged?.postOnCoreQueue {(cbValue: (conference: Conference, state: Conference.State)) in
|
||||
if cbValue.state == .Created {
|
||||
self.currentCall?.conference?.publisher?.onStateChanged?.postOnCoreQueue {(cbValue: (conference: Conference, newState: Conference.State)) in
|
||||
if cbValue.newState == .Created {
|
||||
DispatchQueue.main.async {
|
||||
self.getConference()
|
||||
}
|
||||
|
|
@ -395,9 +396,8 @@ class CallViewModel: ObservableObject {
|
|||
)
|
||||
}
|
||||
|
||||
// swiftlint:disable:next cyclomatic_complexity
|
||||
func addConferenceCallBacks() {
|
||||
coreContext.doOnCoreQueue { core in
|
||||
coreContext.doOnCoreQueue { _ in
|
||||
self.mConferenceSuscriptions.insert(
|
||||
self.currentCall?.conference?.publisher?.onActiveSpeakerParticipantDevice?.postOnCoreQueue {(cbValue: (conference: Conference, participantDevice: ParticipantDevice)) in
|
||||
if cbValue.participantDevice.address != nil {
|
||||
|
|
@ -477,7 +477,7 @@ class CallViewModel: ObservableObject {
|
|||
}
|
||||
})
|
||||
|
||||
var activeSpeakerParticipantTmp: ParticipantModel? = nil
|
||||
var activeSpeakerParticipantTmp: ParticipantModel?
|
||||
var activeSpeakerNameTmp = ""
|
||||
|
||||
if self.activeSpeakerParticipant == nil {
|
||||
|
|
@ -755,7 +755,7 @@ class CallViewModel: ObservableObject {
|
|||
func switchCamera() {
|
||||
coreContext.doOnCoreQueue { core in
|
||||
let currentDevice = core.videoDevice
|
||||
Log.info("[CallViewModel] Current camera device is \(currentDevice)")
|
||||
Log.info("[CallViewModel] Current camera device is \(currentDevice ?? "nil")")
|
||||
|
||||
core.videoDevicesList.forEach { camera in
|
||||
if camera != currentDevice && camera != "StaticImage: Static picture" {
|
||||
|
|
@ -945,9 +945,6 @@ class CallViewModel: ObservableObject {
|
|||
}
|
||||
*/
|
||||
|
||||
// When Post Quantum is available, ZRTP is Post Quantum
|
||||
let isZrtpPQTmp = Core.getPostQuantumAvailable
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.isRemoteDeviceTrusted = isRemoteDeviceTrustedTmp
|
||||
self.isMediaEncrypted = true
|
||||
|
|
@ -1072,7 +1069,7 @@ class CallViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
func toggleAdminParticipant(index: Int) {
|
||||
coreContext.doOnCoreQueue { core in
|
||||
coreContext.doOnCoreQueue { _ in
|
||||
self.currentCall?.conference?.participantList.forEach({ participant in
|
||||
if participant.address != nil && self.participantList[index].address.clone() != nil && participant.address!.equal(address2: self.participantList[index].address.clone()!) {
|
||||
self.currentCall?.conference?.setParticipantAdminStatus(participant: participant, isAdmin: !participant.isAdmin)
|
||||
|
|
@ -1082,7 +1079,7 @@ class CallViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
func removeParticipant(index: Int) {
|
||||
coreContext.doOnCoreQueue { core in
|
||||
coreContext.doOnCoreQueue { _ in
|
||||
self.currentCall?.conference?.participantList.forEach({ participant in
|
||||
if participant.address != nil && self.participantList[index].address.clone() != nil && participant.address!.equal(address2: self.participantList[index].address.clone()!) {
|
||||
do {
|
||||
|
|
@ -1309,8 +1306,7 @@ class CallViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
func chatRoomAddDelegate(core: Core, chatRoom: ChatRoom) {
|
||||
self.chatRoomSuscriptions.insert(chatRoom.publisher?.onConferenceJoined?.postOnCoreQueue {
|
||||
(chatRoom: ChatRoom, eventLog: EventLog) in
|
||||
self.chatRoomSuscriptions.insert(chatRoom.publisher?.onConferenceJoined?.postOnCoreQueue { (chatRoom: ChatRoom, _: EventLog) in
|
||||
let state = chatRoom.state
|
||||
let id = LinphoneUtils.getChatRoomId(room: chatRoom)
|
||||
Log.info("\(StartConversationViewModel.TAG) Conversation \(id) \(chatRoom.subject ?? "") state changed: \(state)")
|
||||
|
|
@ -1345,8 +1341,7 @@ class CallViewModel: ObservableObject {
|
|||
}
|
||||
})
|
||||
|
||||
self.chatRoomSuscriptions.insert(chatRoom.publisher?.onStateChanged?.postOnCoreQueue {
|
||||
(chatRoom: ChatRoom, state: ChatRoom.State) in
|
||||
self.chatRoomSuscriptions.insert(chatRoom.publisher?.onStateChanged?.postOnCoreQueue { (chatRoom: ChatRoom, state: ChatRoom.State) in
|
||||
let state = chatRoom.state
|
||||
let id = LinphoneUtils.getChatRoomId(room: chatRoom)
|
||||
if state == ChatRoom.State.CreationFailed {
|
||||
|
|
@ -1362,3 +1357,6 @@ class CallViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
// swiftlint:enable type_body_length
|
||||
// swiftlint:enable line_length
|
||||
// swiftlint:enable cyclomatic_complexity
|
||||
// swiftlint:enable large_tuple
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ class MeetingWaitingRoomViewModel: ObservableObject {
|
|||
func switchCamera() {
|
||||
coreContext.doOnCoreQueue { core in
|
||||
let currentDevice = core.videoDevice
|
||||
Log.info("[CallViewModel] Current camera device is \(currentDevice)")
|
||||
Log.info("[CallViewModel] Current camera device is \(currentDevice ?? "nil")")
|
||||
|
||||
core.videoDevicesList.forEach { camera in
|
||||
if camera != currentDevice && camera != "StaticImage: Static picture" {
|
||||
|
|
@ -246,7 +246,8 @@ class MeetingWaitingRoomViewModel: ObservableObject {
|
|||
case "bluetooth":
|
||||
do {
|
||||
try AVAudioSession.sharedInstance().overrideOutputAudioPort(.none)
|
||||
try AVAudioSession.sharedInstance().setPreferredInput(AVAudioSession.sharedInstance().availableInputs?.filter({ $0.portType.rawValue.contains("Bluetooth") }).first)
|
||||
try AVAudioSession.sharedInstance().setPreferredInput(AVAudioSession.sharedInstance().availableInputs?
|
||||
.filter({ $0.portType.rawValue.contains("Bluetooth") }).first)
|
||||
} catch _ {
|
||||
|
||||
}
|
||||
|
|
@ -260,7 +261,8 @@ class MeetingWaitingRoomViewModel: ObservableObject {
|
|||
do {
|
||||
try AVAudioSession.sharedInstance().overrideOutputAudioPort(.none)
|
||||
if self.isHeadPhoneAvailable() {
|
||||
try AVAudioSession.sharedInstance().setPreferredInput(AVAudioSession.sharedInstance().availableInputs?.filter({ $0.portType.rawValue.contains("Receiver") }).first)
|
||||
try AVAudioSession.sharedInstance().setPreferredInput(AVAudioSession.sharedInstance()
|
||||
.availableInputs?.filter({ $0.portType.rawValue.contains("Receiver") }).first)
|
||||
} else {
|
||||
try AVAudioSession.sharedInstance().setPreferredInput(AVAudioSession.sharedInstance().availableInputs?.first)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
import SwiftUI
|
||||
import linphonesw
|
||||
|
||||
// swiftlint:disable type_body_length
|
||||
struct ContactInnerActionsFragment: View {
|
||||
|
||||
@ObservedObject var contactsManager = ContactsManager.shared
|
||||
|
|
@ -333,9 +334,7 @@ struct ContactInnerActionsFragment: View {
|
|||
.padding(.horizontal)
|
||||
|
||||
Button {
|
||||
if contactAvatarModel != nil {
|
||||
isShowDeletePopup.toggle()
|
||||
}
|
||||
isShowDeletePopup.toggle()
|
||||
} label: {
|
||||
HStack {
|
||||
Image("trash-simple")
|
||||
|
|
@ -377,3 +376,5 @@ struct ContactInnerActionsFragment: View {
|
|||
actionEditButton: {}
|
||||
)
|
||||
}
|
||||
|
||||
// swiftlint:enable type_body_length
|
||||
|
|
|
|||
|
|
@ -77,7 +77,8 @@ struct ContactsInnerFragment: View {
|
|||
|
||||
VStack {
|
||||
List {
|
||||
ContactsListFragment(contactViewModel: contactViewModel, contactsListViewModel: ContactsListViewModel(), showingSheet: $showingSheet, startCallFunc: {addr in })}
|
||||
ContactsListFragment(contactViewModel: contactViewModel, contactsListViewModel: ContactsListViewModel(),
|
||||
showingSheet: $showingSheet, startCallFunc: {_ in })}
|
||||
.listStyle(.plain)
|
||||
.overlay(
|
||||
VStack {
|
||||
|
|
|
|||
|
|
@ -88,7 +88,8 @@ struct ContactsListFragment: View {
|
|||
contactViewModel.indexDisplayedFriend = index
|
||||
}
|
||||
|
||||
if index < contactsManager.lastSearch.count && contactsManager.lastSearch[index].friend != nil && contactsManager.lastSearch[index].friend!.address != nil {
|
||||
if index < contactsManager.lastSearch.count && contactsManager.lastSearch[index].friend != nil
|
||||
&& contactsManager.lastSearch[index].friend!.address != nil {
|
||||
startCallFunc(contactsManager.lastSearch[index].friend!.address!)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
import SwiftUI
|
||||
import linphonesw
|
||||
|
||||
// swiftlint:disable type_body_length
|
||||
struct EditContactFragment: View {
|
||||
|
||||
@ObservedObject var editContactViewModel: EditContactViewModel
|
||||
|
|
@ -531,7 +532,8 @@ struct EditContactFragment: View {
|
|||
contact: newContact, linphoneFriend: true, existingFriend: editContactViewModel.selectedEditFriend) {
|
||||
MagicSearchSingleton.shared.searchForContacts(sourceFlags: MagicSearch.Source.Friends.rawValue | MagicSearch.Source.LdapServers.rawValue)
|
||||
|
||||
if editContactViewModel.selectedEditFriend != nil && editContactViewModel.selectedEditFriend!.name != editContactViewModel.firstName + " " + editContactViewModel.lastName {
|
||||
if editContactViewModel.selectedEditFriend != nil
|
||||
&& editContactViewModel.selectedEditFriend!.name != editContactViewModel.firstName + " " + editContactViewModel.lastName {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
let result = ContactsManager.shared.lastSearch.firstIndex(where: {
|
||||
$0.friend!.name == newContact.firstName + " " + newContact.lastName
|
||||
|
|
@ -562,3 +564,4 @@ struct EditContactFragment: View {
|
|||
isShowDismissPopup: .constant(false)
|
||||
)
|
||||
}
|
||||
// swiftlint:enable type_body_length
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
import linphonesw
|
||||
import Combine
|
||||
|
||||
// swiftlint:disable line_length
|
||||
class ContactViewModel: ObservableObject {
|
||||
|
||||
@Published var indexDisplayedFriend: Int?
|
||||
|
|
@ -177,8 +178,7 @@ class ContactViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
func chatRoomAddDelegate(core: Core, chatRoom: ChatRoom) {
|
||||
self.chatRoomSuscriptions.insert(chatRoom.publisher?.onConferenceJoined?.postOnCoreQueue {
|
||||
(chatRoom: ChatRoom, eventLog: EventLog) in
|
||||
self.chatRoomSuscriptions.insert(chatRoom.publisher?.onConferenceJoined?.postOnCoreQueue { (chatRoom: ChatRoom, _: EventLog) in
|
||||
let state = chatRoom.state
|
||||
let id = LinphoneUtils.getChatRoomId(room: chatRoom)
|
||||
Log.info("\(StartConversationViewModel.TAG) Conversation \(id) \(chatRoom.subject ?? "") state changed: \(state)")
|
||||
|
|
@ -213,8 +213,7 @@ class ContactViewModel: ObservableObject {
|
|||
}
|
||||
})
|
||||
|
||||
self.chatRoomSuscriptions.insert(chatRoom.publisher?.onStateChanged?.postOnCoreQueue {
|
||||
(chatRoom: ChatRoom, state: ChatRoom.State) in
|
||||
self.chatRoomSuscriptions.insert(chatRoom.publisher?.onStateChanged?.postOnCoreQueue { (chatRoom: ChatRoom, state: ChatRoom.State) in
|
||||
let state = chatRoom.state
|
||||
let id = LinphoneUtils.getChatRoomId(room: chatRoom)
|
||||
if state == ChatRoom.State.CreationFailed {
|
||||
|
|
@ -229,3 +228,4 @@ class ContactViewModel: ObservableObject {
|
|||
})
|
||||
}
|
||||
}
|
||||
// swiftlint:enable line_length
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ struct ContentView: View {
|
|||
@State var isShowDismissPopup = false
|
||||
@State var isShowSendCancelMeetingNotificationPopup = false
|
||||
@State var isShowSipAddressesPopup = false
|
||||
@State var isShowSipAddressesPopupType = 0 //0 to call, 1 to message, 2 to video call
|
||||
@State var isShowSipAddressesPopupType = 0 // 0 to call, 1 to message, 2 to video call
|
||||
@State var isShowConversationFragment = false
|
||||
|
||||
@State var fullscreenVideo = false
|
||||
|
|
@ -760,8 +760,7 @@ struct ContentView: View {
|
|||
}
|
||||
|
||||
if contactViewModel.indexDisplayedFriend != nil || historyViewModel.displayedCall != nil || conversationViewModel.displayedConversation != nil ||
|
||||
meetingViewModel.displayedMeeting != nil
|
||||
{
|
||||
meetingViewModel.displayedMeeting != nil {
|
||||
HStack(spacing: 0) {
|
||||
Spacer()
|
||||
.frame(maxWidth:
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
import SwiftUI
|
||||
import WebKit
|
||||
|
||||
// swiftlint:disable type_body_length
|
||||
// swiftlint:disable cyclomatic_complexity
|
||||
struct ChatBubbleView: View {
|
||||
|
||||
@ObservedObject var conversationViewModel: ConversationViewModel
|
||||
|
|
@ -40,8 +42,8 @@ struct ChatBubbleView: View {
|
|||
if eventLogMessage.message.isOutgoing {
|
||||
Spacer()
|
||||
}
|
||||
|
||||
if conversationViewModel.displayedConversation != nil && conversationViewModel.displayedConversation!.isGroup && !eventLogMessage.message.isOutgoing && eventLogMessage.message.isFirstMessage {
|
||||
if conversationViewModel.displayedConversation != nil && conversationViewModel.displayedConversation!.isGroup
|
||||
&& !eventLogMessage.message.isOutgoing && eventLogMessage.message.isFirstMessage {
|
||||
VStack {
|
||||
Avatar(
|
||||
contactAvatarModel: conversationViewModel.participantConversationModel.first(where: {$0.address == eventLogMessage.message.address}) ??
|
||||
|
|
@ -50,14 +52,16 @@ struct ChatBubbleView: View {
|
|||
)
|
||||
.padding(.top, 30)
|
||||
}
|
||||
} else if conversationViewModel.displayedConversation != nil && conversationViewModel.displayedConversation!.isGroup && !eventLogMessage.message.isOutgoing {
|
||||
} else if conversationViewModel.displayedConversation != nil
|
||||
&& conversationViewModel.displayedConversation!.isGroup && !eventLogMessage.message.isOutgoing {
|
||||
VStack {
|
||||
}
|
||||
.padding(.leading, 43)
|
||||
}
|
||||
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
if conversationViewModel.displayedConversation != nil && conversationViewModel.displayedConversation!.isGroup && !eventLogMessage.message.isOutgoing && eventLogMessage.message.isFirstMessage {
|
||||
if conversationViewModel.displayedConversation != nil && conversationViewModel.displayedConversation!.isGroup
|
||||
&& !eventLogMessage.message.isOutgoing && eventLogMessage.message.isFirstMessage {
|
||||
Text(conversationViewModel.participantConversationModel.first(where: {$0.address == eventLogMessage.message.address})?.name ?? "")
|
||||
.default_text_style(styleSize: 12)
|
||||
.padding(.top, 10)
|
||||
|
|
@ -76,7 +80,8 @@ struct ChatBubbleView: View {
|
|||
.resizable()
|
||||
.frame(width: 15, height: 15, alignment: .leading)
|
||||
|
||||
Text(conversationViewModel.participantConversationModel.first(where: {$0.address == eventLogMessage.message.replyMessage!.address})?.name ?? "")
|
||||
Text(conversationViewModel.participantConversationModel.first(
|
||||
where: {$0.address == eventLogMessage.message.replyMessage!.address})?.name ?? "")
|
||||
.default_text_style(styleSize: 12)
|
||||
}
|
||||
.padding(.bottom, 2)
|
||||
|
|
@ -139,7 +144,8 @@ struct ChatBubbleView: View {
|
|||
.default_text_style_300(styleSize: 14)
|
||||
.padding(.top, 1)
|
||||
|
||||
if (conversationViewModel.displayedConversation != nil && conversationViewModel.displayedConversation!.isGroup) || eventLogMessage.message.isOutgoing {
|
||||
if (conversationViewModel.displayedConversation != nil && conversationViewModel.displayedConversation!.isGroup)
|
||||
|| eventLogMessage.message.isOutgoing {
|
||||
if eventLogMessage.message.status == .sending {
|
||||
ProgressView()
|
||||
.controlSize(.mini)
|
||||
|
|
@ -253,7 +259,8 @@ struct ChatBubbleView: View {
|
|||
@ViewBuilder
|
||||
func messageAttachments() -> some View {
|
||||
if eventLogMessage.message.attachments.count == 1 {
|
||||
if eventLogMessage.message.attachments.first!.type == .image || eventLogMessage.message.attachments.first!.type == .gif || eventLogMessage.message.attachments.first!.type == .video {
|
||||
if eventLogMessage.message.attachments.first!.type == .image || eventLogMessage.message.attachments.first!.type == .gif
|
||||
|| eventLogMessage.message.attachments.first!.type == .video {
|
||||
let result = imageDimensions(url: eventLogMessage.message.attachments.first!.thumbnail.absoluteString)
|
||||
ZStack {
|
||||
Rectangle()
|
||||
|
|
@ -265,7 +272,8 @@ struct ChatBubbleView: View {
|
|||
.if(result.1 < UIScreen.main.bounds.height/2) { view in
|
||||
view.frame(maxHeight: result.1)
|
||||
}
|
||||
.if(result.0 >= result.1 && geometryProxy.size.width > 0 && result.0 >= geometryProxy.size.width - 110 && result.1 >= UIScreen.main.bounds.height/2.5) { view in
|
||||
.if(result.0 >= result.1 && geometryProxy.size.width > 0 && result.0 >= geometryProxy.size.width - 110
|
||||
&& result.1 >= UIScreen.main.bounds.height/2.5) { view in
|
||||
view.frame(
|
||||
maxWidth: geometryProxy.size.width - 110,
|
||||
maxHeight: result.1 * ((geometryProxy.size.width - 110) / result.0)
|
||||
|
|
@ -411,8 +419,8 @@ struct ChatBubbleView: View {
|
|||
.contentShape(Rectangle())
|
||||
}
|
||||
}
|
||||
.frame(
|
||||
width: geometryProxy.size.width > 0 && CGFloat(122 * eventLogMessage.message.attachments.count) > geometryProxy.size.width - 110 - (isGroup ? 40 : 0)
|
||||
.frame( width: geometryProxy.size.width > 0
|
||||
&& CGFloat(122 * eventLogMessage.message.attachments.count) > geometryProxy.size.width - 110 - (isGroup ? 40 : 0)
|
||||
? 122 * floor(CGFloat(geometryProxy.size.width - 110 - (isGroup ? 40 : 0)) / 122)
|
||||
: CGFloat(122 * eventLogMessage.message.attachments.count)
|
||||
)
|
||||
|
|
@ -516,3 +524,6 @@ extension View {
|
|||
ChatBubbleView(conversationViewModel: ConversationViewModel(), index: 0)
|
||||
}
|
||||
*/
|
||||
|
||||
// swiftlint:enable type_body_length
|
||||
// swiftlint:enable cyclomatic_complexity
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
import SwiftUI
|
||||
import UniformTypeIdentifiers
|
||||
|
||||
// swiftlint:disable line_length
|
||||
// swiftlint:disable type_body_length
|
||||
struct ConversationFragment: View {
|
||||
|
||||
|
|
@ -780,7 +781,6 @@ struct ConversationFragment: View {
|
|||
.navigationViewStyle(.stack)
|
||||
}
|
||||
}
|
||||
// swiftlint:enable type_body_length
|
||||
|
||||
struct ScrollOffsetPreferenceKey: PreferenceKey {
|
||||
static var defaultValue: CGPoint = .zero
|
||||
|
|
@ -809,9 +809,9 @@ struct ImagePicker: UIViewControllerRepresentable {
|
|||
let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage
|
||||
|
||||
let date = Date()
|
||||
let df = DateFormatter()
|
||||
df.dateFormat = "yyyy-MM-dd-HHmmss"
|
||||
let dateString = df.string(from: date)
|
||||
let dformater = DateFormatter()
|
||||
dformater.dateFormat = "yyyy-MM-dd-HHmmss"
|
||||
let dateString = dformater.string(from: date)
|
||||
|
||||
let path = FileManager.default.temporaryDirectory.appendingPathComponent((dateString.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) ?? "") + ".jpeg")
|
||||
|
||||
|
|
@ -819,7 +819,7 @@ struct ImagePicker: UIViewControllerRepresentable {
|
|||
let data = image!.jpegData(compressionQuality: 1)
|
||||
if data != nil {
|
||||
do {
|
||||
let decodedData: () = try data!.write(to: path)
|
||||
_ = try data!.write(to: path)
|
||||
let attachment = Attachment(id: UUID().uuidString, name: (dateString.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) ?? "") + ".jpeg", url: path, type: .image)
|
||||
parent.selectedMedia.append(attachment)
|
||||
} catch {
|
||||
|
|
@ -846,7 +846,7 @@ struct ImagePicker: UIViewControllerRepresentable {
|
|||
}
|
||||
}
|
||||
default:
|
||||
Log.info("Mismatched type: \(mediaType)")
|
||||
Log.info("Mismatched type: \(mediaType ?? "mediaType is nil")")
|
||||
}
|
||||
|
||||
parent.presentationMode.wrappedValue.dismiss()
|
||||
|
|
@ -876,3 +876,6 @@ struct ImagePicker: UIViewControllerRepresentable {
|
|||
ConversationFragment(conversationViewModel: ConversationViewModel(), conversationsListViewModel: ConversationsListViewModel(), sections: [MessagesSection], ids: [""])
|
||||
}
|
||||
*/
|
||||
|
||||
// swiftlint:enable type_body_length
|
||||
// swiftlint:enable line_length
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@ struct ConversationsFragment: View {
|
|||
var body: some View {
|
||||
ZStack {
|
||||
if #available(iOS 16.0, *), idiom != .pad {
|
||||
ConversationsListFragment(conversationViewModel: conversationViewModel, conversationsListViewModel: conversationsListViewModel, showingSheet: $showingSheet, text: $text)
|
||||
ConversationsListFragment(conversationViewModel: conversationViewModel,
|
||||
conversationsListViewModel: conversationsListViewModel, showingSheet: $showingSheet, text: $text)
|
||||
.sheet(isPresented: $showingSheet) {
|
||||
ConversationsListBottomSheet(
|
||||
conversationsListViewModel: conversationsListViewModel,
|
||||
|
|
@ -41,7 +42,8 @@ struct ConversationsFragment: View {
|
|||
.presentationDetents([.fraction(0.4)])
|
||||
}
|
||||
} else {
|
||||
ConversationsListFragment(conversationViewModel: conversationViewModel, conversationsListViewModel: conversationsListViewModel, showingSheet: $showingSheet, text: $text)
|
||||
ConversationsListFragment(conversationViewModel: conversationViewModel,
|
||||
conversationsListViewModel: conversationsListViewModel, showingSheet: $showingSheet, text: $text)
|
||||
.halfSheet(showSheet: $showingSheet) {
|
||||
ConversationsListBottomSheet(
|
||||
conversationsListViewModel: conversationsListViewModel,
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
import SwiftUI
|
||||
import linphonesw
|
||||
|
||||
// swiftlint:disable type_body_length
|
||||
struct StartConversationFragment: View {
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
|
|
@ -184,7 +185,8 @@ struct StartConversationFragment: View {
|
|||
.padding(.horizontal, 16)
|
||||
}
|
||||
|
||||
ContactsListFragment(contactViewModel: ContactViewModel(), contactsListViewModel: ContactsListViewModel(), showingSheet: .constant(false), startCallFunc: { addr in
|
||||
ContactsListFragment(contactViewModel: ContactViewModel(), contactsListViewModel: ContactsListViewModel(), showingSheet: .constant(false)
|
||||
, startCallFunc: { addr in
|
||||
withAnimation {
|
||||
startConversationViewModel.createOneToOneChatRoomWith(remote: addr)
|
||||
}
|
||||
|
|
@ -389,3 +391,5 @@ struct StartConversationFragment: View {
|
|||
isShowStartConversationFragment: .constant(true)
|
||||
)
|
||||
}
|
||||
|
||||
// swiftlint:enable type_body_length
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@
|
|||
*/
|
||||
|
||||
// swiftlint:disable large_tuple
|
||||
// swiftlint:disable line_length
|
||||
// swiftlint:disable cyclomatic_complexity
|
||||
// swiftlint:disable type_body_length
|
||||
import SwiftUI
|
||||
import linphonesw
|
||||
|
||||
|
|
@ -156,7 +159,7 @@ struct UIList: UIViewRepresentable {
|
|||
return containerView
|
||||
}
|
||||
|
||||
//func updateUIView(_ tableView: UITableView, context: Context) {
|
||||
// func updateUIView(_ tableView: UITableView, context: Context) {
|
||||
func updateUIView(_ uiView: UIView, context: Context) {
|
||||
if let button = uiView.viewWithTag(102) as? FloatingButton {
|
||||
button.unreadMessageCount = conversationViewModel.displayedConversationUnreadMessagesCount
|
||||
|
|
@ -253,17 +256,17 @@ struct UIList: UIViewRepresentable {
|
|||
let newDates = newSections.map { $0.date }
|
||||
let commonDates = Array(Set(oldDates + newDates)).sorted(by: >)
|
||||
for date in commonDates {
|
||||
let oldIndex = appliedDeletes.firstIndex(where: { $0.date == date } )
|
||||
let newIndex = appliedDeletesSwapsAndEdits.firstIndex(where: { $0.date == date } )
|
||||
let oldIndex = appliedDeletes.firstIndex(where: { $0.date == date })
|
||||
let newIndex = appliedDeletesSwapsAndEdits.firstIndex(where: { $0.date == date })
|
||||
if oldIndex == nil, let newIndex {
|
||||
if let operationIndex = newSections.firstIndex(where: { $0.date == date } ) {
|
||||
if let operationIndex = newSections.firstIndex(where: { $0.date == date }) {
|
||||
appliedDeletesSwapsAndEdits.remove(at: newIndex)
|
||||
insertOperations.append(.insertSection(operationIndex))
|
||||
}
|
||||
continue
|
||||
}
|
||||
if newIndex == nil, let oldIndex {
|
||||
if let operationIndex = oldSections.firstIndex(where: { $0.date == date } ) {
|
||||
if let operationIndex = oldSections.firstIndex(where: { $0.date == date }) {
|
||||
appliedDeletes.remove(at: oldIndex)
|
||||
deleteOperations.append(.deleteSection(operationIndex))
|
||||
}
|
||||
|
|
@ -476,8 +479,8 @@ struct UIList: UIViewRepresentable {
|
|||
}
|
||||
|
||||
func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
|
||||
|
||||
let archiveAction = UIContextualAction(style: .normal, title: "") { action, view, completionHandler in
|
||||
|
||||
let archiveAction = UIContextualAction(style: .normal, title: "") { _, _, completionHandler in
|
||||
self.parent.conversationViewModel.replyToMessage(index: indexPath.row)
|
||||
completionHandler(true)
|
||||
}
|
||||
|
|
@ -530,11 +533,6 @@ struct EventLogMessage: Equatable {
|
|||
return formatter
|
||||
}()
|
||||
|
||||
init(eventLog: EventLog, message: Message) {
|
||||
self.eventLog = eventLog
|
||||
self.message = message
|
||||
}
|
||||
|
||||
static func == (lhs: EventLogMessage, rhs: EventLogMessage) -> Bool {
|
||||
lhs.message == rhs.message
|
||||
}
|
||||
|
|
@ -565,7 +563,7 @@ public typealias ChatPaginationClosure = (Message) -> Void
|
|||
|
||||
final class ChatViewModel: ObservableObject {
|
||||
|
||||
@Published private(set) var fullscreenAttachmentItem: Optional<Attachment> = nil
|
||||
@Published private(set) var fullscreenAttachmentItem: Attachment?
|
||||
@Published var fullscreenAttachmentPresented = false
|
||||
|
||||
@Published var messageMenuRow: Message?
|
||||
|
|
@ -586,5 +584,7 @@ final class ChatViewModel: ObservableObject {
|
|||
didSendMessage(message)
|
||||
}
|
||||
}
|
||||
|
||||
// swiftlint:enable large_tuple
|
||||
// swiftlint:enable line_length
|
||||
// swiftlint:enable cyclomatic_complexity
|
||||
// swiftlint:enable type_body_length
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import Foundation
|
|||
import linphonesw
|
||||
import Combine
|
||||
|
||||
// swiftlint:disable line_length
|
||||
class ConversationModel: ObservableObject {
|
||||
|
||||
private var coreContext = CoreContext.shared
|
||||
|
|
@ -236,7 +237,9 @@ class ConversationModel: ObservableObject {
|
|||
|
||||
func downloadContent(chatMessage: ChatMessage, content: Content) {
|
||||
coreContext.doOnCoreQueue { _ in
|
||||
let result = chatMessage.downloadContent(content: content)
|
||||
if !chatMessage.downloadContent(content: content) {
|
||||
Log.error("\(ConversationModel.TAG) An error occured when downloading content of chat message. MessageID=\(chatMessage.messageId)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -246,3 +249,4 @@ class ConversationModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
// swiftlint:enable line_length
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
import SwiftUI
|
||||
|
||||
// swiftlint:disable line_length
|
||||
// swiftlint:disable vertical_parameter_alignment
|
||||
public struct Message: Identifiable, Hashable {
|
||||
|
||||
public enum Status: Equatable, Hashable {
|
||||
|
|
@ -236,7 +238,7 @@ public struct DraftMessage {
|
|||
public let createdAt: Date
|
||||
public let ownReaction: String
|
||||
public let reactions: [String]
|
||||
|
||||
|
||||
public init(id: String? = nil,
|
||||
isOutgoing: Bool,
|
||||
dateReceived: time_t,
|
||||
|
|
@ -324,8 +326,8 @@ extension Sequence {
|
|||
var values = [T]()
|
||||
|
||||
for element in self {
|
||||
if let el = try await transform(element) {
|
||||
values.append(el)
|
||||
if let elmt = try await transform(element) {
|
||||
values.append(elmt)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -354,3 +356,5 @@ extension DateFormatter {
|
|||
return String(format: "%02i:%02i", minute, second)
|
||||
}
|
||||
}
|
||||
// swiftlint:enable line_length
|
||||
// swiftlint:enable vertical_parameter_alignment
|
||||
|
|
|
|||
|
|
@ -23,7 +23,10 @@ import Combine
|
|||
import SwiftUI
|
||||
import AVFoundation
|
||||
|
||||
// swiftlint:disable line_length
|
||||
// swiftlint:disable type_body_length
|
||||
// swiftlint:disable cyclomatic_complexity
|
||||
|
||||
class ConversationViewModel: ObservableObject {
|
||||
|
||||
private var coreContext = CoreContext.shared
|
||||
|
|
@ -85,7 +88,7 @@ class ConversationViewModel: ObservableObject {
|
|||
statusTmp = .sending
|
||||
}
|
||||
|
||||
var indexMessage = self.conversationMessagesSection[0].rows.firstIndex(where: {$0.eventLog.chatMessage?.messageId == message.messageId})
|
||||
let indexMessage = self.conversationMessagesSection[0].rows.firstIndex(where: {$0.eventLog.chatMessage?.messageId == message.messageId})
|
||||
|
||||
DispatchQueue.main.async {
|
||||
if indexMessage != nil {
|
||||
|
|
@ -199,7 +202,7 @@ class ConversationViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
func addParticipantConversationModel(address: Address) {
|
||||
coreContext.doOnCoreQueue { core in
|
||||
coreContext.doOnCoreQueue { _ in
|
||||
ContactAvatarModel.getAvatarModelFromAddress(address: address) { avatarResult in
|
||||
let avatarModelTmp = avatarResult
|
||||
DispatchQueue.main.async {
|
||||
|
|
@ -234,7 +237,7 @@ class ConversationViewModel: ObservableObject {
|
|||
contentText = content.utf8Text ?? ""
|
||||
} else if content.name != nil && !content.name!.isEmpty {
|
||||
if content.filePath == nil || content.filePath!.isEmpty {
|
||||
//self.downloadContent(chatMessage: eventLog.chatMessage!, content: content)
|
||||
// self.downloadContent(chatMessage: eventLog.chatMessage!, content: content)
|
||||
let path = URL(string: self.getNewFilePath(name: content.name ?? ""))
|
||||
|
||||
if path != nil {
|
||||
|
|
@ -434,7 +437,7 @@ class ConversationViewModel: ObservableObject {
|
|||
contentText = content.utf8Text ?? ""
|
||||
} else if content.name != nil && !content.name!.isEmpty {
|
||||
if content.filePath == nil || content.filePath!.isEmpty {
|
||||
//self.downloadContent(chatMessage: eventLog.chatMessage!, content: content)
|
||||
// self.downloadContent(chatMessage: eventLog.chatMessage!, content: content)
|
||||
let path = URL(string: self.getNewFilePath(name: content.name ?? ""))
|
||||
|
||||
if path != nil {
|
||||
|
|
@ -619,7 +622,6 @@ class ConversationViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
|
||||
// swiftlint:disable cyclomatic_complexity
|
||||
func getNewMessages(eventLogs: [EventLog]) {
|
||||
eventLogs.enumerated().forEach { index, eventLog in
|
||||
var attachmentNameList: String = ""
|
||||
|
|
@ -632,7 +634,7 @@ class ConversationViewModel: ObservableObject {
|
|||
contentText = content.utf8Text ?? ""
|
||||
} else {
|
||||
if content.filePath == nil || content.filePath!.isEmpty {
|
||||
//self.downloadContent(chatMessage: eventLog.chatMessage!, content: content)
|
||||
// self.downloadContent(chatMessage: eventLog.chatMessage!, content: content)
|
||||
let path = URL(string: self.getNewFilePath(name: content.name ?? ""))
|
||||
|
||||
if path != nil {
|
||||
|
|
@ -843,7 +845,6 @@ class ConversationViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
// swiftlint:enable cyclomatic_complexity
|
||||
|
||||
func resetMessage() {
|
||||
conversationMessagesSection = []
|
||||
|
|
@ -860,7 +861,6 @@ class ConversationViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
|
||||
// swiftlint:disable cyclomatic_complexity
|
||||
func scrollToMessage(message: Message) {
|
||||
coreContext.doOnCoreQueue { _ in
|
||||
if message.replyMessage != nil {
|
||||
|
|
@ -904,7 +904,7 @@ class ConversationViewModel: ObservableObject {
|
|||
contentText = content.utf8Text ?? ""
|
||||
} else if content.name != nil && !content.name!.isEmpty {
|
||||
if content.filePath == nil || content.filePath!.isEmpty {
|
||||
//self.downloadContent(chatMessage: eventLog.chatMessage!, content: content)
|
||||
// self.downloadContent(chatMessage: eventLog.chatMessage!, content: content)
|
||||
let path = URL(string: self.getNewFilePath(name: content.name ?? ""))
|
||||
|
||||
if path != nil {
|
||||
|
|
@ -1095,7 +1095,6 @@ class ConversationViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
// swiftlint:enable cyclomatic_complexity
|
||||
|
||||
func sendMessage() {
|
||||
coreContext.doOnCoreQueue { _ in
|
||||
|
|
@ -1155,7 +1154,7 @@ class ConversationViewModel: ObservableObject {
|
|||
content.type = "file"
|
||||
}
|
||||
|
||||
//content.subtype = attachment.type == .plainText ? "plain" : FileUtils.getExtensionFromFileName(attachment.fileName)
|
||||
// content.subtype = attachment.type == .plainText ? "plain" : FileUtils.getExtensionFromFileName(attachment.fileName)
|
||||
content.subtype = attachment.full.pathExtension
|
||||
|
||||
content.name = attachment.full.lastPathComponent
|
||||
|
|
@ -1186,7 +1185,7 @@ class ConversationViewModel: ObservableObject {
|
|||
} catch {
|
||||
}
|
||||
}
|
||||
//}
|
||||
// }
|
||||
|
||||
if message != nil && !message!.contents.isEmpty {
|
||||
Log.info("[ConversationViewModel] Sending message")
|
||||
|
|
@ -1250,17 +1249,15 @@ class ConversationViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
func downloadContent(chatMessage: ChatMessage, content: Content) {
|
||||
//Log.debug("[ConversationViewModel] Starting downloading content for file \(model.fileName)")
|
||||
// Log.debug("[ConversationViewModel] Starting downloading content for file \(model.fileName)")
|
||||
if !chatMessage.isFileTransferInProgress && (content.filePath == nil || content.filePath!.isEmpty) {
|
||||
let contentName = content.name
|
||||
if contentName != nil {
|
||||
let isImage = FileUtil.isExtensionImage(path: contentName!)
|
||||
let groupName = "group.\(Bundle.main.bundleIdentifier ?? "").linphoneExtension"
|
||||
let file = FileUtil.sharedContainerUrl().appendingPathComponent("Library/Images").absoluteString + (contentName!.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) ?? "")
|
||||
//let file = FileUtil.getFileStoragePath(fileName: contentName ?? "", isImage: isImage)
|
||||
if let contentName = content.name {
|
||||
// let isImage = FileUtil.isExtensionImage(path: contentName)
|
||||
let file = FileUtil.sharedContainerUrl().appendingPathComponent("Library/Images").absoluteString + (contentName.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) ?? "")
|
||||
// let file = FileUtil.getFileStoragePath(fileName: contentName ?? "", isImage: isImage)
|
||||
content.filePath = String(file.dropFirst(7))
|
||||
Log.info(
|
||||
"[ConversationViewModel] File \(contentName) will be downloaded at \(content.filePath)"
|
||||
"[ConversationViewModel] File \(contentName) will be downloaded at \(content.filePath ?? "NIL")"
|
||||
)
|
||||
self.displayedConversation?.downloadContent(chatMessage: chatMessage, content: content)
|
||||
} else {
|
||||
|
|
@ -1270,7 +1267,6 @@ class ConversationViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
func getNewFilePath(name: String) -> String {
|
||||
let groupName = "group.\(Bundle.main.bundleIdentifier ?? "").linphoneExtension"
|
||||
return FileUtil.sharedContainerUrl().appendingPathComponent("Library/Images").absoluteString + (name.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) ?? "")
|
||||
}
|
||||
|
||||
|
|
@ -1299,7 +1295,7 @@ class ConversationViewModel: ObservableObject {
|
|||
: pathThumbnail!.appendingPathComponent("preview_" + (name.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) ?? "") + ".png")
|
||||
|
||||
if urlName != nil {
|
||||
let decodedData: () = try data.write(to: urlName!)
|
||||
_ = try data.write(to: urlName!)
|
||||
}
|
||||
|
||||
return urlName!.absoluteString
|
||||
|
|
@ -1379,4 +1375,6 @@ class ConversationViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
// swiftlint:enable line_length
|
||||
// swiftlint:enable type_body_length
|
||||
// swiftlint:enable cyclomatic_complexity
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ import Foundation
|
|||
import linphonesw
|
||||
import Combine
|
||||
|
||||
// swiftlint:disable line_length
|
||||
// swiftlint:disable large_tuple
|
||||
class ConversationsListViewModel: ObservableObject {
|
||||
|
||||
private var coreContext = CoreContext.shared
|
||||
|
|
@ -68,7 +70,7 @@ class ConversationsListViewModel: ObservableObject {
|
|||
let chatRoomsCounter = account?.chatRooms != nil ? account!.chatRooms.count : core.chatRooms.count
|
||||
var counter = 0
|
||||
self.mCoreSuscriptions.insert(core.publisher?.onChatRoomStateChanged?.postOnCoreQueue { (cbValue: (core: Core, chatRoom: ChatRoom, state: ChatRoom.State)) in
|
||||
//Log.info("[ConversationsListViewModel] Conversation [${LinphoneUtils.getChatRoomId(chatRoom)}] state changed [$state]")
|
||||
// Log.info("[ConversationsListViewModel] Conversation [${LinphoneUtils.getChatRoomId(chatRoom)}] state changed [$state]")
|
||||
switch cbValue.state {
|
||||
case ChatRoom.State.Created:
|
||||
if !(cbValue.chatRoom.isEmpty && cbValue.chatRoom.hasCapability(mask: ChatRoom.Capabilities.OneToOne.rawValue)) {
|
||||
|
|
@ -81,8 +83,8 @@ class ConversationsListViewModel: ObservableObject {
|
|||
}
|
||||
case ChatRoom.State.Deleted:
|
||||
self.computeChatRoomsList(filter: "")
|
||||
//ToastViewModel.shared.toastMessage = "toast_conversation_deleted"
|
||||
//ToastViewModel.shared.displayToast = true
|
||||
// ToastViewModel.shared.toastMessage = "toast_conversation_deleted"
|
||||
// ToastViewModel.shared.displayToast = true
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
|
@ -214,3 +216,5 @@ class ConversationsListViewModel: ObservableObject {
|
|||
conversationsList = conversationsListTmp
|
||||
}
|
||||
}
|
||||
// swiftlint:enable line_length
|
||||
// swiftlint:enable large_tuple
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
import linphonesw
|
||||
import Combine
|
||||
|
||||
// swiftlint:disable line_length
|
||||
class StartConversationViewModel: ObservableObject {
|
||||
|
||||
static let TAG = "[StartConversationViewModel]"
|
||||
|
|
@ -301,8 +302,7 @@ class StartConversationViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
func chatRoomAddDelegate(core: Core, chatRoom: ChatRoom) {
|
||||
self.chatRoomSuscriptions.insert(chatRoom.publisher?.onConferenceJoined?.postOnCoreQueue {
|
||||
(chatRoom: ChatRoom, eventLog: EventLog) in
|
||||
self.chatRoomSuscriptions.insert(chatRoom.publisher?.onConferenceJoined?.postOnCoreQueue { (chatRoom: ChatRoom, _: EventLog) in
|
||||
let state = chatRoom.state
|
||||
let id = LinphoneUtils.getChatRoomId(room: chatRoom)
|
||||
Log.info("\(StartConversationViewModel.TAG) Conversation \(id) \(chatRoom.subject ?? "") state changed: \(state)")
|
||||
|
|
@ -337,8 +337,7 @@ class StartConversationViewModel: ObservableObject {
|
|||
}
|
||||
})
|
||||
|
||||
self.chatRoomSuscriptions.insert(chatRoom.publisher?.onStateChanged?.postOnCoreQueue {
|
||||
(chatRoom: ChatRoom, state: ChatRoom.State) in
|
||||
self.chatRoomSuscriptions.insert(chatRoom.publisher?.onStateChanged?.postOnCoreQueue { (chatRoom: ChatRoom, state: ChatRoom.State) in
|
||||
let state = chatRoom.state
|
||||
let id = LinphoneUtils.getChatRoomId(room: chatRoom)
|
||||
if state == ChatRoom.State.CreationFailed {
|
||||
|
|
@ -357,3 +356,5 @@ class StartConversationViewModel: ObservableObject {
|
|||
return false // TODO: Will be done later in SDK
|
||||
}
|
||||
}
|
||||
|
||||
// swiftlint:enable line_length
|
||||
|
|
|
|||
|
|
@ -248,7 +248,9 @@ struct ToastView: View {
|
|||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 50)
|
||||
.inset(by: 0.5)
|
||||
.stroke(toastViewModel.toastMessage.contains("Success") ? Color.greenSuccess500 : (toastViewModel.toastMessage.contains("Info_") ? Color.blueInfo500 : Color.redDanger500), lineWidth: 1)
|
||||
.stroke(toastViewModel.toastMessage.contains("Success")
|
||||
? Color.greenSuccess500 : (toastViewModel.toastMessage.contains("Info_")
|
||||
? Color.blueInfo500 : Color.redDanger500), lineWidth: 1)
|
||||
)
|
||||
.onTapGesture {
|
||||
if !toastViewModel.toastMessage.contains("is recording") {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import SwiftUI
|
|||
import UniformTypeIdentifiers
|
||||
import linphonesw
|
||||
|
||||
// swiftlint:disable type_body_length
|
||||
struct DialerBottomSheet: View {
|
||||
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
|
@ -544,6 +545,11 @@ struct DialerBottomSheet: View {
|
|||
|
||||
#Preview {
|
||||
DialerBottomSheet(
|
||||
startCallViewModel: StartCallViewModel(), callViewModel: CallViewModel(), isShowStartCallFragment: .constant(false), showingDialer: .constant(false), currentCall: nil
|
||||
)
|
||||
startCallViewModel: StartCallViewModel()
|
||||
, callViewModel: CallViewModel()
|
||||
, isShowStartCallFragment: .constant(false)
|
||||
, showingDialer: .constant(false)
|
||||
, currentCall: nil)
|
||||
}
|
||||
|
||||
// swiftlint:enable type_body_length
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import SwiftUI
|
|||
import UniformTypeIdentifiers
|
||||
import linphonesw
|
||||
|
||||
// swiftlint:disable line_length
|
||||
// swiftlint:disable type_body_length
|
||||
struct HistoryContactFragment: View {
|
||||
|
||||
|
|
@ -462,5 +461,4 @@ struct HistoryContactFragment: View {
|
|||
indexPage: .constant(1)
|
||||
)
|
||||
}
|
||||
// swiftlint:enable line_length
|
||||
// swiftlint:enable type_body_length
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
import SwiftUI
|
||||
import linphonesw
|
||||
|
||||
// swiftlint:disable type_body_length
|
||||
struct StartCallFragment: View {
|
||||
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
|
@ -217,7 +218,8 @@ struct StartCallFragment: View {
|
|||
.padding(.horizontal, 16)
|
||||
}
|
||||
|
||||
ContactsListFragment(contactViewModel: ContactViewModel(), contactsListViewModel: ContactsListViewModel(), showingSheet: .constant(false), startCallFunc: { addr in
|
||||
ContactsListFragment(contactViewModel: ContactViewModel(), contactsListViewModel: ContactsListViewModel(), showingSheet: .constant(false)
|
||||
, startCallFunc: { addr in
|
||||
if callViewModel.isTransferInsteadCall {
|
||||
showingDialer = false
|
||||
|
||||
|
|
@ -482,3 +484,5 @@ struct StartCallFragment: View {
|
|||
resetCallView: {}
|
||||
)
|
||||
}
|
||||
|
||||
// swiftlint:enable type_body_length
|
||||
|
|
|
|||
|
|
@ -112,7 +112,9 @@ class HistoryModel: ObservableObject {
|
|||
|
||||
func refreshAvatarModel() {
|
||||
coreContext.doOnCoreQueue { _ in
|
||||
let addressFriendTmp = ContactsManager.shared.getFriendWithAddress(address: self.callLog.dir == .Outgoing ? self.callLog.toAddress! : self.callLog.fromAddress!)
|
||||
let addressFriendTmp = ContactsManager.shared.getFriendWithAddress(
|
||||
address: self.callLog.dir == .Outgoing ? self.callLog.toAddress! : self.callLog.fromAddress!
|
||||
)
|
||||
if addressFriendTmp != nil {
|
||||
self.addressFriend = addressFriendTmp
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
import linphonesw
|
||||
import Combine
|
||||
|
||||
// swiftlint:disable line_length
|
||||
class StartCallViewModel: ObservableObject {
|
||||
|
||||
static let TAG = "[StartCallViewModel]"
|
||||
|
|
@ -115,8 +116,7 @@ class StartCallViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
func conferenceAddDelegate(core: Core, conferenceScheduler: ConferenceScheduler) {
|
||||
self.conferenceSuscriptions.insert(conferenceScheduler.publisher?.onStateChanged?.postOnCoreQueue {
|
||||
(conferenceScheduler: ConferenceScheduler, state: ConferenceScheduler.State) in
|
||||
self.conferenceSuscriptions.insert(conferenceScheduler.publisher?.onStateChanged?.postOnCoreQueue { (conferenceScheduler: ConferenceScheduler, state: ConferenceScheduler.State) in
|
||||
Log.info("\(StartCallViewModel.TAG) Conference scheduler state is \(state)")
|
||||
if state == ConferenceScheduler.State.Ready {
|
||||
self.conferenceSuscriptions.removeAll()
|
||||
|
|
@ -153,13 +153,7 @@ class StartCallViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
func startVideoCall(core: Core, conferenceAddress: Address) {
|
||||
do {
|
||||
TelecomManager.shared.doCallWithCore(addr: conferenceAddress, isVideo: true, isConference: true)
|
||||
} catch let error {
|
||||
Log.error(
|
||||
"\(StartCallViewModel.TAG) StartVideoCall: \(error)"
|
||||
)
|
||||
}
|
||||
TelecomManager.shared.doCallWithCore(addr: conferenceAddress, isVideo: true, isConference: true)
|
||||
}
|
||||
|
||||
func interpretAndStartCall() {
|
||||
|
|
@ -171,3 +165,4 @@ class StartCallViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
// swiftlint:enable line_length
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ struct AddParticipantsFragment: View {
|
|||
|
||||
Text(addParticipantsViewModel.participantsToAdd[index].avatarModel.name)
|
||||
.default_text_style(styleSize: 12)
|
||||
.frame(minWidth: 60, maxWidth:80)
|
||||
.frame(minWidth: 60, maxWidth: 80)
|
||||
}
|
||||
Image("x-circle")
|
||||
.renderingMode(.template)
|
||||
|
|
@ -293,5 +293,5 @@ struct AddParticipantsFragment: View {
|
|||
}
|
||||
|
||||
#Preview {
|
||||
AddParticipantsFragment(addParticipantsViewModel: AddParticipantsViewModel(), confirmAddParticipantsFunc: {_ in } )
|
||||
AddParticipantsFragment(addParticipantsViewModel: AddParticipantsViewModel(), confirmAddParticipantsFunc: { _ in })
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// swiftlint:disable line_length
|
||||
import SwiftUI
|
||||
import linphonesw
|
||||
import UniformTypeIdentifiers
|
||||
|
|
@ -247,8 +246,7 @@ struct MeetingFragment: View {
|
|||
.frame(height: 1)
|
||||
.background(Color.gray200)
|
||||
}
|
||||
|
||||
|
||||
|
||||
HStack(alignment: .top, spacing: 10) {
|
||||
Image("users")
|
||||
.renderingMode(.template)
|
||||
|
|
@ -310,5 +308,3 @@ struct MeetingFragment: View {
|
|||
, isShowScheduleMeetingFragment: .constant(true)
|
||||
, isShowSendCancelMeetingNotificationPopup: .constant(false))
|
||||
}
|
||||
|
||||
// swiftlint:enable line_length
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// swiftlint:disable line_length
|
||||
|
||||
import SwiftUI
|
||||
import linphonesw
|
||||
|
||||
|
|
@ -38,5 +36,3 @@ struct MeetingsListFragment: View {
|
|||
#Preview {
|
||||
MeetingsListFragment(meetingsListViewModel: MeetingsListViewModel(), showingSheet: .constant(false))
|
||||
}
|
||||
|
||||
// swiftlint:enable line_length
|
||||
|
|
|
|||
|
|
@ -17,10 +17,9 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// swiftlint:disable line_length
|
||||
|
||||
import SwiftUI
|
||||
|
||||
// swiftlint:disable type_body_length
|
||||
struct ScheduleMeetingFragment: View {
|
||||
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
|
@ -214,7 +213,6 @@ struct ScheduleMeetingFragment: View {
|
|||
.frame(width: 24, height: 24)
|
||||
.padding(.leading, 15)
|
||||
//Picker(selection:, label:("))
|
||||
Text("TODO : repeat")
|
||||
.fontWeight(.bold)
|
||||
.padding(.leading, 5)
|
||||
.default_text_style_500(styleSize: 16)
|
||||
|
|
@ -355,7 +353,6 @@ struct ScheduleMeetingFragment: View {
|
|||
}
|
||||
.padding()
|
||||
|
||||
|
||||
if meetingViewModel.operationInProgress {
|
||||
HStack {
|
||||
Spacer()
|
||||
|
|
@ -491,7 +488,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.maxWidth)
|
||||
.position(x: geometry.size.width / 2, y: geometry.size.height / 2)
|
||||
}
|
||||
.background(.black.opacity(0.65))
|
||||
|
|
@ -509,7 +506,7 @@ struct ScheduleMeetingFragment: View {
|
|||
meetingViewModel.toDate = selectedDate
|
||||
if selectedDate < meetingViewModel.fromDate {
|
||||
// If new end date is before the previous start date, bump down the start date to the earlier possible from current time
|
||||
if (Date.now.distance(to: selectedDate) < duration) {
|
||||
if Date.now.distance(to: selectedDate) < duration {
|
||||
meetingViewModel.fromDate = Date.now
|
||||
} else {
|
||||
meetingViewModel.fromDate = Calendar.current.date(byAdding: .second, value: (-1)*Int(duration), to: selectedDate)!
|
||||
|
|
@ -539,4 +536,4 @@ struct ScheduleMeetingFragment: View {
|
|||
, isShowScheduleMeetingFragment: .constant(true))
|
||||
}
|
||||
|
||||
// swiftlint:enable line_length
|
||||
// swiftlint:enable type_body_length
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import Foundation
|
|||
import linphonesw
|
||||
import Combine
|
||||
|
||||
// swiftlint:disable line_length
|
||||
class MeetingViewModel: ObservableObject {
|
||||
static let TAG = "[MeetingViewModel]"
|
||||
|
||||
|
|
@ -41,7 +42,7 @@ class MeetingViewModel: ObservableObject {
|
|||
|
||||
@Published var selectedTimezoneIdx = 0
|
||||
var selectedTimezone = TimeZone.current
|
||||
var knownTimezones : [String] = []
|
||||
var knownTimezones: [String] = []
|
||||
|
||||
var conferenceScheduler: ConferenceScheduler?
|
||||
private var mSchedulerSubscriptions = Set<AnyCancellable?>()
|
||||
|
|
@ -272,8 +273,7 @@ class MeetingViewModel: ObservableObject {
|
|||
self.fromDate = meeting.meetingDate
|
||||
self.toDate = meeting.endDate
|
||||
self.participants = []
|
||||
|
||||
|
||||
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
let organizer = meeting.confInfo.organizer
|
||||
var organizerFound = false
|
||||
|
|
@ -294,7 +294,7 @@ class MeetingViewModel: ObservableObject {
|
|||
organizerFound = organizerFound || isOrganizer
|
||||
ContactAvatarModel.getAvatarModelFromAddress(address: addr) { avatarResult in
|
||||
DispatchQueue.main.async {
|
||||
self.participants.append(SelectedAddressModel(addr: addr, avModel: avatarResult, isOrg:isOrganizer))
|
||||
self.participants.append(SelectedAddressModel(addr: addr, avModel: avatarResult, isOrg: isOrganizer))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -322,12 +322,12 @@ class MeetingViewModel: ObservableObject {
|
|||
if let conferenceInfo = core.findConferenceInformationFromUri(uri: conferenceAddress) {
|
||||
|
||||
self.conferenceInfoToEdit = conferenceInfo
|
||||
Log.info("\(MeetingViewModel.TAG) Found conference info matching URI \(conferenceInfo.uri?.asString()) with subject \(conferenceInfo.subject)")
|
||||
Log.info("\(MeetingViewModel.TAG) Found conference info matching URI \(conferenceInfo.uri?.asString() ?? "NIL") with subject \(conferenceInfo.subject ?? "NIL")")
|
||||
|
||||
self.fromDate = Date(timeIntervalSince1970: TimeInterval(conferenceInfo.dateTime))
|
||||
self.toDate = Calendar.current.date(byAdding: .minute, value: Int(conferenceInfo.duration), to: self.fromDate)!
|
||||
|
||||
var list: [SelectedAddressModel] = []
|
||||
let list: [SelectedAddressModel] = []
|
||||
for partInfo in conferenceInfo.participantInfos {
|
||||
if let addr = partInfo.address {
|
||||
ContactAvatarModel.getAvatarModelFromAddress(address: addr) { avatarResult in
|
||||
|
|
@ -342,10 +342,9 @@ class MeetingViewModel: ObservableObject {
|
|||
DispatchQueue.main.async {
|
||||
self.subject = conferenceInfo.subject ?? ""
|
||||
self.description = conferenceInfo.description ?? ""
|
||||
self.isBroadcastSelected = false // TODO FIXME
|
||||
self.isBroadcastSelected = false
|
||||
self.computeDateLabels()
|
||||
self.computeTimeLabels()
|
||||
//self.participants = list
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
@ -365,3 +364,5 @@ class MeetingViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// swiftlint:enable line_length
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class MeetingsListViewModel: ObservableObject {
|
|||
init() {
|
||||
coreContext.doOnCoreQueue { core in
|
||||
self.mCoreSuscriptions.insert(core.publisher?.onConferenceInfoReceived?.postOnCoreQueue { (cbVal: (core: Core, conferenceInfo: ConferenceInfo)) in
|
||||
Log.info("\(MeetingsListViewModel.TAG) Conference info received [\(cbVal.conferenceInfo.uri?.asStringUriOnly())")
|
||||
Log.info("\(MeetingsListViewModel.TAG) Conference info received [\(cbVal.conferenceInfo.uri?.asStringUriOnly() ?? "NIL")")
|
||||
self.computeMeetingsList()
|
||||
})
|
||||
}
|
||||
|
|
@ -68,7 +68,9 @@ class MeetingsListViewModel: ObservableObject {
|
|||
let organizerCheck = confInfo.organizer?.asStringUriOnly().range(of: filter, options: .caseInsensitive) != nil
|
||||
let subjectCheck = confInfo.subject?.range(of: filter, options: .caseInsensitive) != nil
|
||||
let descriptionCheck = confInfo.description?.range(of: filter, options: .caseInsensitive) != nil
|
||||
let participantsCheck = confInfo.participantInfos.first(where: {$0.address?.asStringUriOnly().range(of: filter, options: .caseInsensitive) != nil}) != nil
|
||||
let participantsCheck = confInfo.participantInfos.first(
|
||||
where: {$0.address?.asStringUriOnly().range(of: filter, options: .caseInsensitive) != nil}
|
||||
) != nil
|
||||
|
||||
add = organizerCheck || subjectCheck || descriptionCheck || participantsCheck
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ extension Config {
|
|||
public static func get() -> Config {
|
||||
if _instance == nil {
|
||||
let factoryPath = FileUtil.bundleFilePath("linphonerc-factory")!
|
||||
let configDir = Factory.Instance.getConfigDir(context: nil)
|
||||
_instance = Config.newForSharedCore(appGroupId: Config.appGroupName, configFilename: "linphonerc", factoryConfigFilename: factoryPath)!
|
||||
}
|
||||
return _instance!
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
import Foundation
|
||||
|
||||
// swiftlint:disable large_tuple
|
||||
extension Int {
|
||||
|
||||
public func hmsFrom() -> (Int, Int, Int) {
|
||||
|
|
@ -65,3 +66,4 @@ extension Int {
|
|||
return "\(second)"
|
||||
}
|
||||
}
|
||||
// swiftlint:enable large_tuple
|
||||
|
|
|
|||
|
|
@ -26,9 +26,7 @@ extension URL {
|
|||
return components?.url
|
||||
}
|
||||
var resourceSpecifier: String {
|
||||
get {
|
||||
let nrl : NSURL = self as NSURL
|
||||
return nrl.resourceSpecifier ?? self.absoluteString
|
||||
}
|
||||
let nrl: NSURL = self as NSURL
|
||||
return nrl.resourceSpecifier ?? self.absoluteString
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -195,8 +195,7 @@ extension NSURL {
|
|||
if let pathExt = self.pathExtension,
|
||||
let mimeType = UTType(filenameExtension: pathExt)?.preferredMIMEType {
|
||||
return mimeType
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return "application/octet-stream"
|
||||
}
|
||||
}
|
||||
|
|
@ -206,8 +205,7 @@ extension URL {
|
|||
public func mimeType() -> String {
|
||||
if let mimeType = UTType(filenameExtension: self.pathExtension)?.preferredMIMEType {
|
||||
return mimeType
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return "application/octet-stream"
|
||||
}
|
||||
}
|
||||
|
|
@ -217,8 +215,7 @@ extension NSString {
|
|||
public func mimeType() -> String {
|
||||
if let mimeType = UTType(filenameExtension: self.pathExtension)?.preferredMIMEType {
|
||||
return mimeType
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return "application/octet-stream"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,8 @@ class LinphoneUtils: NSObject {
|
|||
}
|
||||
|
||||
public class func applyInternationalPrefix(core: Core, account: Account? = nil) -> Bool {
|
||||
return account?.params?.useInternationalPrefixForCallsAndChats == true || core.defaultAccount?.params?.useInternationalPrefixForCallsAndChats == true
|
||||
return account?.params?.useInternationalPrefixForCallsAndChats == true
|
||||
|| core.defaultAccount?.params?.useInternationalPrefixForCallsAndChats == true
|
||||
}
|
||||
|
||||
public class func isEndToEndEncryptedChatAvailable(core: Core) -> Bool {
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ final class MagicSearchSingleton: ObservableObject {
|
|||
$1.friend!.name!.lowercased().folding(options: .diacriticInsensitive, locale: .current)
|
||||
})
|
||||
|
||||
var addedAvatarListModel : [ContactAvatarModel] = []
|
||||
var addedAvatarListModel: [ContactAvatarModel] = []
|
||||
sortedLastSearch.forEach { searchResult in
|
||||
if searchResult.friend != nil {
|
||||
addedAvatarListModel.append(
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
import SwiftUI
|
||||
import PhotosUI
|
||||
|
||||
// swiftlint:disable line_length
|
||||
struct PhotoPicker: UIViewControllerRepresentable {
|
||||
typealias UIViewControllerType = PHPickerViewController
|
||||
|
||||
|
|
@ -85,6 +86,8 @@ struct PhotoPicker: UIViewControllerRepresentable {
|
|||
} catch {
|
||||
|
||||
}
|
||||
} else {
|
||||
Log.error("Could not load file representation: \(error?.localizedDescription ?? "unknown error")")
|
||||
}
|
||||
|
||||
dispatchGroup.leave()
|
||||
|
|
@ -104,6 +107,8 @@ struct PhotoPicker: UIViewControllerRepresentable {
|
|||
} catch {
|
||||
|
||||
}
|
||||
} else {
|
||||
Log.error("Could not load file representation: \(error?.localizedDescription ?? "unknown error")")
|
||||
}
|
||||
dispatchGroup.leave()
|
||||
}
|
||||
|
|
@ -119,7 +124,7 @@ struct PhotoPicker: UIViewControllerRepresentable {
|
|||
do {
|
||||
let path = FileManager.default.temporaryDirectory.appendingPathComponent((name.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) ?? ""))
|
||||
|
||||
let decodedData: () = try data.write(to: path)
|
||||
_ = try data.write(to: path)
|
||||
|
||||
if type == .video {
|
||||
let asset = AVURLAsset(url: path, options: nil)
|
||||
|
|
@ -134,7 +139,7 @@ struct PhotoPicker: UIViewControllerRepresentable {
|
|||
|
||||
let urlName = FileManager.default.temporaryDirectory.appendingPathComponent("preview_" + (name.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) ?? "") + ".png")
|
||||
|
||||
let decodedData: () = try data.write(to: urlName)
|
||||
_ = try data.write(to: urlName)
|
||||
}
|
||||
|
||||
return path
|
||||
|
|
@ -168,3 +173,5 @@ struct PhotoPicker: UIViewControllerRepresentable {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// swiftlint:enable line_length
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class NotificationService: UNNotificationServiceExtension {
|
|||
if let bestAttemptContent = bestAttemptContent {
|
||||
createCore()
|
||||
|
||||
//if !lc!.config!.getBool(section: "app", key: "disable_chat_feature", defaultValue: false) {
|
||||
// if !lc!.config!.getBool(section: "app", key: "disable_chat_feature", defaultValue: false) {
|
||||
Log.info("received push payload : \(bestAttemptContent.userInfo.debugDescription)")
|
||||
|
||||
/*
|
||||
|
|
@ -178,7 +178,7 @@ class NotificationService: UNNotificationServiceExtension {
|
|||
Log.info("Message not found for callid ["+callId+"]")
|
||||
}
|
||||
}
|
||||
//}
|
||||
// }
|
||||
serviceExtensionTimeWillExpire()
|
||||
}
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ class NotificationService: UNNotificationServiceExtension {
|
|||
if let chatRoomInviteAddr = bestAttemptContent.userInfo["chat-room-addr"] as? String, !chatRoomInviteAddr.isEmpty {
|
||||
bestAttemptContent.title = NSLocalizedString("GC_MSG", comment: "")
|
||||
bestAttemptContent.body = ""
|
||||
bestAttemptContent.sound = UNNotificationSound(named: UNNotificationSoundName("msg.caf")) // TODO : temporary fix, to be removed after flexisip release
|
||||
bestAttemptContent.sound = UNNotificationSound(named: UNNotificationSoundName("msg.caf"))
|
||||
} else {
|
||||
bestAttemptContent.title = NSLocalizedString("Message received", comment: "")
|
||||
bestAttemptContent.body = NSLocalizedString("IM_MSG", comment: "")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue