Skip to content

fix error #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 8.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
Expand Down Expand Up @@ -54,6 +55,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ class ProductDetailController extends Controller {
for (var productVariation in productVariations) {
for (var attr in productVariation.attributes) {
String? attrName = attr.name;
if (attrName == null) continue;
tmpKeys.add(attrName);
tmpKeys.add(attrName!);
}
}

Expand Down
4 changes: 1 addition & 3 deletions LabelStoreMax/lib/app/events/login_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ class DefaultListener extends NyListener {
@override
handle(dynamic event) async {
String? userId = await WPJsonAPI.wpUserId();
if (userId != null) {
WooSignal.instance.setWpUserId(userId);
WooSignal.instance.setWpUserId(userId!);
}
}
}
10 changes: 4 additions & 6 deletions LabelStoreMax/lib/app/models/cart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ class Cart {
List<CartLineItem> cartLineItems = [];
String? currentCartArrJSON = await (NyStorage.read(SharedKey.cart));

if (currentCartArrJSON != null) {
cartLineItems = (jsonDecode(currentCartArrJSON) as List<dynamic>)
.map((i) => CartLineItem.fromJson(i))
.toList();
}

cartLineItems = (jsonDecode(currentCartArrJSON!) as List<dynamic>)
.map((i) => CartLineItem.fromJson(i))
.toList();

return cartLineItems;
}

Expand Down
8 changes: 4 additions & 4 deletions LabelStoreMax/lib/app/models/checkout_session.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -83,8 +83,8 @@ class CheckoutSession {
Future<CustomerAddress?> 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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions LabelStoreMax/lib/app/providers/firebase_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
12 changes: 5 additions & 7 deletions LabelStoreMax/lib/bootstrap/data/order_wc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,12 @@ Future<OrderWC> buildOrderWC({TaxRate? taxRate, bool markPaid = true}) async {
if (wooSignalApp.disableShipping != 1) {
Map<String, dynamic>? 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 = [];
Expand Down
12 changes: 5 additions & 7 deletions LabelStoreMax/lib/bootstrap/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -485,9 +485,7 @@ Future<List<dynamic>> getWishlistProducts() async {
List<dynamic> favouriteProducts = [];
String? currentProductsJSON =
await (NyStorage.read(SharedKey.wishlistProducts));
if (currentProductsJSON != null) {
favouriteProducts = (jsonDecode(currentProductsJSON)).toList();
}
favouriteProducts = (jsonDecode(currentProductsJSON!)).toList();
return favouriteProducts;
}

Expand Down Expand Up @@ -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;
Expand Down
8 changes: 1 addition & 7 deletions LabelStoreMax/lib/resources/pages/account_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,9 @@ class _AccountDetailPageState extends NyPage<AccountDetailPage>

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!),
);
}
}
9 changes: 2 additions & 7 deletions LabelStoreMax/lib/resources/pages/account_login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,8 @@ class _AccountLoginPageState extends NyPage<AccountLoginPage> {
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: [
Expand Down
5 changes: 2 additions & 3 deletions LabelStoreMax/lib/resources/pages/coupon_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,11 @@ class _CouponPageState extends NyPage<CouponPage> {

// 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);
Expand Down