Skip to content

Commit e00f90d

Browse files
committed
Merge branch 'develop' into issue/250-tracking-ui
2 parents 40da842 + 4dae65a commit e00f90d

Some content is hidden

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

41 files changed

+1110
-292
lines changed

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
1.4
22
-----
33
- improvement: Add shipment tracking to Order Details screen
4+
- bugfix: correctly flips chevron on Dashboard > New Orders, to support RTL languages.
45

56
1.3
67
-----

WooCommerce/Classes/Analytics/WooAnalytics.swift

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,25 @@ private extension WooAnalytics {
148148
return
149149
}
150150

151-
NotificationCenter.default.addObserver(self, selector: #selector(trackApplicationOpened), name: UIApplication.didBecomeActiveNotification, object: nil)
152-
NotificationCenter.default.addObserver(self, selector: #selector(trackApplicationClosed), name: UIApplication.didEnterBackgroundNotification, object: nil)
151+
NotificationCenter.default.addObserver(self,
152+
selector: #selector(trackApplicationOpened),
153+
name: UIApplication.didBecomeActiveNotification,
154+
object: nil)
155+
156+
NotificationCenter.default.addObserver(self,
157+
selector: #selector(trackApplicationClosed),
158+
name: UIApplication.didEnterBackgroundNotification,
159+
object: nil)
153160
}
154161

155162
func stopObservingNotifications() {
156-
NotificationCenter.default.removeObserver(self, name: UIApplication.didBecomeActiveNotification, object: nil)
157-
NotificationCenter.default.removeObserver(self, name: UIApplication.didEnterBackgroundNotification, object: nil)
163+
NotificationCenter.default.removeObserver(self,
164+
name: UIApplication.didBecomeActiveNotification,
165+
object: nil)
166+
167+
NotificationCenter.default.removeObserver(self,
168+
name: UIApplication.didEnterBackgroundNotification,
169+
object: nil)
158170
}
159171

160172
@objc func trackApplicationOpened() {

WooCommerce/Classes/AppDelegate.swift

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,23 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
116116
pushNotesManager.registrationDidFail(with: error)
117117
}
118118

119-
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
119+
func application(_ application: UIApplication,
120+
didReceiveRemoteNotification userInfo: [AnyHashable: Any],
121+
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
120122
pushNotesManager.handleNotification(userInfo, completionHandler: completionHandler)
121123
}
122124

123125
func applicationWillResignActive(_ application: UIApplication) {
124-
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
125-
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
126+
// Sent when the application is about to move from active to inactive state.
127+
// This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message)
128+
// or when the user quits the application and it begins the transition to the background state.
129+
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks.
130+
// Games should use this method to pause the game.
126131
}
127132

128133
func applicationDidEnterBackground(_ application: UIApplication) {
129-
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
134+
// Use this method to release shared resources, save user data, invalidate timers,
135+
// and store enough application state information to restore your application to its current state in case it is terminated later.
130136
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
131137
}
132138

@@ -135,7 +141,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
135141
}
136142

137143
func applicationDidBecomeActive(_ application: UIApplication) {
138-
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
144+
// Restart any tasks that were paused (or not yet started) while the application was inactive.
145+
// If the application was previously in the background, optionally refresh the user interface.
139146

140147
RequirementsChecker.checkMinimumWooVersionForDefaultStore()
141148
}

WooCommerce/Classes/Authentication/AuthenticationConstants.swift

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,22 @@ struct AuthenticationConstants {
66

77
/// Email login instructions.
88
///
9-
static let emailInstructions = NSLocalizedString("Log in with your WordPress.com account email address to manage your WooCommerce stores.", comment: "Sign in instructions on the 'log in using email' screen.")
9+
static let emailInstructions = NSLocalizedString(
10+
"Log in with your WordPress.com account email address to manage your WooCommerce stores.",
11+
comment: "Sign in instructions on the 'log in using email' screen."
12+
)
1013

1114
/// Login with Jetpack instructions.
1215
///
13-
static let jetpackInstructions = NSLocalizedString("Log in with your WordPress.com account email address to manage your WooCommerce stores.", comment: "Sign in instructions on the 'log in using email' screen.")
16+
static let jetpackInstructions = NSLocalizedString(
17+
"Log in with your WordPress.com account email address to manage your WooCommerce stores.",
18+
comment: "Sign in instructions on the 'log in using email' screen."
19+
)
1420

1521
/// Login with site URL instructions.
1622
///
17-
static let siteInstructions = NSLocalizedString("Enter the address of your WooCommerce store you'd like to connect.", comment: "Sign in instructions for logging in with a URL.")
23+
static let siteInstructions = NSLocalizedString(
24+
"Enter the address of your WooCommerce store you'd like to connect.",
25+
comment: "Sign in instructions for logging in with a URL."
26+
)
1827
}

WooCommerce/Classes/Authentication/Epilogue/StorePickerViewController.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,13 @@ private extension StorePickerViewController {
314314
/// Displays the Error Notice for the version check.
315315
///
316316
func displayVersionCheckErrorNotice(siteID: Int, siteName: String) {
317-
let message = String.localizedStringWithFormat(NSLocalizedString("Unable to successfully connect to %@",
318-
comment: "On the site picker screen, the error displayed when connecting to a site fails. It reads: Unable to successfully connect to {site name}"), siteName)
317+
let message = String.localizedStringWithFormat(
318+
NSLocalizedString(
319+
"Unable to successfully connect to %@",
320+
comment: "On the site picker screen, the error displayed when connecting to a site fails. It reads: Unable to successfully connect to {site name}"
321+
),
322+
siteName
323+
)
319324
let actionTitle = NSLocalizedString("Retry", comment: "Retry Action")
320325
let notice = Notice(title: message, feedbackType: .error, actionTitle: actionTitle) { [weak self] in
321326
self?.displaySiteWCRequirementWarningIfNeeded(siteID: siteID, siteName: siteName)

WooCommerce/Classes/Authentication/Prologue/LoginPrologueViewController.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,10 @@ private extension LoginPrologueViewController {
152152
/// Returns the Disclaimer Attributed Text (which contains a link to the Jetpack Setup URL).
153153
///
154154
var disclaimerAttributedText: NSAttributedString {
155-
let disclaimerText = NSLocalizedString("This app requires Jetpack to connect to your Store. <br /> Read the <a href=\"https://jetpack.com/support/getting-started-with-jetpack/\">configuration instructions</a>.", comment: "Login Disclaimer Text and Jetpack config instructions. It reads: 'This app requires Jetpack to connect to your Store. Read the configuration instructions.' and it links to a web page on the words 'configuration instructions'. Place the second sentence after the `<br />` tag. Place the noun, 'configuration instructions' between the opening `<a` tag and the closing `</a>` tags. If a literal translation of 'Read the configuration instructions' does not make sense in your language, please use a contextually appropriate substitution. For example, you can translate it to say 'See: instructions' or any alternative that sounds natural in your language.")
155+
let disclaimerText = NSLocalizedString(
156+
"This app requires Jetpack to connect to your Store. <br /> Read the <a href=\"https://jetpack.com/support/getting-started-with-jetpack/\">configuration instructions</a>.",
157+
comment: "Login Disclaimer Text and Jetpack config instructions. It reads: 'This app requires Jetpack to connect to your Store. Read the configuration instructions.' and it links to a web page on the words 'configuration instructions'. Place the second sentence after the `<br />` tag. Place the noun, 'configuration instructions' between the opening `<a` tag and the closing `</a>` tags. If a literal translation of 'Read the configuration instructions' does not make sense in your language, please use a contextually appropriate substitution. For example, you can translate it to say 'See: instructions' or any alternative that sounds natural in your language."
158+
)
156159
let disclaimerAttributes: [NSAttributedString.Key: Any] = [
157160
.font: UIFont.font(forStyle: .caption1, weight: .thin),
158161
.foregroundColor: UIColor.white

WooCommerce/Classes/Extensions/Date+Woo.swift

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,29 @@ extension Date {
7272
private extension Date {
7373

7474
enum Strings {
75-
static let presentDeicticExpression = NSLocalizedString("Updated moments ago", comment: "Deictic expression for a data update that occurred in the very recent past - similar to 'Updated just now'")
76-
static let singularMinuteUpdateStatment = NSLocalizedString("Updated %ld minute ago", comment: "Singular of 'minute' — date and time string that represents the time interval since last data update when exactly 1 minute ago. Usage example: Updated 1 minute ago")
77-
static let pluralMinuteUpdateStatment = NSLocalizedString("Updated %ld minutes ago", comment: "Plural of 'minute' — date and time string that represents the time interval since last data update when greater than 1 minute ago. Usage example: Updated 55 minutes ago")
78-
static let singularHourUpdateStatment = NSLocalizedString("Updated %ld hour ago", comment: "Singular of 'hour' — date and time string that represents the time interval since last data update when exactly 1 hour ago. Usage example: Updated 1 hour ago")
79-
static let pluralHourUpdateStatment = NSLocalizedString("Updated %ld hours ago", comment: "Plural of 'hour' — date and time string that represents the time interval since last data update when greater than 1 hour ago. Usage example: Updated 14 hours ago")
80-
static let longFormUpdateStatement = NSLocalizedString("Updated on %@", comment: "A specific date and time string which represents when the data was last updated. Usage example: Updated on Jan 22, 2019 3:31PM")
75+
static let presentDeicticExpression = NSLocalizedString(
76+
"Updated moments ago",
77+
comment: "Deictic expression for a data update that occurred in the very recent past - similar to 'Updated just now'"
78+
)
79+
static let singularMinuteUpdateStatment = NSLocalizedString(
80+
"Updated %ld minute ago",
81+
comment: "Singular of 'minute' — date and time string that represents the time interval since last data update when exactly 1 minute ago. Usage example: Updated 1 minute ago"
82+
)
83+
static let pluralMinuteUpdateStatment = NSLocalizedString(
84+
"Updated %ld minutes ago",
85+
comment: "Plural of 'minute' — date and time string that represents the time interval since last data update when greater than 1 minute ago. Usage example: Updated 55 minutes ago"
86+
)
87+
static let singularHourUpdateStatment = NSLocalizedString(
88+
"Updated %ld hour ago",
89+
comment: "Singular of 'hour' — date and time string that represents the time interval since last data update when exactly 1 hour ago. Usage example: Updated 1 hour ago"
90+
)
91+
static let pluralHourUpdateStatment = NSLocalizedString(
92+
"Updated %ld hours ago",
93+
comment: "Plural of 'hour' — date and time string that represents the time interval since last data update when greater than 1 hour ago. Usage example: Updated 14 hours ago"
94+
)
95+
static let longFormUpdateStatement = NSLocalizedString(
96+
"Updated on %@",
97+
comment: "A specific date and time string which represents when the data was last updated. Usage example: Updated on Jan 22, 2019 3:31PM"
98+
)
8199
}
82100
}

WooCommerce/Classes/Extensions/String+HTML.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ extension String {
3131
var htmlToAttributedString: NSAttributedString {
3232
guard let data = data(using: .utf8) else { return NSAttributedString() }
3333
do {
34-
return try NSAttributedString(data: data, options: [.documentType: NSAttributedString.DocumentType.html, .characterEncoding: String.Encoding.utf8.rawValue], documentAttributes: nil)
34+
return try NSAttributedString(data: data,
35+
options: [.documentType: NSAttributedString.DocumentType.html,
36+
.characterEncoding: String.Encoding.utf8.rawValue],
37+
documentAttributes: nil)
3538
} catch {
3639
DDLogError("Error: unable to convert HTML data to an attributed string")
3740
return NSAttributedString()

WooCommerce/Classes/Tools/Currency/CurrencyFormatter.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public class CurrencyFormatter {
9595
/// For our purposes here, a "small number" is anything in-between -1000 and 1000 (exclusive).
9696
///
9797
/// - Note: This func leverages the formatter from our `NSDecimalNumber` extension.
98-
/// See: [NSDecimalNumber+Helpers.swift](https://github.com/woocommerce/woocommerce-ios/blob/develop/WooCommerce/Classes/Extensions/NSDecimalNumber%2BHelpers.swift) for more details.
98+
/// See: `NSDecimalNumber+Helpers.swift` for more details.
9999
///
100100
/// Examples with currency code of "USD" (`roundSmallNumbers` is set to `true`):
101101
/// - 0 becomes "$0"
@@ -113,7 +113,9 @@ public class CurrencyFormatter {
113113
/// - 1000 becomes "$1.0k"
114114
/// - 5800199.56 becomes "$5.8m"
115115
///
116-
func formatHumanReadableAmount(_ amount: String, with currency: String = CurrencySettings.shared.currencyCode.rawValue, roundSmallNumbers: Bool = true) -> String? {
116+
func formatHumanReadableAmount(_ amount: String,
117+
with currency: String = CurrencySettings.shared.currencyCode.rawValue,
118+
roundSmallNumbers: Bool = true) -> String? {
117119
guard let decimalAmount = convertToDecimal(from: amount) else {
118120
return nil
119121
}

WooCommerce/Classes/Tools/Currency/CurrencySettings.swift

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,58 @@ public class CurrencySettings {
1414
/// The 3-letter country code for supported currencies
1515
///
1616
public enum CurrencyCode: String, CaseIterable {
17-
case AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTC, BTN, BWP, BYR, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CUC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GGP, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, IMP, INR, IQD, IRR, IRT, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRO, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PRB, PYG, QAR, RMB, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STD, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VEF, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW
17+
// A
18+
case AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN,
19+
// B
20+
BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTC, BTN, BWP, BYR, BYN, BZD,
21+
// C
22+
CAD, CDF, CHF, CLP, CNY, COP, CRC, CUC, CUP, CVE, CZK,
23+
// D
24+
DJF, DKK, DOP, DZD,
25+
// E
26+
EGP, ERN, ETB, EUR, FJD,
27+
// F
28+
FKP,
29+
// G
30+
GBP, GEL, GGP, GHS, GIP, GMD, GNF, GTQ, GYD,
31+
// H
32+
HKD, HNL, HRK, HTG, HUF,
33+
// I
34+
IDR, ILS, IMP, INR, IQD, IRR, IRT, ISK,
35+
// J
36+
JEP, JMD, JOD, JPY,
37+
// K
38+
KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT,
39+
// L
40+
LAK, LBP, LKR, LRD, LSL, LYD,
41+
// M
42+
MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRO, MUR, MVR, MWK, MXN, MYR, MZN,
43+
// N
44+
NAD, NGN, NIO, NOK, NPR, NZD,
45+
// O
46+
OMR,
47+
// P
48+
PAB, PEN, PGK, PHP, PKR, PLN, PRB, PYG,
49+
// Q
50+
QAR,
51+
// R
52+
RMB, RON, RSD, RUB, RWF,
53+
// S
54+
SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STD, SYP, SZL,
55+
// T
56+
THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS,
57+
// U
58+
UAH, UGX, USD, UYU, UZS,
59+
// V
60+
VEF, VND, VUV,
61+
// W
62+
WST,
63+
// X
64+
XAF, XCD, XOF, XPF,
65+
// Y
66+
YER,
67+
// Z
68+
ZAR, ZMW
1869
}
1970

2071
/// Designates where the currency symbol is located on a formatted price

0 commit comments

Comments
 (0)