Skip to content

Commit

Permalink
Add telegram and twitter links to MainSettings module
Browse files Browse the repository at this point in the history
  • Loading branch information
ealymbaev committed Mar 15, 2024
1 parent d589cba commit e0e99e4
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand All @@ -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()
}
Expand Down Expand Up @@ -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),
]

Expand Down

0 comments on commit e0e99e4

Please sign in to comment.