forked from mirrors/linphone-iphone
Fix ephemeral messages on device mode
This commit is contained in:
parent
2c8a87f8bc
commit
3bed20a221
3 changed files with 7 additions and 19 deletions
|
|
@ -1636,10 +1636,9 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog
|
|||
|
||||
|
||||
-(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)))
|
||||
);
|
||||
// If ephemeral mode is DeviceManaged, then we don't need to check anything else
|
||||
return (linphone_chat_room_params_get_ephemeral_mode(linphone_chat_room_get_current_params(cr)) == LinphoneChatRoomEphemeralModeDeviceManaged)
|
||||
|| ( linphone_chat_room_has_capability(cr, LinphoneChatRoomCapabilitiesEphemeral) && 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)));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1666,7 +1665,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] && [self canAdminEphemeral:_chatRoom]) {
|
||||
if ([self canAdminEphemeral:_chatRoom]) {
|
||||
if (indexPath.row == 2) {
|
||||
EphemeralSettingsView *view = VIEW(EphemeralSettingsView);
|
||||
view.room = _chatRoom;
|
||||
|
|
@ -1680,7 +1679,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] && [self canAdminEphemeral:_chatRoom] ? 3 : 2;
|
||||
return [self canAdminEphemeral:_chatRoom] ? 3 : 2;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
|
|
@ -1694,7 +1693,8 @@ 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] && [self canAdminEphemeral:_chatRoom]) {
|
||||
|
||||
if ([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);
|
||||
|
|
|
|||
|
|
@ -346,7 +346,6 @@
|
|||
[self setInteger:maxSize forKey:@"auto_download_incoming_files_max_size"];
|
||||
[self setBool:[VFSUtil vfsEnabledWithGroupName:kLinphoneMsgNotificationAppGroupId] forKey:@"vfs_enabled_mode"];
|
||||
[self setBool:[lm lpConfigBoolForKey:@"auto_write_to_gallery_preference" withDefault:YES] forKey:@"auto_write_to_gallery_mode"];
|
||||
[self setBool:[lm lpConfigBoolForKey:@"ephemeral_feature" withDefault:NO] forKey:@"ephemeral_feature"];
|
||||
}
|
||||
|
||||
// network section
|
||||
|
|
@ -812,7 +811,6 @@
|
|||
}
|
||||
}
|
||||
[lm lpConfigSetBool:[self boolForKey:@"auto_write_to_gallery_mode"] forKey:@"auto_write_to_gallery_preference"];
|
||||
[lm lpConfigSetBool:[self boolForKey:@"ephemeral_feature"] forKey:@"ephemeral_feature"];
|
||||
|
||||
// network section
|
||||
BOOL edgeOpt = [self boolForKey:@"edge_opt_preference"];
|
||||
|
|
|
|||
|
|
@ -60,16 +60,6 @@
|
|||
<key>IASKTextAlignment</key>
|
||||
<string>IASKUITextAlignmentRight</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>DefaultValue</key>
|
||||
<false/>
|
||||
<key>Key</key>
|
||||
<string>ephemeral_feature</string>
|
||||
<key>Title</key>
|
||||
<string>Enable ephemeral messages (beta)</string>
|
||||
<key>Type</key>
|
||||
<string>PSToggleSwitchSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue