mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-13 10:45:29 +00:00
Modern attachments (#505)
* Minimum API version is now 100 * Remove old API features - Anything below API v100 no longer supported * Reefactor attachment widget to support modern attachment API * Filter and display attachments correctly * Refactor
This commit is contained in:
39
lib/api.dart
39
lib/api.dart
@ -187,7 +187,8 @@ class InvenTreeAPI {
|
||||
}
|
||||
|
||||
// Minimum required API version for server
|
||||
static const _minApiVersion = 20;
|
||||
// 2023-03-04
|
||||
static const _minApiVersion = 100;
|
||||
|
||||
bool _strictHttps = false;
|
||||
|
||||
@ -282,30 +283,6 @@ class InvenTreeAPI {
|
||||
String get serverVersion => (serverInfo["version"] ?? "") as String;
|
||||
int get apiVersion => (serverInfo["apiVersion"] ?? 1) as int;
|
||||
|
||||
// Plugins enabled at API v34 and above
|
||||
bool get pluginsEnabled => apiVersion >= 34 && (serverInfo["plugins_enabled"] ?? false) as bool;
|
||||
|
||||
// API endpoint for receiving purchase order line items was introduced in v12
|
||||
bool get supportsPoReceive => apiVersion >= 12;
|
||||
|
||||
// Notification support requires API v25 or newer
|
||||
bool get supportsNotifications => isConnected() && apiVersion >= 25;
|
||||
|
||||
// Return True if the API supports 'settings' (requires API v46)
|
||||
bool get supportsSettings => isConnected() && apiVersion >= 46;
|
||||
|
||||
// Part parameter support requires API v56 or newer
|
||||
bool get supportsPartParameters => isConnected() && apiVersion >= 56;
|
||||
|
||||
// Supports 'modern' barcode API (v80 or newer)
|
||||
bool get supportModernBarcodes => isConnected() && apiVersion >= 80;
|
||||
|
||||
// Structural categories requires API v83 or newer
|
||||
bool get supportsStructuralCategories => isConnected() && apiVersion >= 83;
|
||||
|
||||
// Company attachments require API v95 or newer
|
||||
bool get supportCompanyAttachments => isConnected() && apiVersion >= 95;
|
||||
|
||||
// Consolidated search request API v102 or newer
|
||||
bool get supportsConsolidatedSearch => isConnected() && apiVersion >= 102;
|
||||
|
||||
@ -346,7 +323,11 @@ class InvenTreeAPI {
|
||||
bool get supportsCompanyActiveStatus => isConnected() && apiVersion >= 189;
|
||||
|
||||
// Does the server support the "modern" (consolidated) label printing API?
|
||||
bool get supportsModernLabelPrinting => isConnected() && apiVersion >= 198;
|
||||
bool get supportsModernLabelPrinting => isConnected() && apiVersion >= 201;
|
||||
|
||||
// Does the server support the "modern" (consolidated) attachment API?
|
||||
// Ref: https://github.com/inventree/InvenTree/pull/7420
|
||||
bool get supportsModernAttachments => isConnected() && apiVersion >= 207;
|
||||
|
||||
// Cached list of plugins (refreshed when we connect to the server)
|
||||
List<InvenTreePlugin> _plugins = [];
|
||||
@ -1517,7 +1498,6 @@ class InvenTreeAPI {
|
||||
Map<String, InvenTreeUserSetting> _userSettings = {};
|
||||
|
||||
Future<String> getGlobalSetting(String key) async {
|
||||
if (!supportsSettings) return "";
|
||||
|
||||
InvenTreeGlobalSetting? setting = _globalSettings[key];
|
||||
|
||||
@ -1543,7 +1523,6 @@ class InvenTreeAPI {
|
||||
}
|
||||
|
||||
Future<String> getUserSetting(String key) async {
|
||||
if (!supportsSettings) return "";
|
||||
|
||||
InvenTreeUserSetting? setting = _userSettings[key];
|
||||
|
||||
@ -1687,10 +1666,6 @@ class InvenTreeAPI {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!supportsNotifications) {
|
||||
return;
|
||||
}
|
||||
|
||||
InvenTreeNotification().count(filters: {"read": "false"}).then((int n) {
|
||||
notification_counter = n;
|
||||
});
|
||||
|
Reference in New Issue
Block a user