diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 956ea1d19..ffa770fb2 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -64,7 +64,7 @@ - (void)applicationDidEnterBackground:(UIApplication *)application { LOGI(@"%@", NSStringFromSelector(_cmd)); if([LinphoneManager.instance lpConfigBoolForKey:@"account_push_presence_preference"]){ - linphone_core_set_consolidated_presence([LinphoneManager getLc], LinphoneConsolidatedPresenceOffline); + linphone_core_set_consolidated_presence(LC, LinphoneConsolidatedPresenceOffline); } if (linphone_core_get_global_state(LC) != LinphoneGlobalOff) { [LinphoneManager.instance enterBackgroundMode]; @@ -91,7 +91,7 @@ [LinphoneManager.instance.fastAddressBook reloadFriends]; [AvatarBridge clearFriends]; if([LinphoneManager.instance lpConfigBoolForKey:@"account_push_presence_preference"]){ - linphone_core_set_consolidated_presence([LinphoneManager getLc], LinphoneConsolidatedPresenceOnline); + linphone_core_set_consolidated_presence(LC, LinphoneConsolidatedPresenceOnline); } [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneMessageReceived object:nil]; diff --git a/Classes/Swift/Chat/Views/MultilineMessageCell.swift b/Classes/Swift/Chat/Views/MultilineMessageCell.swift index 6bafcf209..e93375e67 100644 --- a/Classes/Swift/Chat/Views/MultilineMessageCell.swift +++ b/Classes/Swift/Chat/Views/MultilineMessageCell.swift @@ -20,7 +20,7 @@ class MultilineMessageCell: SwipeCollectionViewCell, UICollectionViewDataSource, var contentMediaViewBubble: UIView = UIView(frame: .zero) var contentBubble: UIView = UIView(frame: .zero) var bubble: UIView = UIView(frame: .zero) - var imageUser = Avatar(color:VoipTheme.primaryTextColor, textStyle: VoipTheme.chat_conversation_avatar_small) + let imageUser = UIImageView()//Avatar(color:VoipTheme.primaryTextColor, textStyle: VoipTheme.chat_conversation_avatar_small) var contactDateLabel = StyledLabel(VoipTheme.chat_conversation_forward_label) var chatRead = UIImageView(image: UIImage(named: "chat_delivered.png")) @@ -754,7 +754,9 @@ class MultilineMessageCell: SwipeCollectionViewCell, UICollectionViewDataSource, if isFirstIndexInTableView(indexPath: selfIndexPathConfigure, chat: event.chatMessage!) { imageUser.isHidden = false - imageUser.fillFromAddress(address: (event.chatMessage?.fromAddress)!, withPresence: true) + //imageUser.fillFromAddress(address: (event.chatMessage?.fromAddress)!, withPresence: true) + imageUser.image = FastAddressBook.image(for: event.chatMessage?.fromAddress?.contact()) + //[cell.avatarImage setImage:[FastAddressBook imageForAddress:addr]]; contactDateLabel.text = contactDateForChat(message: event.chatMessage!) contactDateLabel.isHidden = false if editMode { diff --git a/Classes/Swift/Voip/Widgets/Avatar.swift b/Classes/Swift/Voip/Widgets/Avatar.swift index 49399169c..9e1cdab7a 100644 --- a/Classes/Swift/Voip/Widgets/Avatar.swift +++ b/Classes/Swift/Voip/Widgets/Avatar.swift @@ -150,6 +150,7 @@ class Avatar : UIView { friend.append(Friend.getSwiftObject(cObject: (contactAddress.friend)!)) let newFriendDelegate = FriendDelegateStub( onPresenceReceived: { (linphoneFriend: Friend) -> Void in + print("onPresenceReceivedonPresenceReceived \(linphoneFriend.address?.displayName)") if (linphoneFriend.address?.asStringUriOnly()) != nil { let presenceModel = linphoneFriend.getPresenceModelForUriOrTel(uriOrTel: (linphoneFriend.address?.asStringUriOnly())!) NotificationCenter.default.post(name: Notification.Name("LinphoneFriendPresenceUpdate"), object: nil, userInfo: ["friend": linphoneFriend.address?.asStringUriOnly() ?? "", "isOnline": presenceModel!.consolidatedPresence.rawValue == LinphoneConsolidatedPresenceOnline.rawValue]) @@ -267,6 +268,8 @@ class Avatar : UIView { } @objc static func removeAllObserver(){ - shared!.removeAllDelegate() + if shared != nil { + shared!.removeAllDelegate() + } } }