Get information text as a parameter in threads beta view

This commit is contained in:
ismailgulek
2022-04-19 13:10:17 +03:00
parent d019a0550b
commit 4b8a48ffdc
4 changed files with 14 additions and 7 deletions
@@ -26,8 +26,9 @@ final class ThreadsBetaCoordinator: NSObject, ThreadsBetaCoordinatorProtocol {
// MARK: Private
private let threadId: String
private let infoText: String
private lazy var viewController: ThreadsBetaViewController = {
let result = ThreadsBetaViewController.instantiate()
let result = ThreadsBetaViewController.instantiate(infoText: infoText)
result.didTapEnableButton = { [weak self] in
guard let self = self else { return }
RiotSettings.shared.enableThreads = true
@@ -50,8 +51,9 @@ final class ThreadsBetaCoordinator: NSObject, ThreadsBetaCoordinatorProtocol {
// MARK: - Setup
init(threadId: String) {
init(threadId: String, infoText: String) {
self.threadId = threadId
self.infoText = infoText
}
// MARK: - Public
@@ -38,6 +38,7 @@ final class ThreadsBetaCoordinatorBridgePresenter: NSObject {
// MARK: Private
public let threadId: String
public let infoText: String
private let slidingModalPresenter = SlidingModalPresenter()
private var coordinator: ThreadsBetaCoordinator?
@@ -47,8 +48,9 @@ final class ThreadsBetaCoordinatorBridgePresenter: NSObject {
// MARK: - Setup
init(threadId: String) {
init(threadId: String, infoText: String) {
self.threadId = threadId
self.infoText = infoText
super.init()
}
@@ -56,7 +58,7 @@ final class ThreadsBetaCoordinatorBridgePresenter: NSObject {
func present(from viewController: UIViewController, animated: Bool) {
let threadsBetaCoordinator = ThreadsBetaCoordinator(threadId: threadId)
let threadsBetaCoordinator = ThreadsBetaCoordinator(threadId: threadId, infoText: infoText)
threadsBetaCoordinator.delegate = self
guard let presentable = threadsBetaCoordinator.toPresentable() as? SlidingModalPresentable.ViewControllerType else {
MXLog.error("[ThreadsBetaCoordinatorBridgePresenter] Presentable is not 'SlidingModalPresentable'")
@@ -39,6 +39,7 @@ class ThreadsBetaViewController: UIViewController {
// MARK: Private
private var theme: Theme!
private var infoText: String!
// MARK: Public
@@ -69,9 +70,10 @@ class ThreadsBetaViewController: UIViewController {
// MARK: - Setup
@objc class func instantiate() -> ThreadsBetaViewController {
@objc class func instantiate(infoText: String) -> ThreadsBetaViewController {
let viewController = StoryboardScene.ThreadsBetaViewController.initialScene.instantiate()
viewController.theme = ThemeService.shared().theme
viewController.infoText = infoText
return viewController
}
@@ -98,7 +100,7 @@ class ThreadsBetaViewController: UIViewController {
guard let font = self.informationTextView.font else {
return
}
let attributedString = NSMutableAttributedString(string: VectorL10n.threadsBetaInformation,
let attributedString = NSMutableAttributedString(string: infoText,
attributes: [.font: font])
let link = NSAttributedString(string: VectorL10n.threadsBetaInformationLink,
attributes: [.link: Constants.learnMoreLink,