mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-12 02:05:29 +00:00
Improvements for profile management
This commit is contained in:
@ -106,13 +106,6 @@ class UserProfileDBManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Mark the particular profile as selected
|
||||
*/
|
||||
Future<void> selectProfile(int key) async {
|
||||
await store.record("selected").put(await _db, key);
|
||||
}
|
||||
|
||||
/*
|
||||
* Update the selected profile in the database.
|
||||
* The unique integer <key> is used to determine if the profile already exists.
|
||||
@ -196,4 +189,32 @@ class UserProfileDBManager {
|
||||
|
||||
return profileList;
|
||||
}
|
||||
|
||||
/*
|
||||
* Mark the particular profile as selected
|
||||
*/
|
||||
Future<void> selectProfile(int key) async {
|
||||
await store.record("selected").put(await _db, key);
|
||||
}
|
||||
|
||||
/*
|
||||
* Look-up and select a profile by name.
|
||||
* Return true if the profile was selected
|
||||
*/
|
||||
Future<bool> selectProfileByName(String name) async {
|
||||
var profiles = await getAllProfiles();
|
||||
|
||||
for (var prf in profiles) {
|
||||
if (prf.name == name) {
|
||||
int key = prf.key ?? -1;
|
||||
|
||||
if (key >= 0) {
|
||||
await selectProfile(key);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user