From d7cd81069ddbf52fe1d1f416cf7324b5f2df8f75 Mon Sep 17 00:00:00 2001 From: Joshua Liebowitz Date: Tue, 3 Dec 2019 09:44:29 -0800 Subject: [PATCH 1/2] Disable Website link in the side bar (#66) --- ScienceJournal/UI/AboutViewController.swift | 19 +++++++++++++------ ScienceJournal/UI/SidebarViewController.swift | 3 ++- .../UI/UserFlowViewController.swift | 3 +-- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/ScienceJournal/UI/AboutViewController.swift b/ScienceJournal/UI/AboutViewController.swift index fae57ce..e7d10f1 100644 --- a/ScienceJournal/UI/AboutViewController.swift +++ b/ScienceJournal/UI/AboutViewController.swift @@ -24,7 +24,8 @@ class AboutViewController: MaterialHeaderCollectionViewController { // MARK: - Data model enum AboutRow { - case website + // Website is changing, so hide this option for now. + // case website case licenses case version case privacy @@ -32,7 +33,8 @@ class AboutViewController: MaterialHeaderCollectionViewController { var title: String { switch self { - case .website: return String.settingsWebsiteTitle + // Website is changing, so hide this option for now. + // case .website: return String.settingsWebsiteTitle case .licenses: return String.settingsOpenSourceTitle case .version: return String.settingsVersionTitle case .privacy: return String.settingsPrivacyPolicyTitle @@ -42,7 +44,8 @@ class AboutViewController: MaterialHeaderCollectionViewController { var description: String? { switch self { - case .website: return "https://g.co/sciencejournal" + // Website is changing, so hide this option for now. + // case .website: return "" case .licenses: return nil case .version: return Bundle.appVersionString case .privacy: return "https://www.google.com/policies/privacy/" @@ -52,7 +55,8 @@ class AboutViewController: MaterialHeaderCollectionViewController { var accessibilityLabel: String { switch self { - case .website: return String.settingsWebsiteTitle + // Website is changing, so hide this option for now. + // case .website: return String.settingsWebsiteTitle case .licenses: return String.settingsOpenSourceTitle case .version: return "\(String.settingsVersionTitle) \(self.description ?? "")" case .privacy: return String.settingsPrivacyPolicyTitle @@ -82,7 +86,8 @@ class AboutViewController: MaterialHeaderCollectionViewController { // MARK: - Datasource let rows: [AboutRow] = [ - .website, + // Disable website for now, since location is likely changing. + // .website, .licenses, .version, .privacy, @@ -166,7 +171,9 @@ class AboutViewController: MaterialHeaderCollectionViewController { didSelectItemAt indexPath: IndexPath) { let rowData = rows[indexPath.row] switch rowData { - case .website, .privacy, .terms: + // Website is changing, so hide this option for now. + // case .website, .privacy, .terms: + case .privacy, .terms: if let stringURL = rowData.description, let url = URL(string: stringURL) { UIApplication.shared.open(url) } diff --git a/ScienceJournal/UI/SidebarViewController.swift b/ScienceJournal/UI/SidebarViewController.swift index e45a7f1..e75f536 100644 --- a/ScienceJournal/UI/SidebarViewController.swift +++ b/ScienceJournal/UI/SidebarViewController.swift @@ -96,7 +96,8 @@ class SidebarViewController: UIViewController, UICollectionViewDelegate, UIColle let menuStructure: [SidebarRow] = [ .experiments, - .website, + // Website is changing, so hide this option for now. + // .website, .settings, .feedback, .about diff --git a/ScienceJournal/UI/UserFlowViewController.swift b/ScienceJournal/UI/UserFlowViewController.swift index 876c8d7..b98536d 100644 --- a/ScienceJournal/UI/UserFlowViewController.swift +++ b/ScienceJournal/UI/UserFlowViewController.swift @@ -387,8 +387,7 @@ class UserFlowViewController: UIViewController, ExperimentsListViewControllerDel aboutNavController.modalPresentationStyle = .formSheet present(aboutNavController, animated: true) case .website: - let websiteURL = - "https://makingscience.withgoogle.com/science-journal/activities?utm_source=app" + let websiteURL = "new url here" guard let url = URL(string: websiteURL) else { return } UIApplication.shared.open(url) case .settings: From f0665e78e2c1822b83c80bc2dfd3a4aea21914c7 Mon Sep 17 00:00:00 2001 From: Joshua Liebowitz Date: Tue, 3 Dec 2019 12:11:42 -0800 Subject: [PATCH 2/2] Instead of commenting out, just remove the weblink --- ScienceJournal/UI/AboutViewController.swift | 12 ------------ ScienceJournal/UI/SidebarViewController.swift | 17 ----------------- ScienceJournal/UI/UserFlowViewController.swift | 4 ---- 3 files changed, 33 deletions(-) diff --git a/ScienceJournal/UI/AboutViewController.swift b/ScienceJournal/UI/AboutViewController.swift index e7d10f1..2b8e1a2 100644 --- a/ScienceJournal/UI/AboutViewController.swift +++ b/ScienceJournal/UI/AboutViewController.swift @@ -24,8 +24,6 @@ class AboutViewController: MaterialHeaderCollectionViewController { // MARK: - Data model enum AboutRow { - // Website is changing, so hide this option for now. - // case website case licenses case version case privacy @@ -33,8 +31,6 @@ class AboutViewController: MaterialHeaderCollectionViewController { var title: String { switch self { - // Website is changing, so hide this option for now. - // case .website: return String.settingsWebsiteTitle case .licenses: return String.settingsOpenSourceTitle case .version: return String.settingsVersionTitle case .privacy: return String.settingsPrivacyPolicyTitle @@ -44,8 +40,6 @@ class AboutViewController: MaterialHeaderCollectionViewController { var description: String? { switch self { - // Website is changing, so hide this option for now. - // case .website: return "" case .licenses: return nil case .version: return Bundle.appVersionString case .privacy: return "https://www.google.com/policies/privacy/" @@ -55,8 +49,6 @@ class AboutViewController: MaterialHeaderCollectionViewController { var accessibilityLabel: String { switch self { - // Website is changing, so hide this option for now. - // case .website: return String.settingsWebsiteTitle case .licenses: return String.settingsOpenSourceTitle case .version: return "\(String.settingsVersionTitle) \(self.description ?? "")" case .privacy: return String.settingsPrivacyPolicyTitle @@ -86,8 +78,6 @@ class AboutViewController: MaterialHeaderCollectionViewController { // MARK: - Datasource let rows: [AboutRow] = [ - // Disable website for now, since location is likely changing. - // .website, .licenses, .version, .privacy, @@ -171,8 +161,6 @@ class AboutViewController: MaterialHeaderCollectionViewController { didSelectItemAt indexPath: IndexPath) { let rowData = rows[indexPath.row] switch rowData { - // Website is changing, so hide this option for now. - // case .website, .privacy, .terms: case .privacy, .terms: if let stringURL = rowData.description, let url = URL(string: stringURL) { UIApplication.shared.open(url) diff --git a/ScienceJournal/UI/SidebarViewController.swift b/ScienceJournal/UI/SidebarViewController.swift index e75f536..199b7db 100644 --- a/ScienceJournal/UI/SidebarViewController.swift +++ b/ScienceJournal/UI/SidebarViewController.swift @@ -26,7 +26,6 @@ protocol SidebarDelegate: class { /// Represents rows in the sidebar that provides titles and icons for each item. enum SidebarRow { case experiments - case website case settings case feedback case about @@ -34,7 +33,6 @@ enum SidebarRow { var title: String { switch self { case .experiments: return String.navigationItemExperiments - case .website: return String.navigationItemActivities case .settings: return String.navigationItemSettings case .feedback: return String.actionFeedback case .about: return String.actionAbout @@ -44,19 +42,11 @@ enum SidebarRow { var icon: String { switch self { case .experiments: return "ic_book_36pt" - case .website: return "ic_web_asset_36pt" case .settings: return "ic_settings_36pt" case .feedback: return "ic_feedback_36pt" case .about: return "ic_info_36pt" } } - - var accessoryIcon: String? { - switch self { - case .website: return "ic_open_in_browser" - default: return nil - } - } } /// Controls the contents of the sidebar menu and manages its appearance and disappearance. @@ -96,8 +86,6 @@ class SidebarViewController: UIViewController, UICollectionViewDelegate, UIColle let menuStructure: [SidebarRow] = [ .experiments, - // Website is changing, so hide this option for now. - // .website, .settings, .feedback, .about @@ -411,11 +399,6 @@ class SidebarViewController: UIViewController, UICollectionViewDelegate, UIColle cell.titleLabel.text = cellData.title cell.accessibilityLabel = cell.titleLabel.text cell.iconView.image = UIImage(named: cellData.icon) - var accessoryImage: UIImage? - if let accessoryIcon = cellData.accessoryIcon { - accessoryImage = UIImage(named: accessoryIcon) - } - cell.accessoryIconView.image = accessoryImage } return cell } diff --git a/ScienceJournal/UI/UserFlowViewController.swift b/ScienceJournal/UI/UserFlowViewController.swift index b98536d..24ff574 100644 --- a/ScienceJournal/UI/UserFlowViewController.swift +++ b/ScienceJournal/UI/UserFlowViewController.swift @@ -386,10 +386,6 @@ class UserFlowViewController: UIViewController, ExperimentsListViewControllerDel aboutNavController.isNavigationBarHidden = true aboutNavController.modalPresentationStyle = .formSheet present(aboutNavController, animated: true) - case .website: - let websiteURL = "new url here" - guard let url = URL(string: websiteURL) else { return } - UIApplication.shared.open(url) case .settings: let settingsVC = SettingsViewController(analyticsReporter: analyticsReporter, driveSyncManager: userManager.driveSyncManager,