mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Ephemeral messages in session mode
This commit is contained in:
parent
ea03700aba
commit
bb1d160373
2 changed files with 14 additions and 4 deletions
|
|
@ -1628,6 +1628,13 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog
|
|||
// Popup menu
|
||||
|
||||
|
||||
-(BOOL) canAdminEphemeral:(LinphoneChatRoom *)cr {
|
||||
return linphone_chat_room_has_capability(cr, LinphoneChatRoomCapabilitiesEphemeral) && (
|
||||
(linphone_chat_room_params_get_ephemeral_mode(linphone_chat_room_get_current_params(cr)) == LinphoneChatRoomEphemeralModeDeviceManaged) ||
|
||||
(linphone_chat_room_params_get_ephemeral_mode(linphone_chat_room_get_current_params(cr)) == LinphoneChatRoomEphemeralModeAdminManaged && linphone_participant_is_admin(linphone_chat_room_get_me(cr)))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
- (void) setupPopupMenu {
|
||||
_popupMenu.dataSource = self;
|
||||
|
|
@ -1652,7 +1659,7 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog
|
|||
[_tableController onEditClick:nil];
|
||||
[self onEditionChangeClick:nil];
|
||||
}
|
||||
if ([ConfigManager.instance lpConfigBoolForKeyWithKey:@"ephemeral_feature" defaultValue:false]) {
|
||||
if ([ConfigManager.instance lpConfigBoolForKeyWithKey:@"ephemeral_feature" defaultValue:false] && [self canAdminEphemeral:_chatRoom]) {
|
||||
if (indexPath.row == 2) {
|
||||
EphemeralSettingsView *view = VIEW(EphemeralSettingsView);
|
||||
view.room = _chatRoom;
|
||||
|
|
@ -1666,7 +1673,7 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog
|
|||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return [ConfigManager.instance lpConfigBoolForKeyWithKey:@"ephemeral_feature" defaultValue:false] ? 3 : 2;
|
||||
return [ConfigManager.instance lpConfigBoolForKeyWithKey:@"ephemeral_feature" defaultValue:false] && [self canAdminEphemeral:_chatRoom] ? 3 : 2;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
|
|
@ -1680,7 +1687,7 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog
|
|||
cell.imageView.image = [LinphoneUtils resizeImage:[UIImage imageNamed:@"delete_default.png"] newSize:CGSizeMake(20, 25)];
|
||||
cell.textLabel.text = NSLocalizedString(@"Delete messages",nil);
|
||||
}
|
||||
if ([ConfigManager.instance lpConfigBoolForKeyWithKey:@"ephemeral_feature" defaultValue:false]) {
|
||||
if ([ConfigManager.instance lpConfigBoolForKeyWithKey:@"ephemeral_feature" defaultValue:false] && [self canAdminEphemeral:_chatRoom]) {
|
||||
if (indexPath.row == 2) {
|
||||
cell.imageView.image = [LinphoneUtils resizeImage:[UIImage imageNamed:@"ephemeral_messages_default.png"] newSize:CGSizeMake(20, 25)];
|
||||
cell.textLabel.text = NSLocalizedString(@"Ephemeral messages",nil);
|
||||
|
|
|
|||
|
|
@ -884,7 +884,10 @@ static RootViewManager *rootViewManagerInstance = nil;
|
|||
LinphoneChatRoomParams *param = linphone_core_create_default_chat_room_params(LC);
|
||||
linphone_chat_room_params_enable_group(param, isGroup);
|
||||
linphone_chat_room_params_enable_encryption(param, isEncrypted);
|
||||
|
||||
linphone_chat_room_params_set_ephemeral_mode(param,[LinphoneManager.instance lpConfigBoolForKey:@"ephemeral_chat_messages_settings_per_device" withDefault:true] ?
|
||||
LinphoneChatRoomEphemeralModeDeviceManaged :
|
||||
LinphoneChatRoomEphemeralModeAdminManaged);
|
||||
linphone_chat_room_params_set_ephemeral_lifetime(param,0);
|
||||
LinphoneChatRoom *room = linphone_core_create_chat_room_2(LC, param, subject ?: LINPHONE_DUMMY_SUBJECT, addresses);
|
||||
|
||||
if (!room) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue