Skip to content

Commit d86af65

Browse files
committed
Add additional text to beta view
1 parent f6d63b7 commit d86af65

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

Riot/Modules/Room/RoomViewController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6851,7 +6851,8 @@ - (void)showThreadsBetaForEvent:(MXEvent *)event
68516851
}
68526852

68536853
self.threadsBetaBridgePresenter = [[ThreadsBetaCoordinatorBridgePresenter alloc] initWithThreadId:event.eventId
6854-
infoText:VectorL10n.threadsBetaInformation];
6854+
infoText:VectorL10n.threadsBetaInformation
6855+
additionalText:nil];
68556856
self.threadsBetaBridgePresenter.delegate = self;
68566857

68576858
[self.threadsBetaBridgePresenter presentFrom:self.presentedViewController?:self animated:YES];

Riot/Modules/Threads/Beta/ThreadsBetaCoordinator.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ final class ThreadsBetaCoordinator: NSObject, ThreadsBetaCoordinatorProtocol {
2727

2828
private let threadId: String
2929
private let infoText: String
30+
private let additionalText: String?
3031
private lazy var viewController: ThreadsBetaViewController = {
31-
let result = ThreadsBetaViewController.instantiate(infoText: infoText)
32+
let result = ThreadsBetaViewController.instantiate(infoText: infoText, additionalText: additionalText)
3233
result.didTapEnableButton = { [weak self] in
3334
guard let self = self else { return }
3435
RiotSettings.shared.enableThreads = true
@@ -51,9 +52,10 @@ final class ThreadsBetaCoordinator: NSObject, ThreadsBetaCoordinatorProtocol {
5152

5253
// MARK: - Setup
5354

54-
init(threadId: String, infoText: String) {
55+
init(threadId: String, infoText: String, additionalText: String?) {
5556
self.threadId = threadId
5657
self.infoText = infoText
58+
self.additionalText = additionalText
5759
}
5860

5961
// MARK: - Public

Riot/Modules/Threads/Beta/ThreadsBetaCoordinatorBridgePresenter.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ final class ThreadsBetaCoordinatorBridgePresenter: NSObject {
3939

4040
public let threadId: String
4141
public let infoText: String
42+
public let additionalText: String?
4243
private let slidingModalPresenter = SlidingModalPresenter()
4344
private var coordinator: ThreadsBetaCoordinator?
4445

@@ -48,17 +49,20 @@ final class ThreadsBetaCoordinatorBridgePresenter: NSObject {
4849

4950
// MARK: - Setup
5051

51-
init(threadId: String, infoText: String) {
52+
init(threadId: String, infoText: String, additionalText: String?) {
5253
self.threadId = threadId
5354
self.infoText = infoText
55+
self.additionalText = additionalText
5456
super.init()
5557
}
5658

5759
// MARK: - Public
5860

5961
func present(from viewController: UIViewController, animated: Bool) {
6062

61-
let threadsBetaCoordinator = ThreadsBetaCoordinator(threadId: threadId, infoText: infoText)
63+
let threadsBetaCoordinator = ThreadsBetaCoordinator(threadId: threadId,
64+
infoText: infoText,
65+
additionalText: additionalText)
6266
threadsBetaCoordinator.delegate = self
6367
guard let presentable = threadsBetaCoordinator.toPresentable() as? SlidingModalPresentable.ViewControllerType else {
6468
MXLog.error("[ThreadsBetaCoordinatorBridgePresenter] Presentable is not 'SlidingModalPresentable'")

Riot/Modules/Threads/Beta/ThreadsBetaViewController.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class ThreadsBetaViewController: UIViewController {
4040

4141
private var theme: Theme!
4242
private var infoText: String!
43+
private var additionalText: String?
4344

4445
// MARK: Public
4546

@@ -70,10 +71,11 @@ class ThreadsBetaViewController: UIViewController {
7071

7172
// MARK: - Setup
7273

73-
@objc class func instantiate(infoText: String) -> ThreadsBetaViewController {
74+
@objc class func instantiate(infoText: String, additionalText: String?) -> ThreadsBetaViewController {
7475
let viewController = StoryboardScene.ThreadsBetaViewController.initialScene.instantiate()
7576
viewController.theme = ThemeService.shared().theme
7677
viewController.infoText = infoText
78+
viewController.additionalText = additionalText
7779
return viewController
7880
}
7981

@@ -106,6 +108,11 @@ class ThreadsBetaViewController: UIViewController {
106108
attributes: [.link: Constants.learnMoreLink,
107109
.font: font])
108110
attributedString.append(link)
111+
112+
if let additionalText = additionalText {
113+
attributedString.append(NSAttributedString(string: additionalText,
114+
attributes: [.font: font]))
115+
}
109116
self.informationTextView.attributedText = attributedString
110117
}
111118

0 commit comments

Comments
 (0)