Skip to content

Commit 7d98684

Browse files
Merge branch 'trunk' into feat/8394-generate-application-password
2 parents b2f3d74 + cc593fb commit 7d98684

File tree

52 files changed

+1911
-203
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1911
-203
lines changed

Experiments/Experiments/DefaultFeatureFlagService.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
3939
return true
4040
case .storeCreationM2WithInAppPurchasesEnabled:
4141
return false
42+
case .storeCreationM3Profiler:
43+
return buildConfig == .localDeveloper || buildConfig == .alpha
4244
case .justInTimeMessagesOnDashboard:
4345
return true
4446
case .systemStatusReportInSupportRequest:

Experiments/Experiments/FeatureFlag.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ public enum FeatureFlag: Int {
8787
///
8888
case storeCreationM2WithInAppPurchasesEnabled
8989

90+
/// Store creation milestone 3 - profiler questions
91+
///
92+
case storeCreationM3Profiler
93+
9094
/// Just In Time Messages on Dashboard
9195
///
9296
case justInTimeMessagesOnDashboard

Fakes/Fakes/Networking.generated.swift

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1593,6 +1593,19 @@ extension SiteSettingGroup {
15931593
.general
15941594
}
15951595
}
1596+
extension Networking.SiteSummaryStats {
1597+
/// Returns a "ready to use" type filled with fake values.
1598+
///
1599+
public static func fake() -> Networking.SiteSummaryStats {
1600+
.init(
1601+
siteID: .fake(),
1602+
date: .fake(),
1603+
period: .fake(),
1604+
visitors: .fake(),
1605+
views: .fake()
1606+
)
1607+
}
1608+
}
15961609
extension Networking.SiteVisitStats {
15971610
/// Returns a "ready to use" type filled with fake values.
15981611
///
@@ -1611,7 +1624,8 @@ extension Networking.SiteVisitStatsItem {
16111624
public static func fake() -> Networking.SiteVisitStatsItem {
16121625
.init(
16131626
period: .fake(),
1614-
visitors: .fake()
1627+
visitors: .fake(),
1628+
views: .fake()
16151629
)
16161630
}
16171631
}

Networking/Networking/Model/Copiable/Models+Copiable.generated.swift

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,6 +1912,30 @@ extension Networking.SiteSetting {
19121912
}
19131913
}
19141914

1915+
extension Networking.SiteSummaryStats {
1916+
public func copy(
1917+
siteID: CopiableProp<Int64> = .copy,
1918+
date: CopiableProp<String> = .copy,
1919+
period: CopiableProp<StatGranularity> = .copy,
1920+
visitors: CopiableProp<Int> = .copy,
1921+
views: CopiableProp<Int> = .copy
1922+
) -> Networking.SiteSummaryStats {
1923+
let siteID = siteID ?? self.siteID
1924+
let date = date ?? self.date
1925+
let period = period ?? self.period
1926+
let visitors = visitors ?? self.visitors
1927+
let views = views ?? self.views
1928+
1929+
return Networking.SiteSummaryStats(
1930+
siteID: siteID,
1931+
date: date,
1932+
period: period,
1933+
visitors: visitors,
1934+
views: views
1935+
)
1936+
}
1937+
}
1938+
19151939
extension Networking.SiteVisitStats {
19161940
public func copy(
19171941
siteID: CopiableProp<Int64> = .copy,
@@ -1936,14 +1960,17 @@ extension Networking.SiteVisitStats {
19361960
extension Networking.SiteVisitStatsItem {
19371961
public func copy(
19381962
period: CopiableProp<String> = .copy,
1939-
visitors: CopiableProp<Int> = .copy
1963+
visitors: CopiableProp<Int> = .copy,
1964+
views: CopiableProp<Int> = .copy
19401965
) -> Networking.SiteVisitStatsItem {
19411966
let period = period ?? self.period
19421967
let visitors = visitors ?? self.visitors
1968+
let views = views ?? self.views
19431969

19441970
return Networking.SiteVisitStatsItem(
19451971
period: period,
1946-
visitors: visitors
1972+
visitors: visitors,
1973+
views: views
19471974
)
19481975
}
19491976
}

Networking/Networking/Model/Stats/SiteSummaryStats.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Codegen
33

44
/// Represents site summary stats for a specific period.
55
///
6-
public struct SiteSummaryStats: Decodable {
6+
public struct SiteSummaryStats: Decodable, GeneratedCopiable, GeneratedFakeable {
77
public let siteID: Int64
88
public let date: String
99
public let period: StatGranularity

Networking/Networking/Model/Stats/SiteVisitStats.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ public struct SiteVisitStats: Decodable, GeneratedCopiable, GeneratedFakeable {
2525
let rawData: [[AnyCodable]] = try container.decode([[AnyCodable]].self, forKey: .data)
2626
let rawDataContainers = rawData.map({ MIContainer(data: $0.map({ $0.value }), fieldNames: fieldNames) })
2727
let items = rawDataContainers.map({ SiteVisitStatsItem(period: $0.fetchStringValue(for: ItemFieldNames.period),
28-
visitors: $0.fetchIntValue(for: ItemFieldNames.visitors)) })
28+
visitors: $0.fetchIntValue(for: ItemFieldNames.visitors),
29+
views: $0.fetchIntValue(for: ItemFieldNames.views)) })
2930

3031
self.init(siteID: siteID, date: date, granularity: granularity, items: items)
3132
}
@@ -79,11 +80,12 @@ extension SiteVisitStats: Equatable {
7980
//
8081
private extension SiteVisitStats {
8182

82-
/// Defines all of the possbile fields for a SiteVisitStatsItem.
83+
/// Defines all of the possible fields for a SiteVisitStatsItem.
8384
///
8485
enum ItemFieldNames: String {
85-
case period = "period"
86-
case visitors = "visitors"
86+
case period
87+
case visitors
88+
case views
8789
}
8890
}
8991

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
import Foundation
22
import Codegen
33

4-
/// Represents an single site visit stat for a specific period.
4+
/// Represents a single site visit stat for a specific period.
55
///
66
public struct SiteVisitStatsItem: Equatable, GeneratedCopiable, GeneratedFakeable {
77
public let period: String
88
public let visitors: Int
9+
public let views: Int
910

1011
/// SiteVisitStatsItem struct initializer.
1112
///
12-
public init(period: String, visitors: Int) {
13+
public init(period: String, visitors: Int, views: Int) {
1314
self.period = period
1415
self.visitors = visitors
16+
self.views = views
1517
}
1618
}
1719

@@ -21,6 +23,7 @@ public struct SiteVisitStatsItem: Equatable, GeneratedCopiable, GeneratedFakeabl
2123
extension SiteVisitStatsItem: Comparable {
2224
public static func < (lhs: SiteVisitStatsItem, rhs: SiteVisitStatsItem) -> Bool {
2325
return lhs.period < rhs.period ||
24-
(lhs.period == rhs.period && lhs.visitors < rhs.visitors)
26+
(lhs.period == rhs.period && lhs.visitors < rhs.visitors) ||
27+
(lhs.period == rhs.period && lhs.visitors == rhs.visitors && lhs.views < rhs.views)
2528
}
2629
}

Networking/Networking/Remote/SiteStatsRemote.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class SiteStatsRemote: Remote {
2727
let parameters = [ParameterKeys.unit: unit.rawValue,
2828
ParameterKeys.date: dateFormatter.string(from: latestDateToInclude),
2929
ParameterKeys.quantity: String(quantity),
30-
ParameterKeys.statFields: ParameterValues.visitors]
30+
ParameterKeys.statFields: "\(ParameterValues.visitors),\(ParameterValues.views)"]
3131
let request = DotcomRequest(wordpressApiVersion: .mark1_1, method: .get, path: path, parameters: parameters)
3232
let mapper = SiteVisitStatsMapper(siteID: siteID)
3333
enqueue(request, mapper: mapper, completion: completion)
@@ -83,5 +83,6 @@ private extension SiteStatsRemote {
8383

8484
enum ParameterValues {
8585
static let visitors: String = "visitors"
86+
static let views: String = "views"
8687
}
8788
}

Networking/NetworkingTests/Mapper/SiteVisitStatsMapperTests.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ class SiteVisitStatsMapperTests: XCTestCase {
2424
let sampleItem1 = dayStats.items![0]
2525
XCTAssertEqual(sampleItem1.period, "2018-07-26")
2626
XCTAssertEqual(sampleItem1.visitors, 101)
27+
XCTAssertEqual(sampleItem1.views, 202)
2728

2829
let sampleItem2 = dayStats.items![11]
2930
XCTAssertEqual(sampleItem2.period, "2018-08-06")
3031
XCTAssertEqual(sampleItem2.visitors, 2)
32+
XCTAssertEqual(sampleItem2.views, 4)
3133
}
3234

3335
/// Verifies that all of the week unit SiteVisitStats fields are parsed correctly.
@@ -47,10 +49,12 @@ class SiteVisitStatsMapperTests: XCTestCase {
4749
let sampleItem1 = weekStats.items![0]
4850
XCTAssertEqual(sampleItem1.period, "2018W05W21")
4951
XCTAssertEqual(sampleItem1.visitors, 4)
52+
XCTAssertEqual(sampleItem1.views, 8)
5053

5154
let sampleItem2 = weekStats.items![11]
5255
XCTAssertEqual(sampleItem2.period, "2018W08W06")
5356
XCTAssertEqual(sampleItem2.visitors, 123123123)
57+
XCTAssertEqual(sampleItem2.views, 246246246)
5458
}
5559

5660
/// Verifies that all of the month unit SiteVisitStats fields are parsed correctly.
@@ -70,10 +74,12 @@ class SiteVisitStatsMapperTests: XCTestCase {
7074
let sampleItem1 = monthStats.items![0]
7175
XCTAssertEqual(sampleItem1.period, "2017-09-01")
7276
XCTAssertEqual(sampleItem1.visitors, 224)
77+
XCTAssertEqual(sampleItem1.views, 448)
7378

7479
let sampleItem2 = monthStats.items![10]
7580
XCTAssertEqual(sampleItem2.period, "2018-07-01")
7681
XCTAssertEqual(sampleItem2.visitors, 6)
82+
XCTAssertEqual(sampleItem2.views, 12)
7783
}
7884

7985
/// Verifies that all of the year unit SiteVisitStats fields are parsed correctly.
@@ -93,10 +99,12 @@ class SiteVisitStatsMapperTests: XCTestCase {
9399
let sampleItem1 = yearStats.items![0]
94100
XCTAssertEqual(sampleItem1.period, "2014-01-01")
95101
XCTAssertEqual(sampleItem1.visitors, 1145)
102+
XCTAssertEqual(sampleItem1.views, 2290)
96103

97104
let sampleItem2 = yearStats.items![3]
98105
XCTAssertEqual(sampleItem2.period, "2017-01-01")
99106
XCTAssertEqual(sampleItem2.visitors, 144)
107+
XCTAssertEqual(sampleItem2.views, 288)
100108
}
101109
}
102110

Networking/NetworkingTests/Responses/site-visits-alt.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"data": [
1414
[
1515
"2014-01-01",
16-
12821,
16+
12831,
1717
1140,
1818
1094,
1919
0,
@@ -22,7 +22,7 @@
2222
],
2323
[
2424
"2015-01-01",
25-
14808,
25+
14818,
2626
1634,
2727
1492,
2828
0,

0 commit comments

Comments
 (0)