Skip to content

Commit

Permalink
Fixes for 5.2 release
Browse files Browse the repository at this point in the history
FIx

Fix PipController

Other fixes (Reported on AppStoreConnect)
  • Loading branch information
QuentinArguillere committed Nov 28, 2023
1 parent 568b9ea commit 422f84e
Show file tree
Hide file tree
Showing 13 changed files with 87 additions and 57 deletions.
4 changes: 2 additions & 2 deletions Classes/LinphoneUI/UIChatBubblePhotoCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ - (void)update {
size_t contentCount = bctbx_list_size(contents);
if (voiceContent)
contentCount--;
BOOL multiParts = ((linphone_chat_message_get_text_content(self.message) != NULL) ? bctbx_list_size(contents) > 2 : bctbx_list_size(contents) > 1);
BOOL multiParts = ((linphone_chat_message_get_utf8_text(self.message) != NULL) ? bctbx_list_size(contents) > 2 : bctbx_list_size(contents) > 1);
if (voiceContent && !multiParts) {
_cancelButton.hidden = _fileTransferProgress.hidden = _downloadButton.hidden = _playButton.hidden = _fileName.hidden = _fileView.hidden = _fileButton.hidden = YES;
return;
Expand Down Expand Up @@ -732,7 +732,7 @@ - (void)layoutSubviews {
}

// Positioning text message
const char *utf8Text = linphone_chat_message_get_text_content(self.message);
const char *utf8Text = linphone_chat_message_get_utf8_text(self.message);

CGRect textFrame = self.messageText.frame;
if (_contentViews.count > 0 || _finalImage.image)
Expand Down
14 changes: 7 additions & 7 deletions Classes/LinphoneUI/UIChatBubbleTextCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ + (NSString *)TextMessageForChat:(LinphoneChatMessage *)message {
const char *url = linphone_chat_message_get_external_body_url(message);
const LinphoneContent *last_content = linphone_chat_message_get_file_transfer_information(message);
// Last message was a file transfer (image) so display a picture...
if (url || last_content) {
if (linphone_chat_message_get_text_content(message))
return [NSString stringWithUTF8String:linphone_chat_message_get_text_content(message)];
if ((url || last_content) && message) {
if (linphone_chat_message_get_utf8_text(message))
return [NSString stringWithUTF8String:linphone_chat_message_get_utf8_text(message)];
return @"🗻";
} else {
const char *text = linphone_chat_message_get_text_content(message) ?: "";
const char *text = linphone_chat_message_get_utf8_text(message) ?: "";
return [NSString stringWithUTF8String:text] ?: [NSString stringWithCString:text encoding:NSASCIIStringEncoding]
?: NSLocalizedString(@"(invalid string)", nil);
}
Expand Down Expand Up @@ -530,7 +530,7 @@ + (CGSize)ViewHeightForMessageText:(LinphoneChatMessage *)chat withWidth:(int)wi
if (voiceContent)
contentCount--;

BOOL multiParts = ((linphone_chat_message_get_text_content(chat) != NULL) ? contentCount > 2 : contentCount > 1);
BOOL multiParts = ((linphone_chat_message_get_utf8_text(chat) != NULL) ? contentCount > 2 : contentCount > 1);

if (voiceContent && contentCount == 0) {
size = CGSizeMake(VOICE_RECORDING_PLAYER_WIDTH, VOICE_RECORDING_PLAYER_HEIGHT);
Expand Down Expand Up @@ -618,7 +618,7 @@ + (CGSize)ViewHeightForMessageText:(LinphoneChatMessage *)chat withWidth:(int)wi


// if here, either 1 file + text or just one file or just text.
BOOL justText = linphone_chat_message_get_text_content(chat) != NULL && contentCount == 1;
BOOL justText = linphone_chat_message_get_utf8_text(chat) != NULL && contentCount == 1;
if (justText) { // Just text
size = [self computeBoundingBox:messageText
size:CGSizeMake(width - CELL_MESSAGE_X_MARGIN - 4, CGFLOAT_MAX)
Expand Down Expand Up @@ -886,7 +886,7 @@ -(void) buildActions {
[_messageActionsIcons addObject:@"menu_copy_text_default"];
[_messageActionsBlocks addObject:^{
[thiz dismissPopup];
[UIPasteboard.generalPasteboard setString:[NSString stringWithUTF8String:linphone_chat_message_get_text_content(message)]];
[UIPasteboard.generalPasteboard setString:[NSString stringWithUTF8String:linphone_chat_message_get_utf8_text(message)]];
}];
}

Expand Down
2 changes: 1 addition & 1 deletion Classes/LinphoneUI/UIChatReplyBubbleView.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ -(void) configureForMessage:(LinphoneChatMessage *)message withDimissBlock:(void

NSString *sender = [FastAddressBook displayNameForAddress:linphone_chat_message_get_from_address(message)];
_senderName.text = sender;
const char * text = isIcal ? [ICSBubbleView getSubjectFromContentWithCmessage:message].UTF8String : linphone_chat_message_get_text_content(message);
const char * text = isIcal ? [ICSBubbleView getSubjectFromContentWithCmessage:message].UTF8String : linphone_chat_message_get_utf8_text(message);
if (text && strlen(text) == 0)
text = nil;
_textContent.text = text ? [NSString stringWithUTF8String:text] : @"";
Expand Down
14 changes: 8 additions & 6 deletions Classes/Swift/CallManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -564,13 +564,15 @@ import AVFoundation
if call.replacedCall != nil {
endCallKitReplacedCall = false

let uuid = CallManager.instance().providerDelegate.uuids["\(CallManager.uuidReplacedCall)"]
let uuid = CallManager.instance().providerDelegate.uuids["\(CallManager.uuidReplacedCall ?? "")"]
let callInfo = CallManager.instance().providerDelegate.callInfos[uuid!]
callInfo!.callId = CallManager.instance().referedToCall ?? ""
CallManager.instance().providerDelegate.callInfos.updateValue(callInfo!, forKey: uuid!)
CallManager.instance().providerDelegate.uuids.removeValue(forKey: callId)
CallManager.instance().providerDelegate.uuids.updateValue(uuid!, forKey: callInfo!.callId)
CallManager.instance().providerDelegate.updateCall(uuid: uuid!, handle: addr!.asStringUriOnly(), hasVideo: video, displayName: displayName)
if (callInfo != nil && uuid != nil && addr != nil) {
CallManager.instance().providerDelegate.callInfos.updateValue(callInfo!, forKey: uuid!)
CallManager.instance().providerDelegate.uuids.removeValue(forKey: callId)
CallManager.instance().providerDelegate.uuids.updateValue(uuid!, forKey: callInfo!.callId)
CallManager.instance().providerDelegate.updateCall(uuid: uuid!, handle: addr!.asStringUriOnly(), hasVideo: video, displayName: displayName)
}
} else if (CallManager.callKitEnabled()) {
let isConference = isConferenceCall(call: call)
let isEarlyConference = isConference && CallsViewModel.shared.currentCallData.value??.isConferenceCall.value != true // Conference info not be received yet.
Expand Down Expand Up @@ -638,7 +640,7 @@ import AVFoundation
.OutgoingEarlyMedia:
if (CallManager.callKitEnabled()) {
let uuid = CallManager.instance().providerDelegate.uuids[""]
if (uuid != nil) {
if (uuid != nil && callId != nil) {
let callInfo = CallManager.instance().providerDelegate.callInfos[uuid!]
callInfo!.callId = callId
CallManager.instance().providerDelegate.callInfos.updateValue(callInfo!, forKey: uuid!)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ class ChatConversationTableViewSwift: UIViewController, UICollectionViewDataSour

ChatConversationViewModel.sharedModel.removeTmpFile(filePath: plainFile)
plainFile = ""
}else {
}else if chatMessage.contents.first?.filePath != nil {
self.previewItems.append(self.getPreviewItem(filePath: (chatMessage.contents.first?.filePath)!))
}

Expand Down
16 changes: 14 additions & 2 deletions Classes/Swift/Chat/Views/MessageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ class MessageView: UIView, UITextViewDelegate {
messageWithEmojiView.addArrangedSubview(emojisButton)
emojisButton.alignParentRight().matchParentHeight().done()

if #available(iOS 17.0, *) {
emojisButton.isHidden = true
}

UIDeviceBridge.displayModeSwitched.readCurrentAndObserve { _ in
self.backgroundColor = VoipTheme.voipToolbarBackgroundColor.get()
self.messageWithEmojiView.backgroundColor = VoipTheme.backgroundWhiteBlack.get()
Expand All @@ -99,7 +103,11 @@ class MessageView: UIView, UITextViewDelegate {
let chatRoom = ChatRoom.getSwiftObject(cObject: PhoneMainView.instance().currentRoom)
if ((messageText.text.isEmpty && !fileContext) || isLoading) {
sendButton.isEnabled = false
emojisButton.isHidden = false
if #available(iOS 17.0, *) {
emojisButton.isHidden = true
} else {
emojisButton.isHidden = false
}
NotificationCenter.default.post(name: Notification.Name("LinphoneResetTextViewSize"), object: self)
lastNumLines = 0
} else {
Expand All @@ -111,7 +119,11 @@ class MessageView: UIView, UITextViewDelegate {
}
}
if onlyEmojis {
emojisButton.isHidden = false
if #available(iOS 17.0, *) {
emojisButton.isHidden = true
} else {
emojisButton.isHidden = false
}
} else {
emojisButton.isHidden = true
}
Expand Down
22 changes: 12 additions & 10 deletions Classes/Swift/Chat/Views/MultilineMessageCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1784,8 +1784,10 @@ class MultilineMessageCell: SwipeCollectionViewCell, UICollectionViewDataSource,
var result = ""
do{
let linphonePlayer = try core.createLocalPlayer(soundCardName: nil, videoDisplayName: nil, windowId: nil)
try linphonePlayer.open(filename: _voiceRecordingFile!)
result = formattedDuration(linphonePlayer.duration)!
if _voiceRecordingFile != nil {
try linphonePlayer.open(filename: _voiceRecordingFile!)
}
result = formattedDuration(linphonePlayer.duration) ?? ""
linphonePlayer.close()
}catch{
Log.e(error.localizedDescription)
Expand Down Expand Up @@ -2026,13 +2028,13 @@ class MultilineMessageCell: SwipeCollectionViewCell, UICollectionViewDataSource,
subject = event.subject!
return VoipTexts.bubble_chat_event_message_new_subject + subject
case Int(LinphoneEventLogTypeConferenceParticipantAdded.rawValue):
participant = (event.participantAddress!.displayName != "" && event.participantAddress!.displayName != nil ? event.participantAddress!.displayName : event.participantAddress!.username)!
participant = (event.participantAddress!.displayName != nil && event.participantAddress!.displayName != "" ? event.participantAddress!.displayName : event.participantAddress!.username)!
return participant + VoipTexts.bubble_chat_event_message_has_joined
case Int(LinphoneEventLogTypeConferenceParticipantRemoved.rawValue):
participant = (event.participantAddress!.displayName != "" && event.participantAddress!.displayName != nil ? event.participantAddress!.displayName : event.participantAddress!.username)!
participant = (event.participantAddress!.displayName != nil && event.participantAddress!.displayName != "" ? event.participantAddress!.displayName : event.participantAddress!.username)!
return participant + VoipTexts.bubble_chat_event_message_has_left
case Int(LinphoneEventLogTypeConferenceParticipantSetAdmin.rawValue):
participant = (event.participantAddress!.displayName != "" && event.participantAddress!.displayName != nil ? event.participantAddress!.displayName : event.participantAddress!.username)!
participant = (event.participantAddress!.displayName != nil && event.participantAddress!.displayName != nil && event.participantAddress!.displayName != "" ? event.participantAddress!.displayName : event.participantAddress!.username)!
return participant + VoipTexts.bubble_chat_event_message_now_admin
case Int(LinphoneEventLogTypeConferenceParticipantUnsetAdmin.rawValue):
participant = (event.participantAddress!.displayName != "" && event.participantAddress!.displayName != nil ? event.participantAddress!.displayName : event.participantAddress!.username)!
Expand All @@ -2043,28 +2045,28 @@ class MultilineMessageCell: SwipeCollectionViewCell, UICollectionViewDataSource,
return VoipTexts.bubble_chat_event_message_joined_group
case Int(LinphoneEventLogTypeConferenceSecurityEvent.rawValue):
let type = event.securityEventType
let participant = event.securityEventFaultyDeviceAddress!.displayName != "" ? event.securityEventFaultyDeviceAddress!.displayName : event.securityEventFaultyDeviceAddress!.username
let participant = event.securityEventFaultyDeviceAddress!.displayName != nil && event.securityEventFaultyDeviceAddress!.displayName != "" ? event.securityEventFaultyDeviceAddress!.displayName : event.securityEventFaultyDeviceAddress!.username
switch (type.rawValue) {
case Int(LinphoneSecurityEventTypeSecurityLevelDowngraded.rawValue):
if (participant!.isEmpty){
if (participant != nil && participant!.isEmpty){
return VoipTexts.bubble_chat_event_message_security_level_decreased
}else{
return VoipTexts.bubble_chat_event_message_security_level_decreased_because + participant!
}
case Int(LinphoneSecurityEventTypeParticipantMaxDeviceCountExceeded.rawValue):
if (participant!.isEmpty){
if (participant != nil && participant!.isEmpty){
return VoipTexts.bubble_chat_event_message_max_participant
}else{
return VoipTexts.bubble_chat_event_message_max_participant_by + participant!
}
case Int(LinphoneSecurityEventTypeEncryptionIdentityKeyChanged.rawValue):
if (participant!.isEmpty){
if (participant != nil && participant!.isEmpty){
return VoipTexts.bubble_chat_event_message_lime_changed
}else{
return VoipTexts.bubble_chat_event_message_lime_changed_for + participant!
}
case Int(LinphoneSecurityEventTypeManInTheMiddleDetected.rawValue):
if (participant!.isEmpty){
if (participant != nil && participant!.isEmpty){
return VoipTexts.bubble_chat_event_message_attack_detected
}else{
return VoipTexts.bubble_chat_event_message_attack_detected_for + participant!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class ScheduledConferencesCell: UITableViewCell {
subject.text = (isBroadcast ? VoipTexts.conference_scheduled_title_broadcast_cell : VoipTexts.conference_scheduled_title_meeting_cell) + data.subject.value!
cancelledLabel.text = data.isConferenceCancelled.value == true ? ( data.canEdit.value == true ? VoipTexts.conference_scheduled_cancelled_by_me: VoipTexts.conference_scheduled_cancelled_by_organizer) : nil
cancelledLabel.isHidden = data.isConferenceCancelled.value != true
descriptionValue.text = data.description.value!
descriptionValue.text = data.description.value != nil ? data.description.value! : ""
urlValue.text = data.address.value!
self.joinConf.isHidden = data.isConferenceCancelled.value == true
self.editConf.isHidden = data.canEdit.value != true || data.isConferenceCancelled.value == true
Expand Down
2 changes: 1 addition & 1 deletion Classes/Swift/Voip/ViewModels/ConferenceViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ class ConferenceViewModel {
}

static func getConferenceSubject(conference:Conference) -> String? {
if (conference.subject!.count > 0) {
if (conference.subject != nil && conference.subject!.count > 0) {
return conference.subject
} else {
let conferenceInfo = Core.get().findConferenceInformationFromUri(uri: conference.conferenceAddress!)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,20 @@ extension SingleCallView : AVPictureInPictureControllerDelegate {
activeVideoCallSourceView: currentCallView!.remoteVideo,
contentViewController: pipVideoCallController)
pipController = AVPictureInPictureController(contentSource: pipContentSource)
pipController.delegate = self

ControlsViewModel.shared.isVideoEnabled.readCurrentAndObserve{ (video) in
pipVideoCallController.matchVideoDimension()
self.pipController.canStartPictureInPictureAutomaticallyFromInline = video == true
}

CallsViewModel.shared.currentCallData.observe(onChange: { callData in
if (callData??.call.state != .StreamsRunning && self.pipController.isPictureInPictureActive) {
self.pipController.stopPictureInPicture()
if (pipController != nil) {
pipController.delegate = self

ControlsViewModel.shared.isVideoEnabled.readCurrentAndObserve{ (video) in
pipVideoCallController.matchVideoDimension()
self.pipController.canStartPictureInPictureAutomaticallyFromInline = video == true
}
})

CallsViewModel.shared.currentCallData.observe(onChange: { callData in
if (callData??.call.state != .StreamsRunning && self.pipController.isPictureInPictureActive) {
self.pipController.stopPictureInPicture()
}
})
}
}


Expand Down
2 changes: 1 addition & 1 deletion Classes/Swift/Voip/Widgets/Avatar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Avatar : UIView {
initialsLabel.isHidden = true
iconImageView.isHidden = false
} else {
if (Core.get().defaultAccount?.isPhoneNumber(username: address.username!) == true) {
if (Core.get().defaultAccount != nil && address.username != nil && Core.get().defaultAccount!.isPhoneNumber(username: address.username!) == true) {
iconImageView.image = Avatar.singleAvatar
initialsLabel.isHidden = true
iconImageView.isHidden = false
Expand Down
34 changes: 23 additions & 11 deletions GoogleService-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,35 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AD_UNIT_ID_FOR_BANNER_TEST</key>
<string></string>
<key>AD_UNIT_ID_FOR_INTERSTITIAL_TEST</key>
<string></string>
<key>CLIENT_ID</key>
<string></string>
<string>221368768663-0ufgu96cel0auk4v0me863lgm252b9n2.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string></string>
<string>com.googleusercontent.apps.221368768663-0ufgu96cel0auk4v0me863lgm252b9n2</string>
<key>API_KEY</key>
<string></string>
<string>AIzaSyDJTtlRCM7IqdVUU2dSIYq2YIsTz6bqnkI</string>
<key>GCM_SENDER_ID</key>
<string></string>
<string>221368768663</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string></string>
<string>org.linphone.phone</string>
<key>PROJECT_ID</key>
<string></string>
<string>linphone-iphone</string>
<key>STORAGE_BUCKET</key>
<string></string>
<string>linphone-iphone.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false/>
<key>IS_ANALYTICS_ENABLED</key>
<false/>
<key>IS_APPINVITE_ENABLED</key>
<true/>
<key>IS_GCM_ENABLED</key>
<true/>
<key>IS_SIGNIN_ENABLED</key>
<true/>
<key>GOOGLE_APP_ID</key>
<string>1:221368768663:ios:a2c822bc087b5a219431d2</string>
<key>DATABASE_URL</key>
<string>https://linphone-iphone.firebaseio.com</string>
</dict>
</plist>
6 changes: 3 additions & 3 deletions Podfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Uncomment the next line to define a global platform for your project
platform :ios, '12.0'
platform :ios, '13.0'
source "https://gitlab.linphone.org/BC/public/podspec.git"
source "https://github.com/CocoaPods/Specs.git"

def all_pods
if ENV['PODFILE_PATH'].nil?
pod 'linphone-sdk', '~>5.3.0-alpha'
pod 'linphone-sdk', '~>5.3.0-beta'
else
pod 'linphone-sdk', :path => ENV['PODFILE_PATH'] # local sdk
end
Expand Down Expand Up @@ -121,7 +121,7 @@ post_install do |installer|

installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
end
end

0 comments on commit 422f84e

Please sign in to comment.