Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ios : Activer les sondages (#880) #881

Merged
merged 3 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 21 additions & 24 deletions Riot/Modules/Room/RoomCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ final class RoomCoordinator: NSObject, RoomCoordinatorProtocol {

self.roomViewController.parentSpaceId = parameters.parentSpaceId

// Tchap: Disable Polls
// TimelinePollProvider.shared.session = parameters.session
TimelinePollProvider.shared.session = parameters.session
VoiceBroadcastPlaybackProvider.shared.session = parameters.session
VoiceBroadcastRecorderProvider.shared.session = parameters.session

Expand Down Expand Up @@ -478,23 +477,22 @@ final class RoomCoordinator: NSObject, RoomCoordinatorProtocol {
// }

private func startEditPollCoordinator(startEvent: MXEvent? = nil) {
// Tchap: Feature unavailable
// let parameters = PollEditFormCoordinatorParameters(room: roomViewController.roomDataSource.room, pollStartEvent: startEvent)
// let coordinator = PollEditFormCoordinator(parameters: parameters)
//
// coordinator.completion = { [weak self, weak coordinator] in
// guard let self = self, let coordinator = coordinator else {
// return
// }
//
// self.navigationRouter?.dismissModule(animated: true, completion: nil)
// self.remove(childCoordinator: coordinator)
// }
//
// add(childCoordinator: coordinator)
//
// navigationRouter?.present(coordinator, animated: true)
// coordinator.start()
let parameters = PollEditFormCoordinatorParameters(room: roomViewController.roomDataSource.room, pollStartEvent: startEvent)
let coordinator = PollEditFormCoordinator(parameters: parameters)

coordinator.completion = { [weak self, weak coordinator] in
guard let self = self, let coordinator = coordinator else {
return
}

self.navigationRouter?.dismissModule(animated: true, completion: nil)
self.remove(childCoordinator: coordinator)
}

add(childCoordinator: coordinator)

navigationRouter?.present(coordinator, animated: true)
coordinator.start()
}

private func startLoading() {
Expand Down Expand Up @@ -650,20 +648,19 @@ extension RoomCoordinator: RoomViewControllerDelegate {
}

func roomViewController(_ roomViewController: RoomViewController, canEndPollWithEventIdentifier eventIdentifier: String) -> Bool {
return /*TimelinePollProvider.shared.timelinePollCoordinatorForEventIdentifier(eventIdentifier)?.canEndPoll() ??*/ false
return TimelinePollProvider.shared.timelinePollCoordinatorForEventIdentifier(eventIdentifier)?.canEndPoll() ?? false
}

func roomViewController(_ roomViewController: RoomViewController, endPollWithEventIdentifier eventIdentifier: String) {
// Tchap: Disable polls
// TimelinePollProvider.shared.timelinePollCoordinatorForEventIdentifier(eventIdentifier)?.endPoll()
TimelinePollProvider.shared.timelinePollCoordinatorForEventIdentifier(eventIdentifier)?.endPoll()
}

func roomViewController(_ roomViewController: RoomViewController, canEditPollWithEventIdentifier eventIdentifier: String) -> Bool {
return /*TimelinePollProvider.shared.timelinePollCoordinatorForEventIdentifier(eventIdentifier)?.canEditPoll() ??*/ false
return TimelinePollProvider.shared.timelinePollCoordinatorForEventIdentifier(eventIdentifier)?.canEditPoll() ?? false
}

func roomViewController(_ roomViewController: RoomViewController, didRequestEditForPollWithStart startEvent: MXEvent) {
// startEditPollCoordinator(startEvent: startEvent)
startEditPollCoordinator(startEvent: startEvent)
}

func roomViewControllerDidStartLoading(_ roomViewController: RoomViewController) {
Expand Down
66 changes: 33 additions & 33 deletions Riot/Modules/Room/RoomViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -3286,39 +3286,39 @@ - (RoomTimelineCellIdentifier)cellIdentifierForCellData:(MXKCellData*)cellData a
}
}
}
// else if (bubbleData.tag == RoomBubbleCellDataTagPoll)
// {
// if (bubbleData.isIncoming)
// {
// if (bubbleData.isPaginationFirstBubble)
// {
// cellIdentifier = RoomTimelineCellIdentifierIncomingPollWithPaginationTitle;
// }
// else if (bubbleData.shouldHideSenderInformation)
// {
// cellIdentifier = RoomTimelineCellIdentifierIncomingPollWithoutSenderInfo;
// }
// else
// {
// cellIdentifier = RoomTimelineCellIdentifierIncomingPoll;
// }
// }
// else
// {
// if (bubbleData.isPaginationFirstBubble)
// {
// cellIdentifier = RoomTimelineCellIdentifierOutgoingPollWithPaginationTitle;
// }
// else if (bubbleData.shouldHideSenderInformation)
// {
// cellIdentifier = RoomTimelineCellIdentifierOutgoingPollWithoutSenderInfo;
// }
// else
// {
// cellIdentifier = RoomTimelineCellIdentifierOutgoingPoll;
// }
// }
// }
else if (bubbleData.tag == RoomBubbleCellDataTagPoll)
{
if (bubbleData.isIncoming)
{
if (bubbleData.isPaginationFirstBubble)
{
cellIdentifier = RoomTimelineCellIdentifierIncomingPollWithPaginationTitle;
}
else if (bubbleData.shouldHideSenderInformation)
{
cellIdentifier = RoomTimelineCellIdentifierIncomingPollWithoutSenderInfo;
}
else
{
cellIdentifier = RoomTimelineCellIdentifierIncomingPoll;
}
}
else
{
if (bubbleData.isPaginationFirstBubble)
{
cellIdentifier = RoomTimelineCellIdentifierOutgoingPollWithPaginationTitle;
}
else if (bubbleData.shouldHideSenderInformation)
{
cellIdentifier = RoomTimelineCellIdentifierOutgoingPollWithoutSenderInfo;
}
else
{
cellIdentifier = RoomTimelineCellIdentifierOutgoingPoll;
}
}
}
// else if (bubbleData.tag == RoomBubbleCellDataTagLocation || bubbleData.tag == RoomBubbleCellDataTagLiveLocation)
// {
// if (bubbleData.isIncoming)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ - (void)registerVoiceMessageCellsForTableView:(UITableView*)tableView
- (void)registerPollCellsForTableView:(UITableView *)tableView
{
// // Incoming
// [tableView registerClass:PollIncomingBubbleCell.class forCellReuseIdentifier:PollIncomingBubbleCell.defaultReuseIdentifier];
// [tableView registerClass:PollIncomingWithoutSenderInfoBubbleCell.class forCellReuseIdentifier:PollIncomingWithoutSenderInfoBubbleCell.defaultReuseIdentifier];
// [tableView registerClass:PollIncomingWithPaginationTitleBubbleCell.class forCellReuseIdentifier:PollIncomingWithPaginationTitleBubbleCell.defaultReuseIdentifier];
[tableView registerClass:PollIncomingBubbleCell.class forCellReuseIdentifier:PollIncomingBubbleCell.defaultReuseIdentifier];
[tableView registerClass:PollIncomingWithoutSenderInfoBubbleCell.class forCellReuseIdentifier:PollIncomingWithoutSenderInfoBubbleCell.defaultReuseIdentifier];
[tableView registerClass:PollIncomingWithPaginationTitleBubbleCell.class forCellReuseIdentifier:PollIncomingWithPaginationTitleBubbleCell.defaultReuseIdentifier];
// // Outgoing
// [tableView registerClass:PollOutgoingWithoutSenderInfoBubbleCell.class forCellReuseIdentifier:PollOutgoingWithoutSenderInfoBubbleCell.defaultReuseIdentifier];
// [tableView registerClass:PollOutgoingWithPaginationTitleBubbleCell.class forCellReuseIdentifier:PollOutgoingWithPaginationTitleBubbleCell.defaultReuseIdentifier];
[tableView registerClass:PollOutgoingWithoutSenderInfoBubbleCell.class forCellReuseIdentifier:PollOutgoingWithoutSenderInfoBubbleCell.defaultReuseIdentifier];
[tableView registerClass:PollOutgoingWithPaginationTitleBubbleCell.class forCellReuseIdentifier:PollOutgoingWithPaginationTitleBubbleCell.defaultReuseIdentifier];
}

- (void)registerLocationCellsForTableView:(UITableView*)tableView
Expand Down Expand Up @@ -285,15 +285,15 @@ - (void)registerVoiceBroadcastRecorderCellsForTableView:(UITableView*)tableView

- (NSDictionary<NSNumber *,Class> *)pollCellsMapping
{
return @{/*
return @{
// Incoming
@(RoomTimelineCellIdentifierIncomingPoll) : PollIncomingBubbleCell.class,
@(RoomTimelineCellIdentifierIncomingPollWithoutSenderInfo) : PollIncomingWithoutSenderInfoBubbleCell.class,
@(RoomTimelineCellIdentifierIncomingPollWithPaginationTitle) : PollIncomingWithPaginationTitleBubbleCell.class,
// Outgoing
@(RoomTimelineCellIdentifierOutgoingPoll) : PollOutgoingWithoutSenderInfoBubbleCell.class,
@(RoomTimelineCellIdentifierOutgoingPollWithoutSenderInfo) : PollOutgoingWithoutSenderInfoBubbleCell.class,
@(RoomTimelineCellIdentifierOutgoingPollWithPaginationTitle) : PollOutgoingWithPaginationTitleBubbleCell.class,*/
@(RoomTimelineCellIdentifierOutgoingPollWithPaginationTitle) : PollOutgoingWithPaginationTitleBubbleCell.class,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ - (void)registerVoiceMessageCellsForTableView:(UITableView*)tableView

- (void)registerPollCellsForTableView:(UITableView*)tableView
{
// [tableView registerClass:PollPlainCell.class forCellReuseIdentifier:PollPlainCell.defaultReuseIdentifier];
// [tableView registerClass:PollWithoutSenderInfoPlainCell.class forCellReuseIdentifier:PollWithoutSenderInfoPlainCell.defaultReuseIdentifier];
// [tableView registerClass:PollWithPaginationTitlePlainCell.class forCellReuseIdentifier:PollWithPaginationTitlePlainCell.defaultReuseIdentifier];
[tableView registerClass:PollPlainCell.class forCellReuseIdentifier:PollPlainCell.defaultReuseIdentifier];
[tableView registerClass:PollWithoutSenderInfoPlainCell.class forCellReuseIdentifier:PollWithoutSenderInfoPlainCell.defaultReuseIdentifier];
[tableView registerClass:PollWithPaginationTitlePlainCell.class forCellReuseIdentifier:PollWithPaginationTitlePlainCell.defaultReuseIdentifier];
}

- (void)registerLocationCellsForTableView:(UITableView*)tableView
Expand Down Expand Up @@ -566,13 +566,13 @@ - (void)registerVoiceBroadcastRecorderCellsForTableView:(UITableView*)tableView
{
return @{
// Incoming
// @(RoomTimelineCellIdentifierIncomingPoll) : PollPlainCell.class,
// @(RoomTimelineCellIdentifierIncomingPollWithoutSenderInfo) : PollWithoutSenderInfoPlainCell.class,
// @(RoomTimelineCellIdentifierIncomingPollWithPaginationTitle) : PollWithPaginationTitlePlainCell.class,
@(RoomTimelineCellIdentifierIncomingPoll) : PollPlainCell.class,
@(RoomTimelineCellIdentifierIncomingPollWithoutSenderInfo) : PollWithoutSenderInfoPlainCell.class,
@(RoomTimelineCellIdentifierIncomingPollWithPaginationTitle) : PollWithPaginationTitlePlainCell.class,
// Outoing
// @(RoomTimelineCellIdentifierOutgoingPoll) : PollPlainCell.class,
// @(RoomTimelineCellIdentifierOutgoingPollWithoutSenderInfo) : PollWithoutSenderInfoPlainCell.class,
// @(RoomTimelineCellIdentifierOutgoingPollWithPaginationTitle) : PollWithPaginationTitlePlainCell.class
@(RoomTimelineCellIdentifierOutgoingPoll) : PollPlainCell.class,
@(RoomTimelineCellIdentifierOutgoingPollWithoutSenderInfo) : PollWithoutSenderInfoPlainCell.class,
@(RoomTimelineCellIdentifierOutgoingPollWithPaginationTitle) : PollWithPaginationTitlePlainCell.class
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct PollEditFormAnswerOptionView: View {
})
.textFieldStyle(BorderedInputFieldStyle(isEditing: focused))
Button(action: onDelete) {
Image(uiImage: Asset.Images.pollDeleteOptionIcon.image)
Image(uiImage: Asset_tchap.Images.tchapPollDeleteOptionIcon.image)
}
.accessibilityIdentifier("Delete answer option")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ private struct PollEditFormTypeButton: View {

private var selectionImage: UIImage {
if type == selectedType {
return Asset.Images.pollTypeCheckboxSelected.image
return Asset_tchap.Images.tchapPollTypeCheckboxSelected.image
} else {
return Asset.Images.pollTypeCheckboxDefault.image
return Asset_tchap.Images.tchapPollTypeCheckboxDefault.image
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct TimelinePollAnswerOptionButton: View {
VStack(alignment: .leading, spacing: 12.0) {
HStack(alignment: .top, spacing: 8.0) {
if !poll.closed {
Image(uiImage: answerOption.selected ? Asset.Images.pollCheckboxSelected.image : Asset.Images.pollCheckboxDefault.image)
Image(uiImage: answerOption.selected ? Asset_tchap.Images.tchapPollCheckboxSelected.image : Asset_tchap.Images.tchapPollCheckboxDefault.image)
}

Text(answerOption.text)
Expand All @@ -62,7 +62,7 @@ struct TimelinePollAnswerOptionButton: View {

HStack(spacing: 6) {
if poll.closed, answerOption.winner {
Image(uiImage: Asset.Images.pollWinnerIcon.image)
Image(uiImage: Asset_tchap.Images.tchapPollWinnerIcon.image)
}

if poll.shouldDiscloseResults {
Expand Down
6 changes: 6 additions & 0 deletions Tchap/Assets/Images.xcassets/Room/Polls/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "poll_checkbox_default.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "poll_checkbox_selected.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "poll_delete_icon.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "poll_delete_option_icon.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "poll_edit_icon.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading