some fix for lime devices view

This commit is contained in:
Danmei Chen 2019-10-15 14:23:14 +02:00
parent 29204b253a
commit 729bd6a556
8 changed files with 56 additions and 39 deletions

View file

@ -74,8 +74,9 @@ static UICompositeViewDescription *compositeDescription = nil;
}
LinphoneParticipant *me = linphone_chat_room_get_me(_room);
[_devicesMenuEntries
addObject:[[DevicesMenuEntry alloc] initWithTitle:me number:0 isMe:TRUE]];
// not show me if there is only one device
if (bctbx_list_size(linphone_participant_get_devices(me)) > 1)
[_devicesMenuEntries addObject:[[DevicesMenuEntry alloc] initWithTitle:me number:0 isMe:TRUE]];
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[_tableView reloadData];
@ -117,14 +118,20 @@ static UICompositeViewDescription *compositeDescription = nil;
entry->myself ? cell.addressLabel.text = NSLocalizedString(@"Me", nil) : [ContactDisplay setDisplayNameLabel:cell.addressLabel forAddress:linphone_participant_get_address(entry->participant)];
cell.participant = entry->participant;
[cell update:(entry->numberOfDevices != 0)];
[cell update:(entry->numberOfDevices != 0) isMyself:entry->myself];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
DevicesMenuEntry *entry = [_devicesMenuEntries objectAtIndex:indexPath.row];
NSInteger num = (entry->numberOfDevices != 0) ? 0: bctbx_list_size(linphone_participant_get_devices(entry->participant));
NSInteger num = 0;
if (entry->numberOfDevices == 0) {
num = bctbx_list_size(linphone_participant_get_devices(entry->participant));
// not show current device
if (entry->myself)
num -= 1;
}
[_devicesMenuEntries replaceObjectAtIndex:indexPath.row withObject:[[DevicesMenuEntry alloc] initWithTitle:entry->participant number:num isMe:entry->myself]];
[_tableView reloadData];
}

View file

@ -337,7 +337,6 @@
// chat section
{
[self setInteger:linphone_core_lime_enabled(LC) forKey:@"use_lime_preference"];
[self setCString:linphone_core_get_file_transfer_server(LC) forKey:@"file_transfer_server_url_preference"];
int maxSize = linphone_core_get_max_size_for_auto_download_incoming_files(LC);
[self setObject:maxSize==0 ? @"Always" : (maxSize==-1 ? @"Nerver" : @"Customize") forKey:@"auto_download_mode"];
@ -770,9 +769,7 @@
linphone_core_set_media_encryption_mandatory(LC, [self boolForKey:@"media_encrption_mandatory_preference"]);
// 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 (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)

View file

@ -31,5 +31,5 @@
- (IBAction)onSecurityCallClick:(id)sender;
- (id)initWithIdentifier:(NSString *)identifier;
- (void)update:(BOOL)listOpen;
- (void)update:(BOOL)listOpen isMyself:(BOOL)isMyself;
@end

View file

@ -37,8 +37,23 @@
return self;
}
- (void)update:(BOOL)listOpen {
_devices = linphone_participant_get_devices(_participant);
- (void)update:(BOOL)listOpen isMyself:(BOOL)isMyself {
_devices = linphone_participant_get_devices(_participant);
if (isMyself) {
// remove my device
// TODO replaced by bctbx_list_remove_custom when server can remove device which has no app
bctbx_list_t *cur;
bctbx_list_t *elem = _devices;
while (elem != NULL) {
cur = elem;
elem = elem->next;
if ([[NSString stringWithUTF8String:linphone_participant_device_get_name(cur->data) ? :
linphone_address_as_string_uri_only(linphone_participant_device_get_address(cur->data))] isEqualToString:[[UIDevice currentDevice] name]]) {
_devices = bctbx_list_remove(_devices, cur->data);
break;
}
}
}
UIImage *image = [FastAddressBook imageForSecurityLevel:linphone_participant_get_security_level(_participant)];
if (bctbx_list_size(_devices) == 1) {
[_securityButton setImage:image forState:UIControlStateNormal];

View file

@ -596,10 +596,6 @@ void update_hash_cbs(LinphoneAccountCreator *creator, LinphoneAccountCreatorStat
[hiddenKeys addObject:@"media_encryption_preference"];
}
if (!linphone_core_lime_available(LC)) {
[hiddenKeys addObject:@"use_lime_preference"];
}
#ifndef DEBUG
[hiddenKeys addObject:@"debug_actions_group"];
[hiddenKeys addObject:@"release_button"];

View file

@ -5,9 +5,9 @@ source "https://github.com/CocoaPods/Specs.git"
def basic_pods
if ENV['PODFILE_PATH'].nil?
pod 'linphone-sdk', '4.2'
pod 'linphone-sdk/basic-frameworks', '> 4.3.0-alpha'
else
pod 'linphone-sdk', :path => ENV['PODFILE_PATH'] # loacl sdk
pod 'linphone-sdk/basic-frameworks', :path => ENV['PODFILE_PATH'] # loacl sdk
end
if not ENV['USE_CRASHLYTHICS'].nil?

View file

@ -98,6 +98,30 @@
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>DefaultValue</key>
<string>None</string>
<key>Key</key>
<string>media_encryption_preference</string>
<key>Title</key>
<string>Media Encryption</string>
<key>Titles</key>
<array>
<string>None</string>
<string>SRTP</string>
<string>ZRTP</string>
<string>DTLS</string>
</array>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
<key>Values</key>
<array>
<string>None</string>
<string>SRTP</string>
<string>ZRTP</string>
<string>DTLS</string>
</array>
</dict>
<dict>
<key>DefaultValue</key>
<false/>

View file

@ -40,28 +40,6 @@
<key>IASKTextAlignment</key>
<string>IASKUITextAlignmentRight</string>
</dict>
<dict>
<key>DefaultValue</key>
<string>0</string>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
<key>Titles</key>
<array>
<string>Disabled</string>
<string>Preferred</string>
<string>Mandatory</string>
</array>
<key>Values</key>
<array>
<integer>0</integer>
<integer>2</integer>
<integer>1</integer>
</array>
<key>Title</key>
<string>Encrypt messages with LIME</string>
<key>Key</key>
<string>use_lime_preference</string>
</dict>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>