Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
hillelcoren committed Feb 14, 2024
2 parents 095b3a1 + f53aa99 commit a9c0043
Show file tree
Hide file tree
Showing 38 changed files with 648 additions and 240 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/flatpak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
draft: false
prerelease: false
title: "Latest Release"
automatic_release_tag: "v5.0.154"
automatic_release_tag: "v5.0.155"
files: |
${{ github.workspace }}/artifacts/Invoice-Ninja-Archive
${{ github.workspace }}/artifacts/Invoice-Ninja-Hash
Expand Down
1 change: 1 addition & 0 deletions flatpak/com.invoiceninja.InvoiceNinja.metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
</screenshots>
<content_rating type="oars-1.1"/>
<releases>
<release version="5.0.155" date="2024-02-07"/>
<release version="5.0.154" date="2024-02-04"/>
<release version="5.0.153" date="2024-01-29"/>
<release version="5.0.152" date="2024-01-24"/>
Expand Down
26 changes: 13 additions & 13 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ PODS:
- GTMAppAuth (2.0.0):
- AppAuth/Core (~> 1.6)
- GTMSessionFetcher/Core (< 4.0, >= 1.5)
- GTMSessionFetcher/Core (3.2.0)
- GTMSessionFetcher/Core (3.3.1)
- image_cropper (0.0.4):
- Flutter
- TOCropViewController (~> 2.6.1)
Expand All @@ -78,16 +78,16 @@ PODS:
- Flutter
- printing (1.0.0):
- Flutter
- SDWebImage (5.18.7):
- SDWebImage/Core (= 5.18.7)
- SDWebImage/Core (5.18.7)
- Sentry/HybridSDK (8.15.2):
- SentryPrivate (= 8.15.2)
- SDWebImage (5.18.10):
- SDWebImage/Core (= 5.18.10)
- SDWebImage/Core (5.18.10)
- Sentry/HybridSDK (8.18.0):
- SentryPrivate (= 8.18.0)
- sentry_flutter (0.0.1):
- Flutter
- FlutterMacOS
- Sentry/HybridSDK (= 8.15.2)
- SentryPrivate (8.15.2)
- Sentry/HybridSDK (= 8.18.0)
- SentryPrivate (8.18.0)
- share_plus (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
Expand Down Expand Up @@ -204,7 +204,7 @@ SPEC CHECKSUMS:
google_sign_in_ios: 8115e3fbe097e6509beb819ed602d47369d9011f
GoogleSignIn: b232380cf495a429b8095d3178a8d5855b42e842
GTMAppAuth: 99fb010047ba3973b7026e45393f51f27ab965ae
GTMSessionFetcher: 41b9ef0b4c08a6db4b7eb51a21ae5183ec99a2c8
GTMSessionFetcher: 8a1b34ad97ebe6f909fb8b9b77fba99943007556
image_cropper: a3291c624a953049bc6a02e1f8c8ceb162a24b25
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
in_app_purchase_storekit: 4fb7ee9e824b1f09107fbfbbce8c4b276366dc43
Expand All @@ -215,10 +215,10 @@ SPEC CHECKSUMS:
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
printing: 233e1b73bd1f4a05615548e9b5a324c98588640b
SDWebImage: f9258c58221ed854cfa0e2b80ee4033710b1c6d3
Sentry: 6f5742b4c47c17c9adcf265f6f328cf4a0ed1923
sentry_flutter: 2c309a1d4b45e59d02cfa15795705687f1e2081b
SentryPrivate: b2f7996f37781080f04a946eb4e377ff63c64195
SDWebImage: fc8f2d48bbfd72ef39d70e981bd24a3f3be53fec
Sentry: 8984a4ffb2b9bd2894d74fb36e6f5833865bc18e
sentry_flutter: c87a0556eeb6cbf7f9f924d30e878bdedf22d364
SentryPrivate: 2f0c9ba4c3fc993f70eab6ca95673509561e0085
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
sign_in_with_apple: f3bf75217ea4c2c8b91823f225d70230119b8440
Expand Down
4 changes: 2 additions & 2 deletions lib/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Constants {
}

// TODO remove version once #46609 is fixed
const String kClientVersion = '5.0.154';
const String kClientVersion = '5.0.155';
const String kMinServerVersion = '5.0.4';

const String kAppName = 'Invoice Ninja';
Expand Down Expand Up @@ -43,7 +43,7 @@ const String kGoogleStoreUrl =
'https://play.google.com/store/apps/details?id=$kPlayStoreAppId';
const String kGoogleFDroidUrl =
'https://f-droid.org/packages/com.invoiceninja.app';
const String kMacOSUrl = 'https://apps.apple.com/app/id1503970375';
const String kMacOSUrl = 'https://apps.apple.com/app/$kAppStoreAppId';
const String kLinuxUrl = 'https://snapcraft.io/invoiceninja';
const String kWindowsUrl =
'https://apps.microsoft.com/store/detail/invoice-ninja/$kMicrosoftAppStoreId';
Expand Down
2 changes: 1 addition & 1 deletion lib/data/models/client_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ abstract class ClientEntity extends Object
bool get hasCurrency =>
settings.currencyId != null && settings.currencyId!.isNotEmpty;

String? get languageId => settings.languageId;
String get languageId => settings.languageId ?? kLanguageEnglish;

ClientContactEntity getContact(String? contactId) =>
contacts.firstWhere((contact) => contact.id == contactId,
Expand Down
1 change: 1 addition & 0 deletions lib/data/models/import_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ class ImportType extends EnumClass {
EntityType.invoice.apiValue: 'invoices',
EntityType.recurringInvoice.apiValue: 'recurring_invoices',
EntityType.payment.apiValue: 'payments',
EntityType.quote.apiValue: 'quotes',
EntityType.task.apiValue: 'tasks',
EntityType.vendor.apiValue: 'vendors',
EntityType.expense.apiValue: 'expenses',
Expand Down
12 changes: 12 additions & 0 deletions lib/data/models/payment_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class PaymentFields {
static const String customValue2 = 'custom2';
static const String customValue3 = 'custom3';
static const String customValue4 = 'custom4';
static const String documents = 'documents';
}

abstract class PaymentEntity extends Object
Expand Down Expand Up @@ -124,6 +125,7 @@ abstract class PaymentEntity extends Object
invitationId: '',
isApplying: false,
gatewayTypeId: '',
documents: BuiltList<DocumentEntity>(),
);
}

Expand Down Expand Up @@ -229,6 +231,8 @@ abstract class PaymentEntity extends Object

BuiltList<PaymentableEntity> get credits;

BuiltList<DocumentEntity> get documents;

bool get canBeAppliedOrRefunded => [
kPaymentStatusCompleted,
kPaymentStatusPartiallyRefunded,
Expand Down Expand Up @@ -353,6 +357,10 @@ abstract class PaymentEntity extends Object
response =
stateA.name.toLowerCase().compareTo(stateB.name.toLowerCase());
break;
case PaymentFields.documents:
response =
paymentA!.documents.length.compareTo(paymentB!.documents.length);
break;
default:
print('## ERROR: sort by payment.$sortField is not implemented');
break;
Expand Down Expand Up @@ -451,6 +459,10 @@ abstract class PaymentEntity extends Object
}
}

if (!isDeleted! && multiselect) {
actions.add(EntityAction.documents);
}

if (actions.isNotEmpty && actions.last != null) {
actions.add(null);
}
Expand Down
28 changes: 28 additions & 0 deletions lib/data/models/payment_model.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions lib/data/models/serializers.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/data/models/transaction_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ abstract class TransactionEntity extends Object

bool get isConverted => statusId == kTransactionStatusConverted;

String get formattedDescription => description.replaceAll('\n', ' ');
String get formattedDescription => description.replaceAll('\\n', ' ');

@override
List<EntityAction?> getActions(
Expand Down
28 changes: 25 additions & 3 deletions lib/data/repositories/payment_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:flutter/foundation.dart';

// Package imports:
import 'package:built_collection/built_collection.dart';
import 'package:http/http.dart';

// Project imports:
import 'package:invoiceninja_flutter/constants.dart';
Expand Down Expand Up @@ -38,7 +39,7 @@ class PaymentRepository {

Future<BuiltList<PaymentEntity>> loadList(Credentials credentials, int page,
int createdAt, bool filterDeleted) async {
String url = credentials.url+
String url = credentials.url +
'/payments?per_page=$kMaxRecordsPerPage&page=$page&created_at=$createdAt';

if (filterDeleted) {
Expand All @@ -61,7 +62,7 @@ class PaymentRepository {
}

final url =
credentials.url+ '/payments/bulk?per_page=$kMaxEntitiesPerBulkAction';
credentials.url + '/payments/bulk?per_page=$kMaxEntitiesPerBulkAction';
final dynamic response = await webClient.post(url, credentials.token,
data: json.encode({'ids': ids, 'action': action.toApiParam()}));

Expand All @@ -73,6 +74,7 @@ class PaymentRepository {

Future<PaymentEntity> saveData(Credentials credentials, PaymentEntity payment,
{bool? sendEmail = false}) async {
payment = payment.rebuild((b) => b..documents.clear());
final data = serializers.serializeWith(PaymentEntity.serializer, payment);
dynamic response;

Expand Down Expand Up @@ -100,7 +102,7 @@ class PaymentRepository {
final data = serializers.serializeWith(PaymentEntity.serializer, payment);
dynamic response;

var url = credentials.url+ '/payments/refund?';
var url = credentials.url + '/payments/refund?';
if (payment.sendEmail == true) {
url += '&email_receipt=true';
}
Expand All @@ -115,4 +117,24 @@ class PaymentRepository {

return paymentResponse.data;
}

Future<PaymentEntity> uploadDocument(
Credentials credentials,
BaseEntity entity,
List<MultipartFile> multipartFiles,
bool isPrivate) async {
final fields = <String, String>{
'_method': 'put',
'is_public': isPrivate ? '0' : '1',
};

final dynamic response = await webClient.post(
'${credentials.url}/payments/${entity.id}/upload', credentials.token,
data: fields, multipartFiles: multipartFiles);

final PaymentItemResponse paymentItemResponse =
serializers.deserializeWith(PaymentItemResponse.serializer, response)!;

return paymentItemResponse.data;
}
}
10 changes: 7 additions & 3 deletions lib/redux/credit/credit_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -634,8 +634,12 @@ Future handleCreditAction(BuildContext context, List<BaseEntity> credits,
.get(credit.invitationDownloadLink, state.token, rawResponse: true)
.then((response) {
store.dispatch(StopLoading());
saveDownloadedFile(response.bodyBytes,
localization!.credit + '_' + credit.number + '.pdf');
saveDownloadedFile(
response.bodyBytes,
credit.number + '.pdf',
prefix: EntityType.credit.apiValue,
languageId: client.languageId,
);
}).catchError((_) {
store.dispatch(StopLoading());
});
Expand Down Expand Up @@ -694,7 +698,7 @@ Future handleCreditAction(BuildContext context, List<BaseEntity> credits,
break;
case EntityAction.bulkPrint:
store.dispatch(StartSaving());
final url = state.credentials.url+ '/credits/bulk';
final url = state.credentials.url + '/credits/bulk';
final data = json.encode(
{'ids': creditIds, 'action': EntityAction.bulkPrint.toApiParam()});
final http.Response? response = await WebClient()
Expand Down
5 changes: 5 additions & 0 deletions lib/redux/document/document_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import 'package:invoiceninja_flutter/redux/credit/credit_actions.dart';
import 'package:invoiceninja_flutter/redux/expense/expense_actions.dart';
import 'package:invoiceninja_flutter/redux/group/group_actions.dart';
import 'package:invoiceninja_flutter/redux/invoice/invoice_actions.dart';
import 'package:invoiceninja_flutter/redux/payment/payment_actions.dart';
import 'package:invoiceninja_flutter/redux/product/product_actions.dart';
import 'package:invoiceninja_flutter/redux/project/project_actions.dart';
import 'package:invoiceninja_flutter/redux/purchase_order/purchase_order_actions.dart';
Expand Down Expand Up @@ -502,6 +503,10 @@ void handleDocumentAction(
completer.future.then<Null>((_) => store
.dispatch(LoadVendor(vendorId: document.parentId)));
break;
case EntityType.payment:
completer.future.then<Null>((_) => store
.dispatch(LoadPayment(paymentId: document.parentId)));
break;
default:
completer.future
.then<Null>((_) => store.dispatch(RefreshData()));
Expand Down
Loading

0 comments on commit a9c0043

Please sign in to comment.