From e0e99e4f25a4bc0c50b574ceae60032a8af3bf72 Mon Sep 17 00:00:00 2001 From: Ermat Date: Fri, 15 Mar 2024 14:53:53 +0600 Subject: [PATCH] Add telegram and twitter links to MainSettings module --- .../Modules/Settings/About/AboutView.swift | 14 ------ .../Main/MainSettingsViewController.swift | 43 +++++++++++++++---- 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutView.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutView.swift index ac21c35cef..28e875e515 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutView.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutView.swift @@ -85,20 +85,6 @@ struct AboutView: View { Image.disclosureIcon } - ClickableRow(action: { - let account = AppConfig.appTwitterAccount - - if let appUrl = URL(string: "twitter://user?screen_name=\(account)"), UIApplication.shared.canOpenURL(appUrl) { - UIApplication.shared.open(appUrl) - } else { - linkUrl = URL(string: "https://twitter.com/\(account)") - } - }) { - Image("twitter_24").themeIcon() - Text("Twitter").themeBody() - Image.disclosureIcon - } - ClickableRow(action: { linkUrl = URL(string: AppConfig.appWebPageLink) }) { diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsViewController.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsViewController.swift index ec9f464e8f..ecc23cd742 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsViewController.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsViewController.swift @@ -83,7 +83,7 @@ class MainSettingsViewController: ThemeViewController { languageCell.set(backgroundStyle: .lawrence, isLast: true) buildTitleValue(cell: languageCell, image: UIImage(named: "globe_24"), title: "settings.language".localized, value: viewModel.currentLanguage) - aboutCell.set(backgroundStyle: .lawrence, isFirst: true, isLast: true) + aboutCell.set(backgroundStyle: .lawrence, isFirst: true) syncAboutCell() footerCell.set(appVersion: viewModel.appVersion) @@ -330,6 +330,39 @@ class MainSettingsViewController: ThemeViewController { ] } + private var socialRows: [RowProtocol] { + [ + tableView.universalRow48( + id: "telegram", + image: .local(UIImage(named: "telegram_24")), + title: .body("Telegram"), + accessoryType: .disclosure, + autoDeselect: true, + isFirst: true, + action: { + UrlManager.open(url: "https://t.me/\(AppConfig.appTelegramAccount)") + } + ), + tableView.universalRow48( + id: "twitter", + image: .local(UIImage(named: "twitter_24")), + title: .body("Twitter"), + accessoryType: .disclosure, + autoDeselect: true, + isLast: true, + action: { + let account = AppConfig.appTwitterAccount + + if let appUrl = URL(string: "twitter://user?screen_name=\(account)"), UIApplication.shared.canOpenURL(appUrl) { + UIApplication.shared.open(appUrl) + } else { + UrlManager.open(url: "https://twitter.com/\(account)") + } + } + ), + ] + } + private var aboutRows: [RowProtocol] { [ StaticRow( @@ -340,18 +373,12 @@ class MainSettingsViewController: ThemeViewController { self?.navigationController?.pushViewController(AboutModule.view().toViewController(title: "settings.about_app.title".localized), animated: true) } ), - ] - } - - private var feedbackRows: [RowProtocol] { - [ tableView.universalRow48( id: "rate-us", image: .local(UIImage(named: "rate_24")), title: .body("settings.rate_us".localized), accessoryType: .disclosure, autoDeselect: true, - isFirst: true, action: { [weak self] in self?.viewModel.onTapRateApp() } @@ -464,8 +491,8 @@ extension MainSettingsViewController: SectionsDataSource { Section(id: "wallet_connect", headerState: .margin(height: .margin32), rows: walletConnectRows), Section(id: "appearance_settings", headerState: .margin(height: .margin32), rows: appearanceRows), Section(id: "knowledge", headerState: .margin(height: .margin32), rows: knowledgeRows), + Section(id: "social", headerState: .margin(height: .margin32), rows: socialRows), Section(id: "about", headerState: .margin(height: .margin32), rows: aboutRows), - Section(id: "feedback", headerState: .margin(height: .margin32), rows: feedbackRows), Section(id: "footer", headerState: .margin(height: .margin32), footerState: .margin(height: .margin32), rows: footerRows), ]