Skip to content

Commit f6d63b7

Browse files
committed
Get information text as a parameter in threads beta view
1 parent c6c2596 commit f6d63b7

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

Riot/Modules/Room/RoomViewController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6850,7 +6850,8 @@ - (void)showThreadsBetaForEvent:(MXEvent *)event
68506850
self.threadsBetaBridgePresenter = nil;
68516851
}
68526852

6853-
self.threadsBetaBridgePresenter = [[ThreadsBetaCoordinatorBridgePresenter alloc] initWithThreadId:event.eventId];
6853+
self.threadsBetaBridgePresenter = [[ThreadsBetaCoordinatorBridgePresenter alloc] initWithThreadId:event.eventId
6854+
infoText:VectorL10n.threadsBetaInformation];
68546855
self.threadsBetaBridgePresenter.delegate = self;
68556856

68566857
[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
@@ -26,8 +26,9 @@ final class ThreadsBetaCoordinator: NSObject, ThreadsBetaCoordinatorProtocol {
2626
// MARK: Private
2727

2828
private let threadId: String
29+
private let infoText: String
2930
private lazy var viewController: ThreadsBetaViewController = {
30-
let result = ThreadsBetaViewController.instantiate()
31+
let result = ThreadsBetaViewController.instantiate(infoText: infoText)
3132
result.didTapEnableButton = { [weak self] in
3233
guard let self = self else { return }
3334
RiotSettings.shared.enableThreads = true
@@ -50,8 +51,9 @@ final class ThreadsBetaCoordinator: NSObject, ThreadsBetaCoordinatorProtocol {
5051

5152
// MARK: - Setup
5253

53-
init(threadId: String) {
54+
init(threadId: String, infoText: String) {
5455
self.threadId = threadId
56+
self.infoText = infoText
5557
}
5658

5759
// MARK: - Public

Riot/Modules/Threads/Beta/ThreadsBetaCoordinatorBridgePresenter.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ final class ThreadsBetaCoordinatorBridgePresenter: NSObject {
3838
// MARK: Private
3939

4040
public let threadId: String
41+
public let infoText: String
4142
private let slidingModalPresenter = SlidingModalPresenter()
4243
private var coordinator: ThreadsBetaCoordinator?
4344

@@ -47,16 +48,17 @@ final class ThreadsBetaCoordinatorBridgePresenter: NSObject {
4748

4849
// MARK: - Setup
4950

50-
init(threadId: String) {
51+
init(threadId: String, infoText: String) {
5152
self.threadId = threadId
53+
self.infoText = infoText
5254
super.init()
5355
}
5456

5557
// MARK: - Public
5658

5759
func present(from viewController: UIViewController, animated: Bool) {
5860

59-
let threadsBetaCoordinator = ThreadsBetaCoordinator(threadId: threadId)
61+
let threadsBetaCoordinator = ThreadsBetaCoordinator(threadId: threadId, infoText: infoText)
6062
threadsBetaCoordinator.delegate = self
6163
guard let presentable = threadsBetaCoordinator.toPresentable() as? SlidingModalPresentable.ViewControllerType else {
6264
MXLog.error("[ThreadsBetaCoordinatorBridgePresenter] Presentable is not 'SlidingModalPresentable'")

Riot/Modules/Threads/Beta/ThreadsBetaViewController.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class ThreadsBetaViewController: UIViewController {
3939
// MARK: Private
4040

4141
private var theme: Theme!
42+
private var infoText: String!
4243

4344
// MARK: Public
4445

@@ -69,9 +70,10 @@ class ThreadsBetaViewController: UIViewController {
6970

7071
// MARK: - Setup
7172

72-
@objc class func instantiate() -> ThreadsBetaViewController {
73+
@objc class func instantiate(infoText: String) -> ThreadsBetaViewController {
7374
let viewController = StoryboardScene.ThreadsBetaViewController.initialScene.instantiate()
7475
viewController.theme = ThemeService.shared().theme
76+
viewController.infoText = infoText
7577
return viewController
7678
}
7779

@@ -98,7 +100,7 @@ class ThreadsBetaViewController: UIViewController {
98100
guard let font = self.informationTextView.font else {
99101
return
100102
}
101-
let attributedString = NSMutableAttributedString(string: VectorL10n.threadsBetaInformation,
103+
let attributedString = NSMutableAttributedString(string: infoText,
102104
attributes: [.font: font])
103105
let link = NSAttributedString(string: VectorL10n.threadsBetaInformationLink,
104106
attributes: [.link: Constants.learnMoreLink,

0 commit comments

Comments
 (0)