Fix minor problems with presence

This commit is contained in:
Benoit Martins 2023-04-25 11:49:23 +02:00 committed by QuentinArguillere
parent 5f297b5dec
commit 139ac987d8
3 changed files with 10 additions and 5 deletions

View file

@ -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];

View file

@ -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 {

View file

@ -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()
}
}
}