mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 13:36:50 +00:00
Defines a class for representing an InvenTreePlugin instance
This commit is contained in:
parent
0c7f5d7fe7
commit
0c9c7b2a68
13
lib/api.dart
13
lib/api.dart
@ -17,6 +17,7 @@ import "package:flutter_cache_manager/flutter_cache_manager.dart";
|
|||||||
import "package:inventree/widget/dialogs.dart";
|
import "package:inventree/widget/dialogs.dart";
|
||||||
import "package:inventree/l10.dart";
|
import "package:inventree/l10.dart";
|
||||||
import "package:inventree/inventree/sentry.dart";
|
import "package:inventree/inventree/sentry.dart";
|
||||||
|
import "package:inventree/inventree/model.dart";
|
||||||
import "package:inventree/user_profile.dart";
|
import "package:inventree/user_profile.dart";
|
||||||
import "package:inventree/widget/snacks.dart";
|
import "package:inventree/widget/snacks.dart";
|
||||||
import "package:path_provider/path_provider.dart";
|
import "package:path_provider/path_provider.dart";
|
||||||
@ -227,9 +228,14 @@ class InvenTreeAPI {
|
|||||||
|
|
||||||
int get apiVersion => _apiVersion;
|
int get apiVersion => _apiVersion;
|
||||||
|
|
||||||
|
// Are plugins enabled on the server?
|
||||||
bool _pluginsEnabled = false;
|
bool _pluginsEnabled = false;
|
||||||
|
|
||||||
bool pluginsEnabled() => supportPlugins() && _pluginsEnabled;
|
// True plugin support requires API v34 or newer
|
||||||
|
// Returns True only if the server API version is new enough, and plugins are enabled
|
||||||
|
bool pluginsEnabled() => apiVersion >= 34 && _pluginsEnabled;
|
||||||
|
|
||||||
|
List<InvenTreePlugin> plugins = [];
|
||||||
|
|
||||||
// Getter for server version information
|
// Getter for server version information
|
||||||
String get version => _version;
|
String get version => _version;
|
||||||
@ -260,11 +266,6 @@ class InvenTreeAPI {
|
|||||||
return apiVersion >= 14;
|
return apiVersion >= 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
// True plugin support requires API v34 or newer
|
|
||||||
bool supportPlugins() {
|
|
||||||
return apiVersion >= 34;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Connect to the remote InvenTree server:
|
* Connect to the remote InvenTree server:
|
||||||
*
|
*
|
||||||
|
@ -500,6 +500,20 @@ class InvenTreeModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class representing a single plugin instance
|
||||||
|
*/
|
||||||
|
class InvenTreePlugin extends InvenTreeModel {
|
||||||
|
|
||||||
|
InvenTreePlugin() : super();
|
||||||
|
|
||||||
|
InvenTreePlugin.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get URL => "plugin/";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class InvenTreeAttachment extends InvenTreeModel {
|
class InvenTreeAttachment extends InvenTreeModel {
|
||||||
// Class representing an "attachment" file
|
// Class representing an "attachment" file
|
||||||
InvenTreeAttachment() : super();
|
InvenTreeAttachment() : super();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user