Skip to content

Commit c72cc32

Browse files
committed
v5.8.0 updates
1 parent bf14ab3 commit c72cc32

File tree

11 files changed

+150
-114
lines changed

11 files changed

+150
-114
lines changed

LabelStoreMax/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [5.8.0] - 2022-03-29
2+
3+
* Add phone number to customer input form
4+
* Gradle version bump
5+
* Pubspec.yaml dependency updates
6+
17
## [5.7.3] - 2022-02-21
28

39
* Fix builds for Flutter 2.10.2

LabelStoreMax/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# WooCommerce App: Label StoreMax
66

7-
### Label StoreMax - v5.7.3
7+
### Label StoreMax - v5.8.0
88

99

1010
[Official WooSignal WooCommerce App](https://woosignal.com)

LabelStoreMax/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:4.2.2'
9+
classpath 'com.android.tools.build:gradle:7.0.1'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111
}
1212
}

LabelStoreMax/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip

LabelStoreMax/lib/app/models/checkout_session.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class CheckoutSession {
4444
coupon = null;
4545
}
4646

47-
void saveBillingAddress() async {
47+
saveBillingAddress() async {
4848
CustomerAddress customerAddress =
4949
CheckoutSession.getInstance.billingDetails.billingAddress;
5050

@@ -66,7 +66,7 @@ class CheckoutSession {
6666
return null;
6767
}
6868

69-
void clearBillingAddress() async =>
69+
clearBillingAddress() async =>
7070
await NyStorage.delete(SharedKey.customerBillingDetails);
7171

7272
saveShippingAddress() async {
@@ -88,8 +88,8 @@ class CheckoutSession {
8888
return null;
8989
}
9090

91-
void clearShippingAddress() async =>
92-
NyStorage.delete(SharedKey.customerShippingDetails);
91+
clearShippingAddress() async =>
92+
await NyStorage.delete(SharedKey.customerShippingDetails);
9393

9494
Future<String> total({bool withFormat = false, TaxRate taxRate}) async {
9595
double totalCart = parseWcPrice(await Cart.getInstance.getTotal());

LabelStoreMax/lib/app/models/customer_address.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class CustomerAddress {
1717
String city;
1818
String postalCode;
1919
String emailAddress;
20+
String phoneNumber;
2021
CustomerCountry customerCountry;
2122

2223
CustomerAddress(
@@ -26,6 +27,7 @@ class CustomerAddress {
2627
this.city,
2728
this.postalCode,
2829
this.emailAddress,
30+
this.phoneNumber,
2931
this.customerCountry});
3032

3133
void initAddress() {
@@ -36,6 +38,7 @@ class CustomerAddress {
3638
postalCode = "";
3739
customerCountry = CustomerCountry();
3840
emailAddress = "";
41+
phoneNumber = "";
3942
}
4043

4144
bool hasMissingFields() =>
@@ -85,6 +88,9 @@ class CustomerAddress {
8588
addressLine = json['address_line'];
8689
city = json['city'];
8790
postalCode = json['postal_code'];
91+
if (json['phone_number'] != null) {
92+
phoneNumber = json['phone_number'];
93+
}
8894
customerCountry = CustomerCountry.fromJson(json['customer_country']);
8995
emailAddress = json['email_address'];
9096
}
@@ -98,6 +104,9 @@ class CustomerAddress {
98104
data['postal_code'] = postalCode;
99105
data['state'] = customerCountry.state;
100106
data['country'] = customerCountry.name;
107+
if (phoneNumber != null && phoneNumber != "") {
108+
data['phone_number'] = phoneNumber;
109+
}
101110
data['email_address'] = emailAddress;
102111
data['customer_country'] = null;
103112
if (customerCountry != null) {

LabelStoreMax/lib/bootstrap/data/order_wc.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ Future<OrderWC> buildOrderWC({TaxRate taxRate, bool markPaid = true}) async {
6565
billing.city = billingDetails.billingAddress.city;
6666
billing.postcode = billingDetails.billingAddress.postalCode;
6767
billing.email = billingDetails.billingAddress.emailAddress;
68+
if (billingDetails.billingAddress.phoneNumber != "") {
69+
billing.phone = billingDetails.billingAddress.phoneNumber;
70+
}
6871
if (billingDetails.billingAddress.customerCountry.hasState()) {
6972
billing.state = billingDetails.billingAddress.customerCountry.state.name;
7073
}

LabelStoreMax/lib/resources/pages/checkout_details.dart

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
4444
_txtBillingCity = TextEditingController(),
4545
_txtBillingPostalCode = TextEditingController(),
4646
_txtBillingEmailAddress = TextEditingController(),
47+
_txtBillingPhoneNumber = TextEditingController(),
4748
// shipping
4849
_txtShippingFirstName = TextEditingController(),
4950
_txtShippingLastName = TextEditingController(),
@@ -74,6 +75,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
7475
txtControllerCity: _txtBillingCity,
7576
txtControllerPostalCode: _txtBillingPostalCode,
7677
txtControllerEmailAddress: _txtBillingEmailAddress,
78+
txtControllerPhoneNumber: _txtBillingPhoneNumber,
7779
customerCountry: _billingCountry,
7880
onTapCountry: () => _navigateToSelectCountry(type: "billing"),
7981
);
@@ -107,6 +109,9 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
107109
CustomerAddress sfCustomerShippingAddress =
108110
await CheckoutSession.getInstance.getShippingAddress();
109111
_setFieldsFromCustomerAddress(sfCustomerShippingAddress, type: "shipping");
112+
setState(() {
113+
114+
});
110115
}
111116

112117
_setFieldsFromCustomerAddress(CustomerAddress customerAddress,
@@ -122,6 +127,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
122127
city: customerAddress.city,
123128
postalCode: customerAddress.postalCode,
124129
emailAddress: customerAddress.emailAddress,
130+
phoneNumber: customerAddress.phoneNumber,
125131
customerCountry: customerAddress.customerCountry,
126132
type: type,
127133
);
@@ -134,6 +140,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
134140
@required String city,
135141
@required String postalCode,
136142
@required String emailAddress,
143+
@required String phoneNumber,
137144
@required CustomerCountry customerCountry,
138145
String type}) {
139146
if (type == "billing") {
@@ -142,6 +149,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
142149
_txtBillingAddressLine.text = addressLine;
143150
_txtBillingCity.text = city;
144151
_txtBillingPostalCode.text = postalCode;
152+
_txtBillingPhoneNumber.text = phoneNumber;
145153
_txtBillingEmailAddress.text = emailAddress;
146154
_billingCountry = customerCountry;
147155
} else if (type == "shipping") {
@@ -172,20 +180,19 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
172180
crossAxisAlignment: CrossAxisAlignment.center,
173181
mainAxisAlignment: MainAxisAlignment.spaceBetween,
174182
children: <Widget>[
175-
Flexible(
176-
fit: FlexFit.tight,
183+
Expanded(
177184
child: Column(
178185
crossAxisAlignment: CrossAxisAlignment.center,
179186
mainAxisAlignment: MainAxisAlignment.start,
180187
children: [
188+
if (_hasDifferentShippingAddress)
181189
Container(
182190
margin: EdgeInsets.symmetric(vertical: 0),
183191
child: Column(
184192
crossAxisAlignment: CrossAxisAlignment.start,
185193
mainAxisAlignment: MainAxisAlignment.spaceAround,
186194
children: <Widget>[
187-
(_hasDifferentShippingAddress
188-
? Padding(
195+
Padding(
189196
child: Row(
190197
crossAxisAlignment:
191198
CrossAxisAlignment.center,
@@ -212,14 +219,12 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
212219
].where((e) => e != null).toList(),
213220
),
214221
padding: EdgeInsets.symmetric(vertical: 4),
215-
)
216-
: null),
222+
),
217223
].where((e) => e != null).toList(),
218224
),
219225
height: 60,
220226
),
221-
Flexible(
222-
fit: FlexFit.tight,
227+
Expanded(
223228
child: Container(
224229
decoration: BoxDecoration(
225230
color: ThemeColor.get(context).backgroundContainer,
@@ -230,7 +235,8 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
230235
: null,
231236
),
232237
padding: EdgeInsets.only(left: 8, right: 8, top: 8),
233-
child: (activeTab ?? tabBillingDetails()),
238+
margin: EdgeInsets.only(top: 8),
239+
child: (activeTab ?? tabBillingDetails())
234240
),
235241
),
236242
],
@@ -274,7 +280,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
274280
),
275281
PrimaryButton(
276282
title: trans("USE DETAILS"),
277-
action: () => _useDetailsTapped(),
283+
action: _useDetailsTapped,
278284
),
279285
],
280286
),
@@ -286,15 +292,17 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
286292
);
287293
}
288294

289-
_useDetailsTapped() {
295+
_useDetailsTapped() async {
290296
CustomerAddress customerBillingAddress = _setCustomerAddress(
291297
firstName: _txtBillingFirstName.text,
292298
lastName: _txtBillingLastName.text,
293299
addressLine: _txtBillingAddressLine.text,
294300
city: _txtBillingCity.text,
295301
postalCode: _txtBillingPostalCode.text,
302+
phoneNumber: _txtBillingPhoneNumber.text,
296303
emailAddress: _txtBillingEmailAddress.text,
297-
customerCountry: _billingCountry);
304+
customerCountry: _billingCountry,
305+
);
298306

299307
CheckoutSession.getInstance.billingDetails.shippingAddress =
300308
customerBillingAddress;
@@ -350,11 +358,11 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
350358
}
351359

352360
if (valRememberDetails == true) {
353-
CheckoutSession.getInstance.saveBillingAddress();
354-
CheckoutSession.getInstance.saveShippingAddress();
361+
await CheckoutSession.getInstance.saveBillingAddress();
362+
await CheckoutSession.getInstance.saveShippingAddress();
355363
} else {
356-
CheckoutSession.getInstance.clearBillingAddress();
357-
CheckoutSession.getInstance.clearShippingAddress();
364+
await CheckoutSession.getInstance.clearBillingAddress();
365+
await CheckoutSession.getInstance.clearShippingAddress();
358366
}
359367

360368
CheckoutSession.getInstance.billingDetails.rememberDetails =
@@ -380,6 +388,7 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
380388
addressLine: "",
381389
city: "",
382390
postalCode: "",
391+
phoneNumber: "",
383392
emailAddress: "",
384393
customerCountry: CustomerCountry());
385394
}
@@ -393,13 +402,17 @@ class _CheckoutDetailsPageState extends State<CheckoutDetailsPage> {
393402
@required String city,
394403
@required String postalCode,
395404
@required String emailAddress,
405+
String phoneNumber,
396406
@required CustomerCountry customerCountry}) {
397407
CustomerAddress customerShippingAddress = CustomerAddress();
398408
customerShippingAddress.firstName = firstName;
399409
customerShippingAddress.lastName = lastName;
400410
customerShippingAddress.addressLine = addressLine;
401411
customerShippingAddress.city = city;
402412
customerShippingAddress.postalCode = postalCode;
413+
if (phoneNumber != null && phoneNumber != "") {
414+
customerShippingAddress.phoneNumber = phoneNumber;
415+
}
403416
customerShippingAddress.customerCountry = customerCountry;
404417
customerShippingAddress.emailAddress = emailAddress;
405418
return customerShippingAddress;

0 commit comments

Comments
 (0)