Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit 4705455

Browse files
authored
Merge pull request #567 from wordpress-mobile/task/add-settings-two-step-enabled
Add twoStepEnabled property to AccountSettings
2 parents 6d6c6aa + bbaf2dc commit 4705455

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ _None._
3939

4040
### New Features
4141

42-
_None._
42+
- Add `twoStepEnabled` property to `AccountSettings` model. [#567]
4343

4444
### Bug Fixes
4545

WordPressKit/AccountSettings.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public struct AccountSettings {
1818
public let language: String // language
1919
public let tracksOptOut: Bool
2020
public let blockEmailNotifications: Bool
21+
public let twoStepEnabled: Bool // two_step_enabled
2122

2223
public init(firstName: String,
2324
lastName: String,
@@ -32,7 +33,8 @@ public struct AccountSettings {
3233
webAddress: String,
3334
language: String,
3435
tracksOptOut: Bool,
35-
blockEmailNotifications: Bool) {
36+
blockEmailNotifications: Bool,
37+
twoStepEnabled: Bool) {
3638
self.firstName = firstName
3739
self.lastName = lastName
3840
self.displayName = displayName
@@ -47,6 +49,7 @@ public struct AccountSettings {
4749
self.language = language
4850
self.tracksOptOut = tracksOptOut
4951
self.blockEmailNotifications = blockEmailNotifications
52+
self.twoStepEnabled = twoStepEnabled
5053
}
5154
}
5255

WordPressKit/AccountSettingsRemote.swift

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ public class AccountSettingsRemote: ServiceRemoteWordPressComREST {
157157
}
158158

159159
private func settingsFromResponse(_ responseObject: AnyObject) throws -> AccountSettings {
160-
guard let
161-
response = responseObject as? [String: AnyObject],
160+
guard let response = responseObject as? [String: AnyObject],
162161
let firstName = response["first_name"] as? String,
163162
let lastName = response["last_name"] as? String,
164163
let displayName = response["display_name"] as? String,
@@ -172,10 +171,12 @@ public class AccountSettingsRemote: ServiceRemoteWordPressComREST {
172171
let webAddress = response["user_URL"] as? String,
173172
let language = response["language"] as? String,
174173
let tracksOptOut = response["tracks_opt_out"] as? Bool,
175-
let blockEmailNotifications = response["subscription_delivery_email_blocked"] as? Bool else {
176-
WPKitLogError("Error decoding me/settings response: \(responseObject)")
177-
throw ResponseError.decodingFailure
178-
}
174+
let blockEmailNotifications = response["subscription_delivery_email_blocked"] as? Bool,
175+
let twoStepEnabled = response["two_step_enabled"] as? Bool
176+
else {
177+
WPKitLogError("Error decoding me/settings response: \(responseObject)")
178+
throw ResponseError.decodingFailure
179+
}
179180

180181
let aboutMeText = aboutMe.decodingXMLCharacters()
181182

@@ -192,7 +193,8 @@ public class AccountSettingsRemote: ServiceRemoteWordPressComREST {
192193
webAddress: webAddress,
193194
language: language,
194195
tracksOptOut: tracksOptOut,
195-
blockEmailNotifications: blockEmailNotifications)
196+
blockEmailNotifications: blockEmailNotifications,
197+
twoStepEnabled: twoStepEnabled)
196198
}
197199

198200
private func fieldNameForChange(_ change: AccountSettingsChange) -> String {

0 commit comments

Comments
 (0)