Skip to content

Commit d29b023

Browse files
authored
Merge branch 'trunk' into issue/7605-remove-appleIDAccDeletion-feature-flag
2 parents e73902e + 7125053 commit d29b023

File tree

124 files changed

+1944
-631
lines changed

Some content is hidden

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

124 files changed

+1944
-631
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
Contains editorialized release notes. Raw release notes should go into `RELEASE-NOTES.txt`.
33
-->
44

5+
## 10.3
6+
7+
More love for In-Person Payments and Analytics this time around. We fixed a bug which could prevent you from collecting payments in the app. Card reader connections are more stable. And we fixed an issue where your store's analytics are sometimes not updated.
8+
9+
510
## 10.2
611
Even though this release doesn’t have any new features, we still put a lot of love into it! You can now enable or disable the option to take card or cash payments on collection or delivery. We also added a new Help Center page that makes it easier for you to login to the app.
712

Experiments/Experiments/DefaultFeatureFlagService.swift

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
77
switch featureFlag {
88
case .barcodeScanner:
99
return buildConfig == .localDeveloper || buildConfig == .alpha
10-
case .couponView:
11-
return true
1210
case .productSKUInputScanner:
1311
return true
1412
case .inbox:
@@ -17,18 +15,10 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
1715
return buildConfig == .localDeveloper || buildConfig == .alpha
1816
case .splitViewInOrdersTab:
1917
return buildConfig == .localDeveloper || buildConfig == .alpha
20-
case .couponDeletion:
21-
return true
22-
case .couponEditing:
23-
return true
24-
case .couponCreation:
25-
return true
2618
case .updateOrderOptimistically:
2719
return buildConfig == .localDeveloper || buildConfig == .alpha
2820
case .shippingLabelsOnboardingM1:
2921
return buildConfig == .localDeveloper || buildConfig == .alpha
30-
case .backgroundProductImageUpload:
31-
return true
3222
case .newToWooCommerceLinkInLoginPrologue:
3323
return true
3424
case .loginPrologueOnboarding:

Experiments/Experiments/FeatureFlag.swift

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ public enum FeatureFlag: Int {
1414
///
1515
case reviews
1616

17-
/// Displays the option to view coupons
18-
///
19-
case couponView
20-
2117
/// Barcode scanner for product SKU input
2218
///
2319
case productSKUInputScanner
@@ -34,18 +30,6 @@ public enum FeatureFlag: Int {
3430
///
3531
case splitViewInOrdersTab
3632

37-
/// Displays the option to delete coupons
38-
///
39-
case couponDeletion
40-
41-
/// Displays the option to edit a coupon
42-
///
43-
case couponEditing
44-
45-
/// Displays the option to create a coupon
46-
///
47-
case couponCreation
48-
4933
/// Enable optimistic updates for orders
5034
///
5135
case updateOrderOptimistically
@@ -54,10 +38,6 @@ public enum FeatureFlag: Int {
5438
///
5539
case shippingLabelsOnboardingM1
5640

57-
/// Enable image upload after leaving the product form
58-
///
59-
case backgroundProductImageUpload
60-
6141
/// Enable IPP reader manuals consolidation screen
6242
///
6343
case consolidatedCardReaderManuals

Networking/Networking.xcodeproj/project.pbxproj

Lines changed: 56 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import Foundation
2+
3+
/// Mapper: Jetpack Connection URL
4+
///
5+
struct JetpackConnectionURLMapper: Mapper {
6+
7+
/// (Attempts) to convert the response into a URL.
8+
///
9+
func map(response: Data) throws -> URL {
10+
guard let escapedString = String(data: response, encoding: .utf8) else {
11+
throw JetpackConnectionRemote.ConnectionError.malformedURL
12+
}
13+
// The API returns an escaped string with double quotes, so we need to clean it up.
14+
let urlString = escapedString
15+
.trimmingCharacters(in: .whitespacesAndNewlines)
16+
.replacingOccurrences(of: "\"", with: "")
17+
.replacingOccurrences(of: "\\", with: "")
18+
return try urlString.asURL()
19+
}
20+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import Foundation
2+
3+
/// Mapper: Jetpack user
4+
///
5+
struct JetpackUserMapper: Mapper {
6+
7+
/// (Attempts) to extract the updated `currentUser` field from a given JSON Encoded response.
8+
///
9+
func map(response: Data) throws -> JetpackUser {
10+
let decoder = JSONDecoder()
11+
return try decoder.decode(JetpackConnectionData.self, from: response).currentUser
12+
}
13+
}
14+
15+
/// JetpackConnectionData Disposable Entity:
16+
/// This entity allows us to parse JetpackUser with JSONDecoder.
17+
///
18+
private struct JetpackConnectionData: Decodable {
19+
let currentUser: JetpackUser
20+
21+
private enum CodingKeys: String, CodingKey {
22+
case currentUser
23+
}
24+
}

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

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,30 @@ extension CouponReport {
169169
}
170170
}
171171

172+
extension DotcomUser {
173+
public func copy(
174+
id: CopiableProp<Int64> = .copy,
175+
username: CopiableProp<String> = .copy,
176+
email: CopiableProp<String> = .copy,
177+
displayName: CopiableProp<String> = .copy,
178+
avatar: NullableCopiableProp<String> = .copy
179+
) -> DotcomUser {
180+
let id = id ?? self.id
181+
let username = username ?? self.username
182+
let email = email ?? self.email
183+
let displayName = displayName ?? self.displayName
184+
let avatar = avatar ?? self.avatar
185+
186+
return DotcomUser(
187+
id: id,
188+
username: username,
189+
email: email,
190+
displayName: displayName,
191+
avatar: avatar
192+
)
193+
}
194+
}
195+
172196
extension InboxAction {
173197
public func copy(
174198
id: CopiableProp<Int64> = .copy,
@@ -235,6 +259,30 @@ extension InboxNote {
235259
}
236260
}
237261

262+
extension JetpackUser {
263+
public func copy(
264+
isConnected: CopiableProp<Bool> = .copy,
265+
isPrimary: CopiableProp<Bool> = .copy,
266+
username: CopiableProp<String> = .copy,
267+
wpcomUser: NullableCopiableProp<DotcomUser> = .copy,
268+
gravatar: NullableCopiableProp<String> = .copy
269+
) -> JetpackUser {
270+
let isConnected = isConnected ?? self.isConnected
271+
let isPrimary = isPrimary ?? self.isPrimary
272+
let username = username ?? self.username
273+
let wpcomUser = wpcomUser ?? self.wpcomUser
274+
let gravatar = gravatar ?? self.gravatar
275+
276+
return JetpackUser(
277+
isConnected: isConnected,
278+
isPrimary: isPrimary,
279+
username: username,
280+
wpcomUser: wpcomUser,
281+
gravatar: gravatar
282+
)
283+
}
284+
}
285+
238286
extension Media {
239287
public func copy(
240288
mediaID: CopiableProp<Int64> = .copy,
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import Codegen
2+
import Foundation
3+
4+
/// Basic information of a WordPress.com user
5+
public struct DotcomUser: Decodable, GeneratedFakeable, GeneratedCopiable {
6+
7+
/// User ID in WP.com
8+
public let id: Int64
9+
10+
/// Username in WP.com
11+
public let username: String
12+
13+
/// Registered email address with WP.com
14+
public let email: String
15+
16+
/// Display name in WP.com
17+
public let displayName: String
18+
19+
/// Link to avatar used in WP.com
20+
public let avatar: String?
21+
22+
/// Member-wise initializer
23+
public init(id: Int64, username: String, email: String, displayName: String, avatar: String?) {
24+
self.id = id
25+
self.username = username
26+
self.email = email
27+
self.displayName = displayName
28+
self.avatar = avatar
29+
}
30+
}
31+
32+
/// Defines all of the `WordPressComUser` CodingKeys.
33+
///
34+
private extension DotcomUser {
35+
36+
enum CodingKeys: String, CodingKey {
37+
case id = "ID"
38+
case username = "login"
39+
case email
40+
case displayName = "display_name"
41+
case avatar
42+
}
43+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import Codegen
2+
import Foundation
3+
4+
/// Information of a WP.com user connected to a site's Jetpack if exists
5+
public struct JetpackUser: Decodable, GeneratedFakeable, GeneratedCopiable {
6+
7+
/// Whether the user has connected a WP.com account to the site's Jetpack
8+
public let isConnected: Bool
9+
10+
/// Whether the user is the primary account connected to the site's Jetpack
11+
public let isPrimary: Bool
12+
13+
/// WP.org username in the site.
14+
public let username: String
15+
16+
/// The connected WP.com user if exists
17+
public let wpcomUser: DotcomUser?
18+
19+
/// Gravatar link of the user
20+
public let gravatar: String?
21+
22+
/// Member-wise initializer
23+
public init(isConnected: Bool, isPrimary: Bool, username: String, wpcomUser: DotcomUser?, gravatar: String?) {
24+
self.isConnected = isConnected
25+
self.isPrimary = isPrimary
26+
self.username = username
27+
self.wpcomUser = wpcomUser
28+
self.gravatar = gravatar
29+
}
30+
31+
public init(from decoder: Decoder) throws {
32+
let container = try decoder.container(keyedBy: CodingKeys.self)
33+
isConnected = try container.decode(Bool.self, forKey: .isConnected)
34+
isPrimary = try container.decode(Bool.self, forKey: .isPrimary)
35+
username = try container.decode(String.self, forKey: .username)
36+
wpcomUser = try? container.decode(DotcomUser.self, forKey: .wpcomUser)
37+
gravatar = try? container.decode(String.self, forKey: .gravatar)
38+
}
39+
}
40+
41+
/// Defines all of the `JetpackUser` CodingKeys.
42+
///
43+
private extension JetpackUser {
44+
45+
enum CodingKeys: String, CodingKey {
46+
case isConnected
47+
case isPrimary = "isMaster"
48+
case username
49+
case wpcomUser
50+
case gravatar
51+
}
52+
}

Networking/Networking/Network/AlamofireNetwork.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ public class AlamofireNetwork: Network {
107107
}
108108

109109

110-
/// MARK: - Alamofire.DataResponse: Private Methods
111-
///
112-
private extension Alamofire.DataResponse {
110+
// MARK: - Alamofire.DataResponse: Helper Methods
111+
//
112+
extension Alamofire.DataResponse {
113113

114114
/// Returns the Networking Layer Error (if any):
115115
///
@@ -136,8 +136,8 @@ private extension Alamofire.DataResponse {
136136
}
137137

138138
// MARK: - Swift.Result Conversion
139-
140-
private extension Alamofire.Result {
139+
//
140+
extension Alamofire.Result {
141141
/// Convert this `Alamofire.Result` to a `Swift.Result`.
142142
///
143143
func toSwiftResult() -> Swift.Result<Value, Error> {

0 commit comments

Comments
 (0)