Skip to content

Commit e9bdef3

Browse files
committed
Merge branch 'trunk' into feat/6966-reset-stats-sync-ts-after-orders
* trunk: (232 commits) Update release notes. Use the Woo blue color instead of the native blue. Update copy Provide formatted updated time when dispatching an entry Update UI for the last refreshed label Mock an action response to prevent the test case sending HTTP request Build WooFoundation framework using app extension safe APIs Build Networking framework using app extension safe APIs Build Experiments framework using app extension safe APIs Fix typo Update analytics opened event to contains a list of widgets installed Update Charts to 4.1.0 Tracks when the widget has been tapped Add event for when a widget is tapped Removes trailing whitespace Localize widget dsplay name Reloads the store info widget after reloading stats in the app Do not transform conversion rate to percentage twice Maker formatting helpers static Add clarification for CurrencySettings Codable implementation ...
2 parents 137cb8d + 86a9239 commit e9bdef3

File tree

170 files changed

+3684
-781
lines changed

Some content is hidden

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

170 files changed

+3684
-781
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.xcodeproj/project.pbxproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@
463463
isa = XCBuildConfiguration;
464464
baseConfigurationReference = 2B7FCE683D4058A7A16F7946 /* Pods-Experiments.debug.xcconfig */;
465465
buildSettings = {
466+
APPLICATION_EXTENSION_API_ONLY = YES;
466467
CLANG_ENABLE_MODULES = YES;
467468
CODE_SIGN_STYLE = Automatic;
468469
DEFINES_MODULE = YES;
@@ -489,6 +490,7 @@
489490
isa = XCBuildConfiguration;
490491
baseConfigurationReference = AF72D9DB7771E7A5105C88B0 /* Pods-Experiments.release.xcconfig */;
491492
buildSettings = {
493+
APPLICATION_EXTENSION_API_ONLY = YES;
492494
CLANG_ENABLE_MODULES = YES;
493495
CODE_SIGN_STYLE = Automatic;
494496
DEFINES_MODULE = YES;
@@ -611,6 +613,7 @@
611613
isa = XCBuildConfiguration;
612614
baseConfigurationReference = 8CB554DFAAD3EF41D17099C4 /* Pods-Experiments.release-alpha.xcconfig */;
613615
buildSettings = {
616+
APPLICATION_EXTENSION_API_ONLY = YES;
614617
CLANG_ENABLE_MODULES = YES;
615618
CODE_SIGN_STYLE = Automatic;
616619
DEFINES_MODULE = YES;

Experiments/Experiments/DefaultFeatureFlagService.swift

Lines changed: 0 additions & 12 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,20 +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
32-
case .appleIDAccountDeletion:
33-
return true
3422
case .newToWooCommerceLinkInLoginPrologue:
3523
return true
3624
case .loginPrologueOnboarding:

Experiments/Experiments/FeatureFlag.swift

Lines changed: 0 additions & 24 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,18 +38,10 @@ 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
6444

65-
/// Apple ID account deletion
66-
///
67-
case appleIDAccountDeletion
68-
6945
/// Showing a "New to WooCommerce" link in the login prologue screen
7046
///
7147
case newToWooCommerceLinkInLoginPrologue

Networking/Networking.xcodeproj/project.pbxproj

Lines changed: 59 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+
}

0 commit comments

Comments
 (0)