mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-09-28 23:31:43 +12:00
Save on category share
This commit is contained in:
parent
51f7e3f4f5
commit
73bc99b3c6
2 changed files with 18 additions and 11 deletions
|
@ -107,17 +107,7 @@ public class StoreCategoryWrapper {
|
|||
});
|
||||
|
||||
share.addListener((observable, oldValue, newValue) -> {
|
||||
category.setShare(newValue);
|
||||
|
||||
DataStoreCategory p = category;
|
||||
if (newValue) {
|
||||
while ((p = DataStorage.get()
|
||||
.getStoreCategoryIfPresent(p.getParentCategory())
|
||||
.orElse(null))
|
||||
!= null) {
|
||||
p.setShare(true);
|
||||
}
|
||||
}
|
||||
DataStorage.get().shareCategory(category, newValue);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -314,6 +314,23 @@ public abstract class DataStorage {
|
|||
saveAsync();
|
||||
}
|
||||
|
||||
public void shareCategory(DataStoreCategory category, boolean share) {
|
||||
category.setShare(share);
|
||||
|
||||
DataStoreCategory p = category;
|
||||
if (share) {
|
||||
while ((p = DataStorage.get()
|
||||
.getStoreCategoryIfPresent(p.getParentCategory())
|
||||
.orElse(null))
|
||||
!= null) {
|
||||
p.setShare(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Update git remote if needed
|
||||
DataStorage.get().saveAsync();
|
||||
}
|
||||
|
||||
public void updateCategory(DataStoreEntry entry, DataStoreCategory newCategory) {
|
||||
if (getStoreCategoryIfPresent(entry.getUuid())
|
||||
.map(category -> category.equals(newCategory))
|
||||
|
|
Loading…
Reference in a new issue