mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
[Switch submodule branch] Add LIME to settings + manage LIME when sending messages
This commit is contained in:
parent
7603a61f7b
commit
816f7466cb
7 changed files with 48 additions and 43 deletions
|
|
@ -240,8 +240,8 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
linphone_chat_message_unref(msg);
|
||||
|
||||
[_tableController scrollToBottom:true];
|
||||
|
||||
if(linphone_core_lime_enabled(LC) == LinphoneLimeMandatory && !linphone_chat_room_lime_available(_chatRoom)) {
|
||||
|
||||
if (linphone_core_lime_enabled(LC) == LinphoneLimeMandatory && !linphone_chat_room_lime_available(_chatRoom)) {
|
||||
[LinphoneManager.instance alertLIME:_chatRoom];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -707,8 +707,8 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response
|
|||
if (room) {
|
||||
LinphoneChatMessage *msg = linphone_chat_room_create_message(room, replyText.UTF8String);
|
||||
linphone_chat_room_send_chat_message(room, msg);
|
||||
|
||||
if(linphone_core_lime_enabled(LC) == LinphoneLimeMandatory && !linphone_chat_room_lime_available(room)) {
|
||||
|
||||
if (linphone_core_lime_enabled(LC) == LinphoneLimeMandatory && !linphone_chat_room_lime_available(room)) {
|
||||
[LinphoneManager.instance alertLIME:room];
|
||||
}
|
||||
linphone_chat_room_mark_as_read(room);
|
||||
|
|
@ -754,7 +754,7 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response
|
|||
linphone_call_set_authentication_token_verified(call, NO);
|
||||
}
|
||||
} else if ([response.actionIdentifier isEqual:@"Call"]) {
|
||||
|
||||
|
||||
} else { // in this case the value is : com.apple.UNNotificationDefaultActionIdentifier
|
||||
if ([response.notification.request.content.categoryIdentifier isEqual:@"call_cat"]) {
|
||||
[PhoneMainView.instance displayIncomingCall:call];
|
||||
|
|
@ -903,11 +903,11 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response
|
|||
if (room) {
|
||||
LinphoneChatMessage *msg = linphone_chat_room_create_message(room, replyText.UTF8String);
|
||||
linphone_chat_room_send_chat_message(room, msg);
|
||||
|
||||
if(linphone_core_lime_enabled(LC) == LinphoneLimeMandatory && !linphone_chat_room_lime_available(room)) {
|
||||
|
||||
if (linphone_core_lime_enabled(LC) == LinphoneLimeMandatory && !linphone_chat_room_lime_available(room)) {
|
||||
[LinphoneManager.instance alertLIME:room];
|
||||
}
|
||||
|
||||
|
||||
linphone_chat_room_mark_as_read(room);
|
||||
[PhoneMainView.instance updateApplicationBadgeNumber];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@
|
|||
[self setBool:[lm lpConfigBoolForKey:@"repeat_call_notification"]
|
||||
forKey:@"repeat_call_notification_preference"];
|
||||
}
|
||||
|
||||
|
||||
// chat section
|
||||
{
|
||||
[self setInteger:linphone_core_lime_enabled(LC) forKey:@"use_lime_preference"];
|
||||
|
|
@ -747,28 +747,32 @@
|
|||
[lm lpConfigSetBool:[self boolForKey:@"repeat_call_notification_preference"]
|
||||
forKey:@"repeat_call_notification"];
|
||||
}
|
||||
|
||||
|
||||
// chat section
|
||||
{
|
||||
int val = [self integerForKey:@"use_lime_preference"];
|
||||
linphone_core_enable_lime(LC, val);
|
||||
if(val == LinphoneLimeMandatory && (linphone_core_get_media_encryption(LC) != LinphoneMediaEncryptionZRTP)) {
|
||||
if (val == LinphoneLimeMandatory &&
|
||||
(linphone_core_get_media_encryption(LC) != LinphoneMediaEncryptionZRTP)) {
|
||||
linphone_core_set_media_encryption(LC, LinphoneMediaEncryptionZRTP);
|
||||
[self setCString:"ZRTP" forKey:@"media_encryption_preference"];
|
||||
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"ZRTP activation", nil)
|
||||
message:NSLocalizedString(@"LIME requires ZRTP encryption.\n"
|
||||
@"By activating LIME you automatically ZRTP media encryption.",
|
||||
nil)
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK"
|
||||
UIAlertController *errView = [UIAlertController
|
||||
alertControllerWithTitle:NSLocalizedString(@"ZRTP activation", nil)
|
||||
message:NSLocalizedString(
|
||||
@"LIME requires ZRTP encryption.\n"
|
||||
@"By activating LIME you automatically ZRTP media encryption.",
|
||||
nil)
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
UIAlertAction *defaultAction = [UIAlertAction actionWithTitle:@"OK"
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {}];
|
||||
handler:^(UIAlertAction *action){
|
||||
}];
|
||||
[errView addAction:defaultAction];
|
||||
[PhoneMainView.instance presentViewController:errView animated:YES completion:nil];
|
||||
}
|
||||
linphone_core_set_file_transfer_server(
|
||||
LC, [[self stringForKey:@"file_transfer_server_url_preference"] UTF8String]);
|
||||
LC, [[self stringForKey:@"file_transfer_server_url_preference"] UTF8String]);
|
||||
}
|
||||
|
||||
// network section
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ typedef struct _LinphoneManagerSounds {
|
|||
- (void)acceptCallForCallId:(NSString*)callid;
|
||||
- (LinphoneCall *)callByCallId:(NSString *)call_id;
|
||||
- (void)cancelLocalNotifTimerForCallId:(NSString*)callid;
|
||||
- (void) alertLIME:(LinphoneChatRoom *)room;
|
||||
- (void)alertLIME:(LinphoneChatRoom *)room;
|
||||
|
||||
+ (BOOL)langageDirectionIsRTL;
|
||||
+ (void)kickOffNetworkConnection;
|
||||
|
|
|
|||
|
|
@ -1360,28 +1360,30 @@ static void linphone_iphone_call_encryption_changed(LinphoneCore *lc, LinphoneCa
|
|||
}
|
||||
|
||||
#pragma mark - Message composition start
|
||||
- (void) alertLIME:(LinphoneChatRoom *)room {
|
||||
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"LIME Error", nil)
|
||||
message:NSLocalizedString(@"You are trying to send a message using LIME to a contact not verified by ZRTP.\n"
|
||||
@"Please call this contact and verify his ZRTP key before sending your messages.",
|
||||
nil)
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK"
|
||||
- (void)alertLIME:(LinphoneChatRoom *)room {
|
||||
UIAlertController *errView = [UIAlertController
|
||||
alertControllerWithTitle:NSLocalizedString(@"LIME Error", nil)
|
||||
message:NSLocalizedString(
|
||||
@"You are trying to send a message using LIME to a contact not verified by ZRTP.\n"
|
||||
@"Please call this contact and verify his ZRTP key before sending your messages.",
|
||||
nil)
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
UIAlertAction *defaultAction = [UIAlertAction actionWithTitle:@"OK"
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {}];
|
||||
handler:^(UIAlertAction *action){
|
||||
}];
|
||||
[errView addAction:defaultAction];
|
||||
|
||||
UIAlertAction* callAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Call", nil)
|
||||
|
||||
UIAlertAction *callAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Call", nil)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
[self call:linphone_chat_room_get_peer_address(room)];
|
||||
}];
|
||||
handler:^(UIAlertAction *action) {
|
||||
[self call:linphone_chat_room_get_peer_address(room)];
|
||||
}];
|
||||
[errView addAction:callAction];
|
||||
[PhoneMainView.instance presentViewController:errView animated:YES completion:nil];
|
||||
}
|
||||
|
||||
|
||||
- (void)onMessageComposeReceived:(LinphoneCore *)core forRoom:(LinphoneChatRoom *)room {
|
||||
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneTextComposeEvent
|
||||
object:self
|
||||
|
|
|
|||
|
|
@ -593,8 +593,8 @@ void update_hash_cbs(LinphoneAccountCreator *creator, LinphoneAccountCreatorStat
|
|||
if (!linphone_core_sip_transport_supported(LC, LinphoneTransportTls)) {
|
||||
[hiddenKeys addObject:@"media_encryption_preference"];
|
||||
}
|
||||
|
||||
if(!linphone_core_lime_available(LC)) {
|
||||
|
||||
if (!linphone_core_lime_available(LC)) {
|
||||
[hiddenKeys addObject:@"use_lime_preference"];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@
|
|||
//
|
||||
|
||||
#import "FileTransferDelegate.h"
|
||||
#import "Utils.h"
|
||||
#import "PhoneMainView.h"
|
||||
#import "LinphoneManager.h"
|
||||
#import "PhoneMainView.h"
|
||||
#import "Utils.h"
|
||||
|
||||
@interface FileTransferDelegate ()
|
||||
@property(strong) NSMutableData *data;
|
||||
|
|
@ -173,11 +173,10 @@ static LinphoneBuffer *linphone_iphone_file_transfer_send(LinphoneChatMessage *m
|
|||
|
||||
LOGI(@"%p Uploading content from message %p", self, _message);
|
||||
linphone_chat_room_send_chat_message(chatRoom, _message);
|
||||
|
||||
if(linphone_core_lime_enabled(LC) == LinphoneLimeMandatory && !linphone_chat_room_lime_available(chatRoom)) {
|
||||
|
||||
if (linphone_core_lime_enabled(LC) == LinphoneLimeMandatory && !linphone_chat_room_lime_available(chatRoom)) {
|
||||
[LinphoneManager.instance alertLIME:chatRoom];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (BOOL)download:(LinphoneChatMessage *)message {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue