Skip to content

Commit 05c4673

Browse files
committed
Merge branch 'trunk' into task/jp-shared-keychain
2 parents 3e47941 + f401fbe commit 05c4673

39 files changed

Lines changed: 477 additions & 121 deletions

.buildkite/commands/run-ui-tests.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ IOS_VERSION=$3
66

77
echo "Running $TEST_NAME on $DEVICE for iOS $IOS_VERSION"
88

9+
# Run this at the start to fail early if value not available
10+
echo '--- :test-analytics: Configuring Test Analytics'
11+
if [[ $DEVICE =~ ^iPhone ]]; then
12+
export BUILDKITE_ANALYTICS_TOKEN=$BUILDKITE_ANALYTICS_TOKEN_UI_TESTS_IPHONE
13+
else
14+
export BUILDKITE_ANALYTICS_TOKEN=$BUILDKITE_ANALYTICS_TOKEN_UI_TESTS_IPAD
15+
fi
16+
917
echo "--- 📦 Downloading Build Artifacts"
1018
download_artifact build-products.tar
1119
tar -xf build-products.tar

.buildkite/commands/run-unit-tests.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/bin/bash -eu
22

3+
# Run this at the start to fail early if value not available
4+
echo '--- :test-analytics: Configuring Test Analytics'
5+
export BUILDKITE_ANALYTICS_TOKEN=$BUILDKITE_ANALYTICS_TOKEN_UNIT_TESTS
6+
37
echo "--- 📦 Downloading Build Artifacts"
48
download_artifact build-products.tar
59
tar -xf build-products.tar

RELEASE-NOTES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
20.6
22
-----
33
* [*] [Jetpack-only] Recommend App: you can now share the Jetpack app with your friends. [#19174]
4+
* [*] [Jetpack-only] Feature Announcements: new features are highlighted via the What's New modals. [#19176]
5+
* [*] Pages List: Fixed an issue where the app would freeze when opening the pages list if one of the featured images is a GIF. [#19184]
46

57

68
20.5

WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WordPress/Classes/Networking/MediaHost+Blog.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ extension MediaHost {
99
}
1010

1111
init(with blog: Blog, failure: (BlogError) -> ()) {
12+
let isAtomic = blog.isAtomic()
13+
self.init(with: blog, isAtomic: isAtomic, failure: failure)
14+
}
15+
16+
init(with blog: Blog, isAtomic: Bool, failure: (BlogError) -> ()) {
1217
self.init(isAccessibleThroughWPCom: blog.isAccessibleThroughWPCom(),
1318
isPrivate: blog.isPrivate(),
14-
isAtomic: blog.isAtomic(),
19+
isAtomic: isAtomic,
1520
siteID: blog.dotComID?.intValue,
1621
username: blog.usernameForSite,
1722
authToken: blog.authToken,

WordPress/Classes/Stores/UserPersistentRepository.swift

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
protocol UserPersistentRepositoryReader {
2-
2+
func object(forKey key: String) -> Any?
3+
func string(forKey key: String) -> String?
4+
func bool(forKey key: String) -> Bool
5+
func integer(forKey key: String) -> Int
6+
func float(forKey key: String) -> Float
7+
func double(forKey key: String) -> Double
8+
func array(forKey key: String) -> [Any]?
9+
func dictionary(forKey key: String) -> [String: Any]?
310
}
411

512
protocol UserPersistentRepositoryWriter {
6-
func set(_ value: Any?, forKey defaultName: String)
7-
func set(_ value: Int, forKey defaultName: String)
8-
func set(_ value: Float, forKey defaultName: String)
9-
func set(_ value: Double, forKey defaultName: String)
10-
func set(_ value: Bool, forKey defaultName: String)
11-
func set(_ url: URL?, forKey defaultName: String)
13+
func set(_ value: Any?, forKey key: String)
14+
func set(_ value: Int, forKey key: String)
15+
func set(_ value: Float, forKey key: String)
16+
func set(_ value: Double, forKey key: String)
17+
func set(_ value: Bool, forKey key: String)
18+
func set(_ url: URL?, forKey key: String)
19+
func removeObject(forKey key: String)
1220
}
1321

1422
typealias UserPersistentRepository = UserPersistentRepositoryReader & UserPersistentRepositoryWriter
Lines changed: 91 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class UserPersistentStore: UserPersistentRepository {
2-
static let standard = UserPersistentStore(defaultsSuiteName: defaultsSuiteName)
3-
private static let defaultsSuiteName = "temporary.suite.name" // TBD
2+
static let standard = UserPersistentStore(defaultsSuiteName: defaultsSuiteName)!
3+
private static let defaultsSuiteName = WPAppGroupName // TBD
44

55
private let userDefaults: UserDefaults
66

@@ -11,28 +11,104 @@ class UserPersistentStore: UserPersistentRepository {
1111
userDefaults = suiteDefaults
1212
}
1313

14-
// MARK: - UserePersistentRepositoryWriter
15-
func set(_ value: Any?, forKey defaultName: String) {
16-
userDefaults.set(value, forKey: defaultName)
14+
// MARK: - UserPeresistentRepositoryReader
15+
func object(forKey key: String) -> Any? {
16+
if let object = userDefaults.object(forKey: key) {
17+
return object
18+
}
19+
20+
return UserDefaults.standard.object(forKey: key)
21+
}
22+
23+
func string(forKey key: String) -> String? {
24+
if let string = userDefaults.string(forKey: key) {
25+
return string
26+
}
27+
28+
return UserDefaults.standard.string(forKey: key)
29+
}
30+
31+
func bool(forKey key: String) -> Bool {
32+
userDefaults.bool(forKey: key) || UserDefaults.standard.bool(forKey: key)
33+
}
34+
35+
func integer(forKey key: String) -> Int {
36+
let suiteValue = userDefaults.integer(forKey: key)
37+
if suiteValue != 0 {
38+
return suiteValue
39+
}
40+
41+
return UserDefaults.standard.integer(forKey: key)
42+
}
43+
44+
func float(forKey key: String) -> Float {
45+
let suiteValue = userDefaults.float(forKey: key)
46+
if suiteValue != 0 {
47+
return suiteValue
48+
}
49+
50+
return UserDefaults.standard.float(forKey: key)
51+
}
52+
53+
func double(forKey key: String) -> Double {
54+
let suiteValue = userDefaults.double(forKey: key)
55+
if suiteValue != 0 {
56+
return suiteValue
57+
}
58+
59+
return UserDefaults.standard.double(forKey: key)
60+
}
61+
62+
func array(forKey key: String) -> [Any]? {
63+
let suiteValue = userDefaults.array(forKey: key)
64+
if suiteValue != nil {
65+
return suiteValue
66+
}
67+
68+
return UserDefaults.standard.array(forKey: key)
69+
}
70+
71+
func dictionary(forKey key: String) -> [String: Any]? {
72+
let suiteValue = userDefaults.dictionary(forKey: key)
73+
if suiteValue != nil {
74+
return suiteValue
75+
}
76+
77+
return UserDefaults.standard.dictionary(forKey: key)
78+
}
79+
80+
// MARK: - UserPersistentRepositoryWriter
81+
func set(_ value: Any?, forKey key: String) {
82+
userDefaults.set(value, forKey: key)
83+
UserDefaults.standard.removeObject(forKey: key)
84+
}
85+
86+
func set(_ value: Int, forKey key: String) {
87+
userDefaults.set(value, forKey: key)
88+
UserDefaults.standard.removeObject(forKey: key)
1789
}
1890

19-
func set(_ value: Int, forKey defaultName: String) {
20-
userDefaults.set(value, forKey: defaultName)
91+
func set(_ value: Float, forKey key: String) {
92+
userDefaults.set(value, forKey: key)
93+
UserDefaults.standard.removeObject(forKey: key)
2194
}
2295

23-
func set(_ value: Float, forKey defaultName: String) {
24-
userDefaults.set(value, forKey: defaultName)
96+
func set(_ value: Double, forKey key: String) {
97+
userDefaults.set(value, forKey: key)
98+
UserDefaults.standard.removeObject(forKey: key)
2599
}
26100

27-
func set(_ value: Double, forKey defaultName: String) {
28-
userDefaults.set(value, forKey: defaultName)
101+
func set(_ value: Bool, forKey key: String) {
102+
userDefaults.set(value, forKey: key)
103+
UserDefaults.standard.removeObject(forKey: key)
29104
}
30105

31-
func set(_ value: Bool, forKey defaultName: String) {
32-
userDefaults.set(value, forKey: defaultName)
106+
func set(_ url: URL?, forKey key: String) {
107+
userDefaults.set(url, forKey: key)
108+
UserDefaults.standard.removeObject(forKey: key)
33109
}
34110

35-
func set(_ url: URL?, forKey defaultName: String) {
36-
userDefaults.set(url, forKey: defaultName)
111+
func removeObject(forKey key: String) {
112+
userDefaults.removeObject(forKey: key)
37113
}
38114
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import Foundation
2+
3+
final class UserPersistentStoreFactory {
4+
static func instance() -> UserPersistentRepository {
5+
FeatureFlag.sharedUserDefaults.enabled ? UserPersistentStore.standard : UserDefaults.standard
6+
}
7+
}

WordPress/Classes/Utility/App Configuration/AppConstants.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import WordPressAuthenticator
99
static let productBlogDisplayURL = "blog.wordpress.com"
1010
static let zendeskSourcePlatform = "mobile_-_ios"
1111
static let shareAppName: ShareAppName = .wordpress
12+
static let mobileAnnounceAppId = "2"
1213
@objc static let eventNamePrefix = "wpios"
1314

1415
/// Notifications Constants
@@ -41,6 +42,7 @@ extension AppConstants {
4142
struct Settings {
4243
static let aboutTitle: String = NSLocalizedString("About WordPress", comment: "Link to About screen for WordPress for iOS")
4344
static let shareButtonTitle = NSLocalizedString("Share WordPress with a friend", comment: "Title for a button that recommends the app to others")
45+
static let whatIsNewTitle = NSLocalizedString("What's New in WordPress", comment: "Opens the What's New / Feature Announcement modal")
4446
}
4547

4648
struct Login {

WordPress/Classes/Utility/BuildInformation/FeatureFlag.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ enum FeatureFlag: Int, CaseIterable, OverrideableFlag {
3232
case featureHighlightTooltip
3333
case jetpackPowered
3434
case jetpackPoweredBottomSheet
35+
case sharedUserDefaults
3536
case sharedLogin
3637

3738
/// Returns a boolean indicating if the feature is enabled
@@ -105,6 +106,8 @@ enum FeatureFlag: Int, CaseIterable, OverrideableFlag {
105106
return true
106107
case .jetpackPoweredBottomSheet:
107108
return false
109+
case .sharedUserDefaults:
110+
return false
108111
case .sharedLogin:
109112
return false
110113
}
@@ -197,6 +200,8 @@ extension FeatureFlag {
197200
return "Jetpack powered banners and badges"
198201
case .jetpackPoweredBottomSheet:
199202
return "Jetpack powered bottom sheet"
203+
case .sharedUserDefaults:
204+
return "Shared User Defaults"
200205
case .sharedLogin:
201206
return "Shared Login"
202207
}

0 commit comments

Comments
 (0)