Add helpers for boolean functions

This commit is contained in:
Oliver Walters committed 2023-04-21 21:09:02 +10:00
1 parent f253234b94
commit 88a02eb9ef
2 files changed
+13

No files matched your search

+1
View File
@@ -1,6 +1,7 @@
### 0.11.6 - April 2023 ### 0.11.6 - April 2023
--- ---
- Add support for Project Codes
- Fix action button colors - Fix action button colors
- Added Norwegian translations - Added Norwegian translations
- Fix serial number field when creating stock item - Fix serial number field when creating stock item
+12
View File
@@ -1365,6 +1365,12 @@ class InvenTreeAPI {
} }
} }
// Return a boolean global setting value
Future<bool> getGlobalBooleanSetting(String key) async {
String value = await getGlobalSetting(key);
return value.toLowerCase() == "true";
}
Future<String> getUserSetting(String key) async { Future<String> getUserSetting(String key) async {
if (!supportsSettings) return ""; if (!supportsSettings) return "";
@@ -1385,6 +1391,12 @@ class InvenTreeAPI {
} }
} }
// Return a boolean user setting value
Future<bool> getUserBooleanSetting(String key) async {
String value = await getUserSetting(key);
return value.toLowerCase() == "true";
}
/* /*
* Send a request to the server to locate / identify either a StockItem or StockLocation * Send a request to the server to locate / identify either a StockItem or StockLocation
*/ */