Add "Confirm image size before sending" setting.

Use this when sending images.
This commit is contained in:
Doug
2021-07-28 14:14:34 +01:00
parent 814145050d
commit abd1bd2a41
7 changed files with 67 additions and 7 deletions

View File

@@ -51,6 +51,7 @@ enum
{
SECTION_TAG_SIGN_OUT = 0,
SECTION_TAG_USER_SETTINGS,
SECTION_TAG_MEDIA,
SECTION_TAG_SECURITY,
SECTION_TAG_NOTIFICATIONS,
SECTION_TAG_CALLS,
@@ -86,6 +87,11 @@ enum
USER_SETTINGS_PHONENUMBERS_OFFSET = 1000
};
enum
{
MEDIA_SETTINGS_CONFIRM_IMAGE_SIZE = 0
};
enum
{
NOTIFICATION_SETTINGS_ENABLE_PUSH_INDEX = 0,
@@ -344,6 +350,14 @@ TableViewSectionsDelegate>
sectionUserSettings.headerTitle = NSLocalizedStringFromTable(@"settings_user_settings", @"Vector", nil);
[tmpSections addObject:sectionUserSettings];
if (BuildSettings.settingsScreenShowConfirmImageSize)
{
Section *sectionMedia = [Section sectionWithTag:SECTION_TAG_MEDIA];
[sectionMedia addRowWithTag:MEDIA_SETTINGS_CONFIRM_IMAGE_SIZE];
sectionMedia.headerTitle = NSLocalizedStringFromTable(@"settings_media", @"Vector", nil);
[tmpSections addObject:sectionMedia];
}
Section *sectionSecurity = [Section sectionWithTag:SECTION_TAG_SECURITY];
[sectionSecurity addRowWithTag:SECURITY_BUTTON_INDEX];
sectionSecurity.headerTitle = NSLocalizedStringFromTable(@"settings_security", @"Vector", nil);
@@ -1784,6 +1798,21 @@ TableViewSectionsDelegate>
cell = passwordCell;
}
}
else if (section == SECTION_TAG_MEDIA)
{
if (row == MEDIA_SETTINGS_CONFIRM_IMAGE_SIZE)
{
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
labelAndSwitchCell.mxkLabel.text = NSLocalizedStringFromTable(@"settings_confirm_image_size", @"Vector", nil);
labelAndSwitchCell.mxkSwitch.on = RiotSettings.shared.roomInputToolbarCompressionMode == MXKRoomInputToolbarCompressionModePrompt;
labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor;
labelAndSwitchCell.mxkSwitch.enabled = YES;
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleConfirmImageSize:) forControlEvents:UIControlEventTouchUpInside];
cell = labelAndSwitchCell;
}
}
else if (section == SECTION_TAG_NOTIFICATIONS)
{
if (row == NOTIFICATION_SETTINGS_ENABLE_PUSH_INDEX)
@@ -2802,6 +2831,11 @@ TableViewSectionsDelegate>
}
}
- (void)toggleConfirmImageSize:(UISwitch *)sender
{
RiotSettings.shared.roomInputToolbarCompressionMode = sender.on ? MXKRoomInputToolbarCompressionModePrompt : MXKRoomInputToolbarCompressionModeNone;
}
- (void)togglePushNotifications:(UISwitch *)sender
{
// Check first whether the user allow notification from device settings