Skip to content

Commit

Permalink
Delete: obsolete properties and methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Momo Ozawa committed Sep 10, 2021
1 parent 14be7cb commit 5982e7c
Showing 1 changed file with 0 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ class SiteStatsInsightsTableViewController: UITableViewController, StoryboardLoa

// Store 'customize' separately as it is not per site.
private let userDefaultsHideCustomizeKey = "StatsInsightsHideCustomizeCard"
private var hideCustomizeCard = false

// Store Insights settings for all sites.
// Used when writing to/reading from User Defaults.
Expand Down Expand Up @@ -266,15 +265,10 @@ private extension SiteStatsInsightsTableViewController {

func writeInsightsToUserDefaults() {

writeCustomizeCardSetting()

guard let siteID = SiteStatsInformation.sharedInstance.siteID?.stringValue else {
return
}

// Remove 'customize' from array since it is not per site.
removeCustomizeCard()

let insightTypesValues = InsightType.valuesForTypes(insightsToShow)
let currentSiteInsights = [siteID: insightTypesValues]

Expand All @@ -283,13 +277,6 @@ private extension SiteStatsInsightsTableViewController {
allSitesInsights.append(currentSiteInsights)

UserDefaults.standard.set(allSitesInsights, forKey: userDefaultsInsightTypesKey)

// Add back 'customize'.
addCustomizeCard()
}

func writeCustomizeCardSetting() {
UserDefaults.standard.set(hideCustomizeCard, forKey: userDefaultsHideCustomizeKey)
}

/// Loads an insight that can be permanently dismissed. Adds or removes the insight from the list of insights to show.
Expand Down Expand Up @@ -329,17 +316,6 @@ private extension SiteStatsInsightsTableViewController {
permanentlyDismissInsight(.customize, using: userDefaultsHideCustomizeKey)
}

func removeCustomizeCard() {
insightsToShow = insightsToShow.filter { $0 != .customize }
}

func addCustomizeCard() {
if !hideCustomizeCard && !insightsToShow.contains(.customize) {
// Insert customize at the beginning of the array so it is displayed first.
insightsToShow.insert(.customize, at: 0)
}
}

// MARK: - Insights Management

func showAddInsightView() {
Expand Down

0 comments on commit 5982e7c

Please sign in to comment.