Skip to content

Commit

Permalink
Adjust version requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
hillelcoren committed May 24, 2023
1 parent 6b7d9d5 commit 50b61d3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/ui/settings/email_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ class _EmailSettingsState extends State<EmailSettings> {
onChanged: (value) => viewModel.onSettingsChanged(
settings.rebuild((b) => b..ublEmailAttachment = value)),
),
if (supportsLatestFeatures())
if (supportsLatestFeatures(null))
BoolDropdownButton(
label: localization.enableEInvoice,
value: settings.enableEInvoice,
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/settings/settings_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ class SettingsSearch extends StatelessWidget {
[
'tax_settings',
'inclusive_taxes',
if (supportsLatestFeatures()) 'calculate_taxes#2023-04-26',
if (supportsLatestFeatures('5.6.0')) 'calculate_taxes#2023-04-26',
],
],
kSettingsTaxRates: [
Expand Down Expand Up @@ -623,7 +623,7 @@ class SettingsSearch extends StatelessWidget {
'mailgun#2023-01-11',
'email_alignment#2023-01-17',
'show_email_footer#2023-01-17',
if (supportsLatestFeatures()) 'enable_e_invoice#2023-04-27,'
if (supportsLatestFeatures(null)) 'enable_e_invoice#2023-04-27,'
],
],
kSettingsTemplatesAndReminders: [
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/settings/tax_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class _TaxSettingsState extends State<TaxSettings> {
onPressed: () => viewModel.onConfigureRatesPressed(context),
),
),
if (supportsLatestFeatures())
if (supportsLatestFeatures('5.6.0'))
FormCard(
isLast: true,
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down
13 changes: 10 additions & 3 deletions lib/utils/platforms.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,23 @@ bool supportsAppleOAuth() => kIsWeb || isApple();
// TODO remove this function
bool supportsMicrosoftOAuth() => kIsWeb;

bool supportsLatestFeatures() {
bool supportsLatestFeatures(String version) {
final store = StoreProvider.of<AppState>(navigatorKey.currentContext);
final state = store.state;

if (!kReleaseMode || state.isStaging) {
return true;
}

return Version.parse(state.account.currentVersion) >=
Version.parse('5.5.118');
if (state.isSelfHosted) {
return true;
}

if (version == null) {
return false;
}

return Version.parse(state.account.currentVersion) >= Version.parse(version);
}

bool supportsInAppPurchase() {
Expand Down

0 comments on commit 50b61d3

Please sign in to comment.