Skip to content

Commit cb38555

Browse files
authored
Merge branch 'trunk' into issue/8289-show-processing-directly-after-collect-payment
2 parents 2339ae5 + a19201e commit cb38555

File tree

44 files changed

+818
-237
lines changed

Some content is hidden

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

44 files changed

+818
-237
lines changed

Podfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ end
3535

3636
def wordpress_kit
3737
# To allow pod to pick up beta versions use -beta. E.g., 1.1.7-beta.1
38-
pod 'WordPressKit', '~> 4.49.0'
38+
pod 'WordPressKit', '~> 5.0.0'
3939
# pod 'WordPressKit', :git => 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', :branch => ''
4040
end
4141

@@ -71,12 +71,12 @@ target 'WooCommerce' do
7171
pod 'Gridicons', '~> 1.2.0'
7272

7373
# To allow pod to pick up beta versions use -beta. E.g., 1.1.7-beta.1
74-
pod 'WordPressAuthenticator', '~> 4.3.0'
75-
# pod 'WordPressAuthenticator', :git => 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', :commit => ''
74+
pod 'WordPressAuthenticator', '~> 5.0.0'
75+
# pod 'WordPressAuthenticator', :git => 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', :commit => ''
7676
# pod 'WordPressAuthenticator', :git => 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', :branch => ''
7777
# pod 'WordPressAuthenticator', :path => '../WordPressAuthenticator-iOS'
7878

79-
pod 'WordPressShared', '~> 1.15'
79+
pod 'WordPressShared', '~> 2.0-beta'
8080

8181
pod 'WordPressUI', '~> 1.12.5'
8282
# pod 'WordPressUI', :git => 'https://github.com/wordpress-mobile/WordPressUI-iOS.git', :branch => ''

Podfile.lock

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ PODS:
1515
- CocoaLumberjack/Core (3.7.4)
1616
- CocoaLumberjack/Swift (3.7.4):
1717
- CocoaLumberjack/Core
18-
- FormatterKit/Resources (1.9.0)
19-
- FormatterKit/TimeIntervalFormatter (1.9.0):
20-
- FormatterKit/Resources
2118
- GoogleSignIn (6.0.2):
2219
- AppAuth (~> 1.4)
2320
- GTMAppAuth (~> 1.0)
@@ -42,29 +39,25 @@ PODS:
4239
- WordPress-Aztec-iOS (1.11.0)
4340
- WordPress-Editor-iOS (1.11.0):
4441
- WordPress-Aztec-iOS (= 1.11.0)
45-
- WordPressAuthenticator (4.3.0):
46-
- CocoaLumberjack (~> 3.5)
42+
- WordPressAuthenticator (5.0.0):
4743
- GoogleSignIn (~> 6.0.1)
4844
- Gridicons (~> 1.0)
4945
- "NSURL+IDN (= 0.4)"
5046
- SVProgressHUD (~> 2.2.5)
51-
- WordPressKit (~> 4.18-beta)
52-
- WordPressShared (~> 1.12-beta)
47+
- WordPressKit (~> 5.0-beta)
48+
- WordPressShared (~> 2.0-beta)
5349
- WordPressUI (~> 1.7-beta)
54-
- WordPressKit (4.49.0):
50+
- WordPressKit (5.0.0):
5551
- Alamofire (~> 4.8.0)
56-
- CocoaLumberjack (~> 3.4)
5752
- NSObject-SafeExpectations (= 0.0.4)
5853
- UIDeviceIdentifier (~> 2.0)
59-
- WordPressShared (~> 1.15-beta)
54+
- WordPressShared (~> 2.0-beta)
6055
- wpxmlrpc (~> 0.9)
61-
- WordPressShared (1.16.1):
62-
- CocoaLumberjack (~> 3.4)
63-
- FormatterKit/TimeIntervalFormatter (~> 1.8)
56+
- WordPressShared (2.0.0-beta.2)
6457
- WordPressUI (1.12.5)
6558
- Wormholy (1.6.5)
6659
- WPMediaPicker (1.8.1)
67-
- wpxmlrpc (0.9.0)
60+
- wpxmlrpc (0.10.0)
6861
- XLPagerTabStrip (9.0.0)
6962
- ZendeskCommonUISDK (6.1.1)
7063
- ZendeskCoreSDK (2.5.1)
@@ -91,9 +84,9 @@ DEPENDENCIES:
9184
- Sourcery (~> 1.0.3)
9285
- StripeTerminal (~> 2.14)
9386
- WordPress-Editor-iOS (~> 1.11.0)
94-
- WordPressAuthenticator (~> 4.3.0)
95-
- WordPressKit (~> 4.49.0)
96-
- WordPressShared (~> 1.15)
87+
- WordPressAuthenticator (~> 5.0.0)
88+
- WordPressKit (~> 5.0.0)
89+
- WordPressShared (~> 2.0-beta)
9790
- WordPressUI (~> 1.12.5)
9891
- Wormholy (~> 1.6.5)
9992
- WPMediaPicker (~> 1.8.1)
@@ -108,7 +101,6 @@ SPEC REPOS:
108101
- AppAuth
109102
- Automattic-Tracks-iOS
110103
- CocoaLumberjack
111-
- FormatterKit
112104
- GoogleSignIn
113105
- Gridicons
114106
- GTMAppAuth
@@ -145,7 +137,6 @@ SPEC CHECKSUMS:
145137
AppAuth: 8fca6b5563a5baef2c04bee27538025e4ceb2add
146138
Automattic-Tracks-iOS: 63e55654f500b3e8fb35087e64575e00d12eb2f5
147139
CocoaLumberjack: 543c79c114dadc3b1aba95641d8738b06b05b646
148-
FormatterKit: 184db51bf120b633693a73624a4cede89ec51a41
149140
GoogleSignIn: fd381840dbe7c1137aa6dc30849a5c3e070c034a
150141
Gridicons: 4455b9f366960121430e45997e32112ae49ffe1d
151142
GTMAppAuth: 0ff230db599948a9ad7470ca667337803b3fc4dd
@@ -162,13 +153,13 @@ SPEC CHECKSUMS:
162153
UIDeviceIdentifier: af4e11e25a2ea670078e2bd677bb0e8144f9f063
163154
WordPress-Aztec-iOS: 050b34d4c3adfb7c60363849049b13d60683b348
164155
WordPress-Editor-iOS: 304098424f1051cb271546c99f906aac296b1b81
165-
WordPressAuthenticator: fd1084278edc077c48026c9080a1d9b0ca9c2304
166-
WordPressKit: 96deb6ba37ea5eaec4ddcaa53eca04d653246152
167-
WordPressShared: 5477f179c7fe03b5d574f91adda66f67d131827e
156+
WordPressAuthenticator: 0cdf1bff75bd3f58fe733d6457221f27bbbdc9f4
157+
WordPressKit: 202f529323b079a344f7bc1493b7ebebfd9ed4b5
158+
WordPressShared: 04403b43f821c4ed2b84a2112ef9f64f1e7cdceb
168159
WordPressUI: c5be816f6c7b3392224ac21de9e521e89fa108ac
169160
Wormholy: 3252bc3e55a1847ef9a0976c1377bd77bf3635fa
170161
WPMediaPicker: 9011a0ec1f468c039af7485c244576b4c9889a0f
171-
wpxmlrpc: bf55a43a7e710bd2a4fb8c02dfe83b1246f14f13
162+
wpxmlrpc: 68db063041e85d186db21f674adf08d9c70627fd
172163
XLPagerTabStrip: 61c57fd61f611ee5f01ff1495ad6fbee8bf496c5
173164
ZendeskCommonUISDK: 5808802951ad2bb424f0bed4259dc3c0ce9b52ec
174165
ZendeskCoreSDK: 19a18e5ef2edcb18f4dbc0ea0d12bd31f515712a
@@ -178,6 +169,6 @@ SPEC CHECKSUMS:
178169
ZendeskSupportProvidersSDK: 2bdf8544f7cd0fd4c002546f5704b813845beb2a
179170
ZendeskSupportSDK: 3a8e508ab1d9dd22dc038df6c694466414e037ba
180171

181-
PODFILE CHECKSUM: d57f522b14409f38c9fb733afac389ebebdb3ffd
172+
PODFILE CHECKSUM: 163bea8d6c3d10366ec3df45e35730da367abaa8
182173

183174
COCOAPODS: 1.11.3

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
11.6
44
-----
5+
- [***] We added a new Analytics Hub inside the My Store area of the app. Simply click on the See More button under the store stats to check more detailed information on Revenue, Orders and Products. [https://github.com/woocommerce/woocommerce-ios/pull/8356]
56
- [*] In-Person Payments: fixed timing issues in payments flow, which caused "Remove card" to be shown for too long [https://github.com/woocommerce/woocommerce-ios/pull/8351]
67

78
11.5

WooCommerce/Classes/Analytics/WooAnalyticsEvent.swift

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1773,3 +1773,31 @@ extension WooAnalyticsEvent {
17731773
}
17741774
}
17751775
}
1776+
1777+
// MARK: - Analytics Hub
1778+
//
1779+
extension WooAnalyticsEvent {
1780+
enum AnalyticsHub {
1781+
enum Keys: String {
1782+
case option
1783+
}
1784+
1785+
/// Tracks when the "See more" button is tapped in My Store, to open the Analytics Hub.
1786+
///
1787+
static func seeMoreAnalyticsTapped() -> WooAnalyticsEvent {
1788+
WooAnalyticsEvent(statName: .dashboardSeeMoreAnalyticsTapped, properties: [:])
1789+
}
1790+
1791+
/// Tracks when the date range selector button is tapped.
1792+
///
1793+
static func dateRangeButtonTapped() -> WooAnalyticsEvent {
1794+
WooAnalyticsEvent(statName: .analyticsHubDateRangeButtonTapped, properties: [:])
1795+
}
1796+
1797+
/// Tracks when a date range option is selected like “today”, “yesterday”, or “custom”.
1798+
///
1799+
static func dateRangeOptionSelected(_ option: String) -> WooAnalyticsEvent {
1800+
WooAnalyticsEvent(statName: .analyticsHubDateRangeOptionSelected, properties: [Keys.option.rawValue: option])
1801+
}
1802+
}
1803+
}

WooCommerce/Classes/Analytics/WooAnalyticsStat.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ public enum WooAnalyticsStat: String {
130130
case dashboardPulledToRefresh = "dashboard_pulled_to_refresh"
131131
case dashboardNewOrdersButtonTapped = "dashboard_unfulfilled_orders_button_tapped"
132132
case dashboardShareStoreButtonTapped = "dashboard_share_your_store_button_tapped"
133+
case dashboardSeeMoreAnalyticsTapped = "dashboard_see_more_analytics_tapped"
133134

134135
// MARK: Dashboard Data/Action Events
135136
//
@@ -149,6 +150,11 @@ public enum WooAnalyticsStat: String {
149150
case dashboardNewStatsRevertedBannerLearnMoreTapped = "dashboard_new_stats_reverted_banner_learn_more_tapped"
150151
case usedAnalytics = "used_analytics"
151152

153+
// MARK: Analytics Hub Events
154+
//
155+
case analyticsHubDateRangeButtonTapped = "analytics_hub_date_range_button_tapped"
156+
case analyticsHubDateRangeOptionSelected = "analytics_hub_date_range_option_selected"
157+
152158
// MARK: Products Onboarding Events
153159
//
154160
case productsOnboardingEligible = "products_onboarding_store_is_eligible"

WooCommerce/Classes/AppDelegate.swift

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
5454
// Setup Components
5555
setupAnalytics()
5656
setupCocoaLumberjack()
57+
setupLibraryLogger()
5758
setupLogLevel(.verbose)
5859
setupPushNotificationsManagerIfPossible()
5960
setupAppRatingManager()
@@ -276,12 +277,19 @@ private extension AppDelegate {
276277
DDLog.add(logger)
277278
}
278279

279-
/// Sets up the current Log Leve.
280+
/// Sets up loggers for WordPress libraries
281+
///
282+
func setupLibraryLogger() {
283+
let logger = ServiceLocator.wordPressLibraryLogger
284+
WPSharedSetLoggingDelegate(logger)
285+
WPAuthenticatorSetLoggingDelegate(logger)
286+
WPKitSetLoggingDelegate(logger)
287+
}
288+
289+
/// Sets up the current Log Level.
280290
///
281291
func setupLogLevel(_ level: DDLogLevel) {
282-
WPSharedSetLoggingLevel(level)
283-
WPAuthenticatorSetLoggingLevel(level)
284-
WPKitSetLoggingLevel(level)
292+
CocoaLumberjack.dynamicLogLevel = level
285293
}
286294

287295
/// Setup: Notice Presenter
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import Foundation
2+
import Yosemite
3+
4+
enum JustInTimeMessagesSourceScreen {
5+
case dashboard
6+
}
7+
8+
/// Provides the Just in Time Messages content for a given source screen and site. It also tracks the requests success or error.
9+
///
10+
final class JustInTimeMessagesProvider {
11+
private let stores: StoresManager
12+
private let analytics: Analytics
13+
private let appScreenJitmSourceMapping: [JustInTimeMessagesSourceScreen: String] = [.dashboard: "my_store"]
14+
15+
init(stores: StoresManager = ServiceLocator.stores,
16+
analytics: Analytics = ServiceLocator.analytics) {
17+
self.stores = stores
18+
self.analytics = analytics
19+
}
20+
21+
func loadMessage(for screen: JustInTimeMessagesSourceScreen, siteID: Int64) async throws -> JustInTimeMessageAnnouncementCardViewModel? {
22+
guard let source = appScreenJitmSourceMapping[screen] else {
23+
DDLogInfo("Could not load JITM for \(screen) because there is no mapping for the given screen")
24+
return nil
25+
}
26+
27+
return try await withCheckedThrowingContinuation { continuation in
28+
let action = JustInTimeMessageAction.loadMessage(
29+
siteID: siteID,
30+
screen: source,
31+
hook: .adminNotices) { [weak self] result in
32+
guard let self = self else { return }
33+
switch result {
34+
case let .success(messages):
35+
guard let message = messages.first else {
36+
return continuation.resume(returning: nil)
37+
}
38+
self.analytics.track(event:
39+
.JustInTimeMessage.fetchSuccess(source: source,
40+
messageID: message.messageID,
41+
count: Int64(messages.count)))
42+
let viewModel = JustInTimeMessageAnnouncementCardViewModel(
43+
justInTimeMessage: message,
44+
screenName: source,
45+
siteID: siteID)
46+
continuation.resume(returning: viewModel)
47+
case let .failure(error):
48+
self.analytics.track(event:
49+
.JustInTimeMessage.fetchFailure(source: source,
50+
error: error))
51+
continuation.resume(throwing: error)
52+
}
53+
}
54+
Task { @MainActor in
55+
stores.dispatch(action)
56+
}
57+
}
58+
}
59+
}

WooCommerce/Classes/ServiceLocator/ServiceLocator.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Storage
55
import Yosemite
66
import Hardware
77
import WooFoundation
8+
import WordPressShared
89

910
/// Provides global dependencies.
1011
///
@@ -179,6 +180,9 @@ final class ServiceLocator {
179180
return _fileLogger
180181
}
181182

183+
/// Provides an instance of `WordPressLoggingDelegate` for logging in WordPress libraries.
184+
static let wordPressLibraryLogger: WordPressLoggingDelegate = WordPressLibraryLogger()
185+
182186
/// Provides the access point to the CrashLogger
183187
/// - Returns: An implementation
184188
static var crashLogging: CrashLoggingStack {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import CocoaLumberjack
2+
import WordPressShared
3+
4+
class WordPressLibraryLogger: NSObject, WordPressLoggingDelegate {
5+
6+
func logError(_ str: String) {
7+
DDLogError(str)
8+
}
9+
10+
func logWarning(_ str: String) {
11+
DDLogWarn(str)
12+
}
13+
14+
func logInfo(_ str: String) {
15+
DDLogInfo(str)
16+
}
17+
18+
func logDebug(_ str: String) {
19+
DDLogDebug(str)
20+
}
21+
22+
func logVerbose(_ str: String) {
23+
DDLogVerbose(str)
24+
}
25+
}

WooCommerce/Classes/ViewModels/CardPresentPayments/CardPresentModalScanningForReader.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ final class CardPresentModalScanningForReader: CardPresentPaymentsModalViewModel
2121

2222
let auxiliaryButtonTitle: String? = nil
2323

24-
let auxiliaryButtonimage: UIImage? = .infoOutlineImage
25-
2624
var auxiliaryAttributedButtonTitle: NSAttributedString? {
2725
let result = NSMutableAttributedString(
2826
string: .localizedStringWithFormat(

0 commit comments

Comments
 (0)