Skip to content
This repository has been archived by the owner on Jun 7, 2020. It is now read-only.

[NEW] Add sharing & reviewing to preferences #2350

Merged
merged 5 commits into from
Nov 23, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,18 @@ final class PreferencesViewController: BaseTableViewController {
}
}

@IBOutlet weak var labelReview: UILabel! {
didSet {
labelReview.text = viewModel.review
}
}

@IBOutlet weak var labelShare: UILabel! {
didSet {
labelShare.text = viewModel.share
}
}

@IBOutlet weak var labelApp: UILabel! {
didSet {
labelApp.text = viewModel.appicon
Expand Down Expand Up @@ -132,6 +144,8 @@ final class PreferencesViewController: BaseTableViewController {
return super.navigationController as? PreferencesNavigationController
}

weak var shareAppCell: UITableViewCell?

override func viewDidLoad() {
super.viewDidLoad()
title = viewModel.title
Expand Down Expand Up @@ -222,24 +236,56 @@ final class PreferencesViewController: BaseTableViewController {
}
}

private func cellAppIconDidPressed() {
performSegue(withIdentifier: "AppIcon", sender: nil)
}

private func cellLanguageDidPressed() {
performSegue(withIdentifier: "Language", sender: nil)
}

private func cellReviewDidPressed() {
guard let url = viewModel.reviewURL else {
return
}

UIApplication.shared.open(url, options: [:], completionHandler: nil)
}

private func cellShareDidPressed() {
guard let url = viewModel.shareURL else {
return
}

let controller = UIActivityViewController(activityItems: [url], applicationActivities: nil)

if let cell = shareAppCell, UIDevice.current.userInterfaceIdiom == .pad {
controller.modalPresentationStyle = .popover
controller.popoverPresentationController?.sourceView = shareAppCell
controller.popoverPresentationController?.sourceRect = cell.bounds
}

present(controller, animated: true, completion: nil)
}

private func cellAppIconDidPressed() {
performSegue(withIdentifier: "AppIcon", sender: nil)
}

// MARK: UITableViewDelegate

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.section == kSectionSettings {
if indexPath.row == 0 {
switch indexPath.row {
case 0:
cellContactDidPressed()
} else if indexPath.row == 1 {
case 1:
cellLanguageDidPressed()
} else if indexPath.row == 4 {
case 4:
cellReviewDidPressed()
case 5:
shareAppCell = tableView.cellForRow(at: indexPath)
cellShareDidPressed()
case 6:
cellAppIconDidPressed()
default:
break
}
} else if indexPath.section == kSectionInformation {
if indexPath.row == 0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ final class PreferencesViewModel {
internal let contactus = localized("myaccount.settings.contactus")
internal let license = localized("myaccount.settings.license")
internal let language = localized("myaccount.settings.language")
internal let appicon = localized("myaccount.settings.appicon")
internal let webBrowser = localized("myaccount.settings.web_browser")
internal let appicon = localized("myaccount.settings.appicon")
internal let review = localized("myaccount.settings.review")
internal let share = localized("myaccount.settings.share")
internal let theme = localized("theme.settings.title")

internal let licenseURL = URL(string: "https://github.com/RocketChat/Rocket.Chat.iOS/blob/develop/LICENSE")
internal let shareURL = URL(string: "https://itunes.apple.com/app/rocket-chat/id1148741252?ls=1&mt=8")
internal let reviewURL = URL(string: "itms-apps://itunes.apple.com/app/id1148741252?action=write-review&mt=8")

internal let trackingTitle = localized("myaccount.settings.tracking.title")
internal var trackingFooterText = localized("myaccount.settings.tracking.footer")
Expand Down Expand Up @@ -134,7 +138,7 @@ final class PreferencesViewModel {
internal func numberOfRowsInSection(_ section: Int) -> Int {
switch section {
case 0: return 1
case 1: return canChangeAppIcon ? 5 : 4
case 1: return canChangeAppIcon ? 7 : 6
case 2: return canViewAdministrationPanel ? 1 : 0
case 3: return 3
case 4: return 1
Expand Down
4 changes: 3 additions & 1 deletion Rocket.Chat/Resources/cs.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,14 @@
"myaccount.settings.profile" = "Profile"; // TODO
"myaccount.settings.license" = "License"; // TODO
"myaccount.settings.language" = "Language"; // TODO
"myaccount.settings.review" = "Review this App"; // TODO
"myaccount.settings.share" = "Share this App"; // TODO
"myaccount.settings.appicon" = "Application Icon"; // TODO
"myaccount.settings.version" = "Version: %@ (%@)"; // TODO
"myaccount.settings.server_version" = "Server Version: %@"; // TODO
"myaccount.settings.web_browser" = "Web Browser"; // TODO
"myaccount.settings.tracking.title" = "Send Crash Report"; // TODO
"myaccount.settings.tracking.footer" = "We never track the content of your chats. The crash report only contains relevant information for us in order to identifiy problems and fix it."; // TODO
"myaccount.settings.tracking.footer" = "We never track the content of your chats. The crash report only contains relevant information for us in order to identify problems and fix it."; // TODO

// Change Application Icon
"myaccount.settings.changeicon.title" = "Choose an icon"; // TODO:
Expand Down
2 changes: 2 additions & 0 deletions Rocket.Chat/Resources/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@
"myaccount.settings.profile" = "Profil";
"myaccount.settings.license" = "Lizenz";
"myaccount.settings.language" = "Sprache";
"myaccount.settings.review" = "Review this App"; // TODO
"myaccount.settings.share" = "Share this App"; // TODO
"myaccount.settings.appicon" = "App Icon";
"myaccount.settings.version" = "Version: %@ (%@)";
"myaccount.settings.server_version" = "Server Version: %@";
Expand Down
2 changes: 2 additions & 0 deletions Rocket.Chat/Resources/el.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@
"myaccount.settings.profile" = "Λογαριασμός";
"myaccount.settings.license" = "Άδεια";
"myaccount.settings.language" = "Language";
"myaccount.settings.review" = "Review this App"; // TODO
"myaccount.settings.share" = "Share this App"; // TODO
"myaccount.settings.appicon" = "Εικονίδιο Εφαρμογής";
"myaccount.settings.version" = "Έκδοση: %@ (%@)";
"myaccount.settings.server_version" = "Έκδοση Εξυπηρετητή: %@";
Expand Down
4 changes: 3 additions & 1 deletion Rocket.Chat/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,13 @@
"myaccount.settings.license" = "License";
"myaccount.settings.language" = "Language";
"myaccount.settings.appicon" = "Application Icon";
"myaccount.settings.review" = "Review this App";
"myaccount.settings.share" = "Share this App";
"myaccount.settings.version" = "Version: %@ (%@)";
"myaccount.settings.server_version" = "Server Version: %@";
"myaccount.settings.web_browser" = "Web Browser";
"myaccount.settings.tracking.title" = "Send Crash Report";
"myaccount.settings.tracking.footer" = "We never track the content of your chats. The crash report only contains relevant information for us in order to identifiy problems and fix it.";
"myaccount.settings.tracking.footer" = "We never track the content of your chats. The crash report only contains relevant information for us in order to identify problems and fix it.";

// Change Application Icon
"myaccount.settings.changeicon.title" = "Choose an icon";
Expand Down
4 changes: 3 additions & 1 deletion Rocket.Chat/Resources/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,14 @@
"myaccount.settings.profile" = "Perfil";
"myaccount.settings.license" = "Licencia";
"myaccount.settings.language" = "Idioma";
"myaccount.settings.review" = "Review this App"; // TODO
"myaccount.settings.share" = "Share this App"; // TODO
"myaccount.settings.appicon" = "Icono de aplicación";
"myaccount.settings.version" = "Versión: %@ (%@)";
"myaccount.settings.server_version" = "Server Version: %@"; // TODO
"myaccount.settings.web_browser" = "Web Browser"; // TODO
"myaccount.settings.tracking.title" = "Send Crash Report"; // TODO
"myaccount.settings.tracking.footer" = "We never track the content of your chats. The crash report only contains relevant information for us in order to identifiy problems and fix it."; // TODO
"myaccount.settings.tracking.footer" = "We never track the content of your chats. The crash report only contains relevant information for us in order to identify problems and fix it."; // TODO

// Change Application Icon
"myaccount.settings.changeicon.title" = "Elige un icono";
Expand Down
2 changes: 2 additions & 0 deletions Rocket.Chat/Resources/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@
"myaccount.settings.profile" = "Profil";
"myaccount.settings.license" = "Licence";
"myaccount.settings.language" = "Langue";
"myaccount.settings.review" = "Review this App"; // TODO
"myaccount.settings.share" = "Share this App"; // TODO
"myaccount.settings.appicon" = "Icône de l'application";
"myaccount.settings.version" = "Version : %@ (%@)";
"myaccount.settings.server_version" = "Version du serveur: %@";
Expand Down
2 changes: 2 additions & 0 deletions Rocket.Chat/Resources/it.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@
"myaccount.settings.profile" = "Profilo";
"myaccount.settings.license" = "Licenza";
"myaccount.settings.language" = "Lingua";
"myaccount.settings.review" = "Review this App"; // TODO
"myaccount.settings.share" = "Share this App"; // TODO
"myaccount.settings.appicon" = "Icona Applicazione";
"myaccount.settings.version" = "Versione: %@ (%@)";
"myaccount.settings.server_version" = "Versione Server: %@";
Expand Down
2 changes: 2 additions & 0 deletions Rocket.Chat/Resources/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@
"myaccount.settings.profile" = "プロフィール";
"myaccount.settings.license" = "ライセンス";
"myaccount.settings.language" = "言語";
"myaccount.settings.review" = "Review this App"; // TODO
"myaccount.settings.share" = "Share this App"; // TODO
"myaccount.settings.appicon" = "アプリケーションアイコン";
"myaccount.settings.version" = "バージョン: %@ (%@)";
"myaccount.settings.server_version" = "サーバーのバージョン: %@";
Expand Down
2 changes: 2 additions & 0 deletions Rocket.Chat/Resources/pl.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@
"myaccount.settings.profile" = "Profil";
"myaccount.settings.license" = "Licencja";
"myaccount.settings.language" = "Język";
"myaccount.settings.review" = "Review this App"; // TODO
"myaccount.settings.share" = "Share this App"; // TODO
"myaccount.settings.appicon" = "Ikona aplikacji";
"myaccount.settings.version" = "Wersja: %@ (%@)";
"myaccount.settings.server_version" = "Wersja serwera: %@";
Expand Down
2 changes: 2 additions & 0 deletions Rocket.Chat/Resources/pt-BR.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@
"myaccount.settings.profile" = "Perfil";
"myaccount.settings.license" = "Licença";
"myaccount.settings.language" = "Idioma";
"myaccount.settings.review" = "Avalie este App";
"myaccount.settings.share" = "Compartilhe este App";
"myaccount.settings.appicon" = "Ícone do App";
"myaccount.settings.version" = "Versão: %@ (%@)";
"myaccount.settings.server_version" = "Versão do servidor: %@";
Expand Down
2 changes: 2 additions & 0 deletions Rocket.Chat/Resources/pt-PT.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@
"myaccount.settings.profile" = "Perfil";
"myaccount.settings.license" = "Licença";
"myaccount.settings.language" = "Idioma";
"myaccount.settings.review" = "Avalie este App";
"myaccount.settings.share" = "Compartilhe este App";
"myaccount.settings.appicon" = "Ícone da Aplicação";
"myaccount.settings.version" = "Versão: %@ (%@)";
"myaccount.settings.server_version" = "Versão do Servidor: %@";
Expand Down
2 changes: 2 additions & 0 deletions Rocket.Chat/Resources/ru.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@
"myaccount.settings.profile" = "Профиль";
"myaccount.settings.license" = "Лицензия";
"myaccount.settings.language" = "Язык";
"myaccount.settings.review" = "Review this App"; // TODO
"myaccount.settings.share" = "Share this App"; // TODO
"myaccount.settings.appicon" = "Иконка приложения";
"myaccount.settings.version" = "Версия: %@ (%@)";
"myaccount.settings.server_version" = "Версия сервера: %@";
Expand Down
Loading