Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
hillelcoren committed Aug 28, 2024
2 parents 0b3e03f + 60b7e75 commit 4d5d184
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 11 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.162"
automatic_release_tag: "v5.0.163"
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.163" date="2024-08-28"/>
<release version="5.0.162" date="2024-08-21"/>
<release version="5.0.161" date="2024-06-27"/>
<release version="5.0.160" date="2024-05-22"/>
Expand Down
3 changes: 2 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.162';
const String kClientVersion = '5.0.163';
const String kMinServerVersion = '5.0.4';

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

const String kProductProPlanMonth = 'pro_plan';
const String kProductEnterprisePlanMonth_2 = 'enterprise_plan';
Expand Down
20 changes: 18 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,25 @@ emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
-----END CERTIFICATE-----
''';

// https://www.reddit.com/r/flutterhelp/comments/1cnb3q0/certificate_verify_failed_whats_the_right/
class MyHttpOverrides extends HttpOverrides {
MyHttpOverrides(this.host);
final String host;

@override
HttpClient createHttpClient(SecurityContext? context) {
return super.createHttpClient(context)
..badCertificateCallback = (X509Certificate cert, String host, int port) {
return this.host == host;
};
}
}

void main({bool isTesting = false}) async {
final prefs = await SharedPreferences.getInstance();
HttpOverrides.global =
MyHttpOverrides(prefs.getString(kSharedPrefHostOverride) ?? '');

WidgetsFlutterBinding.ensureInitialized();
_registerErrorHandlers();

Expand All @@ -115,8 +133,6 @@ void main({bool isTesting = false}) async {
// Ignore CERT_ALREADY_IN_HASH_TABLE
}

final prefs = await SharedPreferences.getInstance();

if (isDesktopOS()) {
await windowManager.ensureInitialized();

Expand Down
50 changes: 46 additions & 4 deletions lib/ui/auth/login_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:invoiceninja_flutter/ui/app/sms_verification.dart';
// Package imports:
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import 'package:rounded_loading_button/rounded_loading_button.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:sign_in_with_apple/sign_in_with_apple.dart';
import 'package:url_launcher/url_launcher.dart';

Expand Down Expand Up @@ -58,6 +59,7 @@ class _LoginState extends State<LoginView> {
final _secretController = TextEditingController();
final _oneTimePasswordController = TextEditingController();
final _tokenController = TextEditingController();
final _hostOverrideController = TextEditingController();

final _buttonController = RoundedLoadingButtonController();

Expand All @@ -76,6 +78,7 @@ class _LoginState extends State<LoginView> {
bool _tokenLogin = false;
bool _isSelfHosted = false;
bool _createAccount = false;
bool _showSettings = false;

bool _recoverPassword = false;
bool _disable2FA = false;
Expand Down Expand Up @@ -118,6 +121,11 @@ class _LoginState extends State<LoginView> {
if (_urlController.text.isEmpty) {
_urlController.text = widget.viewModel.authState.url;
}

SharedPreferences.getInstance().then((value) {
_hostOverrideController.text =
value.getString(kSharedPrefHostOverride) ?? '';
});
}

@override
Expand All @@ -130,6 +138,7 @@ class _LoginState extends State<LoginView> {
_secretController.dispose();
_oneTimePasswordController.dispose();
_tokenController.dispose();
_hostOverrideController.dispose();

super.dispose();
}
Expand Down Expand Up @@ -796,16 +805,18 @@ class _LoginState extends State<LoginView> {
)
else
InkWell(
onTap: () => launchUrl(Uri.parse(kDocsUrl)),
onTap: () => setState(() {
_showSettings = !_showSettings;
}),
child: Padding(
padding: const EdgeInsets.all(14),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.book, size: 16),
Icon(Icons.settings, size: 16),
SizedBox(width: 8),
Text(localization!.documentation)
Text(localization!.settings)
],
),
),
Expand All @@ -815,7 +826,38 @@ class _LoginState extends State<LoginView> {
),
],
),
SizedBox(height: 20),
SizedBox(height: 8),
if (_showSettings) ...[
FormCard(
forceNarrow: true,
internalPadding: const EdgeInsets.all(0),
children: [
Padding(
padding: EdgeInsets.symmetric(
horizontal: horizontalPadding, vertical: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
DecoratedFormField(
autofocus: true,
hint: 'domain.com',
label: localization!.sslHostOverride,
controller: _hostOverrideController,
keyboardType: TextInputType.text,
onChanged: (value) async {
final prefs = await SharedPreferences.getInstance();
prefs.setString(kSharedPrefHostOverride, value);
},
),
SizedBox(height: 8),
Text(localization.restartAppToApplyChange),
],
),
),
],
),
SizedBox(height: 20),
]
],
),
);
Expand Down
5 changes: 5 additions & 0 deletions lib/utils/i18n.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
static final Map<String, Map<String, String>> _localizedValues = {
'en': {
// STARTER: lang key - do not remove comment
'ssl_host_override': 'SSL Host Override',
'upload_logo_short': 'Upload Logo',
'show_pdfhtml_on_mobile_help':
'For improved visualization, displays a HTML version of the invoice/quote when viewing on mobile.',
Expand Down Expand Up @@ -118092,6 +118093,10 @@ mixin LocalizationsProvider on LocaleCodeAware {
_localizedValues[localeCode]!['upload_logo_short'] ??
_localizedValues['en']!['upload_logo_short']!;

String get sslHostOverride =>
_localizedValues[localeCode]!['ssl_host_override'] ??
_localizedValues['en']!['ssl_host_override']!;

// STARTER: lang field - do not remove comment

String lookup(String? key, {String? overrideLocaleCode}) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.foss.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: invoiceninja_flutter
description: Client for Invoice Ninja
version: 5.0.162+162
version: 5.0.163+163
homepage: https://invoiceninja.com
documentation: https://invoiceninja.github.io
publish_to: none
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: invoiceninja_flutter
description: Client for Invoice Ninja
version: 5.0.162+162
version: 5.0.163+163
homepage: https://invoiceninja.com
documentation: https://invoiceninja.github.io
publish_to: none
Expand Down
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: invoiceninja
version: '5.0.162'
version: '5.0.163'
summary: Create invoices, accept payments, track expenses & time tasks
description: "### Note: if the app fails to run using `snap run invoiceninja` it may help to run `/snap/invoiceninja/current/bin/invoiceninja` instead
Expand Down

0 comments on commit 4d5d184

Please sign in to comment.