Skip to content

Commit 8abb621

Browse files
committed
Clear no longer necessary code
1 parent ee754e8 commit 8abb621

File tree

5 files changed

+2
-108
lines changed

5 files changed

+2
-108
lines changed

WooCommerce/Classes/Extensions/Date+Woo.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ extension Date {
7575
/// other: nil
7676
/// returns: Jan 1, 2022
7777
///
78-
func formatAsRange(with other: Date? = nil, timezone: TimeZone, calendar: Calendar) -> String? {
78+
func formatAsRange(with other: Date? = nil, timezone: TimeZone, calendar: Calendar) -> String {
7979
guard let other = other else {
8080
return DateFormatter.Stats.createAnalyticsHubDayMonthYearFormatter(timezone: timezone).string(from: self)
8181
}

WooCommerce/Classes/ViewRelated/Dashboard/Analytics Hub/AnalyticsTimeRangeCard.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ private extension AnalyticsTimeRangeCard {
125125
///
126126
struct DatesFormatter: RangedDateTextFormatter {
127127
func format(start: Date, end: Date) -> String {
128-
AnalyticsHubTimeRange(start: start, end: end).formatToString(simplified: false, timezone: .current, calendar: Locale.current.calendar)
128+
start.formatAsRange(with: end, timezone: .current, calendar: Locale.current.calendar)
129129
}
130130
}
131131
}

WooCommerce/Classes/ViewRelated/Dashboard/Analytics Hub/Time Range/AnalyticsHubTimeRange.swift

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,4 @@ import Foundation
33
struct AnalyticsHubTimeRange {
44
let start: Date
55
let end: Date
6-
7-
func formatToString(simplified: Bool, timezone: TimeZone, calendar: Calendar) -> String {
8-
if simplified {
9-
return DateFormatter.Stats.createAnalyticsHubDayMonthYearFormatter(timezone: timezone).string(from: start)
10-
}
11-
12-
let startDateDescription: String
13-
if start.isSameYear(as: end, using: calendar) {
14-
startDateDescription = DateFormatter.Stats.createAnalyticsHubDayMonthFormatter(timezone: timezone).string(from: start)
15-
} else {
16-
startDateDescription = DateFormatter.Stats.createAnalyticsHubDayMonthYearFormatter(timezone: timezone).string(from: start)
17-
}
18-
19-
let endDateDescription: String
20-
if start.isSameMonth(as: end, using: calendar) {
21-
endDateDescription = DateFormatter.Stats.createAnalyticsHubDayYearFormatter(timezone: timezone).string(from: end)
22-
} else {
23-
endDateDescription = DateFormatter.Stats.createAnalyticsHubDayMonthYearFormatter(timezone: timezone).string(from: end)
24-
}
25-
26-
return "\(startDateDescription) - \(endDateDescription)"
27-
}
286
}

WooCommerce/WooCommerce.xcodeproj/project.pbxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,7 +1396,6 @@
13961396
B5FD111221D3CE7700560344 /* NewNoteViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = B5FD111121D3CE7700560344 /* NewNoteViewController.xib */; };
13971397
B5FD111621D3F13700560344 /* BordersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5FD111521D3F13700560344 /* BordersView.swift */; };
13981398
B60B5026292D308A00178C26 /* AnalyticsTimeRangeCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = B60B5025292D308A00178C26 /* AnalyticsTimeRangeCard.swift */; };
1399-
B61C17722947981C002E9881 /* AnalyticsHubTimeRangeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B61C17712947981C002E9881 /* AnalyticsHubTimeRangeTests.swift */; };
14001399
B622BC74289CF19400B10CEC /* WaitingTimeTrackerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B622BC73289CF19400B10CEC /* WaitingTimeTrackerTests.swift */; };
14011400
B626C71B287659D60083820C /* OrderCustomFieldsDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = B626C71A287659D60083820C /* OrderCustomFieldsDetails.swift */; };
14021401
B63AAF4B254AD2C6000B28A2 /* URL+SurveyViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B63AAF4A254AD2C6000B28A2 /* URL+SurveyViewControllerTests.swift */; };
@@ -3466,7 +3465,6 @@
34663465
B5FD111121D3CE7700560344 /* NewNoteViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NewNoteViewController.xib; sourceTree = "<group>"; };
34673466
B5FD111521D3F13700560344 /* BordersView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BordersView.swift; sourceTree = "<group>"; };
34683467
B60B5025292D308A00178C26 /* AnalyticsTimeRangeCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsTimeRangeCard.swift; sourceTree = "<group>"; };
3469-
B61C17712947981C002E9881 /* AnalyticsHubTimeRangeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsHubTimeRangeTests.swift; sourceTree = "<group>"; };
34703468
B622BC73289CF19400B10CEC /* WaitingTimeTrackerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WaitingTimeTrackerTests.swift; sourceTree = "<group>"; };
34713469
B626C71A287659D60083820C /* OrderCustomFieldsDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderCustomFieldsDetails.swift; sourceTree = "<group>"; };
34723470
B63AAF4A254AD2C6000B28A2 /* URL+SurveyViewControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URL+SurveyViewControllerTests.swift"; sourceTree = "<group>"; };
@@ -7642,7 +7640,6 @@
76427640
children = (
76437641
AE4CCCEA29365CFD00B47EE8 /* AnalyticsHubViewModelTests.swift */,
76447642
B6440FB8292E74230012D506 /* AnalyticsHubTimeRangeSelectionTests.swift */,
7645-
B61C17712947981C002E9881 /* AnalyticsHubTimeRangeTests.swift */,
76467643
);
76477644
path = "Analytics Hub";
76487645
sourceTree = "<group>";
@@ -11633,7 +11630,6 @@
1163311630
022C658C2863BBAC00EC35A9 /* ProductFormViewController+ProductImageUploaderTests.swift in Sources */,
1163411631
093B265927DF15100026F92D /* BulkUpdatePriceViewControllerTests.swift in Sources */,
1163511632
2614EB1C24EB611200968D4B /* TopBannerViewTests.swift in Sources */,
11636-
B61C17722947981C002E9881 /* AnalyticsHubTimeRangeTests.swift in Sources */,
1163711633
B5DBF3C320E1484400B53AED /* StoresManagerTests.swift in Sources */,
1163811634
DE3404EA28B4C1D000CF0D97 /* NonAtomicSiteViewModelTests.swift in Sources */,
1163911635
02E493EF245C1087000AEA9E /* ProductFormBottomSheetListSelectorCommandTests.swift in Sources */,

WooCommerce/WooCommerceTests/ViewRelated/Dashboard/Analytics Hub/AnalyticsHubTimeRangeTests.swift

Lines changed: 0 additions & 80 deletions
This file was deleted.

0 commit comments

Comments
 (0)