Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions Fakes/Fakes/Networking.generated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1510,6 +1510,7 @@ extension Networking.Site {
url: .fake(),
adminURL: .fake(),
loginURL: .fake(),
frameNonce: .fake(),
plan: .fake(),
isJetpackThePluginInstalled: .fake(),
isJetpackConnected: .fake(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1785,6 +1785,7 @@ extension Networking.Site {
url: CopiableProp<String> = .copy,
adminURL: CopiableProp<String> = .copy,
loginURL: CopiableProp<String> = .copy,
frameNonce: CopiableProp<String> = .copy,
plan: CopiableProp<String> = .copy,
isJetpackThePluginInstalled: CopiableProp<Bool> = .copy,
isJetpackConnected: CopiableProp<Bool> = .copy,
Expand All @@ -1800,6 +1801,7 @@ extension Networking.Site {
let url = url ?? self.url
let adminURL = adminURL ?? self.adminURL
let loginURL = loginURL ?? self.loginURL
let frameNonce = frameNonce ?? self.frameNonce
let plan = plan ?? self.plan
let isJetpackThePluginInstalled = isJetpackThePluginInstalled ?? self.isJetpackThePluginInstalled
let isJetpackConnected = isJetpackConnected ?? self.isJetpackConnected
Expand All @@ -1816,6 +1818,7 @@ extension Networking.Site {
url: url,
adminURL: adminURL,
loginURL: loginURL,
frameNonce: frameNonce,
plan: plan,
isJetpackThePluginInstalled: isJetpackThePluginInstalled,
isJetpackConnected: isJetpackConnected,
Expand Down
7 changes: 7 additions & 0 deletions Networking/Networking/Model/Site.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public struct Site: Decodable, Equatable, GeneratedFakeable, GeneratedCopiable {
///
public let loginURL: String

public let frameNonce: String

/// Short name for site's plan.
///
public let plan: String
Expand Down Expand Up @@ -82,13 +84,15 @@ public struct Site: Decodable, Equatable, GeneratedFakeable, GeneratedCopiable {
let gmtOffset = try optionsContainer.decode(Double.self, forKey: .gmtOffset)
let adminURL = try optionsContainer.decode(String.self, forKey: .adminURL)
let loginURL = try optionsContainer.decode(String.self, forKey: .loginURL)
let frameNonce = try optionsContainer.decode(String.self, forKey: .frameNonce)

self.init(siteID: siteID,
name: name,
description: description,
url: url,
adminURL: adminURL,
loginURL: loginURL,
frameNonce: frameNonce,
plan: String(), // Not created on init. Added in supplementary API request.
isJetpackThePluginInstalled: isJetpackThePluginInstalled,
isJetpackConnected: isJetpackConnected,
Expand All @@ -107,6 +111,7 @@ public struct Site: Decodable, Equatable, GeneratedFakeable, GeneratedCopiable {
url: String,
adminURL: String,
loginURL: String,
frameNonce: String,
plan: String,
isJetpackThePluginInstalled: Bool,
isJetpackConnected: Bool,
Expand All @@ -121,6 +126,7 @@ public struct Site: Decodable, Equatable, GeneratedFakeable, GeneratedCopiable {
self.url = url
self.adminURL = adminURL
self.loginURL = loginURL
self.frameNonce = frameNonce
self.plan = plan
self.isJetpackThePluginInstalled = isJetpackThePluginInstalled
self.isJetpackConnected = isJetpackConnected
Expand Down Expand Up @@ -163,6 +169,7 @@ private extension Site {
case jetpackConnectionActivePlugins = "jetpack_connection_active_plugins"
case adminURL = "admin_url"
case loginURL = "login_url"
case frameNonce = "frame_nonce"
}

enum PlanKeys: String, CodingKey {
Expand Down
2 changes: 1 addition & 1 deletion Networking/Networking/Remote/AccountRemote.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class AccountRemote: Remote, AccountRemoteProtocol {
let path = "me/sites"
let parameters = [
"fields": "ID,name,description,URL,options,jetpack,jetpack_connection",
"options": "timezone,is_wpcom_store,woocommerce_is_active,gmt_offset,jetpack_connection_active_plugins,admin_url,login_url"
"options": "timezone,is_wpcom_store,woocommerce_is_active,gmt_offset,jetpack_connection_active_plugins,admin_url,login_url,frame_nonce"
]

let request = DotcomRequest(wordpressApiVersion: .mark1_1, method: .get, path: path, parameters: parameters)
Expand Down
2 changes: 2 additions & 0 deletions Networking/NetworkingTests/Mapper/AccountMapperTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ final class AccountMapperTests: XCTestCase {
XCTAssertEqual(first.url, "https://some-testing-url.testing.blog")
XCTAssertEqual(first.adminURL, "https://some-testing-url.here/wp-admin/")
XCTAssertEqual(first.loginURL, "https://some-testing-url.here/wp-login.php")
XCTAssertEqual(first.frameNonce, "73ae7163d8")
XCTAssertFalse(first.isJetpackCPConnected)
XCTAssertTrue(first.isJetpackConnected)
XCTAssertTrue(first.isJetpackThePluginInstalled)
Expand All @@ -52,6 +53,7 @@ final class AccountMapperTests: XCTestCase {
XCTAssertEqual(second.url, "https://thoughts.testing.blog")
XCTAssertEqual(second.adminURL, "https://thoughts.testing.blog/wp-admin/")
XCTAssertEqual(second.loginURL, "https://thoughts.testing.blog/wp-login.php")
XCTAssertEqual(second.frameNonce, "e7bfd785f0")
XCTAssertTrue(second.isJetpackCPConnected)
XCTAssertTrue(second.isJetpackConnected)
XCTAssertFalse(second.isJetpackThePluginInstalled)
Expand Down
4 changes: 3 additions & 1 deletion Storage/Storage.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@
9302E3AB220E1CE900DA5018 /* CoreDataIterativeMigratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreDataIterativeMigratorTests.swift; sourceTree = "<group>"; };
933A272F2222344D00C2143A /* Logging.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logging.swift; sourceTree = "<group>"; };
A3821B262583F14863740A37 /* Pods-Storage.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Storage.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-Storage/Pods-Storage.debug.xcconfig"; sourceTree = "<group>"; };
AE7DF9FA2919023100C4D1ED /* Model 77.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "Model 77.xcdatamodel"; sourceTree = "<group>"; };
AE93BE8F272C0E9F001B55EA /* GeneralStoreSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralStoreSettings.swift; sourceTree = "<group>"; };
AEC4481B290853C300BAA299 /* Model 76.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "Model 76.xcdatamodel"; sourceTree = "<group>"; };
B505255320EE6914008090F5 /* StorageType+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "StorageType+Extensions.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1814,6 +1815,7 @@
DEC51AA4275B41BE009F3DF4 /* WooCommerce.xcdatamodeld */ = {
isa = XCVersionGroup;
children = (
AE7DF9FA2919023100C4D1ED /* Model 77.xcdatamodel */,
AEC4481B290853C300BAA299 /* Model 76.xcdatamodel */,
688908A328F8EB360081A07E /* Model 75.xcdatamodel */,
6889088D28F668330081A07E /* Model 74.xcdatamodel */,
Expand Down Expand Up @@ -1891,7 +1893,7 @@
DEC51ADE275B41BE009F3DF4 /* Model 47.xcdatamodel */,
DEC51ADF275B41BE009F3DF4 /* Model 19.xcdatamodel */,
);
currentVersion = AEC4481B290853C300BAA299 /* Model 76.xcdatamodel */;
currentVersion = AE7DF9FA2919023100C4D1ED /* Model 77.xcdatamodel */;
path = WooCommerce.xcdatamodeld;
sourceTree = "<group>";
versionGroupType = wrapper.xcdatamodel;
Expand Down
4 changes: 4 additions & 0 deletions Storage/Storage/Model/MIGRATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This file documents changes in the WCiOS Storage data model. Please explain any changes to the data model as well as any custom migrations.

## Model 77 (Release 11.2.0.0)
- @ealeksandrov 2022-11-07
- Added `frameNonce` attribute to `Site` entity.

## Model 76 (Release 11.0.0.0)
- @ealeksandrov 2022-10-26
- Added `loginURL` attribute to `Site` entity.
Expand Down
1 change: 1 addition & 0 deletions Storage/Storage/Model/Site+CoreDataProperties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ extension Site {
@NSManaged public var url: String?
@NSManaged public var adminURL: String?
@NSManaged public var loginURL: String?
@NSManaged public var frameNonce: String?
@NSManaged public var plan: String?
@NSManaged public var isWooCommerceActive: NSNumber?
@NSManaged public var isWordPressStore: NSNumber?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<plist version="1.0">
<dict>
<key>_XCCurrentVersionName</key>
<string>Model 76.xcdatamodel</string>
<string>Model 77.xcdatamodel</string>
</dict>
</plist>
Loading