diff --git a/LabelStoreMax/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/LabelStoreMax/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 15cada4..e3773d4 100644 --- a/LabelStoreMax/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/LabelStoreMax/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -26,6 +26,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit" shouldUseLaunchSchemeArgsEnv = "YES"> cartLineItems = []; String? currentCartArrJSON = await (NyStorage.read(SharedKey.cart)); - if (currentCartArrJSON != null) { - cartLineItems = (jsonDecode(currentCartArrJSON) as List) - .map((i) => CartLineItem.fromJson(i)) - .toList(); - } - + cartLineItems = (jsonDecode(currentCartArrJSON!) as List) + .map((i) => CartLineItem.fromJson(i)) + .toList(); + return cartLineItems; } diff --git a/LabelStoreMax/lib/app/models/checkout_session.dart b/LabelStoreMax/lib/app/models/checkout_session.dart index 395d388..32621c2 100644 --- a/LabelStoreMax/lib/app/models/checkout_session.dart +++ b/LabelStoreMax/lib/app/models/checkout_session.dart @@ -61,8 +61,8 @@ class CheckoutSession { String? strCheckoutDetails = await (NyStorage.read(SharedKey.customerBillingDetails)); - if (strCheckoutDetails != null && strCheckoutDetails != "") { - return CustomerAddress.fromJson(jsonDecode(strCheckoutDetails)); + if (strCheckoutDetails != "") { + return CustomerAddress.fromJson(jsonDecode(strCheckoutDetails!)); } return null; } @@ -83,8 +83,8 @@ class CheckoutSession { Future getShippingAddress() async { String? strCheckoutDetails = await (NyStorage.read(SharedKey.customerShippingDetails)); - if (strCheckoutDetails != null && strCheckoutDetails != "") { - return CustomerAddress.fromJson(jsonDecode(strCheckoutDetails)); + if (strCheckoutDetails != "") { + return CustomerAddress.fromJson(jsonDecode(strCheckoutDetails!)); } return null; } diff --git a/LabelStoreMax/lib/app/networking/dio/interceptors/bearer_auth_interceptor.dart b/LabelStoreMax/lib/app/networking/dio/interceptors/bearer_auth_interceptor.dart index 0107059..3779081 100644 --- a/LabelStoreMax/lib/app/networking/dio/interceptors/bearer_auth_interceptor.dart +++ b/LabelStoreMax/lib/app/networking/dio/interceptors/bearer_auth_interceptor.dart @@ -4,10 +4,8 @@ class BearerAuthInterceptor extends Interceptor { @override void onRequest(RequestOptions options, RequestInterceptorHandler handler) { String? userToken = Backpack.instance.read('user_token'); - if (userToken != null) { - options.headers.addAll({"Authorization": "Bearer $userToken"}); - } - return super.onRequest(options, handler); + options.headers.addAll({"Authorization": "Bearer $userToken"}); + return super.onRequest(options, handler); } @override diff --git a/LabelStoreMax/lib/app/providers/firebase_provider.dart b/LabelStoreMax/lib/app/providers/firebase_provider.dart index 92f17ac..1b7e03c 100644 --- a/LabelStoreMax/lib/app/providers/firebase_provider.dart +++ b/LabelStoreMax/lib/app/providers/firebase_provider.dart @@ -47,10 +47,8 @@ class FirebaseProvider implements NyProvider { try { String? token = await messaging.getToken(); - if (token != null) { - WooSignal.instance.setFcmToken(token); - } - } catch (e) { + WooSignal.instance.setFcmToken(token!); + } catch (e) { printError(e); } } diff --git a/LabelStoreMax/lib/bootstrap/data/order_wc.dart b/LabelStoreMax/lib/bootstrap/data/order_wc.dart index cada6e7..b1ee5fb 100644 --- a/LabelStoreMax/lib/bootstrap/data/order_wc.dart +++ b/LabelStoreMax/lib/bootstrap/data/order_wc.dart @@ -101,14 +101,12 @@ Future buildOrderWC({TaxRate? taxRate, bool markPaid = true}) async { if (wooSignalApp.disableShipping != 1) { Map? shippingLineFeeObj = checkoutSession.shippingType!.toShippingLineFee(); - if (shippingLineFeeObj != null) { - ShippingLines shippingLine = ShippingLines(); - shippingLine.methodId = shippingLineFeeObj['method_id']; - shippingLine.methodTitle = shippingLineFeeObj['method_title']; - shippingLine.total = shippingLineFeeObj['total']; - orderWC.shippingLines!.add(shippingLine); + ShippingLines shippingLine = ShippingLines(); + shippingLine.methodId = shippingLineFeeObj?['method_id']; + shippingLine.methodTitle = shippingLineFeeObj?['method_title']; + shippingLine.total = shippingLineFeeObj?['total']; + orderWC.shippingLines!.add(shippingLine); } - } if (taxRate != null) { orderWC.feeLines = []; diff --git a/LabelStoreMax/lib/bootstrap/helpers.dart b/LabelStoreMax/lib/bootstrap/helpers.dart index 4078fdf..91befa1 100644 --- a/LabelStoreMax/lib/bootstrap/helpers.dart +++ b/LabelStoreMax/lib/bootstrap/helpers.dart @@ -471,8 +471,8 @@ String fetchValueInMeta(WPUserInfoResponse wpUserInfoResponse, String key) { .where((meta) => meta.key == key) .first .value; - if (metaDataValue != null && metaDataValue.isNotEmpty) { - return metaDataValue.first ?? ""; + if (metaDataValue!.isNotEmpty) { + return metaDataValue!.first ?? ""; } return value; } @@ -485,9 +485,7 @@ Future> getWishlistProducts() async { List favouriteProducts = []; String? currentProductsJSON = await (NyStorage.read(SharedKey.wishlistProducts)); - if (currentProductsJSON != null) { - favouriteProducts = (jsonDecode(currentProductsJSON)).toList(); - } + favouriteProducts = (jsonDecode(currentProductsJSON!)).toList(); return favouriteProducts; } @@ -575,11 +573,11 @@ bool isProductNew(Product? product) { bool shouldEncrypt() { String? encryptKey = getEnv('ENCRYPT_KEY', defaultValue: ""); - if (encryptKey == null || encryptKey == "") { + if (encryptKey == "") { return false; } String? encryptSecret = getEnv('ENCRYPT_KEY', defaultValue: ""); - if (encryptSecret == null || encryptSecret == "") { + if (encryptSecret == "") { return false; } return true; diff --git a/LabelStoreMax/lib/resources/pages/account_detail_page.dart b/LabelStoreMax/lib/resources/pages/account_detail_page.dart index 34af4e6..ef43924 100644 --- a/LabelStoreMax/lib/resources/pages/account_detail_page.dart +++ b/LabelStoreMax/lib/resources/pages/account_detail_page.dart @@ -184,15 +184,9 @@ class _AccountDetailPageState extends NyPage Widget getAvatar() { String? avatarUrl = _wcCustomerInfoResponse?.data?.avatar; - if (avatarUrl == null) { - return Icon( - Icons.account_circle_rounded, - size: 65, - ); - } return CircleAvatar( - backgroundImage: NetworkImage(avatarUrl), + backgroundImage: NetworkImage(avatarUrl!), ); } } diff --git a/LabelStoreMax/lib/resources/pages/account_login_page.dart b/LabelStoreMax/lib/resources/pages/account_login_page.dart index 650889d..fb5dc05 100644 --- a/LabelStoreMax/lib/resources/pages/account_login_page.dart +++ b/LabelStoreMax/lib/resources/pages/account_login_page.dart @@ -128,13 +128,8 @@ class _AccountLoginPageState extends NyPage { action: () { String? forgotPasswordUrl = AppHelper.instance.appConfig!.wpLoginForgotPasswordUrl; - if (forgotPasswordUrl != null) { - openBrowserTab(url: forgotPasswordUrl); - } else { - NyLogger.info( - "No URL found for \"forgot password\".\nAdd your forgot password URL here https://woosignal.com/dashboard/apps"); - } - }), + openBrowserTab(url: forgotPasswordUrl ?? ""); + }), widget.showBackButton ? Column( children: [ diff --git a/LabelStoreMax/lib/resources/pages/coupon_page.dart b/LabelStoreMax/lib/resources/pages/coupon_page.dart index b4714e3..bff895d 100644 --- a/LabelStoreMax/lib/resources/pages/coupon_page.dart +++ b/LabelStoreMax/lib/resources/pages/coupon_page.dart @@ -212,12 +212,11 @@ class _CouponPageState extends NyPage { // Check usage limit per user int? limitPerUser = coupon.usageLimitPerUser; - if (limitPerUser != null && - coupon.usedBy! + if (coupon.usedBy! .map((e) => e.toLowerCase()) .where((usedBy) => usedBy == emailAddress!.toLowerCase()) .length >= - limitPerUser) { + limitPerUser!) { _showAlert( message: "${trans('You cannot redeem this coupon')}.", style: ToastNotificationStyleType.warning);