Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
hillelcoren committed Jun 20, 2024
2 parents 66e6e64 + dd7ec12 commit 2b2a0fd
Show file tree
Hide file tree
Showing 30 changed files with 333 additions and 18 deletions.
16 changes: 8 additions & 8 deletions bump_version.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/bin/bash

current_version=$(grep "version: 5.0." pubspec.yaml | cut -f2 -d "+" )
new_vesion=$((current_version+1))
new_version=$((current_version+1))
date_today=$(date +%F)

echo "Bump version... $current_version => $new_vesion"
echo "Bump version... $current_version => $new_version"

sed -i -e "s/version: 5.0.$current_version+$current_version/version: 5.0.$new_vesion+$new_vesion/g" ./pubspec.yaml
sed -i -e "s/version: 5.0.$current_version+$current_version/version: 5.0.$new_vesion+$new_vesion/g" ./pubspec.foss.yaml
sed -i -e "s/v5.0.$current_version/v5.0.$new_vesion/g" ./.github/workflows/flatpak.yml
sed -i -e 's/<releases>/<releases>\n <release version="5.0.'$new_vesion'" date="'$date_today'"\/>/g' ./flatpak/com.invoiceninja.InvoiceNinja.metainfo.xml
sed -i -e "s/kClientVersion = '5.0.$current_version'/kClientVersion = '5.0.$new_vesion'/g" ./lib/constants.dart
sed -i -e "s/version: '5.0.$current_version'/version: '5.0.$new_vesion'/g" ./snap/snapcraft.yaml
sed -i -e "s/version: 5.0.$current_version+$current_version/version: 5.0.$new_version+$new_version/g" ./pubspec.yaml
sed -i -e "s/version: 5.0.$current_version+$current_version/version: 5.0.$new_version+$new_version/g" ./pubspec.foss.yaml
sed -i -e "s/v5.0.$current_version/v5.0.$new_version/g" ./.github/workflows/flatpak.yml
sed -i -e 's/<releases>/<releases>\n <release version="5.0.'$new_version'" date="'$date_today'"\/>/g' ./flatpak/com.invoiceninja.InvoiceNinja.metainfo.xml
sed -i -e "s/kClientVersion = '5.0.$current_version'/kClientVersion = '5.0.$new_version'/g" ./lib/constants.dart
sed -i -e "s/version: '5.0.$current_version'/version: '5.0.$new_version'/g" ./snap/snapcraft.yaml

rm lib/flutter_version.dart
echo "const FLUTTER_VERSION = const <String, String>" > lib/flutter_version.dart
Expand Down
1 change: 1 addition & 0 deletions lib/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1128,3 +1128,4 @@ const String kActivityAcceptPurchaseOrder = '137';
const String kActivityEmailPayment = '138';
const String kActivityExpenseNotificationSent = '139';
const String kActivityStatementSent = '140';
const String kActivityComment = '141';
4 changes: 4 additions & 0 deletions lib/data/models/client_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,10 @@ abstract class ClientEntity extends Object
store.state.designState.map, entityType)) {
actions.add(EntityAction.runTemplate);
}

if (!multiselect) {
actions.add(EntityAction.addComment);
}
}

if (!isDeleted! && multiselect) {
Expand Down
32 changes: 32 additions & 0 deletions lib/data/models/entities.dart
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,39 @@ abstract class ActivityEntity

InvoiceHistoryEntity? get history;

// TODO remove isEmpty check
bool get isComment =>
activityTypeId == kActivityComment || activityTypeId.isEmpty;

EntityType? get entityType {
if (isComment) {
if ((invoiceId ?? '').isNotEmpty) {
return EntityType.invoice;
} else if ((quoteId ?? '').isNotEmpty) {
return EntityType.quote;
} else if ((creditId ?? '').isNotEmpty) {
return EntityType.credit;
} else if ((recurringInvoiceId ?? '').isNotEmpty) {
return EntityType.recurringInvoice;
} else if ((paymentId ?? '').isNotEmpty) {
return EntityType.payment;
} else if ((projectId ?? '').isNotEmpty) {
return EntityType.project;
} else if ((taskId ?? '').isNotEmpty) {
return EntityType.task;
} else if ((expenseId ?? '').isNotEmpty) {
return EntityType.expense;
} else if ((recurringExpenseId ?? '').isNotEmpty) {
return EntityType.recurringExpense;
} else if ((purchaseOrderId ?? '').isNotEmpty) {
return EntityType.purchaseOrder;
} else if ((clientId ?? '').isNotEmpty) {
return EntityType.client;
} else if ((vendorId ?? '').isNotEmpty) {
return EntityType.vendor;
}
}

if ([
kActivityCreateClient,
kActivityUpdateClient,
Expand Down
4 changes: 4 additions & 0 deletions lib/data/models/expense_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@ abstract class ExpenseEntity extends Object
actions.add(EntityAction.documents);
}

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

final superActions = super.getActions(userCompany: userCompany);

if (actions.isNotEmpty && superActions.isNotEmpty && actions.last != null) {
Expand Down
4 changes: 4 additions & 0 deletions lib/data/models/invoice_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,10 @@ abstract class InvoiceEntity extends Object
store.state.designState.map, entityType!)) {
actions.add(EntityAction.runTemplate);
}

if (!multiselect) {
actions.add(EntityAction.addComment);
}
}

if (userCompany.canEditEntity(this) && !isCancelledOrReversed) {
Expand Down
1 change: 1 addition & 0 deletions lib/data/models/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class EntityAction extends EnumClass {
static const EntityAction runTemplate = _$runTemplate;
static const EntityAction bulkUpdate = _$bulkUpdate;
static const EntityAction reconnect = _$reconnect;
static const EntityAction addComment = _$addComment;

@override
String toString() {
Expand Down
4 changes: 4 additions & 0 deletions lib/data/models/models.g.dart

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

4 changes: 4 additions & 0 deletions lib/data/models/payment_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,10 @@ abstract class PaymentEntity extends Object
store.state.designState.map, entityType)) {
actions.add(EntityAction.runTemplate);
}

if (!multiselect) {
//actions.add(EntityAction.addComment);
}
}

if (!isDeleted! && multiselect) {
Expand Down
4 changes: 4 additions & 0 deletions lib/data/models/project_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ abstract class ProjectEntity extends Object
store.state.designState.map, entityType)) {
actions.add(EntityAction.runTemplate);
}

if (!multiselect) {
//actions.add(EntityAction.addComment);
}
}

if (actions.isNotEmpty && actions.last != null) {
Expand Down
4 changes: 4 additions & 0 deletions lib/data/models/task_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,10 @@ abstract class TaskEntity extends Object
store.state.designState.map, entityType)) {
actions.add(EntityAction.runTemplate);
}

if (!multiselect) {
//actions.add(EntityAction.addComment);
}
}

if (actions.isNotEmpty && actions.last != null) {
Expand Down
4 changes: 4 additions & 0 deletions lib/data/models/vendor_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ abstract class VendorEntity extends Object
actions.add(EntityAction.documents);
}

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

if (actions.isNotEmpty && actions.last != null) {
actions.add(null);
}
Expand Down
11 changes: 11 additions & 0 deletions lib/redux/client/client_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
import 'package:built_collection/built_collection.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:http/http.dart';
import 'package:invoiceninja_flutter/main_app.dart';
import 'package:invoiceninja_flutter/redux/document/document_actions.dart';
import 'package:invoiceninja_flutter/ui/app/forms/client_picker.dart';
import 'package:invoiceninja_flutter/utils/dialogs.dart';
Expand Down Expand Up @@ -560,6 +561,16 @@ void handleClientAction(BuildContext? context, List<BaseEntity> clients,
),
);
break;
case EntityAction.addComment:
showDialog<void>(
context: navigatorKey.currentContext!,
barrierDismissible: false,
builder: (context) => AddCommentDialog(
entityType: EntityType.client,
entityId: client.id,
),
);
break;
default:
print('## Error: action $action not handled in client_actions');
}
Expand Down
11 changes: 11 additions & 0 deletions lib/redux/credit/credit_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:flutter/material.dart';
import 'package:built_collection/built_collection.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:http/http.dart';
import 'package:invoiceninja_flutter/main_app.dart';
import 'package:invoiceninja_flutter/redux/document/document_actions.dart';
import 'package:invoiceninja_flutter/redux/settings/settings_actions.dart';
import 'package:invoiceninja_flutter/utils/files.dart';
Expand Down Expand Up @@ -754,6 +755,16 @@ Future handleCreditAction(BuildContext context, List<BaseEntity> credits,
);
}
break;
case EntityAction.addComment:
showDialog<void>(
context: navigatorKey.currentContext!,
barrierDismissible: false,
builder: (context) => AddCommentDialog(
entityType: EntityType.credit,
entityId: credit.id,
),
);
break;
default:
print('## ERROR: unhandled action $action in credit_actions');
break;
Expand Down
12 changes: 11 additions & 1 deletion lib/redux/expense/expense_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'dart:async';

// Flutter imports:
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

// Package imports:
import 'package:built_collection/built_collection.dart';
Expand All @@ -12,6 +11,7 @@ import 'package:http/http.dart';

// Project imports:
import 'package:invoiceninja_flutter/data/models/models.dart';
import 'package:invoiceninja_flutter/main_app.dart';
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
import 'package:invoiceninja_flutter/redux/document/document_actions.dart';
Expand Down Expand Up @@ -397,6 +397,16 @@ void handleExpenseAction(
);
}
break;
case EntityAction.addComment:
showDialog<void>(
context: navigatorKey.currentContext!,
barrierDismissible: false,
builder: (context) => AddCommentDialog(
entityType: EntityType.expense,
entityId: expense.id,
),
);
break;
default:
print('## ERROR: unhandled action $action in expense_actions');
break;
Expand Down
10 changes: 10 additions & 0 deletions lib/redux/invoice/invoice_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,16 @@ void handleInvoiceAction(BuildContext? context, List<BaseEntity> invoices,
),
);
break;
case EntityAction.addComment:
showDialog<void>(
context: navigatorKey.currentContext!,
barrierDismissible: false,
builder: (context) => AddCommentDialog(
entityType: EntityType.invoice,
entityId: invoice.id,
),
);
break;
case EntityAction.more:
showEntityActionsDialog(
entities: [invoice],
Expand Down
11 changes: 11 additions & 0 deletions lib/redux/payment/payment_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:http/http.dart';

// Project imports:
import 'package:invoiceninja_flutter/data/models/models.dart';
import 'package:invoiceninja_flutter/main_app.dart';
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
import 'package:invoiceninja_flutter/redux/document/document_actions.dart';
Expand Down Expand Up @@ -469,6 +470,16 @@ void handlePaymentAction(
),
);
break;
case EntityAction.addComment:
showDialog<void>(
context: navigatorKey.currentContext!,
barrierDismissible: false,
builder: (context) => AddCommentDialog(
entityType: EntityType.payment,
entityId: payment.id,
),
);
break;
default:
print('## Error: action $action not handled in client_actions');
}
Expand Down
11 changes: 11 additions & 0 deletions lib/redux/project/project_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:http/http.dart';

// Project imports:
import 'package:invoiceninja_flutter/data/models/models.dart';
import 'package:invoiceninja_flutter/main_app.dart';
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
import 'package:invoiceninja_flutter/redux/document/document_actions.dart';
Expand Down Expand Up @@ -399,6 +400,16 @@ void handleProjectAction(
),
);
break;
case EntityAction.addComment:
showDialog<void>(
context: navigatorKey.currentContext!,
barrierDismissible: false,
builder: (context) => AddCommentDialog(
entityType: EntityType.project,
entityId: project.id,
),
);
break;
default:
print('## Error: action $action not handled in project_actions');
}
Expand Down
15 changes: 14 additions & 1 deletion lib/redux/purchase_order/purchase_order_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,10 @@ class RemovePurchaseOrderContact implements PersistUI {
}

class AddPurchaseOrderItem implements PersistUI {
AddPurchaseOrderItem({this.purchaseOrderItem, this.index,});
AddPurchaseOrderItem({
this.purchaseOrderItem,
this.index,
});

final int? index;
final InvoiceItemEntity? purchaseOrderItem;
Expand Down Expand Up @@ -876,6 +879,16 @@ void handlePurchaseOrderAction(BuildContext? context,
entities: [purchaseOrder],
);
break;
case EntityAction.addComment:
showDialog<void>(
context: navigatorKey.currentContext!,
barrierDismissible: false,
builder: (context) => AddCommentDialog(
entityType: EntityType.purchaseOrder,
entityId: purchaseOrder.id,
),
);
break;
default:
print('## ERROR: unhandled action $action in purchase_order_actions');
break;
Expand Down
11 changes: 11 additions & 0 deletions lib/redux/quote/quote_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:built_collection/built_collection.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:http/http.dart';
import 'package:invoiceninja_flutter/constants.dart';
import 'package:invoiceninja_flutter/main_app.dart';
import 'package:invoiceninja_flutter/redux/document/document_actions.dart';
import 'package:invoiceninja_flutter/redux/settings/settings_actions.dart';
import 'package:invoiceninja_flutter/utils/files.dart';
Expand Down Expand Up @@ -808,6 +809,16 @@ Future handleQuoteAction(
);
}
break;
case EntityAction.addComment:
showDialog<void>(
context: navigatorKey.currentContext!,
barrierDismissible: false,
builder: (context) => AddCommentDialog(
entityType: EntityType.quote,
entityId: quote.id,
),
);
break;
default:
print('## ERROR: unhandled action $action in quote_actions');
break;
Expand Down
Loading

0 comments on commit 2b2a0fd

Please sign in to comment.