mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
Add RemoveAllDelegate in AvatarBridge
This commit is contained in:
parent
4ec3d89d42
commit
5f297b5dec
9 changed files with 35 additions and 11 deletions
|
|
@ -122,6 +122,7 @@
|
|||
- (void) viewWillDisappear:(BOOL)animated {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"LinphoneFriendPresenceUpdate" object:nil];
|
||||
[AvatarBridge removeAllObserver];
|
||||
_notFirstTime = FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
[NSNotificationCenter.defaultCenter removeObserver:self];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"LinphoneFriendPresenceUpdate" object:nil];
|
||||
[AvatarBridge removeAllObserver];
|
||||
if (!_room || !_chatRoomCbs)
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@
|
|||
}
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"LinphoneFriendPresenceUpdate" object:nil];
|
||||
[AvatarBridge removeAllObserver];
|
||||
}
|
||||
|
||||
- (void)layoutSubviews {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#import "ContactDetailsView.h"
|
||||
#import "PhoneMainView.h"
|
||||
#import "UIContactDetailsCell.h"
|
||||
#import "linphoneapp-Swift.h"
|
||||
|
||||
@implementation ContactDetailsView
|
||||
|
||||
|
|
@ -370,6 +371,7 @@
|
|||
}
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"LinphoneFriendPresenceUpdate" object:nil];
|
||||
[AvatarBridge removeAllObserver];
|
||||
}
|
||||
|
||||
#pragma mark - UICompositeViewDelegate Functions
|
||||
|
|
|
|||
|
|
@ -67,6 +67,11 @@
|
|||
object: userInfo];
|
||||
}
|
||||
|
||||
-(void)viewWillDisappear:(BOOL)animated{
|
||||
[super viewWillDisappear:animated];
|
||||
[AvatarBridge removeAllObserver];
|
||||
}
|
||||
|
||||
-(void)viewDidDisappear:(BOOL)animated{
|
||||
[super viewDidDisappear:animated];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"LinphoneFriendPresenceUpdate" object:nil];
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#import "HistoryDetailsView.h"
|
||||
#import "PhoneMainView.h"
|
||||
#import "FastAddressBook.h"
|
||||
#import "linphoneapp-Swift.h"
|
||||
|
||||
@implementation HistoryDetailsView
|
||||
|
||||
|
|
@ -113,6 +114,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[super viewWillDisappear:animated];
|
||||
[NSNotificationCenter.defaultCenter removeObserver:self];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"LinphoneFriendPresenceUpdate" object:nil];
|
||||
[AvatarBridge removeAllObserver];
|
||||
}
|
||||
|
||||
#pragma mark - Event Functions
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@
|
|||
[NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneCoreUpdate object:nil];
|
||||
[NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneCallUpdate object:nil];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"LinphoneFriendPresenceUpdate" object:nil];
|
||||
[AvatarBridge removeAllObserver];
|
||||
}
|
||||
|
||||
#pragma mark - Event Functions
|
||||
|
|
|
|||
|
|
@ -259,6 +259,13 @@ class ChatConversationViewSwift: BackActionsNavigationView, PHPickerViewControll
|
|||
configureMessageField()
|
||||
ChatConversationViewModel.sharedModel.shareFile()
|
||||
}
|
||||
|
||||
override func viewWillDisappear(_ animated: Bool) {
|
||||
if friendDelegate != nil {
|
||||
friend?.removeDelegate(delegate: friendDelegate!)
|
||||
}
|
||||
AvatarBridge.removeAllObserver()
|
||||
}
|
||||
|
||||
override func viewDidDisappear(_ animated: Bool) {
|
||||
resetView()
|
||||
|
|
|
|||
|
|
@ -153,17 +153,6 @@ class Avatar : UIView {
|
|||
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])
|
||||
|
||||
var i = 0
|
||||
self.friend.forEach { friendForEach in
|
||||
if friendForEach.address?.asStringUriOnly() == linphoneFriend.address?.asStringUriOnly() {
|
||||
self.friend[i].removeDelegate(delegate: self.friendDelegate[i])
|
||||
self.friendDelegate.remove(at: i)
|
||||
self.friend.remove(at: i)
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
@ -171,6 +160,17 @@ class Avatar : UIView {
|
|||
friend.last?.addDelegate(delegate: friendDelegate.last!)
|
||||
}
|
||||
}
|
||||
|
||||
func removeAllDelegate(){
|
||||
var i = 0
|
||||
self.friend.forEach { friendForEach in
|
||||
self.friend[i].removeDelegate(delegate: self.friendDelegate[i])
|
||||
i += 1;
|
||||
}
|
||||
|
||||
self.friendDelegate = []
|
||||
self.friend = []
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -265,4 +265,8 @@ class Avatar : UIView {
|
|||
shared!.friendDelegate = []
|
||||
}
|
||||
}
|
||||
|
||||
@objc static func removeAllObserver(){
|
||||
shared!.removeAllDelegate()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue