mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-27 21:16:48 +00:00
Bug fixes (#637)
* Fix formatting * Handle case where server does not provide permissions information * Enhanced URL checks * Enhanced check * Fix for error dialog * Bump version information
This commit is contained in:
parent
762d1ae156
commit
52879c0fc2
@ -1,3 +1,7 @@
|
|||||||
|
### 0.18.1 - April 2025
|
||||||
|
---
|
||||||
|
- Fix bug associated with handling invalid URLs
|
||||||
|
|
||||||
### 0.18.0 - April 2025
|
### 0.18.0 - April 2025
|
||||||
---
|
---
|
||||||
- Adds ability to create new companies from the app
|
- Adds ability to create new companies from the app
|
||||||
|
29
lib/api.dart
29
lib/api.dart
@ -336,6 +336,8 @@ class InvenTreeAPI {
|
|||||||
// Ref: https://github.com/inventree/InvenTree/pull/7420
|
// Ref: https://github.com/inventree/InvenTree/pull/7420
|
||||||
bool get supportsModernAttachments => apiVersion >= 207;
|
bool get supportsModernAttachments => apiVersion >= 207;
|
||||||
|
|
||||||
|
bool get supportsUserPermissions => apiVersion >= 207;
|
||||||
|
|
||||||
// Does the server support the "destination" field on the PurchaseOrder model?
|
// Does the server support the "destination" field on the PurchaseOrder model?
|
||||||
// Ref: https://github.com/inventree/InvenTree/pull/8403
|
// Ref: https://github.com/inventree/InvenTree/pull/8403
|
||||||
bool get supportsPurchaseOrderDestination => apiVersion >= 276;
|
bool get supportsPurchaseOrderDestination => apiVersion >= 276;
|
||||||
@ -725,7 +727,12 @@ class InvenTreeAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
roles = (data["roles"] ?? {}) as Map<String, dynamic>;
|
roles = (data["roles"] ?? {}) as Map<String, dynamic>;
|
||||||
|
|
||||||
|
if (supportsUserPermissions && data.containsKey("permissions")) {
|
||||||
permissions = (data["permissions"] ?? {}) as Map<String, dynamic>;
|
permissions = (data["permissions"] ?? {}) as Map<String, dynamic>;
|
||||||
|
} else {
|
||||||
|
permissions = {};
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1194,6 +1201,15 @@ class InvenTreeAPI {
|
|||||||
|
|
||||||
var _url = makeApiUrl(url);
|
var _url = makeApiUrl(url);
|
||||||
|
|
||||||
|
if (_url.isEmpty) {
|
||||||
|
showServerError(
|
||||||
|
url,
|
||||||
|
L10().invalidHost,
|
||||||
|
L10().invalidHostDetails
|
||||||
|
);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// Add any required query parameters to the URL using ?key=value notation
|
// Add any required query parameters to the URL using ?key=value notation
|
||||||
if (urlParams.isNotEmpty) {
|
if (urlParams.isNotEmpty) {
|
||||||
String query = "?";
|
String query = "?";
|
||||||
@ -1210,13 +1226,12 @@ class InvenTreeAPI {
|
|||||||
|
|
||||||
Uri? _uri = Uri.tryParse(_url);
|
Uri? _uri = Uri.tryParse(_url);
|
||||||
|
|
||||||
if (_uri == null) {
|
if (_uri == null || _uri.host.isEmpty) {
|
||||||
showServerError(url, L10().invalidHost, L10().invalidHostDetails);
|
showServerError(
|
||||||
return null;
|
_url,
|
||||||
}
|
L10().invalidHost,
|
||||||
|
L10().invalidHostDetails
|
||||||
if (_uri.host.isEmpty) {
|
);
|
||||||
showServerError(url, L10().invalidHost, L10().invalidHostDetails);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,13 +228,15 @@ Future<void> showServerError(String url, String title, String description) async
|
|||||||
playAudioFile("sounds/server_error.mp3");
|
playAudioFile("sounds/server_error.mp3");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
description += "\nURL: $url";
|
||||||
|
|
||||||
showSnackIcon(
|
showSnackIcon(
|
||||||
title,
|
title,
|
||||||
success: false,
|
success: false,
|
||||||
actionText: L10().details,
|
actionText: L10().details,
|
||||||
onAction: () {
|
onAction: () {
|
||||||
showErrorDialog(
|
showErrorDialog(
|
||||||
L10().serverError,
|
title,
|
||||||
description: description,
|
description: description,
|
||||||
icon: TablerIcons.server
|
icon: TablerIcons.server
|
||||||
);
|
);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
name: inventree
|
name: inventree
|
||||||
description: InvenTree stock management
|
description: InvenTree stock management
|
||||||
|
|
||||||
version: 0.18.0+97
|
version: 0.18.1+98
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.19.5 <3.13.0"
|
sdk: ">=2.19.5 <3.13.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user