mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-03 20:46:28 +00:00
chat: fix duplicate entry for incoming messages on iPad
This commit is contained in:
parent
4bdff37f7f
commit
1cf72dab89
4 changed files with 15 additions and 10 deletions
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
|
||||
|
|
@ -96,7 +96,7 @@
|
|||
<action selector="onCallClick:" destination="-1" eventType="touchUpInside" id="Dsf-nS-K3V"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" tag="7" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="Hc0-GX-fC5" userLabel="backToCallButton" customClass="UIBackToCallButton">
|
||||
<button hidden="YES" opaque="NO" tag="7" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="Hc0-GX-fC5" userLabel="backToCallButton" customClass="UIBackToCallButton">
|
||||
<rect key="frame" x="225" y="0.0" width="75" height="66"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
|
||||
<state key="normal" image="call_back_default.png">
|
||||
|
|
@ -346,7 +346,7 @@
|
|||
<action selector="onCallClick:" destination="-1" eventType="touchUpInside" id="gcb-ac-VkW"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" tag="7" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="t25-en-4LP" userLabel="backToCallButton" customClass="UIBackToCallButton">
|
||||
<button hidden="YES" opaque="NO" tag="7" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="t25-en-4LP" userLabel="backToCallButton" customClass="UIBackToCallButton">
|
||||
<rect key="frame" x="496" y="0.0" width="75" height="66"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
|
||||
<state key="normal" image="call_back_default.png">
|
||||
|
|
|
|||
|
|
@ -41,10 +41,7 @@
|
|||
#pragma mark -
|
||||
|
||||
- (void)clearMessageList {
|
||||
if (messageList) {
|
||||
ms_list_free_with_data(messageList, (void (*)(void *))linphone_chat_message_unref);
|
||||
messageList = nil;
|
||||
}
|
||||
messageList = ms_list_free_with_data(messageList, (void (*)(void *))linphone_chat_message_unref);
|
||||
}
|
||||
|
||||
- (void)updateData {
|
||||
|
|
@ -72,6 +69,14 @@
|
|||
}
|
||||
|
||||
- (void)addChatEntry:(LinphoneChatMessage *)chat {
|
||||
// do not add the same message multiple times. It can happen on iPad since in fragment
|
||||
// mode, "message received" notification will reload tabledata, retrieving all history
|
||||
// and THEN addChatEntry will be called, requesting the newest message to be added again
|
||||
if (messageList &&
|
||||
(linphone_chat_message_get_storage_id(chat) ==
|
||||
linphone_chat_message_get_storage_id(ms_list_nth_data(messageList, ms_list_size(messageList) - 1)))) {
|
||||
return;
|
||||
}
|
||||
|
||||
messageList = ms_list_append(messageList, linphone_chat_message_ref(chat));
|
||||
int pos = ms_list_size(messageList) - 1;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
|
||||
_messageField.minNumberOfLines = 1;
|
||||
_messageField.maxNumberOfLines = ([LinphoneManager runningOnIpad]) ? 10 : 3;
|
||||
_messageField.maxNumberOfLines = IPAD ? 10 : 3;
|
||||
_messageField.delegate = self;
|
||||
_messageField.font = [UIFont systemFontOfSize:18.0f];
|
||||
_messageField.contentInset = UIEdgeInsetsMake(-15, 0, 0, 0);
|
||||
|
|
@ -320,12 +320,12 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
if (from == NULL || chat == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
char *fromStr = linphone_address_as_string_uri_only(from);
|
||||
const LinphoneAddress *cr_from = linphone_chat_room_get_peer_address(chatRoom);
|
||||
char *cr_from_string = linphone_address_as_string_uri_only(cr_from);
|
||||
|
||||
if (fromStr && cr_from_string) {
|
||||
|
||||
if (strcasecmp(cr_from_string, fromStr) == 0) {
|
||||
if ([UIApplication sharedApplication].applicationState != UIApplicationStateBackground) {
|
||||
linphone_chat_room_mark_as_read(room);
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ static void chatTable_free_chatrooms(void *data) {
|
|||
if (IPAD) {
|
||||
// reset conversation view since in fragment mode, conversations are relative to current data
|
||||
// select first conversation if any
|
||||
if ([self totalNumberOfItems] > 0) {
|
||||
if (data != NULL) {
|
||||
ChatConversationView *view = VIEW(ChatConversationView);
|
||||
[view setChatRoom:(LinphoneChatRoom *)ms_list_nth_data(data, 0)];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue