@@ -3,6 +3,7 @@ import 'dart:convert';
3
3
import 'package:collection/collection.dart' show IterableExtension;
4
4
import 'package:firebase_messaging/firebase_messaging.dart' ;
5
5
import 'package:flutter_inappwebview/flutter_inappwebview.dart' ;
6
+ import 'package:woosignal_shopify_api/money_formatter/money_formatter.dart' ;
6
7
import '/bootstrap/status_alert/models/status_alert_media_configuration.dart' ;
7
8
import '/bootstrap/status_alert/status_alert.dart' ;
8
9
import '/app/models/cart.dart' ;
@@ -18,7 +19,6 @@ import '/config/currency.dart';
18
19
import '/config/payment_gateways.dart' ;
19
20
import '/config/keys.dart' ;
20
21
import 'package:html/parser.dart' ;
21
- import 'package:money_formatter/money_formatter.dart' ;
22
22
import 'package:nylo_framework/nylo_framework.dart' ;
23
23
import 'package:woosignal_shopify_api/models/response/auth/auth_customer_info.dart' ;
24
24
import 'package:woosignal_shopify_api/woosignal_shopify_api.dart' ;
@@ -38,7 +38,6 @@ class ThemeColor {
38
38
static Color fromHex (String hexColor) => nyHexColor (hexColor);
39
39
}
40
40
41
-
42
41
Future appWooSignalShopify (Function (WooSignalShopify api) api) async {
43
42
return await api (WooSignalShopify .instance);
44
43
}
@@ -53,7 +52,7 @@ bool isProductNew(DateTime? createdAt) {
53
52
if (createdAt == null ) false ;
54
53
try {
55
54
return createdAt.isBetween (
56
- DateTime .now ().subtract (Duration (days: 2 )), DateTime .now ()) ??
55
+ DateTime .now ().subtract (Duration (days: 2 )), DateTime .now ()) ??
57
56
false ;
58
57
} on Exception catch (e) {
59
58
NyLogger .error (e.toString ());
@@ -82,18 +81,18 @@ Future<List<PaymentType?>> getShopifyPaymentTypes() async {
82
81
83
82
for (var appPaymentGateway in appPaymentGateways) {
84
83
paymentTypes.add (paymentTypeList.firstWhereOrNull (
85
- (paymentTypeList) => paymentTypeList.name == appPaymentGateway));
84
+ (paymentTypeList) => paymentTypeList.name == appPaymentGateway));
86
85
}
87
86
88
87
return paymentTypes.where ((v) => v != null ).toList ();
89
88
}
90
89
91
90
PaymentType addPayment (
92
- {required int id,
93
- required String name,
94
- required String description,
95
- required String assetImage,
96
- required Function pay}) =>
91
+ {required int id,
92
+ required String name,
93
+ required String description,
94
+ required String assetImage,
95
+ required Function pay}) =>
97
96
PaymentType (
98
97
id: id,
99
98
name: name,
@@ -104,9 +103,9 @@ PaymentType addPayment(
104
103
105
104
showStatusAlert (context,
106
105
{required String title,
107
- required String subtitle,
108
- IconData ? icon,
109
- int ? duration}) {
106
+ required String subtitle,
107
+ IconData ? icon,
108
+ int ? duration}) {
110
109
StatusAlert .show (
111
110
context,
112
111
duration: Duration (seconds: duration ?? 2 ),
@@ -127,7 +126,7 @@ String moneyFormatter(double amount) {
127
126
amount: amount,
128
127
settings: MoneyFormatterSettings (
129
128
symbol:
130
- AppHelper .instance.shopifyAppConfig? .currencyMeta? .symbolNative,
129
+ AppHelper .instance.shopifyAppConfig? .currencyMeta? .symbolNative,
131
130
symbolAndNumberSeparator: "" ),
132
131
);
133
132
if (appCurrencySymbolPosition == SymbolPositionType .left) {
@@ -177,9 +176,9 @@ bool isNumeric(String? str) {
177
176
178
177
checkoutShopify (
179
178
Function (String total, BillingDetails ? billingDetails, Cart cart)
180
- completeCheckout) async {
179
+ completeCheckout) async {
181
180
String cartTotal =
182
- await shopify.CheckoutSession .getInstance.total (withFormat: false );
181
+ await shopify.CheckoutSession .getInstance.total (withFormat: false );
183
182
BillingDetails ? billingDetails =
184
183
shopify.CheckoutSession .getInstance.billingDetails;
185
184
Cart cart = Cart .getInstance;
@@ -188,9 +187,9 @@ checkoutShopify(
188
187
189
188
navigatorPush (BuildContext context,
190
189
{required String routeName,
191
- Object ? arguments,
192
- bool forgetAll = false ,
193
- int ? forgetLast}) {
190
+ Object ? arguments,
191
+ bool forgetAll = false ,
192
+ int ? forgetLast}) {
194
193
if (forgetAll) {
195
194
Navigator .of (context).pushNamedAndRemoveUntil (
196
195
routeName, (Route <dynamic > route) => false ,
@@ -216,13 +215,13 @@ class UserAuth {
216
215
217
216
Future <List <DefaultShipping >> getDefaultShipping () async {
218
217
String data =
219
- await rootBundle.loadString ('public/json/default_shipping.json' );
218
+ await rootBundle.loadString ('public/json/default_shipping.json' );
220
219
dynamic dataJson = json.decode (data);
221
220
List <DefaultShipping > shipping = [];
222
221
223
222
dataJson.forEach ((key, value) {
224
223
DefaultShipping defaultShipping =
225
- DefaultShipping (code: key, country: value['country' ], states: []);
224
+ DefaultShipping (code: key, country: value['country' ], states: []);
226
225
if (value['states' ] != null ) {
227
226
value['states' ].forEach ((key1, value2) {
228
227
defaultShipping.states
@@ -237,7 +236,7 @@ Future<List<DefaultShipping>> getDefaultShipping() async {
237
236
Future <DefaultShipping ?> findCountryMetaForShipping (String countryCode) async {
238
237
List <DefaultShipping > defaultShipping = await getDefaultShipping ();
239
238
List <DefaultShipping > shippingByCountryCode =
240
- defaultShipping.where ((element) => element.code == countryCode).toList ();
239
+ defaultShipping.where ((element) => element.code == countryCode).toList ();
241
240
if (shippingByCountryCode.isNotEmpty) {
242
241
return shippingByCountryCode.first;
243
242
}
@@ -247,7 +246,7 @@ Future<DefaultShipping?> findCountryMetaForShipping(String countryCode) async {
247
246
DefaultShippingState ? findDefaultShippingStateByCode (
248
247
DefaultShipping defaultShipping, String code) {
249
248
List <DefaultShippingState > defaultShippingStates =
250
- defaultShipping.states.where ((state) => state.code == code).toList ();
249
+ defaultShipping.states.where ((state) => state.code == code).toList ();
251
250
if (defaultShippingStates.isEmpty) {
252
251
return null ;
253
252
}
@@ -262,7 +261,7 @@ String truncateString(String data, int length) {
262
261
263
262
Future <List <String >> getWishlistProducts () async {
264
263
List <String > currentProductsJSON =
265
- await (NyStorage .readCollection (Keys .wishlistProducts));
264
+ await (NyStorage .readCollection (Keys .wishlistProducts));
266
265
267
266
return currentProductsJSON;
268
267
}
@@ -350,7 +349,7 @@ class NyNotification {
350
349
/// Get all notifications
351
350
static Future <List <NotificationItem >> allNotifications () async {
352
351
List <NotificationItem > notifications =
353
- await NyStorage .readCollection ("app_notifications" );
352
+ await NyStorage .readCollection ("app_notifications" );
354
353
String ? userId = await WooSignalShopify .authUserId ();
355
354
notifications.removeWhere ((notification) {
356
355
if (notification.meta != null &&
0 commit comments