Skip to content

Commit

Permalink
/issues/5114 - De-labs-ed polls, disabled editing and undisclosed pol…
Browse files Browse the repository at this point in the history
…ls until platform parity.
  • Loading branch information
stefanceriu committed Jan 18, 2022
1 parent f1103d1 commit fc397d4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 33 deletions.
5 changes: 1 addition & 4 deletions Riot/Managers/Settings/RiotSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,7 @@ final class RiotSettings: NSObject {

@UserDefault(key: "roomScreenAllowFilesAction", defaultValue: BuildSettings.roomScreenAllowFilesAction, storage: defaults)
var roomScreenAllowFilesAction

@UserDefault(key: "roomScreenAllowPollsAction", defaultValue: false, storage: defaults)
var roomScreenAllowPollsAction


@UserDefault(key: "roomScreenAllowLocationAction", defaultValue: false, storage: defaults)
var roomScreenAllowLocationAction

Expand Down
2 changes: 1 addition & 1 deletion Riot/Modules/Room/RoomViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -2026,7 +2026,7 @@ - (void)setupActions {
[self roomInputToolbarViewDidTapFileUpload];
}]];
}
if (RiotSettings.shared.roomScreenAllowPollsAction)
if (BuildSettings.pollsEnabled)
{
[actionItems addObject:[[RoomActionItem alloc] initWithImage:[UIImage imageNamed:@"action_poll"] andAction:^{
MXStrongifyAndReturnIfNil(self);
Expand Down
22 changes: 1 addition & 21 deletions Riot/Modules/Settings/SettingsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ typedef NS_ENUM(NSUInteger, ABOUT)

typedef NS_ENUM(NSUInteger, LABS_ENABLE)
{
LABS_ENABLE_RINGING_FOR_GROUP_CALLS_INDEX,
LABS_ENABLE_POLLS
LABS_ENABLE_RINGING_FOR_GROUP_CALLS_INDEX
};

typedef NS_ENUM(NSUInteger, SECURITY)
Expand Down Expand Up @@ -579,7 +578,6 @@ - (void)updateSections
{
Section *sectionLabs = [Section sectionWithTag:SECTION_TAG_LABS];
[sectionLabs addRowWithTag:LABS_ENABLE_RINGING_FOR_GROUP_CALLS_INDEX];
[sectionLabs addRowWithTag:LABS_ENABLE_POLLS];

sectionLabs.headerTitle = [VectorL10n settingsLabs];
if (sectionLabs.hasAnyRows)
Expand Down Expand Up @@ -2464,19 +2462,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N

cell = labelAndSwitchCell;
}

if (row == LABS_ENABLE_POLLS && BuildSettings.pollsEnabled)
{
MXKTableViewCellWithLabelAndSwitch *labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];

labelAndSwitchCell.mxkLabel.text = [VectorL10n settingsLabsEnabledPolls];
labelAndSwitchCell.mxkSwitch.on = RiotSettings.shared.roomScreenAllowPollsAction;
labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor;

[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleEnablePolls:) forControlEvents:UIControlEventValueChanged];

cell = labelAndSwitchCell;
}
}
else if (section == SECTION_TAG_FLAIR)
{
Expand Down Expand Up @@ -3209,11 +3194,6 @@ - (void)toggleEnableRingingForGroupCalls:(UISwitch *)sender
RiotSettings.shared.enableRingingForGroupCalls = sender.isOn;
}

- (void)toggleEnablePolls:(UISwitch *)sender
{
RiotSettings.shared.roomScreenAllowPollsAction = sender.isOn;
}

- (void)togglePinRoomsWithMissedNotif:(UISwitch *)sender
{
RiotSettings.shared.pinRoomsWithMissedNotificationsOnHome = sender.isOn;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ class PollEditFormViewModel: PollEditFormViewModelType {

private func buildPollDetails() -> EditFormPollDetails {
return EditFormPollDetails(type: state.bindings.type,
question: state.bindings.question.text.trimmingCharacters(in: .whitespacesAndNewlines),
answerOptions: state.bindings.answerOptions.compactMap({ answerOption in
let text = answerOption.text.trimmingCharacters(in: .whitespacesAndNewlines)
return text.isEmpty ? nil : text
}))
question: state.bindings.question.text.trimmingCharacters(in: .whitespacesAndNewlines),
answerOptions: state.bindings.answerOptions.compactMap({ answerOption in
let text = answerOption.text.trimmingCharacters(in: .whitespacesAndNewlines)
return text.isEmpty ? nil : text
}))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ struct PollEditForm: View {
ScrollView {
VStack(alignment: .leading, spacing: 32.0) {

PollEditFormTypePicker(selectedType: $viewModel.type)
// Intentionally disabled until platform parity.
// PollEditFormTypePicker(selectedType: $viewModel.type)

VStack(alignment: .leading, spacing: 16.0) {
Text(VectorL10n.pollEditFormPollQuestionOrTopic)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ final class TimelinePollCoordinator: Coordinator, Presentable, PollAggregatorDel
}

func canEditPoll() -> Bool {
return pollAggregator.poll.isClosed == false && pollAggregator.poll.totalAnswerCount == 0
return false // Intentionally disabled until platform parity.
// return pollAggregator.poll.isClosed == false && pollAggregator.poll.totalAnswerCount == 0
}

func endPoll() {
Expand Down

0 comments on commit fc397d4

Please sign in to comment.