|
1 |
| -// Copyright (c) 2022, WooSignal Ltd. |
| 1 | +// Copyright (c) 2023, WooSignal Ltd. |
2 | 2 | // All rights reserved.
|
3 | 3 | //
|
4 | 4 | // Redistribution and use in source and binary forms are permitted
|
@@ -73,11 +73,6 @@ class WPAppNetworkManager {
|
73 | 73 | // Get nonce from WordPress
|
74 | 74 | WPNonceResponse wpNonceResponse = await wpNonce();
|
75 | 75 |
|
76 |
| - // throw exception if there's an error |
77 |
| - if (!(wpNonceResponse is WPNonceResponse)) { |
78 |
| - throw new InvalidNonceException(); |
79 |
| - } |
80 |
| - |
81 | 76 | // Creates payload for login
|
82 | 77 | Map<String, dynamic> payload = {};
|
83 | 78 | if (username != null) payload["username"] = username;
|
@@ -120,11 +115,6 @@ class WPAppNetworkManager {
|
120 | 115 | // Get nonce from WordPress
|
121 | 116 | WPNonceResponse wpNonceResponse = await wpNonce();
|
122 | 117 |
|
123 |
| - // throw exception if nonce null |
124 |
| - if (!(wpNonceResponse is WPNonceResponse)) { |
125 |
| - throw InvalidNonceException(); |
126 |
| - } |
127 |
| - |
128 | 118 | // Creates payload for register
|
129 | 119 | Map<String, dynamic> payload = {
|
130 | 120 | "email": email,
|
@@ -205,23 +195,22 @@ class WPAppNetworkManager {
|
205 | 195 |
|
206 | 196 | /// Sends a request to update details for a WordPress user. Include a valid
|
207 | 197 | /// [userToken] to send a successful request. Optional parameters include
|
208 |
| - /// a [firstName], [lastName], [displayName] and [UserMetaDataItem] to update |
209 |
| - /// meta data on the user. |
| 198 | + /// a [firstName], [lastName], [displayName] or [metaData] to update user's. |
210 | 199 | ///
|
211 | 200 | /// Returns a [WPUserInfoUpdatedResponse] future.
|
212 | 201 | /// Throws an [Exception] if fails.
|
213 | 202 | Future<WPUserInfoUpdatedResponse> wpUpdateUserInfo(userToken,
|
214 | 203 | {String? firstName,
|
215 | 204 | String? lastName,
|
216 | 205 | String? displayName,
|
217 |
| - List<UserMetaDataItem>? wpUserMetaData}) async { |
| 206 | + List<WpMetaData>? metaData}) async { |
218 | 207 | Map<String, dynamic> payload = {};
|
219 | 208 | if (firstName != null) payload["first_name"] = firstName;
|
220 | 209 | if (lastName != null) payload["last_name"] = lastName;
|
221 | 210 | if (displayName != null) payload["display_name"] = displayName;
|
222 |
| - if (wpUserMetaData != null) { |
| 211 | + if (metaData != null) { |
223 | 212 | payload['meta_data'] = {
|
224 |
| - "items": wpUserMetaData.map((e) => e.toJson()).toList() |
| 213 | + "items": metaData.map((e) => e.toJson()).toList() |
225 | 214 | };
|
226 | 215 | }
|
227 | 216 |
|
|
0 commit comments