Skip to content

Commit cf09d61

Browse files
committed
Merge branch 'trunk' into feat/7318-localnotification-dismiss-action-tracking
# Conflicts: # WooCommerce/Classes/ViewRelated/AppCoordinator.swift
2 parents 511381d + 9fc2715 commit cf09d61

File tree

210 files changed

+2356
-567
lines changed

Some content is hidden

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

210 files changed

+2356
-567
lines changed

Gemfile.lock

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
GIT
22
remote: [email protected]:wordpress-mobile/release-toolkit
3-
revision: a4d04a43125d84288e46ea38b893d001cd660a3b
3+
revision: 57e9ad1c7311b076d7c273cd176073748299fdca
44
branch: trunk
55
specs:
6-
fastlane-plugin-wpmreleasetoolkit (4.2.0)
6+
fastlane-plugin-wpmreleasetoolkit (5.1.0)
77
activesupport (~> 5)
88
bigdecimal (~> 1.4)
99
buildkit (~> 1.5)
1010
chroma (= 0.2.0)
1111
diffy (~> 3.3)
1212
git (~> 1.3)
13+
google-cloud-storage (~> 1.31)
1314
jsonlint (~> 0.3)
1415
nokogiri (~> 1.11)
1516
octokit (~> 4.18)
1617
parallel (~> 1.14)
18+
plist (~> 3.1)
1719
progress_bar (~> 1.3)
1820
rake (>= 12.3, < 14.0)
1921
rake-compiler (~> 1.0)
@@ -23,7 +25,7 @@ GEM
2325
specs:
2426
CFPropertyList (3.0.5)
2527
rexml
26-
activesupport (5.2.8)
28+
activesupport (5.2.8.1)
2729
concurrent-ruby (~> 1.0, >= 1.0.2)
2830
i18n (>= 0.7, < 2)
2931
minitest (~> 5.1)
@@ -104,7 +106,7 @@ GEM
104106
highline (~> 2.0.0)
105107
concurrent-ruby (1.1.10)
106108
declarative (0.0.20)
107-
diffy (3.4.0)
109+
diffy (3.4.2)
108110
digest-crc (0.6.4)
109111
rake (>= 12.0.0, < 14.0.0)
110112
domain_name (0.5.20190701)
@@ -134,8 +136,8 @@ GEM
134136
faraday-em_synchrony (1.0.0)
135137
faraday-excon (1.1.0)
136138
faraday-httpclient (1.0.1)
137-
faraday-multipart (1.0.3)
138-
multipart-post (>= 1.2, < 3)
139+
faraday-multipart (1.0.4)
140+
multipart-post (~> 2)
139141
faraday-net_http (1.0.1)
140142
faraday-net_http_persistent (1.2.0)
141143
faraday-patron (1.0.0)
@@ -233,7 +235,7 @@ GEM
233235
http-cookie (1.0.4)
234236
domain_name (~> 0.5)
235237
httpclient (2.8.3)
236-
i18n (1.10.0)
238+
i18n (1.12.0)
237239
concurrent-ruby (~> 1.0)
238240
jmespath (1.6.1)
239241
json (2.6.1)
@@ -245,23 +247,23 @@ GEM
245247
mini_magick (4.11.0)
246248
mini_mime (1.1.2)
247249
mini_portile2 (2.8.0)
248-
minitest (5.15.0)
250+
minitest (5.16.2)
249251
molinillo (0.8.0)
250252
multi_json (1.15.0)
251253
multipart-post (2.0.0)
252254
nanaimo (0.3.0)
253255
nap (1.1.0)
254256
naturally (2.2.1)
255257
netrc (0.11.0)
256-
nokogiri (1.13.6)
258+
nokogiri (1.13.8)
257259
mini_portile2 (~> 2.8.0)
258260
racc (~> 1.4)
259-
nokogiri (1.13.6-x86_64-darwin)
261+
nokogiri (1.13.8-x86_64-darwin)
260262
racc (~> 1.4)
261-
octokit (4.23.0)
263+
octokit (4.25.1)
262264
faraday (>= 1, < 3)
263265
sawyer (~> 0.9)
264-
oj (3.13.13)
266+
oj (3.13.17)
265267
optimist (3.0.1)
266268
options (2.3.2)
267269
optparse (0.1.1)
@@ -306,7 +308,7 @@ GEM
306308
ruby-progressbar (1.11.0)
307309
ruby2_keywords (0.0.5)
308310
rubyzip (2.3.2)
309-
sawyer (0.9.1)
311+
sawyer (0.9.2)
310312
addressable (>= 2.3.5)
311313
faraday (>= 0.17.3, < 3)
312314
security (0.1.3)
@@ -328,7 +330,7 @@ GEM
328330
tty-cursor (~> 0.7)
329331
typhoeus (1.4.0)
330332
ethon (>= 0.9.0)
331-
tzinfo (1.2.9)
333+
tzinfo (1.2.10)
332334
thread_safe (~> 0.1)
333335
uber (0.1.0)
334336
unf (0.1.4)

Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ target 'WooCommerce' do
4242
pod 'Gridicons', '~> 1.2.0'
4343

4444
# To allow pod to pick up beta versions use -beta. E.g., 1.1.7-beta.1
45-
pod 'WordPressAuthenticator', '~> 2.0.1'
45+
pod 'WordPressAuthenticator', '~> 2.1.0-beta.3'
4646
# pod 'WordPressAuthenticator', :git => 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', :commit => ''
4747
# pod 'WordPressAuthenticator', :git => 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', :branch => ''
4848
# pod 'WordPressAuthenticator', :path => '../WordPressAuthenticator-iOS'

Podfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ PODS:
4242
- WordPress-Aztec-iOS (1.11.0)
4343
- WordPress-Editor-iOS (1.11.0):
4444
- WordPress-Aztec-iOS (= 1.11.0)
45-
- WordPressAuthenticator (2.0.1):
45+
- WordPressAuthenticator (2.1.0-beta.3):
4646
- Alamofire (~> 4.8)
4747
- CocoaLumberjack (~> 3.5)
4848
- GoogleSignIn (~> 6.0.1)
@@ -92,7 +92,7 @@ DEPENDENCIES:
9292
- Sourcery (~> 1.0.3)
9393
- StripeTerminal (~> 2.7)
9494
- WordPress-Editor-iOS (~> 1.11.0)
95-
- WordPressAuthenticator (~> 2.0.1)
95+
- WordPressAuthenticator (~> 2.1.0-beta.3)
9696
- WordPressKit (~> 4.49.0)
9797
- WordPressShared (~> 1.15)
9898
- WordPressUI (~> 1.12.5)
@@ -163,7 +163,7 @@ SPEC CHECKSUMS:
163163
UIDeviceIdentifier: af4e11e25a2ea670078e2bd677bb0e8144f9f063
164164
WordPress-Aztec-iOS: 050b34d4c3adfb7c60363849049b13d60683b348
165165
WordPress-Editor-iOS: 304098424f1051cb271546c99f906aac296b1b81
166-
WordPressAuthenticator: 7f41297c3ac33ff19a65cb84950c6260932e47c0
166+
WordPressAuthenticator: 5882d5ba6084a20c0e660950363e456162a11296
167167
WordPressKit: 96deb6ba37ea5eaec4ddcaa53eca04d653246152
168168
WordPressShared: 5477f179c7fe03b5d574f91adda66f67d131827e
169169
WordPressUI: c5be816f6c7b3392224ac21de9e521e89fa108ac
@@ -179,6 +179,6 @@ SPEC CHECKSUMS:
179179
ZendeskSupportProvidersSDK: 2bdf8544f7cd0fd4c002546f5704b813845beb2a
180180
ZendeskSupportSDK: 3a8e508ab1d9dd22dc038df6c694466414e037ba
181181

182-
PODFILE CHECKSUM: 3112ab60d6ff0779572bbc86e380a622138ccc64
182+
PODFILE CHECKSUM: 918b977da8de7fa51654420e8011f30808657095
183183

184184
COCOAPODS: 1.11.2

RELEASE-NOTES.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
*** PLEASE FOLLOW THIS FORMAT: [<priority indicator, more stars = higher priority>] <description> [<PR URL>]
22

3+
9.8
4+
-----
5+
- [***] Login: Introduce a way to sign in using store credentials. [https://github.com/woocommerce/woocommerce-ios/pull/7320]
6+
- [*] In-Person Payments: The purchase card reader information card appears also in the Orders list screen. [https://github.com/woocommerce/woocommerce-ios/pull/7326]
7+
38
9.7
4-
----
9+
-----
510
- [***] Orders: Orders can now be edited within the app. [https://github.com/woocommerce/woocommerce-ios/pull/7300]
11+
- [**] Orders: You can now view the Custom Fields for an order in the Order Details screen. [https://github.com/woocommerce/woocommerce-ios/pull/7310]
612
- [*] In-Person Payments: Card Reader Manuals now appear based on country availability, consolidated into an unique view [https://github.com/woocommerce/woocommerce-ios/pull/7178]
713
- [*] Login: Jetpack setup flow is now accessible from the Login with Store Address flow. [https://github.com/woocommerce/woocommerce-ios/pull/7294]
814
- [*] In-Person Payments: The purchase card reader information card can be dismissed [https://github.com/woocommerce/woocommerce-ios/pull/7260]
915
- [*] In-Person Payments: When dismissing the purchase card reader information card, the user can choose to be reminded in 14 days. [https://github.com/woocommerce/woocommerce-ios/pull/7271]
16+
- [*] In-Person Payments: The purchase card reader information card appears also in the App Settings screen. [https://github.com/woocommerce/woocommerce-ios/pull/7308]
1017
- [*] Refund lines in the Order details screen now appear ordered from oldest to newest [https://github.com/woocommerce/woocommerce-ios/pull/7287]
1118
- [*] Login: when the app is in logged out state, an onboarding screen is shown before the prologue screen if the user hasn't finished or skipped it. [https://github.com/woocommerce/woocommerce-ios/pull/7324]
12-
- [**] Orders: You can now view the Custom Fields for an order in the Order Details screen. [https://github.com/woocommerce/woocommerce-ios/pull/7310]
19+
- [*] Orders: When a store has no orders yet, there is an updated message with a link to learn more on the Orders tab. [https://github.com/woocommerce/woocommerce-ios/pull/7328]
1320

1421
9.6
1522
-----

WooCommerce/Classes/AppDelegate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
141141
)
142142

143143
// show this notification seconds from now
144-
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 1.5, repeats: false)
144+
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 3, repeats: false)
145145

146146
// choose a random identifier
147147
let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger)
@@ -421,7 +421,7 @@ extension AppDelegate {
421421

422422
extension AppDelegate: UNUserNotificationCenterDelegate {
423423
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async {
424-
await ServiceLocator.pushNotesManager.handleUserResponseToNotification(response: response)
424+
await ServiceLocator.pushNotesManager.handleUserResponseToNotification(response)
425425
}
426426

427427
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification) async -> UNNotificationPresentationOptions {

WooCommerce/Classes/Authentication/AuthenticationConstants.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ struct AuthenticationConstants {
2121
/// What is WordPress.com? link (Continue with WordPress.com)
2222
///
2323
static let whatIsWPComLinkTitle = NSLocalizedString(
24-
"_What is WordPress.com?_",
25-
comment: "Navigates to page with details about What is WordPress.com. The underscores _..._ denote underline."
24+
"What is WordPress.com?",
25+
comment: "Navigates to page with details about What is WordPress.com."
2626
)
2727

2828
/// Login with Jetpack instructions.
@@ -58,6 +58,13 @@ struct AuthenticationConstants {
5858
comment: "Button title. Takes the user to the login by store address flow."
5959
)
6060

61+
/// Title of "Sign in with store credentials" button
62+
//
63+
static let signInWithSiteCredsButtonTitle = NSLocalizedString(
64+
"Sign in with store credentials",
65+
comment: "Button title. Takes the user to the site credentials entry screen."
66+
)
67+
6168
/// Title of views in Unified Login
6269
//
6370
static let loginTitle = NSLocalizedString(

WooCommerce/Classes/Authentication/AuthenticationManager.swift

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ class AuthenticationManager: Authentication {
4545
enableSignInWithApple: true,
4646
enableSignupWithGoogle: false,
4747
enableUnifiedAuth: true,
48-
continueWithSiteAddressFirst: true)
48+
continueWithSiteAddressFirst: true,
49+
enableSiteCredentialsLoginForSelfHostedSites: true,
50+
isWPComLoginRequiredForSiteCredentialsLogin: true)
4951

5052
let systemGray3LightModeColor = UIColor(red: 199/255.0, green: 199/255.0, blue: 204/255.0, alpha: 1)
5153
let systemLabelLightModeColor = UIColor(red: 0, green: 0, blue: 0, alpha: 1)
@@ -85,6 +87,7 @@ class AuthenticationManager: Authentication {
8587
usernamePasswordInstructions: AuthenticationConstants.usernamePasswordInstructions,
8688
continueWithWPButtonTitle: AuthenticationConstants.continueWithWPButtonTitle,
8789
enterYourSiteAddressButtonTitle: AuthenticationConstants.enterYourSiteAddressButtonTitle,
90+
signInWithSiteCredentialsButtonTitle: AuthenticationConstants.signInWithSiteCredsButtonTitle,
8891
findSiteButtonTitle: AuthenticationConstants.findYourStoreAddressButtonTitle,
8992
signupTermsOfService: AuthenticationConstants.signupTermsOfService,
9093
whatIsWPComLinkTitle: AuthenticationConstants.whatIsWPComLinkTitle,
@@ -260,6 +263,15 @@ extension AuthenticationManager: WordPressAuthenticatorDelegate {
260263
/// Presents the Login Epilogue, in the specified NavigationController.
261264
///
262265
func presentLoginEpilogue(in navigationController: UINavigationController, for credentials: AuthenticatorCredentials, onDismiss: @escaping () -> Void) {
266+
let matcher = ULAccountMatcher()
267+
matcher.refreshStoredSites()
268+
269+
/// Jetpack is required. Present an error if we don't detect a valid installation for a self-hosted site.
270+
if let urlFromCredentials = credentials.wpcom?.siteURL ?? credentials.wporg?.siteURL,
271+
isJetpackValidForSelfHostedSite(url: urlFromCredentials) {
272+
return presentJetpackError(for: urlFromCredentials, with: credentials, in: navigationController, onDismiss: onDismiss)
273+
}
274+
263275
// We are currently supporting WPCom credentials only
264276
// Update this when handling store credentials authentication.
265277
guard let wpcomLogin = credentials.wpcom else {
@@ -270,16 +282,7 @@ extension AuthenticationManager: WordPressAuthenticatorDelegate {
270282
ServiceLocator.pushNotesManager.cancelLocalNotification(scenarios: [.loginSiteAddressError])
271283
}
272284

273-
let matcher = ULAccountMatcher()
274-
matcher.refreshStoredSites()
275-
276285
guard matcher.match(originalURL: wpcomLogin.siteURL) else {
277-
278-
/// Jetpack is required. Present an error if we don't detect a valid installation for a self-hosted site.
279-
if isJetpackValidForSelfHostedSite(url: wpcomLogin.siteURL) {
280-
return presentJetpackError(for: wpcomLogin.siteURL, with: credentials, in: navigationController, onDismiss: onDismiss)
281-
}
282-
283286
DDLogWarn("⚠️ Present account mismatch error for site: \(String(describing: credentials.wpcom?.siteURL))")
284287
let viewModel = WrongAccountErrorViewModel(siteURL: credentials.wpcom?.siteURL)
285288
let mismatchAccountUI = ULAccountMismatchViewController(viewModel: viewModel)
@@ -447,6 +450,7 @@ private extension AuthenticationManager {
447450
in navigationController: UINavigationController,
448451
onDismiss: @escaping () -> Void) {
449452
let viewModel = JetpackErrorViewModel(siteURL: siteURL, onJetpackSetupCompletion: { [weak self] in
453+
self?.currentSelfHostedSite = nil
450454
self?.presentLoginEpilogue(in: navigationController, for: credentials, onDismiss: onDismiss)
451455
})
452456
let installJetpackUI = ULErrorViewController(viewModel: viewModel)

WooCommerce/Classes/Notifications/PushNotificationsManager.swift

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ final class PushNotificationsManager: PushNotesManager {
4747

4848
/// An observable that emits values when a local notification is received.
4949
///
50-
var localNotificationResponses: AnyPublisher<UNNotificationResponse, Never> {
50+
var localNotificationUserResponses: AnyPublisher<UNNotificationResponse, Never> {
5151
localNotificationResponsesSubject.eraseToAnyPublisher()
5252
}
5353

@@ -268,27 +268,25 @@ extension PushNotificationsManager {
268268
}
269269

270270
@MainActor
271-
func handleUserResponseToNotification(response: UNNotificationResponse) async {
271+
func handleUserResponseToNotification(_ response: UNNotificationResponse) async {
272272
// Remote notification response is handled separately.
273273
if let notification = PushNotification.from(userInfo: response.notification.request.content.userInfo) {
274274
handleRemoteNotificationInAllAppStates(response.notification.request.content.userInfo)
275-
return await handleInactiveRemoteNotification(notification: notification)
275+
await handleInactiveRemoteNotification(notification: notification)
276276
} else {
277277
localNotificationResponsesSubject.send(response)
278278
}
279279
}
280280

281-
/// Handles a Notification while in Background Mode
282-
///
283-
/// - Parameters:
284-
/// - userInfo: The Notification's Payload
285-
/// - completionHandler: A callback, to be executed on completion
286-
///
287-
/// - Returns: True when handled. False otherwise
281+
/// Handles a remote notification while the app is in the background.
288282
///
283+
/// - Parameter userInfo: The notification's payload.
284+
/// - Returns: Whether there is any data fetched in the background.
289285
@MainActor
290286
func handleRemoteNotificationInTheBackground(userInfo: [AnyHashable: Any]) async -> UIBackgroundFetchResult {
291-
guard applicationState == .background, let _ = userInfo[APNSKey.identifier] else {
287+
guard applicationState == .background, // Proceeds only if the app is in background.
288+
let _ = userInfo[APNSKey.identifier] // Ensures that we are only processing a remote notification.
289+
else {
292290
return .noData
293291
}
294292

@@ -452,14 +450,9 @@ private extension PushNotificationsManager {
452450
_ = handleSupportNotification(userInfo)
453451
}
454452

455-
/// Handles a Remote Notification while in Inactive Mode
456-
///
457-
/// - Parameters:
458-
/// - userInfo: The Notification's Payload
459-
/// - completionHandler: A callback, to be executed on completion
460-
///
461-
/// - Returns: True when handled. False otherwise
453+
/// Handles a remote notification while the app is inactive.
462454
///
455+
/// - Parameter notification: Push notification content from a remote notification.
463456
func handleInactiveRemoteNotification(notification: PushNotification) async {
464457
guard applicationState == .inactive else {
465458
return

WooCommerce/Classes/ServiceLocator/PushNotesManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ protocol PushNotesManager {
2222

2323
/// An observable that emits values when a local notification response is received.
2424
///
25-
var localNotificationResponses: AnyPublisher<UNNotificationResponse, Never> { get }
25+
var localNotificationUserResponses: AnyPublisher<UNNotificationResponse, Never> { get }
2626

2727
/// Resets the Badge Count.
2828
///
@@ -73,7 +73,7 @@ protocol PushNotesManager {
7373

7474
/// Handles user's response to a local or remote notification.
7575
/// - Parameter response: The user's response to a notification.
76-
func handleUserResponseToNotification(response: UNNotificationResponse) async
76+
func handleUserResponseToNotification(_ response: UNNotificationResponse) async
7777

7878
/// Handles a local or remote notification when the app is in the foreground.
7979
///

WooCommerce/Classes/ViewModels/Feature Announcement Cards/FeatureAnnouncementCardViewModel.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class FeatureAnnouncementCardViewModel {
1616
config.message
1717
}
1818

19-
var buttonTitle: String {
19+
var buttonTitle: String? {
2020
config.buttonTitle
2121
}
2222

@@ -101,7 +101,7 @@ class FeatureAnnouncementCardViewModel {
101101
let campaign: FeatureAnnouncementCampaign
102102
let title: String
103103
let message: String
104-
let buttonTitle: String
104+
let buttonTitle: String?
105105
let image: UIImage
106106
let dismissAlertTitle: String
107107
let dismissAlertMessage: String

0 commit comments

Comments
 (0)