From 41beedaa7b05c5d0bcfc455324bb7998260c41a9 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 17 Oct 2019 15:45:39 +0300 Subject: [PATCH] Settings --- lib/data/models/company_gateway_model.dart | 1 + lib/data/repositories/company_gateway_repository.dart | 8 ++++---- lib/redux/company_gateway/company_gateway_reducer.dart | 1 - lib/ui/company_gateway/view/company_gateway_view.dart | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/data/models/company_gateway_model.dart b/lib/data/models/company_gateway_model.dart index 47cb668d6..7269412ef 100644 --- a/lib/data/models/company_gateway_model.dart +++ b/lib/data/models/company_gateway_model.dart @@ -50,6 +50,7 @@ abstract class CompanyGatewayEntity extends Object return _$CompanyGatewayEntity._( id: id ?? BaseEntity.nextId, isChanged: false, + isDeleted: false, gateway: GatewayEntity(), gatewayId: null, showBillingAddress: true, diff --git a/lib/data/repositories/company_gateway_repository.dart b/lib/data/repositories/company_gateway_repository.dart index 58b8220f2..1b1cc7b60 100644 --- a/lib/data/repositories/company_gateway_repository.dart +++ b/lib/data/repositories/company_gateway_repository.dart @@ -19,7 +19,7 @@ class CompanyGatewayRepository { Future loadItem( Credentials credentials, String entityId) async { final dynamic response = await webClient.get( - '${credentials.url}/company_gateways/$entityId', credentials.token); + '${credentials.url}/company_gateways/$entityId?include=gateway', credentials.token); final CompanyGatewayItemResponse companyGatewayResponse = serializers .deserializeWith(CompanyGatewayItemResponse.serializer, response); @@ -29,7 +29,7 @@ class CompanyGatewayRepository { Future> loadList( Credentials credentials, int updatedAt) async { - String url = credentials.url + '/company_gateways?'; + String url = credentials.url + '/company_gateways?include=gateway'; if (updatedAt > 0) { url += '&updated_at=${updatedAt - kUpdatedAtBufferSeconds}'; @@ -52,11 +52,11 @@ class CompanyGatewayRepository { if (companyGateway.isNew) { response = await webClient.post( - credentials.url + '/company_gateways', credentials.token, + credentials.url + '/company_gateways?include=gateway', credentials.token, data: json.encode(data)); } else { var url = - credentials.url + '/company_gateways/' + companyGateway.id.toString(); + credentials.url + '/company_gateways/${companyGateway.id}?include=gateway'; if (action != null) { url += '?action=' + action.toString(); } diff --git a/lib/redux/company_gateway/company_gateway_reducer.dart b/lib/redux/company_gateway/company_gateway_reducer.dart index 50e88b618..feec4dfb9 100644 --- a/lib/redux/company_gateway/company_gateway_reducer.dart +++ b/lib/redux/company_gateway/company_gateway_reducer.dart @@ -1,5 +1,4 @@ import 'package:invoiceninja_flutter/data/models/company_gateway_model.dart'; -import 'package:invoiceninja_flutter/redux/group/group_state.dart'; import 'package:redux/redux.dart'; import 'package:invoiceninja_flutter/redux/app/app_actions.dart'; import 'package:invoiceninja_flutter/redux/company/company_actions.dart'; diff --git a/lib/ui/company_gateway/view/company_gateway_view.dart b/lib/ui/company_gateway/view/company_gateway_view.dart index 162405342..8c8b69f60 100644 --- a/lib/ui/company_gateway/view/company_gateway_view.dart +++ b/lib/ui/company_gateway/view/company_gateway_view.dart @@ -31,7 +31,7 @@ class _CompanyGatewayViewState extends State { actions: [ userCompany.canEditEntity(companyGateway) ? EditIconButton( - isVisible: !companyGateway.isDeleted, + isVisible: !(companyGateway.isDeleted ?? false), onPressed: () => viewModel.onEditPressed(context), ) : Container(),