Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
hillelcoren committed Sep 30, 2024
2 parents 63a9f60 + 018d7c2 commit 746e93b
Show file tree
Hide file tree
Showing 14 changed files with 3,685 additions and 534 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.170"
automatic_release_tag: "v5.0.171"
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.171" date="2024-09-29"/>
<release version="5.0.170" date="2024-09-25"/>
<release version="5.0.169" date="2024-09-25"/>
<release version="5.0.168" date="2024-09-09"/>
Expand Down
4 changes: 3 additions & 1 deletion 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.170';
const String kClientVersion = '5.0.171';
const String kMinServerVersion = '5.0.4';

const String kAppName = 'Invoice Ninja';
Expand Down Expand Up @@ -120,6 +120,7 @@ const String kSharedPrefWidth = 'width';
const String kSharedPrefHeight = 'height';
const String kSharedPrefMaximized = 'maximized';
const String kSharedPrefHostOverride = 'host_override';
const String kSharedPrefCompanyId = 'company_id';

const String kProductProPlanMonth = 'pro_plan';
const String kProductEnterprisePlanMonth_2 = 'enterprise_plan';
Expand Down Expand Up @@ -535,6 +536,7 @@ const kNotificationEvents = [

const String kGatewayStripe = 'd14dd26a37cecc30fdd65700bfb55b23';
const String kGatewayStripeConnect = 'd14dd26a47cecc30fdd65700bfb67b34';
const String kGatewayGoCardlessOAuth = 'b9886f9257f0c6ee7c302f1c74475f6c';
const String kGatewayAuthorizeNet = '3b6621f970ab18887c4f6dca78d3f8bb';
const String kGatewayCheckoutCom = '3758e7f7c6f4cecf0f4f348b9a00f456';
const String kGatewayPayPalREST = '80af24a6a691230bbec33e930ab40665';
Expand Down
5 changes: 5 additions & 0 deletions lib/data/models/subscription_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ abstract class SubscriptionEntity extends Object
registrationRequired: false,
useInventoryManagement: false,
steps: DEFAULT_STEPS,
remainingCycles: -1,
webhookConfiguration: WebhookConfigurationEntity(),
);
}
Expand Down Expand Up @@ -135,6 +136,9 @@ abstract class SubscriptionEntity extends Object
@BuiltValueField(wireName: 'use_inventory_management')
bool get useInventoryManagement;

@BuiltValueField(wireName: 'remaining_cycles')
int? get remainingCycles;

@BuiltValueField(wireName: 'frequency_id')
String get frequencyId;

Expand Down Expand Up @@ -272,6 +276,7 @@ abstract class SubscriptionEntity extends Object
static void _initializeBuilder(SubscriptionEntityBuilder builder) => builder
..optionalProductIds = ''
..optionalRecurringProductIds = ''
..remainingCycles = -1
..registrationRequired = false
..useInventoryManagement = false
..steps = DEFAULT_STEPS;
Expand Down
23 changes: 23 additions & 0 deletions lib/data/models/subscription_model.g.dart

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

11 changes: 11 additions & 0 deletions lib/redux/app/app_middleware.dart
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,17 @@ Middleware<AppState> _createLoadState(
} else {
store.dispatch(ViewMainScreen());
}

final prefs = await SharedPreferences.getInstance();
final companyId = prefs.getString(kSharedPrefCompanyId);
if (companyId != null) {
final index = companyStates.indexWhere(
(companyState) => companyState?.company.id == companyId);
if (index > 0) {
store.dispatch(SelectCompany(companyIndex: index));
}
}

WidgetsBinding.instance.addPostFrameCallback((duration) {
store.dispatch(ViewDashboard());
});
Expand Down
5 changes: 5 additions & 0 deletions lib/ui/app/menu_drawer_vm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:flutter/material.dart';

// Package imports:
import 'package:flutter_redux/flutter_redux.dart';
import 'package:invoiceninja_flutter/constants.dart';
import 'package:redux/redux.dart';

// Project imports:
Expand All @@ -24,6 +25,7 @@ import 'package:invoiceninja_flutter/utils/completers.dart';
import 'package:invoiceninja_flutter/utils/dialogs.dart';
import 'package:invoiceninja_flutter/utils/localization.dart';
import 'package:invoiceninja_flutter/utils/oauth.dart';
import 'package:shared_preferences/shared_preferences.dart';

class MenuDrawerBuilder extends StatelessWidget {
const MenuDrawerBuilder({Key? key}) : super(key: key);
Expand Down Expand Up @@ -95,6 +97,9 @@ class MenuDrawerVM {
checkForChanges(
store: store,
callback: () {
SharedPreferences.getInstance().then(
(prefs) => prefs.setString(kSharedPrefCompanyId, company.id));

store.dispatch(ClearEntityFilter());
store.dispatch(DiscardChanges());
store.dispatch(SelectCompany(companyIndex: index));
Expand Down
1 change: 1 addition & 0 deletions lib/ui/company_gateway/edit/company_gateway_edit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class _CompanyGatewayEditState extends State<CompanyGatewayEdit>
kGatewayStripeConnect,
kGatewayWePay,
kGatewayPayPalPlatform,
kGatewayGoCardlessOAuth,
];

final disableSave = (connectGateways.contains(companyGateway.gatewayId) &&
Expand Down
4 changes: 4 additions & 0 deletions lib/ui/company_gateway/edit/company_gateway_edit_vm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ class CompanyGatewayEditVM {
launchUrl(Uri.parse(
'${cleanApiUrl(credentials.url)}/paypal?hash=${response['hash']}'));
break;
case kGatewayGoCardlessOAuth:
launchUrl(Uri.parse(
'${cleanApiUrl(credentials.url)}/gocardless/oauth/connect/${response['hash']}'));
break;
}
}).catchError((dynamic error) {
store.dispatch(StopSaving());
Expand Down
20 changes: 20 additions & 0 deletions lib/ui/subscription/edit/subscription_edit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,26 @@ class _SubscriptionEditState extends State<SubscriptionEdit>
child: Text(localization.lookup(entry.value)),
))
.toList()),
AppDropdownButton<int>(
labelText: localization.remainingCycles,
value: subscription.remainingCycles,
blankValue: null,
onChanged: (dynamic value) => viewModel.onChanged(
subscription
.rebuild((b) => b..remainingCycles = value)),
items: [
DropdownMenuItem(
child: Text(localization.endless),
value: -1,
),
...List<int>.generate(61, (i) => i)
.map((value) => DropdownMenuItem(
child: Text('$value'),
value: value,
))
.toList()
],
),
AppDropdownButton<String>(
labelText: localization.autoBill,
value: subscription.autoBill,
Expand Down
Loading

0 comments on commit 746e93b

Please sign in to comment.